X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Futils%2FActorContextTest.java;h=4ee89ca76d4866d616b97ba14b1e268fa1aeaa82;hb=d3a97264ecf47e8c60ea11a7caebce41b580e91d;hp=377c05bf8c2eaed0bd6ac6b4278b780d20c95499;hpb=3b0499cd187bcdeda057465350d381c8bc28847c;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java index 377c05bf8c..4ee89ca76d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java @@ -331,7 +331,7 @@ public class ActorContextTest extends AbstractActorTest{ public void testClientDispatcherIsGlobalDispatcher(){ ActorContext actorContext = new ActorContext(getSystem(), mock(ActorRef.class), mock(ClusterWrapper.class), - mock(Configuration.class), DatastoreContext.newBuilder().build()); + mock(Configuration.class), DatastoreContext.newBuilder().build(), new PrimaryShardInfoFutureCache()); assertEquals(getSystem().dispatchers().defaultGlobalDispatcher(), actorContext.getClientDispatcher()); @@ -343,7 +343,7 @@ public class ActorContextTest extends AbstractActorTest{ ActorContext actorContext = new ActorContext(actorSystem, mock(ActorRef.class), mock(ClusterWrapper.class), - mock(Configuration.class), DatastoreContext.newBuilder().build()); + mock(Configuration.class), DatastoreContext.newBuilder().build(), new PrimaryShardInfoFutureCache()); assertNotEquals(actorSystem.dispatchers().defaultGlobalDispatcher(), actorContext.getClientDispatcher()); @@ -356,7 +356,7 @@ public class ActorContextTest extends AbstractActorTest{ new JavaTestKit(getSystem()) {{ ActorContext actorContext = new ActorContext(getSystem(), getRef(), mock(ClusterWrapper.class), mock(Configuration.class), DatastoreContext.newBuilder(). - operationTimeoutInSeconds(5).shardTransactionCommitTimeoutInSeconds(7).build()); + operationTimeoutInSeconds(5).shardTransactionCommitTimeoutInSeconds(7).build(), new PrimaryShardInfoFutureCache()); assertEquals("getOperationDuration", 5, actorContext.getOperationDuration().toSeconds()); assertEquals("getTransactionCommitOperationTimeout", 7, @@ -389,7 +389,7 @@ public class ActorContextTest extends AbstractActorTest{ final String expPrimaryPath = "akka://test-system/find-primary-shard"; ActorContext actorContext = new ActorContext(getSystem(), shardManager, mock(ClusterWrapper.class), - mock(Configuration.class), dataStoreContext) { + mock(Configuration.class), dataStoreContext, new PrimaryShardInfoFutureCache()) { @Override protected Future doAsk(ActorRef actorRef, Object message, Timeout timeout) { return Futures.successful((Object) new RemotePrimaryShardFound(expPrimaryPath)); @@ -410,9 +410,7 @@ public class ActorContextTest extends AbstractActorTest{ assertEquals(cachedInfo, actual); - // Wait for 200 Milliseconds. The cached entry should have been removed. - - Uninterruptibles.sleepUninterruptibly(200, TimeUnit.MILLISECONDS); + actorContext.getPrimaryShardInfoCache().remove("foobar"); cached = actorContext.getPrimaryShardInfoCache().getIfPresent("foobar"); @@ -432,7 +430,7 @@ public class ActorContextTest extends AbstractActorTest{ final String expPrimaryPath = "akka://test-system/find-primary-shard"; ActorContext actorContext = new ActorContext(getSystem(), shardManager, mock(ClusterWrapper.class), - mock(Configuration.class), dataStoreContext) { + mock(Configuration.class), dataStoreContext, new PrimaryShardInfoFutureCache()) { @Override protected Future doAsk(ActorRef actorRef, Object message, Timeout timeout) { return Futures.successful((Object) new LocalPrimaryShardFound(expPrimaryPath, mockDataTree)); @@ -454,9 +452,7 @@ public class ActorContextTest extends AbstractActorTest{ assertEquals(cachedInfo, actual); - // Wait for 200 Milliseconds. The cached entry should have been removed. - - Uninterruptibles.sleepUninterruptibly(200, TimeUnit.MILLISECONDS); + actorContext.getPrimaryShardInfoCache().remove("foobar"); cached = actorContext.getPrimaryShardInfoCache().getIfPresent("foobar"); @@ -474,7 +470,7 @@ public class ActorContextTest extends AbstractActorTest{ ActorContext actorContext = new ActorContext(getSystem(), shardManager, mock(ClusterWrapper.class), - mock(Configuration.class), dataStoreContext) { + mock(Configuration.class), dataStoreContext, new PrimaryShardInfoFutureCache()) { @Override protected Future doAsk(ActorRef actorRef, Object message, Timeout timeout) { return Futures.successful((Object) new PrimaryNotFoundException("not found")); @@ -507,7 +503,7 @@ public class ActorContextTest extends AbstractActorTest{ ActorContext actorContext = new ActorContext(getSystem(), shardManager, mock(ClusterWrapper.class), - mock(Configuration.class), dataStoreContext) { + mock(Configuration.class), dataStoreContext, new PrimaryShardInfoFutureCache()) { @Override protected Future doAsk(ActorRef actorRef, Object message, Timeout timeout) { return Futures.successful((Object) new NotInitializedException("not iniislized")); @@ -547,7 +543,7 @@ public class ActorContextTest extends AbstractActorTest{ ActorContext actorContext = new ActorContext(getSystem(), shardManagerActorRef, mock(ClusterWrapper.class), mockConfig, - DatastoreContext.newBuilder().shardInitializationTimeout(200, TimeUnit.MILLISECONDS).build()); + DatastoreContext.newBuilder().shardInitializationTimeout(200, TimeUnit.MILLISECONDS).build(), new PrimaryShardInfoFutureCache()); actorContext.broadcast(new TestMessage());