X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fnode%2Futils%2Fstream%2FNormalizedNodeStreamReaderWriterTest.java;h=aed87ad35543fece162ab782c7557340b6601849;hb=refs%2Fchanges%2F24%2F84324%2F1;hp=e1bf0447e657c88162a284f384efe6c684742245;hpb=77e52504cf30dd68a27273d5088427f43b0eda03;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeStreamReaderWriterTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeStreamReaderWriterTest.java index e1bf0447e6..aed87ad355 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeStreamReaderWriterTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeStreamReaderWriterTest.java @@ -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) {