Switch default stream output to Sodium SR1 39/84539/40
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 25 Sep 2019 06:01:47 +0000 (08:01 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 25 Sep 2019 15:40:19 +0000 (17:40 +0200)
This flips the switch and uses Sodium SR1 format for all unversioned
users. Also updates tests to reflect new expected stream sizes.

JIRA: CONTROLLER-1919
Change-Id: I9973bb93f469c1b59533ce580c795cd30c9edda4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputOutput.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeStreamReaderWriterTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/SerializationUtilsTest.java

index 7e2fb29..2a9d1f7 100644 (file)
@@ -50,7 +50,7 @@ public final class NormalizedNodeInputOutput {
      * @return a new {@link NormalizedNodeDataOutput} instance
      */
     public static NormalizedNodeDataOutput newDataOutput(final @NonNull DataOutput output) {
-        return new NeonSR2NormalizedNodeOutputStreamWriter(output);
+        return new SodiumSR1DataOutput(output);
     }
 
     /**
index 4024cef..4b45af4 100644 (file)
@@ -75,7 +75,7 @@ public class NormalizedNodeStreamReaderWriterTest {
         nnout.writeNormalizedNode(toasterContainer);
 
         final byte[] bytes = bos.toByteArray();
-        assertEquals(1049950, bytes.length);
+        assertEquals(1049619, bytes.length);
 
         NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(bytes));
 
@@ -119,7 +119,7 @@ public class NormalizedNodeStreamReaderWriterTest {
         nnout.writeYangInstanceIdentifier(path);
 
         final byte[] bytes = bos.toByteArray();
-        assertEquals(161, bytes.length);
+        assertEquals(139, bytes.length);
 
         NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(bytes));
 
@@ -144,7 +144,7 @@ public class NormalizedNodeStreamReaderWriterTest {
         writer.writeYangInstanceIdentifier(path);
 
         final byte[] bytes = bos.toByteArray();
-        assertEquals(1163, bytes.length);
+        assertEquals(826, bytes.length);
 
         NormalizedNodeDataInput reader = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(bytes));
 
@@ -207,7 +207,7 @@ public class NormalizedNodeStreamReaderWriterTest {
         nnout.writeNormalizedNode(anyXmlContainer);
 
         final byte[] bytes = bos.toByteArray();
-        assertEquals(235, bytes.length);
+        assertEquals(229, bytes.length);
 
         NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(bytes));
 
@@ -236,7 +236,7 @@ public class NormalizedNodeStreamReaderWriterTest {
         }
 
         final byte[] bytes = bos.toByteArray();
-        assertEquals(100, bytes.length);
+        assertEquals(99, bytes.length);
 
         NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(bytes));
         assertEquals(expected, nnin.readSchemaPath());
@@ -253,7 +253,7 @@ public class NormalizedNodeStreamReaderWriterTest {
         }
 
         final byte[] bytes = bos.toByteArray();
-        assertEquals(105, bytes.length);
+        assertEquals(103, bytes.length);
 
         NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(bytes));
         assertEquals(expected, nnin.readPathArgument());
@@ -287,7 +287,7 @@ public class NormalizedNodeStreamReaderWriterTest {
         }
 
         final byte[] bytes = bos.toByteArray();
-        assertEquals(5_577_993, bytes.length);
+        assertEquals(2_289_103, bytes.length);
 
         NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(bytes));
         assertEquals(expected, nnin.readNormalizedNode());
index 3888426..610a232 100644 (file)
@@ -54,7 +54,7 @@ public class SerializationUtilsTest {
     public void testSerializeDeserializeNodes() throws IOException {
         final NormalizedNode<?, ?> normalizedNode = createNormalizedNode();
         final byte[] bytes = serializeNormalizedNode(normalizedNode);
-        assertEquals(10774, bytes.length);
+        assertEquals(10564, bytes.length);
         assertEquals(normalizedNode, deserializeNormalizedNode(bytes));
     }
 
@@ -68,7 +68,7 @@ public class SerializationUtilsTest {
                 .withValue(new DOMSource(parse))
                 .build();
         final byte[] bytes = serializeNormalizedNode(anyXmlNode);
-        assertEquals(115, bytes.length);
+        assertEquals(113, bytes.length);
         final NormalizedNode<?, ?> deserialized = deserializeNormalizedNode(bytes);
         final DOMSource value = (DOMSource) deserialized.getValue();
         final Diff diff = XMLUnit.compareXML((Document) anyXmlNode.getValue().getNode(),
@@ -89,7 +89,7 @@ public class SerializationUtilsTest {
         SerializationUtils.writePath(out, path);
 
         final byte[] bytes = bos.toByteArray();
-        assertEquals(150, bytes.length);
+        assertEquals(119, bytes.length);
 
         final YangInstanceIdentifier deserialized =
                 SerializationUtils.readPath(new DataInputStream(new ByteArrayInputStream(bytes)));
@@ -105,7 +105,7 @@ public class SerializationUtilsTest {
         SerializationUtils.writeNodeAndPath(out, path, node);
 
         final byte[] bytes = bos.toByteArray();
-        assertEquals(10783, bytes.length);
+        assertEquals(10566, bytes.length);
 
         final DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
         final AtomicBoolean applierCalled = new AtomicBoolean(false);
@@ -129,7 +129,7 @@ public class SerializationUtilsTest {
         SerializationUtils.writePath(out, expected);
 
         final byte[] bytes = bos.toByteArray();
-        assertEquals(47, bytes.length);
+        assertEquals(37, bytes.length);
 
         final DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
         final YangInstanceIdentifier read = SerializationUtils.readPath(in);

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.