+ 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 DistributedDataStore setupDistributedDataStoreWithoutConfig(final String typeName,
+ final SchemaContext schemaContext,
+ final LogicalDatastoreType storeType) {
+ final ClusterWrapper cluster = new ClusterWrapperImpl(getSystem());
+ final ConfigurationImpl configuration = new ConfigurationImpl(new EmptyModuleShardConfigProvider());
+
+ getDatastoreContextBuilder().dataStoreName(typeName);
+
+ final DatastoreContext datastoreContext =
+ getDatastoreContextBuilder().logicalStoreType(storeType).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) {