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%2FSnapshotTest.java;h=b4a8c27b7c9215e0f8ac1406c3fa7ab33ad5f110;hb=2faf656bf68dd3843fd59520b27a7ec2abbdcc68;hp=a0b9cd5ee1898b99ce0ab4fe26bedf49d970ce15;hpb=ecccb6d5b43dd73aef0d2d19349d19ee9b4728f7;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotTest.java index a0b9cd5ee1..b4a8c27b7c 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotTest.java @@ -9,6 +9,7 @@ package org.opendaylight.controller.cluster.raft; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; + import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -24,12 +25,13 @@ import org.opendaylight.controller.cluster.raft.MockRaftActorContext.MockPayload * * @author Thomas Pantelis */ +@Deprecated public class SnapshotTest { @Test public void testBackwardsCompatibleDeserializationFromLithium() throws Exception { Snapshot expSnapshot = newLithiumSnapshot(); - try(FileInputStream fis = new FileInputStream("src/test/resources/lithium-serialized-Snapshot")) { + try (FileInputStream fis = new FileInputStream("src/test/resources/lithium-serialized-Snapshot")) { ObjectInputStream ois = new ObjectInputStream(fis); Snapshot snapshot = (Snapshot) ois.readObject(); @@ -39,7 +41,8 @@ public class SnapshotTest { assertEquals("lastTerm", expSnapshot.getLastTerm(), snapshot.getLastTerm()); assertEquals("lastAppliedIndex", expSnapshot.getLastAppliedIndex(), snapshot.getLastAppliedIndex()); assertEquals("lastAppliedTerm", expSnapshot.getLastAppliedTerm(), snapshot.getLastAppliedTerm()); - assertEquals("unAppliedEntries size", expSnapshot.getUnAppliedEntries().size(), snapshot.getUnAppliedEntries().size()); + assertEquals("unAppliedEntries size", expSnapshot.getUnAppliedEntries().size(), + snapshot.getUnAppliedEntries().size()); assertArrayEquals("state", expSnapshot.getState(), snapshot.getState()); assertEquals("electionTerm", 0, snapshot.getElectionTerm()); assertEquals("electionVotedFor", null, snapshot.getElectionVotedFor()); @@ -49,7 +52,8 @@ public class SnapshotTest { private static Snapshot newLithiumSnapshot() { byte[] state = {1, 2, 3, 4, 5}; List entries = new ArrayList<>(); - entries.add(new ReplicatedLogImplEntry(6, 2, new MockPayload("payload"))); + entries.add(new org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry( + 6, 2, new MockPayload("payload"))); long lastIndex = 6; long lastTerm = 2; long lastAppliedIndex = 5; @@ -62,6 +66,7 @@ public class SnapshotTest { * Use this method to generate a file with a serialized Snapshot instance to be * used in tests that verify backwards compatible de-serialization. */ + @SuppressWarnings("unused") private static void generateSerializedFile(Snapshot snapshot, String fileName) throws IOException { FileOutputStream fos = new FileOutputStream("src/test/resources/" + fileName); ObjectOutputStream oos = new ObjectOutputStream(fos);