Format to 2-space indents
diff --git a/src/test/java/com/intel/jndn/management/ControlResponseTest.java b/src/test/java/com/intel/jndn/management/ControlResponseTest.java
index 5d026e0..d21c3e0 100644
--- a/src/test/java/com/intel/jndn/management/ControlResponseTest.java
+++ b/src/test/java/com/intel/jndn/management/ControlResponseTest.java
@@ -22,31 +22,31 @@
*/
public class ControlResponseTest {
- /**
- * Test encoding/decoding
- *
- * @throws java.lang.Exception
- */
- @Test
- public void testEncodeDecode() throws Exception {
- ControlParameters parameters = new ControlParameters();
- parameters.setFaceId(3);
- ControlResponse response = new ControlResponse();
- response.setStatusCode(404);
- response.setStatusText("Not Found");
- response.getBody().add(parameters);
+ /**
+ * Test encoding/decoding
+ *
+ * @throws java.lang.Exception
+ */
+ @Test
+ public void testEncodeDecode() throws Exception {
+ ControlParameters parameters = new ControlParameters();
+ parameters.setFaceId(3);
+ ControlResponse response = new ControlResponse();
+ response.setStatusCode(404);
+ response.setStatusText("Not Found");
+ response.getBody().add(parameters);
- // encode
- Blob encoded = response.wireEncode();
+ // encode
+ Blob encoded = response.wireEncode();
- // decode
- ControlResponse decoded = new ControlResponse();
- decoded.wireDecode(encoded.buf());
+ // decode
+ ControlResponse decoded = new ControlResponse();
+ decoded.wireDecode(encoded.buf());
- // test
- Assert.assertEquals(response.getStatusCode(), decoded.getStatusCode());
- Assert.assertEquals(response.getStatusText(), decoded.getStatusText());
- Assert.assertEquals(response.getBody().size(), decoded.getBody().size());
- Assert.assertEquals(response.getBody().get(0).getFaceId(), decoded.getBody().get(0).getFaceId());
- }
+ // test
+ Assert.assertEquals(response.getStatusCode(), decoded.getStatusCode());
+ Assert.assertEquals(response.getStatusText(), decoded.getStatusText());
+ Assert.assertEquals(response.getBody().size(), decoded.getBody().size());
+ Assert.assertEquals(response.getBody().get(0).getFaceId(), decoded.getBody().get(0).getFaceId());
+ }
}
diff --git a/src/test/java/com/intel/jndn/management/FaceStatusTest.java b/src/test/java/com/intel/jndn/management/FaceStatusTest.java
index f0d3eaf..e5fbab7 100644
--- a/src/test/java/com/intel/jndn/management/FaceStatusTest.java
+++ b/src/test/java/com/intel/jndn/management/FaceStatusTest.java
@@ -34,127 +34,127 @@
*/
public class FaceStatusTest {
- private static final Logger logger = LogManager.getLogger();
+ private static final Logger logger = LogManager.getLogger();
- /**
- * Test encoding/decoding
- *
- * @throws java.lang.Exception
- */
- @Test
- public void testEncodeDecode() throws Exception {
- FaceStatus status = new FaceStatus();
- status.setFaceId(42);
- status.setUri("...");
- status.setLocalUri("...");
+ /**
+ * Test encoding/decoding
+ *
+ * @throws java.lang.Exception
+ */
+ @Test
+ public void testEncodeDecode() throws Exception {
+ FaceStatus status = new FaceStatus();
+ status.setFaceId(42);
+ status.setUri("...");
+ status.setLocalUri("...");
- // encode
- Blob encoded = status.wireEncode();
+ // encode
+ Blob encoded = status.wireEncode();
- // decode
- FaceStatus decoded = new FaceStatus();
- decoded.wireDecode(encoded.buf());
+ // decode
+ FaceStatus decoded = new FaceStatus();
+ decoded.wireDecode(encoded.buf());
- // test
- Assert.assertEquals(status.getFaceId(), decoded.getFaceId());
- Assert.assertEquals(status.getUri(), decoded.getUri());
- Assert.assertEquals(status.getLocalUri(), decoded.getLocalUri());
- Assert.assertEquals(status.getExpirationPeriod(), decoded.getExpirationPeriod());
- Assert.assertEquals(status.getFaceScope(), decoded.getFaceScope());
- Assert.assertEquals(status.getFacePersistency(), decoded.getFacePersistency());
- Assert.assertEquals(status.getLinkType(), decoded.getLinkType());
- Assert.assertEquals(status.getInBytes(), decoded.getInBytes());
- Assert.assertEquals(status.getOutBytes(), decoded.getOutBytes());
- }
+ // test
+ Assert.assertEquals(status.getFaceId(), decoded.getFaceId());
+ Assert.assertEquals(status.getUri(), decoded.getUri());
+ Assert.assertEquals(status.getLocalUri(), decoded.getLocalUri());
+ Assert.assertEquals(status.getExpirationPeriod(), decoded.getExpirationPeriod());
+ Assert.assertEquals(status.getFaceScope(), decoded.getFaceScope());
+ Assert.assertEquals(status.getFacePersistency(), decoded.getFacePersistency());
+ Assert.assertEquals(status.getLinkType(), decoded.getLinkType());
+ Assert.assertEquals(status.getInBytes(), decoded.getInBytes());
+ Assert.assertEquals(status.getOutBytes(), decoded.getOutBytes());
+ }
- /**
- * Test of decode method, of class FaceStatus.
- *
- * @throws java.lang.Exception
- */
- @Test
- public void testDecodeFakeData() throws Exception {
- Data data = getFaceData(true);
- List<FaceStatus> results = StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
- assertTrue(results.size() > 4);
- for (FaceStatus f : results) {
- // the first face (face 1) should always be the internal face
- if (f.getFaceId() == 1) {
- assertEquals("internal://", f.getUri());
- assertEquals("internal://", f.getLocalUri());
- }
- }
- }
+ /**
+ * Test of decode method, of class FaceStatus.
+ *
+ * @throws java.lang.Exception
+ */
+ @Test
+ public void testDecodeFakeData() throws Exception {
+ Data data = getFaceData(true);
+ List<FaceStatus> results = StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
+ assertTrue(results.size() > 4);
+ for (FaceStatus f : results) {
+ // the first face (face 1) should always be the internal face
+ if (f.getFaceId() == 1) {
+ assertEquals("internal://", f.getUri());
+ assertEquals("internal://", f.getLocalUri());
+ }
+ }
+ }
- /**
- * Integration test to run on actual system
- *
- * @param args
- * @throws EncodingException
- */
- public static void main(String[] args) throws Exception {
- Data data = getFaceData(false);
- List<FaceStatus> results = StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
- assertTrue(results.size() > 4);
- for (FaceStatus f : results) {
- // the first face (face 1) should always be the internal face
- if (f.getFaceId() == 1) {
- assertEquals("internal://", f.getUri());
- assertEquals("internal://", f.getLocalUri());
- }
- }
- }
+ /**
+ * Integration test to run on actual system
+ *
+ * @param args
+ * @throws EncodingException
+ */
+ public static void main(String[] args) throws Exception {
+ Data data = getFaceData(false);
+ List<FaceStatus> results = StatusDataset.wireDecode(data.getContent(), FaceStatus.class);
+ assertTrue(results.size() > 4);
+ for (FaceStatus f : results) {
+ // the first face (face 1) should always be the internal face
+ if (f.getFaceId() == 1) {
+ assertEquals("internal://", f.getUri());
+ assertEquals("internal://", f.getLocalUri());
+ }
+ }
+ }
- /**
- * Retrieve a TLV encoded representation of the face list data
- *
- * @param usePreComputedData to avoid errors when local NFD is not present
- * @return
- */
- private static Data getFaceData(boolean usePreComputedData) {
- // use pre-computed data to avoid errors when local NFD is not present
- if (usePreComputedData) {
- Data data = new Data();
- data.setContent(new Blob(hexStringToByteArray(DATA)));
- return data;
- } // alternately, query the actual localhost for current data
- else {
- Face forwarder = new Face("localhost");
+ /**
+ * Retrieve a TLV encoded representation of the face list data
+ *
+ * @param usePreComputedData to avoid errors when local NFD is not present
+ * @return
+ */
+ private static Data getFaceData(boolean usePreComputedData) {
+ // use pre-computed data to avoid errors when local NFD is not present
+ if (usePreComputedData) {
+ Data data = new Data();
+ data.setContent(new Blob(hexStringToByteArray(DATA)));
+ return data;
+ } // alternately, query the actual localhost for current data
+ else {
+ Face forwarder = new Face("localhost");
- // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
- Interest interest = new Interest(new Name("/localhost/nfd/faces/list"));
- interest.setMustBeFresh(true);
- interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
- interest.setInterestLifetimeMilliseconds(2000.0);
+ // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+ Interest interest = new Interest(new Name("/localhost/nfd/faces/list"));
+ interest.setMustBeFresh(true);
+ interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
+ interest.setInterestLifetimeMilliseconds(2000.0);
- // send packet
- Data data = Client.getDefault().getSync(forwarder, interest);
- String hex = data.getContent().toHex();
- logger.info("Hex dump of face list: " + hex);
- return data;
- }
- }
+ // send packet
+ Data data = Client.getDefault().getSync(forwarder, interest);
+ String hex = data.getContent().toHex();
+ logger.info("Hex dump of face list: " + hex);
+ return data;
+ }
+ }
- /**
- * Pre-computed face list from a vanilla NFD running on Ubuntu 14.04
- */
- private static final String DATA = "803a690101720b696e7465726e616c3a2f2f810b696e7465726e616c3a2f2f840101850100860100900100910201429202063993010094010095010080406901fe720f636f6e74656e7473746f72653a2f2f810f636f6e74656e7473746f72653a2f2f84010185010086010090010091010092010093010094010095010080306901ff72076e756c6c3a2f2f81076e756c6c3a2f2f8401018501008601009001009101009201009301009401009501008053690201007219756470343a2f2f3232342e302e32332e3137303a35363336338117756470343a2f2f31302e35342e31322e373a35363336338401008501008601009001009101009201009301009401009501008056690201017219756470343a2f2f3232342e302e32332e3137303a3536333633811a756470343a2f2f3139322e3136382e35302e35373a3536333633840100850100860100900100910100920100930100940100950100804869020102721b65746865723a2f2f5b30313a30303a35653a30303a31373a61615d810a6465763a2f2f65746830840100850100860100900100910100920100930100940100950100804969020103721b65746865723a2f2f5b30313a30303a35653a30303a31373a61615d810b6465763a2f2f776c616e30840100850100860100900100910100920100930100940100950100804669020104720766643a2f2f32328114756e69783a2f2f2f72756e2f6e66642e736f636b840101850101860100900206349101019201019302012e940400014079950400041903804e690201197216746370343a2f2f3132372e302e302e313a35363336358115746370343a2f2f3132372e302e302e313a36333633840101850101860100900101910100920100930100940132950100";
+ /**
+ * Pre-computed face list from a vanilla NFD running on Ubuntu 14.04
+ */
+ private static final String DATA = "803a690101720b696e7465726e616c3a2f2f810b696e7465726e616c3a2f2f840101850100860100900100910201429202063993010094010095010080406901fe720f636f6e74656e7473746f72653a2f2f810f636f6e74656e7473746f72653a2f2f84010185010086010090010091010092010093010094010095010080306901ff72076e756c6c3a2f2f81076e756c6c3a2f2f8401018501008601009001009101009201009301009401009501008053690201007219756470343a2f2f3232342e302e32332e3137303a35363336338117756470343a2f2f31302e35342e31322e373a35363336338401008501008601009001009101009201009301009401009501008056690201017219756470343a2f2f3232342e302e32332e3137303a3536333633811a756470343a2f2f3139322e3136382e35302e35373a3536333633840100850100860100900100910100920100930100940100950100804869020102721b65746865723a2f2f5b30313a30303a35653a30303a31373a61615d810a6465763a2f2f65746830840100850100860100900100910100920100930100940100950100804969020103721b65746865723a2f2f5b30313a30303a35653a30303a31373a61615d810b6465763a2f2f776c616e30840100850100860100900100910100920100930100940100950100804669020104720766643a2f2f32328114756e69783a2f2f2f72756e2f6e66642e736f636b840101850101860100900206349101019201019302012e940400014079950400041903804e690201197216746370343a2f2f3132372e302e302e313a35363336358115746370343a2f2f3132372e302e302e313a36333633840101850101860100900101910100920100930100940132950100";
- /**
- * Convert hex string to bytes; special thanks to
- * http://stackoverflow.com/questions/140131
- *
- * @param s
- * @return
- */
- private static byte[] hexStringToByteArray(String s) {
- int len = s.length();
- byte[] data = new byte[len / 2];
- for (int i = 0; i < len; i += 2) {
- data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
- + Character.digit(s.charAt(i + 1), 16));
- }
- return data;
- }
+ /**
+ * Convert hex string to bytes; special thanks to
+ * http://stackoverflow.com/questions/140131
+ *
+ * @param s
+ * @return
+ */
+ private static byte[] hexStringToByteArray(String s) {
+ int len = s.length();
+ byte[] data = new byte[len / 2];
+ for (int i = 0; i < len; i += 2) {
+ data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ + Character.digit(s.charAt(i + 1), 16));
+ }
+ return data;
+ }
}
diff --git a/src/test/java/com/intel/jndn/management/FibEntryTest.java b/src/test/java/com/intel/jndn/management/FibEntryTest.java
index 85ac273..e198e7d 100644
--- a/src/test/java/com/intel/jndn/management/FibEntryTest.java
+++ b/src/test/java/com/intel/jndn/management/FibEntryTest.java
@@ -32,54 +32,54 @@
*/
public class FibEntryTest {
- /**
- * Test encoding/decoding
- *
- * @throws java.lang.Exception
- */
- @Test
- public void testEncodeDecode() throws Exception {
- NextHopRecord nextHopRecord = new NextHopRecord();
- nextHopRecord.setFaceId(42);
- nextHopRecord.setCost(100);
- FibEntry entry = new FibEntry();
- entry.setName(new Name("/fib/entry/test"));
- entry.getRecords().add(nextHopRecord);
+ /**
+ * Test encoding/decoding
+ *
+ * @throws java.lang.Exception
+ */
+ @Test
+ public void testEncodeDecode() throws Exception {
+ NextHopRecord nextHopRecord = new NextHopRecord();
+ nextHopRecord.setFaceId(42);
+ nextHopRecord.setCost(100);
+ FibEntry entry = new FibEntry();
+ entry.setName(new Name("/fib/entry/test"));
+ entry.getRecords().add(nextHopRecord);
- // encode
- Blob encoded = entry.wireEncode();
+ // encode
+ Blob encoded = entry.wireEncode();
- // decode
- FibEntry decoded = new FibEntry();
- decoded.wireDecode(encoded.buf());
+ // decode
+ FibEntry decoded = new FibEntry();
+ decoded.wireDecode(encoded.buf());
- // test
- Assert.assertEquals(entry.getName().toUri(), decoded.getName().toUri());
- Assert.assertEquals(entry.getRecords().get(0).getFaceId(), decoded.getRecords().get(0).getFaceId());
- Assert.assertEquals(entry.getRecords().get(0).getCost(), decoded.getRecords().get(0).getCost());
- }
+ // test
+ Assert.assertEquals(entry.getName().toUri(), decoded.getName().toUri());
+ Assert.assertEquals(entry.getRecords().get(0).getFaceId(), decoded.getRecords().get(0).getFaceId());
+ Assert.assertEquals(entry.getRecords().get(0).getCost(), decoded.getRecords().get(0).getCost());
+ }
- /**
- * Integration test to run on actual system
- *
- * @param args
- * @throws EncodingException
- */
- public static void main(String[] args) throws Exception {
- Face forwarder = new Face("localhost");
+ /**
+ * Integration test to run on actual system
+ *
+ * @param args
+ * @throws EncodingException
+ */
+ public static void main(String[] args) throws Exception {
+ Face forwarder = new Face("localhost");
- // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
- Interest interest = new Interest(new Name("/localhost/nfd/fib/list"));
- interest.setMustBeFresh(true);
- interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
- interest.setInterestLifetimeMilliseconds(2000.0);
+ // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+ Interest interest = new Interest(new Name("/localhost/nfd/fib/list"));
+ interest.setMustBeFresh(true);
+ interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
+ interest.setInterestLifetimeMilliseconds(2000.0);
- // send packet
- Data data = Client.getDefault().getSync(forwarder, interest);
+ // send packet
+ Data data = Client.getDefault().getSync(forwarder, interest);
- // decode results
- List<FibEntry> results = StatusDataset.wireDecode(data.getContent(), FibEntry.class);
- assertTrue(results.size() > 0);
- assertEquals("/localhost/nfd", results.get(0).getName().toUri());
- }
+ // decode results
+ List<FibEntry> results = StatusDataset.wireDecode(data.getContent(), FibEntry.class);
+ assertTrue(results.size() > 0);
+ assertEquals("/localhost/nfd", results.get(0).getName().toUri());
+ }
}
diff --git a/src/test/java/com/intel/jndn/management/RibEntryTest.java b/src/test/java/com/intel/jndn/management/RibEntryTest.java
index 96dd70b..a0ba770 100644
--- a/src/test/java/com/intel/jndn/management/RibEntryTest.java
+++ b/src/test/java/com/intel/jndn/management/RibEntryTest.java
@@ -32,56 +32,56 @@
*/
public class RibEntryTest {
- /**
- * Test encoding/decoding
- *
- * @throws java.lang.Exception
- */
- @Test
- public void testEncodeDecode() throws Exception {
- Route route = new Route();
- route.setFaceId(42);
- route.setCost(100);
- route.setOrigin(0);
- RibEntry entry = new RibEntry();
- entry.setName(new Name("/rib/entry/test"));
- entry.getRoutes().add(route);
+ /**
+ * Test encoding/decoding
+ *
+ * @throws java.lang.Exception
+ */
+ @Test
+ public void testEncodeDecode() throws Exception {
+ Route route = new Route();
+ route.setFaceId(42);
+ route.setCost(100);
+ route.setOrigin(0);
+ RibEntry entry = new RibEntry();
+ entry.setName(new Name("/rib/entry/test"));
+ entry.getRoutes().add(route);
- // encode
- Blob encoded = entry.wireEncode();
+ // encode
+ Blob encoded = entry.wireEncode();
- // decode
- RibEntry decoded = new RibEntry();
- decoded.wireDecode(encoded.buf());
+ // decode
+ RibEntry decoded = new RibEntry();
+ decoded.wireDecode(encoded.buf());
- // test
- Assert.assertEquals(entry.getName().toUri(), decoded.getName().toUri());
- Assert.assertEquals(entry.getRoutes().get(0).getFaceId(), decoded.getRoutes().get(0).getFaceId());
- Assert.assertEquals(entry.getRoutes().get(0).getCost(), decoded.getRoutes().get(0).getCost());
- Assert.assertEquals(entry.getRoutes().get(0).getOrigin(), decoded.getRoutes().get(0).getOrigin());
- }
+ // test
+ Assert.assertEquals(entry.getName().toUri(), decoded.getName().toUri());
+ Assert.assertEquals(entry.getRoutes().get(0).getFaceId(), decoded.getRoutes().get(0).getFaceId());
+ Assert.assertEquals(entry.getRoutes().get(0).getCost(), decoded.getRoutes().get(0).getCost());
+ Assert.assertEquals(entry.getRoutes().get(0).getOrigin(), decoded.getRoutes().get(0).getOrigin());
+ }
- /**
- * Integration test to run on actual system
- *
- * @param args
- * @throws EncodingException
- */
- public static void main(String[] args) throws Exception {
- Face forwarder = new Face("localhost");
+ /**
+ * Integration test to run on actual system
+ *
+ * @param args
+ * @throws EncodingException
+ */
+ public static void main(String[] args) throws Exception {
+ Face forwarder = new Face("localhost");
- // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
- Interest interest = new Interest(new Name("/localhost/nfd/rib/list"));
- interest.setMustBeFresh(true);
- interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
- interest.setInterestLifetimeMilliseconds(2000.0);
+ // build management Interest packet; see http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+ Interest interest = new Interest(new Name("/localhost/nfd/rib/list"));
+ interest.setMustBeFresh(true);
+ interest.setChildSelector(Interest.CHILD_SELECTOR_RIGHT);
+ interest.setInterestLifetimeMilliseconds(2000.0);
- // send packet
- Data data = Client.getDefault().getSync(forwarder, interest);
+ // send packet
+ Data data = Client.getDefault().getSync(forwarder, interest);
- // decode results
- List<RibEntry> results = StatusDataset.wireDecode(data.getContent(), RibEntry.class);
- assertTrue(results.size() > 0);
- assertEquals("/localhost/nfd", results.get(0).getName().toUri());
- }
+ // decode results
+ List<RibEntry> results = StatusDataset.wireDecode(data.getContent(), RibEntry.class);
+ assertTrue(results.size() > 0);
+ assertEquals("/localhost/nfd", results.get(0).getName().toUri());
+ }
}