コード例 #1
0
 /**
  * Test encoding/decoding with no name defined
  *
  * @throws EncodingException
  */
 @Test
 public void testEncodeDecodeWithNoName() throws EncodingException {
   ControlParameters controlParameters = new ControlParameters();
   controlParameters.setStrategy(new Name("/localhost/nfd/strategy/broadcast"));
   controlParameters.setUri("null://");
   // encode
   Blob encoded = controlParameters.wireEncode();
   // decode
   ControlParameters decodedControlParameters = new ControlParameters();
   decodedControlParameters.wireDecode(encoded);
   // compare
   assertEquals(
       controlParameters.getStrategy().toUri(), decodedControlParameters.getStrategy().toUri());
   assertEquals(controlParameters.getUri(), decodedControlParameters.getUri());
 }
コード例 #2
0
 /**
  * Test encoding/decoding
  *
  * @throws EncodingException
  */
 @Test
 public void testEncodeDecode() throws EncodingException {
   ControlParameters controlParameters = new ControlParameters();
   controlParameters.setName(new Name("/test/control/parameters"));
   controlParameters.setFaceId(1);
   // encode
   Blob encoded = controlParameters.wireEncode();
   // decode
   ControlParameters decodedControlParameters = new ControlParameters();
   decodedControlParameters.wireDecode(encoded);
   // compare
   assertEquals(controlParameters.getName().toUri(), decodedControlParameters.getName().toUri());
   assertEquals(controlParameters.getFaceId(), decodedControlParameters.getFaceId());
   assertEquals(
       "decoded forwarding flags childInherit is different",
       controlParameters.getForwardingFlags().getChildInherit(),
       decodedControlParameters.getForwardingFlags().getChildInherit());
   assertEquals(
       "decoded forwarding flags capture is different",
       controlParameters.getForwardingFlags().getCapture(),
       decodedControlParameters.getForwardingFlags().getCapture());
 }