Fix integration test key chain; add ability to parse segmented status datasets
diff --git a/src/test/java/com/intel/jndn/management/IntegrationSuite.java b/src/test/java/com/intel/jndn/management/IntegrationSuite.java
index a2263f2..05d59b0 100644
--- a/src/test/java/com/intel/jndn/management/IntegrationSuite.java
+++ b/src/test/java/com/intel/jndn/management/IntegrationSuite.java
@@ -14,6 +14,7 @@
import junit.framework.Assert;
import net.named_data.jndn.Face;
import net.named_data.jndn.Name;
+import net.named_data.jndn.security.KeyChain;
/**
* Tests to run with a local NFD as part of integration testing; will not run in
@@ -25,19 +26,46 @@
private static final Logger logger = Logger.getLogger(IntegrationSuite.class.getName());
+ /**
+ * Test NFD methods
+ *
+ * @param args
+ * @throws Exception
+ */
public static void main(String[] args) throws Exception {
Face face = new Face("localhost");
+ KeyChain keyChain = buildTestKeyChain();
+ face.setCommandSigningInfo(keyChain, keyChain.getDefaultCertificateName());
+
Assert.assertTrue(NFD.pingLocal(face));
-
+
// grab datasets
Assert.assertFalse(NFD.getFaceList(face).isEmpty());
Assert.assertFalse(NFD.getFibList(face).isEmpty());
Assert.assertFalse(NFD.getRouteList(face).isEmpty());
-
+
// create a new route
- Assert.assertTrue(NFD.register(face, "contentstore://", new Name("/my/cache/route"), 999));
-
+ Assert.assertTrue(NFD.register(face, "udp4://127.0.0.1:56363", new Name("/my/test/route"), 999));
+
// remove the route
- Assert.assertTrue(NFD.unregister(face, new Name("/my/cache/route")));
+ Assert.assertTrue(NFD.unregister(face, new Name("/my/test/route"), "udp4://127.0.0.1:56363"));
+ }
+
+ /**
+ * Setup the KeyChain with a default identity; TODO move this to
+ * MemoryIdentityStorage once it can handle getting/setting defaults
+ *
+ * @return
+ * @throws net.named_data.jndn.security.SecurityException
+ */
+ public static KeyChain buildTestKeyChain() throws net.named_data.jndn.security.SecurityException {
+ KeyChain keyChain = new KeyChain();
+ try {
+ keyChain.getDefaultCertificateName();
+ } catch (net.named_data.jndn.security.SecurityException e) {
+ keyChain.createIdentity(new Name("/test/identity"));
+ keyChain.getIdentityManager().setDefaultIdentity(new Name("/test/identity"));
+ }
+ return keyChain;
}
}