AbstractNormalizedNodeDataOutput fails to write out header
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / test / java / org / opendaylight / controller / cluster / datastore / node / utils / stream / NormalizedNodeStreamReaderWriterTest.java
index e1bf0447e657c88162a284f384efe6c684742245..aed87ad35543fece162ab782c7557340b6601849 100644 (file)
@@ -214,17 +214,32 @@ public class NormalizedNodeStreamReaderWriterTest {
     }
 
     @Test
-    public void testSchemaPathSerialization() throws Exception {
+    public void testSchemaPathSerialization() throws IOException {
         final SchemaPath expected = SchemaPath.create(true, TestModel.ANY_XML_QNAME);
 
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(ByteStreams.newDataOutput(bos));
-        nnout.writeSchemaPath(expected);
+        try (NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(ByteStreams.newDataOutput(bos))) {
+            nnout.writeSchemaPath(expected);
+        }
+
+        NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(
+            bos.toByteArray()));
+        assertEquals(expected, nnin.readSchemaPath());
+    }
+
+    @Test
+    public void testWritePathArgument() throws IOException {
+        final NodeIdentifier expected = new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME);
+
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+        try (NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(ByteStreams.newDataOutput(bos))) {
+            nnout.writePathArgument(expected);
+        }
 
         NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(
             bos.toByteArray()));
-        SchemaPath actual = nnin.readSchemaPath();
-        assertEquals(expected, actual);
+        assertEquals(expected, nnin.readPathArgument());
     }
 
     private static String largeString(final int pow) {