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;
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());
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());
}
}