DOMDataTreePrefixTableEntry<DOMDataTreeShardRegistration<DOMDataTreeShard>> lookupShardFrontend(
final DOMDataTreeIdentifier prefix) {
- return shards.lookup(prefix);
-
+ synchronized (shards) {
+ return shards.lookup(prefix);
+ }
}
DOMDataTreeProducer localCreateProducer(final Collection<DOMDataTreeIdentifier> prefix) {
final Object o = actorContext.executeOperation(shardDataTreeActor, new ProducerRemoved(subtrees));
if (o instanceof DOMDataTreeProducerException) {
- throw ((DOMDataTreeProducerException) o);
+ throw (DOMDataTreeProducerException) o;
} else if (o instanceof Throwable) {
throw new DOMDataTreeProducerException("Unable to close producer", (Throwable) o);
}
final ClusterWrapper cluster = new ClusterWrapperImpl(getSystem());
final Configuration config = new ConfigurationImpl(moduleShardsConfig, modulesConfig);
- datastoreContextBuilder.dataStoreName(typeName);
+ setDataStoreName(typeName);
final DatastoreContext datastoreContext = datastoreContextBuilder.build();
final DatastoreContextFactory mockContextFactory = Mockito.mock(DatastoreContextFactory.class);
return dataStore;
}
+ private void setDataStoreName(String typeName) {
+ if ("config".equals(typeName)) {
+ datastoreContextBuilder.logicalStoreType(LogicalDatastoreType.CONFIGURATION);
+ } else if ("operational".equals(typeName)) {
+ datastoreContextBuilder.logicalStoreType(LogicalDatastoreType.OPERATIONAL);
+ } else {
+ datastoreContextBuilder.dataStoreName(typeName);
+ }
+ }
+
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);
+ setDataStoreName(typeName);
final DatastoreContext datastoreContext = getDatastoreContextBuilder().build();
final ClusterWrapper cluster = new ClusterWrapperImpl(getSystem());
final ConfigurationImpl configuration = new ConfigurationImpl(new EmptyModuleShardConfigProvider());
- getDatastoreContextBuilder().dataStoreName(typeName);
+ setDataStoreName(typeName);
final DatastoreContext datastoreContext =
getDatastoreContextBuilder().logicalStoreType(storeType).build();
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.controller.cluster.ActorSystemProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Ignore("https://bugs.opendaylight.org/show_bug.cgi?id=8301")
public class DistributedShardedDOMDataTreeRemotingTest extends AbstractTest {
private static final Logger LOG = LoggerFactory.getLogger(DistributedShardedDOMDataTreeRemotingTest.class);
private final Builder leaderDatastoreContextBuilder =
- DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(100).shardElectionTimeoutFactor(5)
- .logicalStoreType(
- org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION);
+ DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(100).shardElectionTimeoutFactor(5);
private final DatastoreContext.Builder followerDatastoreContextBuilder =
- DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(100).shardElectionTimeoutFactor(5)
- .logicalStoreType(
- org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION);
+ DatastoreContext.newBuilder().shardHeartbeatIntervalInMillis(100).shardElectionTimeoutFactor(5);
private DistributedDataStore leaderConfigDatastore;
private DistributedDataStore leaderOperDatastore;
followerOperDatastore,
followerConfigDatastore);
+ followerTestKit.waitForMembersUp("member-1");
+
leaderShardFactory.init();
followerShardFactory.init();