X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fnet%2Fpterodactylus%2Futil%2Ffcp%2FFcpTest.java;fp=src%2Fnet%2Fpterodactylus%2Futil%2Ffcp%2FFcpTest.java;h=0000000000000000000000000000000000000000;hb=8d0f8a527646b5d9addb41692733e76b07ebf94c;hp=c17dadc7c0dbe93897ad344a9f37d4499af21183;hpb=ebd531bc775036dd66a7e20abebbcb480af35491;p=jSite2.git diff --git a/src/net/pterodactylus/util/fcp/FcpTest.java b/src/net/pterodactylus/util/fcp/FcpTest.java deleted file mode 100644 index c17dadc..0000000 --- a/src/net/pterodactylus/util/fcp/FcpTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * jSite2 - 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.util.fcp; - -import java.io.IOException; - -import junit.framework.TestCase; - -/** - * Tests various commands and the FCP connection. - * - * @author David ‘Bombe’ Roden <bombe@freenetproject.org> - * @version $Id$ - */ -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.disconnect(); - } - - /** - * 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]); - } - -}