adapt to new desgin
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 10 Apr 2008 00:54:28 +0000 (00:54 +0000)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 10 Apr 2008 00:54:28 +0000 (00:54 +0000)
git-svn-id: http://trooper/svn/projects/jSite/trunk@683 c3eda9e8-030b-0410-8277-bc7414b0a119

src/net/pterodactylus/util/fcp/FcpTest.java

index 7aca867..c17dadc 100644 (file)
@@ -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<Map<String, String>> peers = fcpConnection.sendListPeers(true, true);
-//             for (Map<String, String> peer: peers) {
-//                     for (Map.Entry<String, String> entry: peer.entrySet()) {
-//                             System.out.println(entry.getKey() + ": " + entry.getValue());
-//                     }
-//             }
-//     }
-
-//     public void testListPeerNotes() throws FcpException, IOException {
-//             List<Map<String, String>> peers = fcpConnection.sendListPeerNotes("AY6rGAGjayoyQD2CkvQibf1Ct3mh6iwqyntzNpfRsiM");
-//             for (Map<String, String> peer: peers) {
-//                     for (Map.Entry<String, String> 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]);
        }
 
 }