/// <summary> /// Test encoding/decoding with no name defined /// </summary> /// /// <exception cref="EncodingException"></exception> public void testEncodeDecodeWithNoName() { 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 Assert.AssertEquals(controlParameters.getStrategy().toUri(), decodedControlParameters.getStrategy().toUri()); Assert.AssertEquals(controlParameters.getUri(), decodedControlParameters.getUri()); }
/// <summary> /// Test encoding/decoding /// </summary> /// /// <exception cref="EncodingException"></exception> public void testEncodeDecode() { 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 Assert.AssertEquals(controlParameters.getName().toUri(), decodedControlParameters.getName().toUri()); Assert.AssertEquals(controlParameters.getFaceId(), decodedControlParameters.getFaceId()); Assert.AssertEquals("decoded forwarding flags childInherit is different", controlParameters.getForwardingFlags().getChildInherit(), decodedControlParameters.getForwardingFlags().getChildInherit()); Assert.AssertEquals("decoded forwarding flags capture is different", controlParameters.getForwardingFlags().getCapture(), decodedControlParameters.getForwardingFlags().getCapture()); }