From b32d5232ee2ba5b0c1be36c80f68c55344153739 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 18 Nov 2009 20:10:33 +0100 Subject: [PATCH] Move test case to test folder. --- src/main/java/net/pterodactylus/fcp/FcpTest.java | 92 ----------------------- test/main/java/net/pterodactylus/fcp/FcpTest.java | 92 +++++++++++++++++++++++ 2 files changed, 92 insertions(+), 92 deletions(-) delete mode 100644 src/main/java/net/pterodactylus/fcp/FcpTest.java create mode 100644 test/main/java/net/pterodactylus/fcp/FcpTest.java diff --git a/src/main/java/net/pterodactylus/fcp/FcpTest.java b/src/main/java/net/pterodactylus/fcp/FcpTest.java deleted file mode 100644 index 6c51848..0000000 --- a/src/main/java/net/pterodactylus/fcp/FcpTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * jFCPlib - FcpTest.java - Copyright © 2008 David Roden - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -package net.pterodactylus.fcp; - -import java.io.IOException; - -import junit.framework.TestCase; - -/** - * Tests various commands and the FCP connection. - * - * @author David ‘Bombe’ Roden <bombe@freenetproject.org> - */ -public class FcpTest extends TestCase { - - /** The FCP connection. */ - private FcpConnection fcpConnection; - - /** - * {@inheritDoc} - */ - @Override - protected void setUp() throws Exception { - fcpConnection = new FcpConnection("wing"); - fcpConnection.connect(); - fcpConnection.sendMessage(new ClientHello("FcpTest")); - } - - /** - * {@inheritDoc} - */ - @Override - protected void tearDown() throws Exception { - fcpConnection.close(); - } - - /** - * Tests the FCP connection be simply {@link #setUp() setting it up} and - * {@link #tearDown() tearing it down} again. - */ - public void testFcpConnection() { - /* do nothing. */ - } - - /** - * Generates an SSK key pair. - * - * @throws IOException - * if an I/O error occurs - * @throws InterruptedException - * if {@link Object#wait()} wakes up spuriously - */ - public void testGenerateSSK() throws IOException, InterruptedException { - final SSKKeypair[] keypair = new SSKKeypair[1]; - FcpAdapter fcpAdapter = new FcpAdapter() { - - /** - * {@inheritDoc} - */ - @Override - public void receivedSSKKeypair(FcpConnection fcpConnection, SSKKeypair sskKeypair) { - keypair[0] = sskKeypair; - synchronized (this) { - notify(); - } - } - }; - fcpConnection.addFcpListener(fcpAdapter); - synchronized (fcpAdapter) { - fcpConnection.sendMessage(new GenerateSSK()); - fcpAdapter.wait(); - } - assertNotNull("ssk keypair", keypair[0]); - } - -} diff --git a/test/main/java/net/pterodactylus/fcp/FcpTest.java b/test/main/java/net/pterodactylus/fcp/FcpTest.java new file mode 100644 index 0000000..6c51848 --- /dev/null +++ b/test/main/java/net/pterodactylus/fcp/FcpTest.java @@ -0,0 +1,92 @@ +/* + * jFCPlib - FcpTest.java - Copyright © 2008 David Roden + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.pterodactylus.fcp; + +import java.io.IOException; + +import junit.framework.TestCase; + +/** + * Tests various commands and the FCP connection. + * + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> + */ +public class FcpTest extends TestCase { + + /** The FCP connection. */ + private FcpConnection fcpConnection; + + /** + * {@inheritDoc} + */ + @Override + protected void setUp() throws Exception { + fcpConnection = new FcpConnection("wing"); + fcpConnection.connect(); + fcpConnection.sendMessage(new ClientHello("FcpTest")); + } + + /** + * {@inheritDoc} + */ + @Override + protected void tearDown() throws Exception { + fcpConnection.close(); + } + + /** + * Tests the FCP connection be simply {@link #setUp() setting it up} and + * {@link #tearDown() tearing it down} again. + */ + public void testFcpConnection() { + /* do nothing. */ + } + + /** + * Generates an SSK key pair. + * + * @throws IOException + * if an I/O error occurs + * @throws InterruptedException + * if {@link Object#wait()} wakes up spuriously + */ + public void testGenerateSSK() throws IOException, InterruptedException { + final SSKKeypair[] keypair = new SSKKeypair[1]; + FcpAdapter fcpAdapter = new FcpAdapter() { + + /** + * {@inheritDoc} + */ + @Override + public void receivedSSKKeypair(FcpConnection fcpConnection, SSKKeypair sskKeypair) { + keypair[0] = sskKeypair; + synchronized (this) { + notify(); + } + } + }; + fcpConnection.addFcpListener(fcpAdapter); + synchronized (fcpAdapter) { + fcpConnection.sendMessage(new GenerateSSK()); + fcpAdapter.wait(); + } + assertNotNull("ssk keypair", keypair[0]); + } + +} -- 2.7.4