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%2Fdatabroker%2Factors%2Fdds%2FModuleShardBackendResolverTest.java;h=971330d0c52c6841b371d7249380f192e8b7f26c;hb=refs%2Fchanges%2F00%2F84600%2F3;hp=5576ba75188330dcd306e62aebf6a65bdd9b0444;hpb=2b702880c19e11be077ddcc540aeacd80ecfcaf6;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/ModuleShardBackendResolverTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/ModuleShardBackendResolverTest.java index 5576ba7518..971330d0c5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/ModuleShardBackendResolverTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/ModuleShardBackendResolverTest.java @@ -45,7 +45,7 @@ import org.opendaylight.controller.cluster.datastore.shardmanager.RegisterForSha import org.opendaylight.controller.cluster.datastore.shardstrategy.DefaultShardStrategy; import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy; import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory; -import org.opendaylight.controller.cluster.datastore.utils.ActorContext; +import org.opendaylight.controller.cluster.datastore.utils.ActorUtils; import org.opendaylight.controller.cluster.datastore.utils.PrimaryShardInfoFutureCache; import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -79,14 +79,14 @@ public class ModuleShardBackendResolverTest { shardManagerProbe = new TestProbe(system, "ShardManager"); - final ActorContext actorContext = createActorContextMock(system, contextProbe.ref()); - when(actorContext.getShardManager()).thenReturn(shardManagerProbe.ref()); + final ActorUtils actorUtils = createActorUtilsMock(system, contextProbe.ref()); + when(actorUtils.getShardManager()).thenReturn(shardManagerProbe.ref()); - moduleShardBackendResolver = new ModuleShardBackendResolver(CLIENT_ID, actorContext); - when(actorContext.getShardStrategyFactory()).thenReturn(shardStrategyFactory); - when(shardStrategyFactory.getStrategy(YangInstanceIdentifier.EMPTY)).thenReturn(shardStrategy); + moduleShardBackendResolver = new ModuleShardBackendResolver(CLIENT_ID, actorUtils); + when(actorUtils.getShardStrategyFactory()).thenReturn(shardStrategyFactory); + when(shardStrategyFactory.getStrategy(YangInstanceIdentifier.empty())).thenReturn(shardStrategy); final PrimaryShardInfoFutureCache cache = new PrimaryShardInfoFutureCache(); - when(actorContext.getPrimaryShardInfoCache()).thenReturn(cache); + when(actorUtils.getPrimaryShardInfoCache()).thenReturn(cache); } @After @@ -96,15 +96,15 @@ public class ModuleShardBackendResolverTest { @Test public void testResolveShardForPathNonNullCookie() { - when(shardStrategy.findShard(YangInstanceIdentifier.EMPTY)).thenReturn(DefaultShardStrategy.DEFAULT_SHARD); - final Long cookie = moduleShardBackendResolver.resolveShardForPath(YangInstanceIdentifier.EMPTY); + when(shardStrategy.findShard(YangInstanceIdentifier.empty())).thenReturn(DefaultShardStrategy.DEFAULT_SHARD); + final Long cookie = moduleShardBackendResolver.resolveShardForPath(YangInstanceIdentifier.empty()); Assert.assertEquals(0L, cookie.longValue()); } @Test public void testResolveShardForPathNullCookie() { - when(shardStrategy.findShard(YangInstanceIdentifier.EMPTY)).thenReturn("foo"); - final Long cookie = moduleShardBackendResolver.resolveShardForPath(YangInstanceIdentifier.EMPTY); + when(shardStrategy.findShard(YangInstanceIdentifier.empty())).thenReturn("foo"); + final Long cookie = moduleShardBackendResolver.resolveShardForPath(YangInstanceIdentifier.empty()); Assert.assertEquals(1L, cookie.longValue()); } @@ -184,8 +184,8 @@ public class ModuleShardBackendResolverTest { verifyNoMoreInteractions(mockCallback); } - private static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) { - final ActorContext mock = mock(ActorContext.class); + private static ActorUtils createActorUtilsMock(final ActorSystem system, final ActorRef actor) { + final ActorUtils mock = mock(ActorUtils.class); final Promise promise = new scala.concurrent.impl.Promise.DefaultPromise<>(); final ActorSelection selection = system.actorSelection(actor.path()); final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);