From: David ‘Bombe’ Roden Date: Thu, 10 Apr 2008 00:54:28 +0000 (+0000) Subject: adapt to new desgin X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=cd056778c3f2491efd134588b8335e79231a109d;p=jSite2.git adapt to new desgin git-svn-id: http://trooper/svn/projects/jSite/trunk@683 c3eda9e8-030b-0410-8277-bc7414b0a119 --- diff --git a/src/net/pterodactylus/util/fcp/FcpTest.java b/src/net/pterodactylus/util/fcp/FcpTest.java index 7aca867..c17dadc 100644 --- a/src/net/pterodactylus/util/fcp/FcpTest.java +++ b/src/net/pterodactylus/util/fcp/FcpTest.java @@ -55,32 +55,11 @@ public class FcpTest extends TestCase { /** * Tests the FCP connection be simply {@link #setUp() setting it up} and * {@link #tearDown() tearing it down} again. - * - * @throws IOException - * if an I/O error occurs */ - public void testFcpConnection() throws IOException { + public void testFcpConnection() { /* do nothing. */ } -// public void testListPeers() throws FcpException, IOException { -// List> peers = fcpConnection.sendListPeers(true, true); -// for (Map peer: peers) { -// for (Map.Entry entry: peer.entrySet()) { -// System.out.println(entry.getKey() + ": " + entry.getValue()); -// } -// } -// } - -// public void testListPeerNotes() throws FcpException, IOException { -// List> peers = fcpConnection.sendListPeerNotes("AY6rGAGjayoyQD2CkvQibf1Ct3mh6iwqyntzNpfRsiM"); -// for (Map peer: peers) { -// for (Map.Entry entry: peer.entrySet()) { -// System.out.println(entry.getKey() + ": " + entry.getValue()); -// } -// } -// } - /** * Generates an SSK key pair. * @@ -90,37 +69,26 @@ public class FcpTest extends TestCase { * if {@link Object#wait()} wakes up spuriously */ public void testGenerateSSK() throws IOException, InterruptedException { - final boolean[] result = new boolean[1]; + final SSKKeypair[] keypair = new SSKKeypair[1]; FcpAdapter fcpAdapter = new FcpAdapter() { - /** - * @see net.pterodactylus.util.fcp.FcpAdapter#receivedNodeHello(net.pterodactylus.util.fcp.FcpConnection, - * net.pterodactylus.util.fcp.NodeHello) - */ - @Override - public void receivedNodeHello(FcpConnection fcpConnection, NodeHello nodeHello) { - result[0] = true; - synchronized (this) { - notify(); - } - } /** - * @see net.pterodactylus.util.fcp.FcpAdapter#receivedCloseConnectionDuplicateClientName(net.pterodactylus.util.fcp.FcpConnection, - * net.pterodactylus.util.fcp.CloseConnectionDuplicateClientName) + * {@inheritDoc} */ @Override - public void receivedCloseConnectionDuplicateClientName(FcpConnection fcpConnection, CloseConnectionDuplicateClientName closeConnectionDuplicateClientName) { - result[0] = false; + public void receivedSSKKeypair(FcpConnection fcpConnection, SSKKeypair sskKeypair) { + keypair[0] = sskKeypair; synchronized (this) { notify(); } } }; + fcpConnection.addFcpListener(fcpAdapter); synchronized (fcpAdapter) { fcpConnection.sendMessage(new GenerateSSK()); fcpAdapter.wait(); } - assertTrue("received NodeHello", result[0]); + assertNotNull("ssk keypair", keypair[0]); } }