X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Futils%2FActorUtilsTest.java;h=daef2143a2df5c88b893b72701499457001a391a;hb=HEAD;hp=1f60cdfae43da6ca9499268932aa0493299aa205;hpb=3859df9beca8f13f1ff2b2744ed3470a1715bec3;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorUtilsTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorUtilsTest.java index 1f60cdfae4..daef2143a2 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorUtilsTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorUtilsTest.java @@ -59,7 +59,7 @@ import org.opendaylight.controller.cluster.datastore.messages.RemotePrimaryShard import org.opendaylight.controller.cluster.raft.utils.EchoActor; import org.opendaylight.controller.cluster.raft.utils.MessageCollectorActor; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; +import org.opendaylight.yangtools.yang.data.tree.api.DataTree; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import scala.concurrent.Await; @@ -67,10 +67,10 @@ import scala.concurrent.Future; import scala.concurrent.duration.FiniteDuration; public class ActorUtilsTest extends AbstractActorTest { - static final Logger LOG = LoggerFactory.getLogger(ActorUtilsTest.class); - private static class TestMessage { + private static final class TestMessage { + } private static final class MockShardManager extends UntypedAbstractActor { @@ -85,8 +85,7 @@ public class ActorUtilsTest extends AbstractActorTest { } @Override public void onReceive(final Object message) { - if (message instanceof FindPrimary) { - FindPrimary fp = (FindPrimary)message; + if (message instanceof FindPrimary fp) { Object resp = findPrimaryResponses.get(fp.getShardName()); if (resp == null) { LOG.error("No expected FindPrimary response found for shard name {}", fp.getShardName()); @@ -109,11 +108,11 @@ public class ActorUtilsTest extends AbstractActorTest { } private static Props props(final boolean found, final ActorRef actorRef) { - return Props.create(new MockShardManagerCreator(found, actorRef)); + return Props.create(MockShardManager.class, new MockShardManagerCreator(found, actorRef)); } private static Props props() { - return Props.create(new MockShardManagerCreator()); + return Props.create(MockShardManager.class, new MockShardManagerCreator()); } @SuppressWarnings("serial") @@ -122,8 +121,8 @@ public class ActorUtilsTest extends AbstractActorTest { final ActorRef actorRef; MockShardManagerCreator() { - this.found = false; - this.actorRef = null; + found = false; + actorRef = null; } MockShardManagerCreator(final boolean found, final ActorRef actorRef) { @@ -149,9 +148,7 @@ public class ActorUtilsTest extends AbstractActorTest { ActorUtils actorUtils = new ActorUtils(getSystem(), shardManagerActorRef, mock(ClusterWrapper.class), mock(Configuration.class)); - Optional out = actorUtils.findLocalShard("default"); - - assertEquals(shardActorRef, out.get()); + assertEquals(Optional.of(shardActorRef), actorUtils.findLocalShard("default")); testKit.expectNoMessage(); return null; @@ -379,7 +376,7 @@ public class ActorUtilsTest extends AbstractActorTest { assertNotNull(actual); assertTrue("LocalShardDataTree present", actual.getLocalShardDataTree().isPresent()); - assertSame("LocalShardDataTree", mockDataTree, actual.getLocalShardDataTree().get()); + assertSame("LocalShardDataTree", mockDataTree, actual.getLocalShardDataTree().orElseThrow()); assertTrue("Unexpected PrimaryShardActor path " + actual.getPrimaryShardActor().path(), expPrimaryPath.endsWith(actual.getPrimaryShardActor().pathString())); assertEquals("getPrimaryShardVersion", DataStoreVersions.CURRENT_VERSION, actual.getPrimaryShardVersion());