X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fmessages%2FInstallSnapshotTest.java;h=70eece61636f90a0472625deee3569d8028d4f11;hp=cde180796b8eba6634971ffd22238513a6bb602e;hb=bad1f8b8f3c1780cd37ec8a817ef4b0f23901654;hpb=7dd1463c557f712b6791d62d6103b573d517951b diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshotTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshotTest.java index cde180796b..70eece6163 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshotTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshotTest.java @@ -17,7 +17,6 @@ import org.junit.Test; import org.opendaylight.controller.cluster.raft.RaftVersions; import org.opendaylight.controller.cluster.raft.persisted.ServerConfigurationPayload; import org.opendaylight.controller.cluster.raft.persisted.ServerInfo; -import org.opendaylight.controller.protobuff.messages.cluster.raft.InstallSnapshotMessages; /** * Unit tests for InstallSnapshot. @@ -45,36 +44,14 @@ public class InstallSnapshotTest { Object serialized = expected.toSerializable(RaftVersions.CURRENT_VERSION); assertEquals("Serialized type", InstallSnapshot.class, serialized.getClass()); - InstallSnapshot actual = InstallSnapshot.fromSerializable(SerializationUtils.clone((Serializable) serialized)); + InstallSnapshot actual = (InstallSnapshot) SerializationUtils.clone((Serializable) serialized); verifyInstallSnapshot(expected, actual); expected = new InstallSnapshot(3L, "leaderId", 11L, 2L, data, 5, 6); - actual = InstallSnapshot.fromSerializable(SerializationUtils.clone( - (Serializable) expected.toSerializable(RaftVersions.CURRENT_VERSION))); + actual = (InstallSnapshot) SerializationUtils.clone((Serializable) expected.toSerializable(RaftVersions.CURRENT_VERSION)); verifyInstallSnapshot(expected, actual); } - @Test - public void testSerializationWithPreBoronVersion() { - byte[] data = {0,1,2,3,4,5,7,8,9}; - InstallSnapshot expected = new InstallSnapshot(3L, "leaderId", 11L, 2L, data, 5, 6, Optional.of(54321), - Optional.absent()); - - Object serialized = expected.toSerializable(RaftVersions.LITHIUM_VERSION); - assertEquals("Serialized type", InstallSnapshot.SERIALIZABLE_CLASS, serialized.getClass()); - - InstallSnapshot actual = InstallSnapshot.fromSerializable(SerializationUtils.clone((Serializable) serialized)); - verifyInstallSnapshot(expected, actual); - } - - @Test - public void testIsSerializedType() { - assertEquals("isSerializedType", true, InstallSnapshot.isSerializedType( - InstallSnapshotMessages.InstallSnapshot.newBuilder().build())); - assertEquals("isSerializedType", true, InstallSnapshot.isSerializedType(new InstallSnapshot())); - assertEquals("isSerializedType", false, InstallSnapshot.isSerializedType(new Object())); - } - private static void verifyInstallSnapshot(InstallSnapshot expected, InstallSnapshot actual) { assertEquals("getTerm", expected.getTerm(), actual.getTerm()); assertEquals("getChunkIndex", expected.getChunkIndex(), actual.getChunkIndex());