X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fmessages%2FInstallSnapshotTest.java;h=c6f080eb229a5d0f20ac31d26f8df949abaf5457;hb=8874f15140aa20aa205b5469e02f319076d53860;hp=a3da9594169af01290664a255e18d8d9e5fbd385;hpb=9a091425d16dadf09a5be4e764785707f5253013;p=controller.git 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 a3da959416..c6f080eb22 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 @@ -26,7 +26,16 @@ import org.opendaylight.controller.cluster.raft.persisted.ServerInfo; */ public class InstallSnapshotTest { @Test - public void testSerialization() { + public void testCurrentSerialization() { + testSerialization(RaftVersions.CURRENT_VERSION, 1262, 1125); + } + + @Test + public void testFluorineSerialization() { + testSerialization(RaftVersions.FLUORINE_VERSION, 1302, 1165); + } + + private static void testSerialization(final short raftVersion, final int fullSize, final int emptySize) { byte[] data = new byte[1000]; for (int i = 0, j = 0; i < data.length; i++) { data[i] = (byte)j; @@ -35,13 +44,13 @@ public class InstallSnapshotTest { } } - ServerConfigurationPayload serverConfig = new ServerConfigurationPayload(List.of( + var serverConfig = new ServerConfigurationPayload(List.of( new ServerInfo("leader", true), new ServerInfo("follower", false))); - assertInstallSnapshot(1302, new InstallSnapshot(3L, "leaderId", 11L, 2L, data, 5, 6, OptionalInt.of(54321), - Optional.of(serverConfig), RaftVersions.CURRENT_VERSION)); + assertInstallSnapshot(fullSize, new InstallSnapshot(3L, "leaderId", 11L, 2L, data, 5, 6, OptionalInt.of(54321), + Optional.of(serverConfig), raftVersion)); - assertInstallSnapshot(1165, new InstallSnapshot(3L, "leaderId", 11L, 2L, data, 5, 6, OptionalInt.empty(), - Optional.empty(), RaftVersions.CURRENT_VERSION)); + assertInstallSnapshot(emptySize, new InstallSnapshot(3L, "leaderId", 11L, 2L, data, 5, 6, OptionalInt.empty(), + Optional.empty(), raftVersion)); } private static void assertInstallSnapshot(final int expectedSize, final InstallSnapshot expected) {