Implement scatter/gather on module shards
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / databroker / actors / dds / DistributedDataStoreClientBehaviorTest.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.databroker.actors.dds;
9
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.mockito.Mockito.doReturn;
12 import static org.mockito.Mockito.mock;
13
14 import java.util.Set;
15 import org.opendaylight.controller.cluster.access.client.ClientActorContext;
16 import org.opendaylight.controller.cluster.datastore.config.Configuration;
17 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
18 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
19 import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
20
21 public class DistributedDataStoreClientBehaviorTest extends AbstractDataStoreClientBehaviorTest {
22     @Override
23     protected AbstractDataStoreClientBehavior createBehavior(final ClientActorContext clientContext,
24                                                              final ActorUtils context) {
25         final ShardStrategy strategy = mock(ShardStrategy.class);
26         doReturn(SHARD).when(strategy).findShard(any());
27         final ShardStrategyFactory factory = mock(ShardStrategyFactory.class);
28         doReturn(strategy).when(factory).getStrategy(any());
29         doReturn(factory).when(context).getShardStrategyFactory();
30
31         final Configuration config = mock(Configuration.class);
32         doReturn(Set.of(SHARD)).when(config).getAllShardNames();
33         doReturn(config).when(context).getConfiguration();
34
35         return new DistributedDataStoreClientBehavior(clientContext, context);
36     }
37 }