Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Add more serialization assertions
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
persisted
/
ShardDataTreeSnapshotTest.java
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 333f3e9b247528a5d79805359f44c1965d7e9288..9327f6262fea5d000e0692c33c728ac2d2afd23b 100644
(file)
--- 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);
}
snapshot.serialize(out);
}
+ final byte[] bytes = bos.toByteArray();
+ assertEquals(242, bytes.length);
+
ShardDataTreeSnapshot deserialized;
ShardDataTreeSnapshot deserialized;
- try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(b
os.toByteArray()
))) {
- deserialized = ShardDataTreeSnapshot.deserialize(in);
+ try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(b
ytes
))) {
+ deserialized = ShardDataTreeSnapshot.deserialize(in)
.getSnapshot()
;
}
Optional<NormalizedNode<?, ?>> actualNode = deserialized.getRootNode();
}
Optional<NormalizedNode<?, ?>> actualNode = deserialized.getRootNode();
@@
-73,9
+76,12
@@
public class ShardDataTreeSnapshotTest {
snapshot.serialize(out);
}
snapshot.serialize(out);
}
+ final byte[] bytes = bos.toByteArray();
+ assertEquals(390, bytes.length);
+
ShardDataTreeSnapshot deserialized;
ShardDataTreeSnapshot deserialized;
- try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(b
os.toByteArray()
))) {
- deserialized = ShardDataTreeSnapshot.deserialize(in);
+ try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(b
ytes
))) {
+ deserialized = ShardDataTreeSnapshot.deserialize(in)
.getSnapshot()
;
}
Optional<NormalizedNode<?, ?>> actualNode = deserialized.getRootNode();
}
Optional<NormalizedNode<?, ?>> actualNode = deserialized.getRootNode();
@@
-91,7
+97,7
@@
public class ShardDataTreeSnapshotTest {
private final String data;
private final String data;
- TestShardDataTreeSnapshotMetadata(String data) {
+ TestShardDataTreeSnapshotMetadata(
final
String data) {
this.data = data;
}
this.data = data;
}
@@
-111,7
+117,7
@@
public class ShardDataTreeSnapshotTest {
}
@Override
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(
final
Object obj) {
return obj instanceof TestShardDataTreeSnapshotMetadata
&& data.equals(((TestShardDataTreeSnapshotMetadata)obj).data);
}
return obj instanceof TestShardDataTreeSnapshotMetadata
&& data.equals(((TestShardDataTreeSnapshotMetadata)obj).data);
}
@@
-123,17
+129,17
@@
public class ShardDataTreeSnapshotTest {
public Proxy() {
}
public Proxy() {
}
- Proxy(String data) {
+ Proxy(
final
String data) {
this.data = data;
}
@Override
this.data = data;
}
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal(
final
ObjectOutput out) throws IOException {
out.writeObject(data);
}
@Override
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();
}
data = (String) in.readObject();
}