X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDistributedDataStoreTest.java;h=00243ea5d1d1e9e52cff5dfc21335d7a5cbdc13f;hp=08c3ea9602adb9cd891f9e1fe573ded671e5d6d7;hb=f9f6d8ed4b12e39386801f6b16b9485f5558336e;hpb=9f61e98b036119694dfef0759a7cafc56aae6e86 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java index 08c3ea9602..00243ea5d1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java @@ -8,6 +8,7 @@ import akka.actor.Props; import akka.dispatch.ExecutionContexts; import akka.dispatch.Futures; import akka.util.Timeout; +import com.google.common.base.Optional; import com.google.common.util.concurrent.MoreExecutors; import org.junit.After; import org.junit.Before; @@ -33,9 +34,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import scala.concurrent.ExecutionContextExecutor; import scala.concurrent.Future; import scala.concurrent.duration.FiniteDuration; - import java.util.concurrent.TimeUnit; - import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertNull; import static org.junit.Assert.assertNotNull; @@ -87,7 +86,7 @@ public class DistributedDataStoreTest extends AbstractActorTest{ new DistributedDataStore(actorSystem, "config", mock(ClusterWrapper.class), mock(Configuration.class), - new DatastoreContext()); + DatastoreContext.newBuilder().build()); verify(actorSystem).actorOf(any(Props.class), eq("shardmanager-config")); } @@ -97,11 +96,11 @@ public class DistributedDataStoreTest extends AbstractActorTest{ ListenerRegistration registration = distributedDataStore.registerChangeListener(TestModel.TEST_PATH, new AsyncDataChangeListener>() { - @Override - public void onDataChanged(AsyncDataChangeEvent> change) { - throw new UnsupportedOperationException("onDataChanged"); - } - }, AsyncDataBroker.DataChangeScope.BASE); + @Override + public void onDataChanged(AsyncDataChangeEvent> change) { + throw new UnsupportedOperationException("onDataChanged"); + } + }, AsyncDataBroker.DataChangeScope.BASE); // Since we do not expect the shard to be local registration will return a NoOpRegistration assertTrue(registration instanceof NoOpDataChangeListenerRegistration); @@ -119,8 +118,9 @@ public class DistributedDataStoreTest extends AbstractActorTest{ Future future = mock(Future.class); when(actorContext.getOperationDuration()).thenReturn(FiniteDuration.apply(5, TimeUnit.SECONDS)); when(actorContext.getActorSystem()).thenReturn(getSystem()); + when(actorContext.findLocalShard(anyString())).thenReturn(Optional.of(doNothingActorRef)); when(actorContext - .executeLocalShardOperationAsync(anyString(), anyObject(), any(Timeout.class))).thenReturn(future); + .executeOperationAsync(eq(doNothingActorRef), anyObject(), any(Timeout.class))).thenReturn(future); ListenerRegistration registration = distributedDataStore.registerChangeListener(TestModel.TEST_PATH, @@ -153,8 +153,9 @@ public class DistributedDataStoreTest extends AbstractActorTest{ when(actorSystem.dispatcher()).thenReturn(executor); when(actorSystem.actorOf(any(Props.class))).thenReturn(doNothingActorRef); when(actorContext.getActorSystem()).thenReturn(actorSystem); + when(actorContext.findLocalShard(anyString())).thenReturn(Optional.of(doNothingActorRef)); when(actorContext - .executeLocalShardOperationAsync(anyString(), anyObject(), any(Timeout.class))).thenReturn(f); + .executeOperationAsync(eq(doNothingActorRef), anyObject(), any(Timeout.class))).thenReturn(f); when(actorContext.actorSelection(any(ActorPath.class))).thenReturn(actorSelection); ListenerRegistration registration = @@ -195,8 +196,9 @@ public class DistributedDataStoreTest extends AbstractActorTest{ when(actorSystem.dispatcher()).thenReturn(executor); when(actorSystem.actorOf(any(Props.class))).thenReturn(doNothingActorRef); when(actorContext.getActorSystem()).thenReturn(actorSystem); + when(actorContext.findLocalShard(anyString())).thenReturn(Optional.of(doNothingActorRef)); when(actorContext - .executeLocalShardOperationAsync(anyString(), anyObject(), any(Timeout.class))).thenReturn(f); + .executeOperationAsync(eq(doNothingActorRef), anyObject(), any(Timeout.class))).thenReturn(f); when(actorContext.actorSelection(any(ActorPath.class))).thenReturn(actorSelection); ListenerRegistration registration =