Leader should always apply modifications as local
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / actors / ShardSnapshotActorTest.java
index 30b8bab1b7bafe9887e639fe20639a931b90c016..6a0def0901ac70d413af19e201793fb4311d75b8 100644 (file)
@@ -9,12 +9,14 @@ package org.opendaylight.controller.cluster.datastore.actors;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import akka.actor.ActorRef;
 import akka.testkit.javadsl.TestKit;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
+import java.time.Duration;
 import java.util.Optional;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.AbstractActorTest;
@@ -41,7 +43,7 @@ public class ShardSnapshotActorTest extends AbstractActorTest {
         ShardSnapshotActor.requestSnapshot(snapshotActor, snapshot,
             Optional.ofNullable(installSnapshotStream), kit.getRef());
 
-        final CaptureSnapshotReply reply = kit.expectMsgClass(kit.duration("3 seconds"), CaptureSnapshotReply.class);
+        final CaptureSnapshotReply reply = kit.expectMsgClass(Duration.ofSeconds(3), CaptureSnapshotReply.class);
         assertNotNull("getSnapshotState is null", reply.getSnapshotState());
         assertEquals("SnapshotState type", ShardSnapshotState.class, reply.getSnapshotState().getClass());
         assertEquals("Snapshot", snapshot, ((ShardSnapshotState)reply.getSnapshotState()).getSnapshot());
@@ -50,13 +52,13 @@ public class ShardSnapshotActorTest extends AbstractActorTest {
             final ShardDataTreeSnapshot deserialized;
             try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(
                 installSnapshotStream.toByteArray()))) {
-                deserialized = ShardDataTreeSnapshot.deserialize(in);
+                deserialized = ShardDataTreeSnapshot.deserialize(in).getSnapshot();
             }
 
             assertEquals("Deserialized snapshot type", snapshot.getClass(), deserialized.getClass());
 
             final Optional<NormalizedNode<?, ?>> maybeNode = deserialized.getRootNode();
-            assertEquals("isPresent", true, maybeNode.isPresent());
+            assertTrue("isPresent", maybeNode.isPresent());
             assertEquals("Root node", expectedRoot, maybeNode.get());
         }
     }