import org.opendaylight.controller.cluster.datastore.DatastoreContext.Builder;
import org.opendaylight.controller.cluster.datastore.config.Configuration;
import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl;
+import org.opendaylight.controller.cluster.datastore.config.EmptyModuleShardConfigProvider;
import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
import org.opendaylight.controller.cluster.datastore.messages.DatastoreSnapshot;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
return dataStore;
}
+ public DistributedDataStore setupDistributedDataStoreWithoutConfig(final String typeName,
+ final SchemaContext schemaContext) {
+ final ClusterWrapper cluster = new ClusterWrapperImpl(getSystem());
+ final ConfigurationImpl configuration = new ConfigurationImpl(new EmptyModuleShardConfigProvider());
+
+ getDatastoreContextBuilder().dataStoreName(typeName);
+
+ final DatastoreContext datastoreContext = getDatastoreContextBuilder().build();
+
+ final DatastoreContextFactory mockContextFactory = Mockito.mock(DatastoreContextFactory.class);
+ Mockito.doReturn(datastoreContext).when(mockContextFactory).getBaseDatastoreContext();
+ Mockito.doReturn(datastoreContext).when(mockContextFactory).getShardDatastoreContext(Mockito.anyString());
+
+ final DistributedDataStore dataStore = new DistributedDataStore(getSystem(), cluster,
+ configuration, mockContextFactory, restoreFromSnapshot);
+
+ dataStore.onGlobalContextUpdated(schemaContext);
+
+ datastoreContextBuilder = DatastoreContext.newBuilderFrom(datastoreContext);
+ return dataStore;
+ }
+
public void waitUntilLeader(final ActorContext actorContext, final String... shardNames) {
for (String shardName: shardNames) {
ActorRef shard = findLocalShard(actorContext, shardName);