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%2FDistributedDataStoreClientBehaviorTest.java;fp=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatabroker%2Factors%2Fdds%2FDistributedDataStoreClientBehaviorTest.java;h=312edb335c9a01ad195af5fdb3ac984a6e252d50;hb=438d5278050961f0773707e6508b1b736eac1c0f;hp=a546955ab82ae306abfa9126e9a49edfa6ce2597;hpb=1d5ca4009be6c61d7b61989799037ad8f1ab7a75;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/DistributedDataStoreClientBehaviorTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/DistributedDataStoreClientBehaviorTest.java index a546955ab8..312edb335c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/DistributedDataStoreClientBehaviorTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/DistributedDataStoreClientBehaviorTest.java @@ -8,10 +8,12 @@ package org.opendaylight.controller.cluster.databroker.actors.dds; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import java.util.Set; import org.opendaylight.controller.cluster.access.client.ClientActorContext; +import org.opendaylight.controller.cluster.datastore.config.Configuration; import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy; import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory; import org.opendaylight.controller.cluster.datastore.utils.ActorUtils; @@ -20,11 +22,16 @@ public class DistributedDataStoreClientBehaviorTest extends AbstractDataStoreCli @Override protected AbstractDataStoreClientBehavior createBehavior(final ClientActorContext clientContext, final ActorUtils context) { - final ShardStrategyFactory factory = mock(ShardStrategyFactory.class); final ShardStrategy strategy = mock(ShardStrategy.class); - when(strategy.findShard(any())).thenReturn(SHARD); - when(factory.getStrategy(any())).thenReturn(strategy); - when(context.getShardStrategyFactory()).thenReturn(factory); + doReturn(SHARD).when(strategy).findShard(any()); + final ShardStrategyFactory factory = mock(ShardStrategyFactory.class); + doReturn(strategy).when(factory).getStrategy(any()); + doReturn(factory).when(context).getShardStrategyFactory(); + + final Configuration config = mock(Configuration.class); + doReturn(Set.of(SHARD)).when(config).getAllShardNames(); + doReturn(config).when(context).getConfiguration(); + return new DistributedDataStoreClientBehavior(clientContext, context); } }