use of org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory in project controller by opendaylight.
the class AbstractTransactionProxyTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
schemaContext = TestModel.createTestContext();
doReturn(getSystem()).when(mockActorContext).getActorSystem();
doReturn(getSystem().dispatchers().defaultGlobalDispatcher()).when(mockActorContext).getClientDispatcher();
doReturn(MemberName.forName(memberName)).when(mockActorContext).getCurrentMemberName();
doReturn(new ShardStrategyFactory(configuration, LogicalDatastoreType.CONFIGURATION)).when(mockActorContext).getShardStrategyFactory();
doReturn(schemaContext).when(mockActorContext).getSchemaContext();
doReturn(new Timeout(operationTimeoutInSeconds, TimeUnit.SECONDS)).when(mockActorContext).getOperationTimeout();
doReturn(mockClusterWrapper).when(mockActorContext).getClusterWrapper();
doReturn(mockClusterWrapper).when(mockActorContext).getClusterWrapper();
doReturn(dataStoreContextBuilder.build()).when(mockActorContext).getDatastoreContext();
final ClientIdentifier mockClientId = MockIdentifiers.clientIdentifier(getClass(), memberName);
mockComponentFactory = new TransactionContextFactory(mockActorContext, mockClientId);
Timer timer = new MetricRegistry().timer("test");
doReturn(timer).when(mockActorContext).getOperationTimer(any(String.class));
}
use of org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory in project controller by opendaylight.
the class DistributedDataStoreClientBehaviorTest method createBehavior.
@Override
protected AbstractDataStoreClientBehavior createBehavior(final ClientActorContext clientContext, final ActorContext 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);
return new DistributedDataStoreClientBehavior(clientContext, context);
}
Aggregations