current state
[jSite2.git] / src / net / pterodactylus / util / fcp / FcpTest.java
1 /*
2  * jSite2 - FcpTest.java -
3  * Copyright © 2008 David Roden
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 package net.pterodactylus.util.fcp;
21
22 import java.io.IOException;
23 import java.util.List;
24 import java.util.Map;
25
26 import junit.framework.TestCase;
27
28
29 /**
30  * TODO
31  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
32  * @version $Id$
33  */
34 public class FcpTest extends TestCase {
35
36         private FcpConnection fcpConnection;
37         
38         /**
39          * {@inheritDoc}
40          */
41         @Override
42         protected void setUp() throws Exception {
43                 fcpConnection = new FcpConnection("wing", "FcpTest");
44                 fcpConnection.connect();
45         }
46         
47         /**
48          * {@inheritDoc}
49          */
50         @Override
51         protected void tearDown() throws Exception {
52                 fcpConnection.disconnect();
53         }
54         
55         public void testFcpConnection() throws FcpException, IOException {
56         }
57         
58         public void testListPeers() throws FcpException, IOException {
59                 List<Map<String, String>> peers = fcpConnection.sendListPeers(true, true);
60                 for (Map<String, String> peer: peers) {
61                         for (Map.Entry<String, String> entry: peer.entrySet()) {
62                                 System.out.println(entry.getKey() + ": " + entry.getValue());
63                         }
64                 }
65         }
66         
67         public void testListPeerNotes() throws FcpException, IOException {
68                 List<Map<String, String>> peers = fcpConnection.sendListPeerNotes("AY6rGAGjayoyQD2CkvQibf1Ct3mh6iwqyntzNpfRsiM");
69                 for (Map<String, String> peer: peers) {
70                         for (Map.Entry<String, String> entry: peer.entrySet()) {
71                                 System.out.println(entry.getKey() + ": " + entry.getValue());
72                         }
73                 }
74         }
75         
76         public void testGenerateSSK() throws IOException, FcpException {
77                 FcpKeyPair keyPair = fcpConnection.generateSSK();
78                 System.out.println("PrivateKey: " + keyPair.getPrivateKey());
79                 System.out.println("PublicKey: " + keyPair.getPublicKey());
80         }
81         
82 }