X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fpersisted%2FShardDataTreeSnapshotTest.java;h=5adf2cb6bd1a0a3da93ebdecb234c0a8f62dc56c;hp=333f3e9b247528a5d79805359f44c1965d7e9288;hb=21a8c34586d37b6fc59abed2ca2287be3db56e00;hpb=9bce68c4712d00951d121be68b09578bc6e09151 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshotTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshotTest.java index 333f3e9b24..5adf2cb6bd 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshotTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshotTest.java @@ -47,9 +47,12 @@ public class ShardDataTreeSnapshotTest { snapshot.serialize(out); } + final byte[] bytes = bos.toByteArray(); + assertEquals(236, bytes.length); + ShardDataTreeSnapshot deserialized; - try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()))) { - deserialized = ShardDataTreeSnapshot.deserialize(in); + try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes))) { + deserialized = ShardDataTreeSnapshot.deserialize(in).getSnapshot(); } Optional> actualNode = deserialized.getRootNode(); @@ -73,9 +76,12 @@ public class ShardDataTreeSnapshotTest { snapshot.serialize(out); } + final byte[] bytes = bos.toByteArray(); + assertEquals(384, bytes.length); + ShardDataTreeSnapshot deserialized; - try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()))) { - deserialized = ShardDataTreeSnapshot.deserialize(in); + try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes))) { + deserialized = ShardDataTreeSnapshot.deserialize(in).getSnapshot(); } Optional> actualNode = deserialized.getRootNode(); @@ -91,7 +97,7 @@ public class ShardDataTreeSnapshotTest { private final String data; - TestShardDataTreeSnapshotMetadata(String data) { + TestShardDataTreeSnapshotMetadata(final String data) { this.data = data; } @@ -111,7 +117,7 @@ public class ShardDataTreeSnapshotTest { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { return obj instanceof TestShardDataTreeSnapshotMetadata && data.equals(((TestShardDataTreeSnapshotMetadata)obj).data); } @@ -123,17 +129,17 @@ public class ShardDataTreeSnapshotTest { public Proxy() { } - Proxy(String data) { + Proxy(final String data) { this.data = data; } @Override - public void writeExternal(ObjectOutput out) throws IOException { + public void writeExternal(final ObjectOutput out) throws IOException { out.writeObject(data); } @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { data = (String) in.readObject(); }