LOG.info("Shard created : {}, persistent : {}", name, datastoreContext.isPersistent());
+ // FIXME: BUG-1014: pass down the proper TreeType
store = new ShardDataTree(builder.getSchemaContext());
shardMBean = ShardMBeanFactory.getShardStatsMBean(name.toString(),
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
private final TipProducingDataTree dataTree;
private SchemaContext schemaContext;
- public ShardDataTree(final SchemaContext schemaContext) {
- dataTree = InMemoryDataTreeFactory.getInstance().create();
+ public ShardDataTree(final SchemaContext schemaContext, final TreeType treeType) {
+ dataTree = InMemoryDataTreeFactory.getInstance().create(treeType);
updateSchemaContext(schemaContext);
+ }
+ /**
+ * @deprecated Use {@link #ShardDataTree(SchemaContext, TreeType)} instead.
+ */
+ @Deprecated
+ public ShardDataTree(final SchemaContext schemaContext) {
+ this(schemaContext, TreeType.OPERATIONAL);
}
public TipProducingDataTree getDataTree() {
final SchemaContext schemaContext) {
this.rootIdentifier = rootIdentifier;
this.nodes = nodes;
+ // FIXME: BUG-1014: pass down proper DataTree
this.dataTree = InMemoryDataTreeFactory.getInstance().create();
this.dataTree.setSchemaContext(schemaContext);
}
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class ShardDataTreeTest {
@Test
public void testWrite() throws ExecutionException, InterruptedException {
- modify(new ShardDataTree(fullSchema), false, true, true);
+ modify(new ShardDataTree(fullSchema, TreeType.OPERATIONAL), false, true, true);
}
@Test
public void testMerge() throws ExecutionException, InterruptedException {
- modify(new ShardDataTree(fullSchema), true, true, true);
+ modify(new ShardDataTree(fullSchema, TreeType.OPERATIONAL), true, true, true);
}
@Test
public void bug4359AddRemoveCarOnce() throws ExecutionException, InterruptedException {
- ShardDataTree shardDataTree = new ShardDataTree(fullSchema);
+ ShardDataTree shardDataTree = new ShardDataTree(fullSchema, TreeType.OPERATIONAL);
List<DataTreeCandidateTip> candidates = new ArrayList<>();
candidates.add(addCar(shardDataTree));
@Test
public void bug4359AddRemoveCarTwice() throws ExecutionException, InterruptedException {
- ShardDataTree shardDataTree = new ShardDataTree(fullSchema);
+ ShardDataTree shardDataTree = new ShardDataTree(fullSchema, TreeType.OPERATIONAL);
List<DataTreeCandidateTip> candidates = new ArrayList<>();
candidates.add(addCar(shardDataTree));
peopleSchemaContext = SchemaContextHelper.select(SchemaContextHelper.PEOPLE_YANG);
carsSchemaContext = SchemaContextHelper.select(SchemaContextHelper.CARS_YANG);
- peopleDataTree = new ShardDataTree(peopleSchemaContext);
+ peopleDataTree = new ShardDataTree(peopleSchemaContext, TreeType.OPERATIONAL);
}
@Test
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import scala.concurrent.Await;
private static final TransactionType RW = TransactionType.READ_WRITE;
private static final TransactionType WO = TransactionType.WRITE_ONLY;
- private static final ShardDataTree store = new ShardDataTree(testSchemaContext);
+ private static final ShardDataTree store = new ShardDataTree(testSchemaContext, TreeType.OPERATIONAL);
private static final ShardIdentifier SHARD_IDENTIFIER =
ShardIdentifier.builder().memberName("member-1")
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
private final ShardStats shardStats = new ShardStats(SHARD_IDENTIFIER.toString(), "DataStore");
- private final ShardDataTree store = new ShardDataTree(testSchemaContext);
+ private final ShardDataTree store = new ShardDataTree(testSchemaContext, TreeType.OPERATIONAL);
private int txCounter = 0;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
import scala.concurrent.duration.FiniteDuration;
/**
private static final YangInstanceIdentifier ENTITY_ID2 =
YangInstanceIdentifier.of(QName.create("test", "2015-08-14", "entity2"));
- private final ShardDataTree shardDataTree = new ShardDataTree(SchemaContextHelper.entityOwners());
+ private final ShardDataTree shardDataTree = new ShardDataTree(SchemaContextHelper.entityOwners(),
+ TreeType.OPERATIONAL);
@Test
public void testOnDataTreeChanged() throws Exception {
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import scala.concurrent.Await;
import scala.concurrent.Future;
service.start();
- ShardDataTree shardDataTree = new ShardDataTree(SchemaContextHelper.entityOwners());
+ ShardDataTree shardDataTree = new ShardDataTree(SchemaContextHelper.entityOwners(), TreeType.OPERATIONAL);
shardBuilder.setDataTree(shardDataTree.getDataTree());
Entity entity1 = new Entity(ENTITY_TYPE, "one");
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
;
/**
private static final Entity ENTITY1 = new Entity(ENTITY_TYPE, ENTITY_ID1);
private static final Entity ENTITY2 = new Entity(ENTITY_TYPE, ENTITY_ID2);
- private final ShardDataTree shardDataTree = new ShardDataTree(SchemaContextHelper.entityOwners());
+ private final ShardDataTree shardDataTree = new ShardDataTree(SchemaContextHelper.entityOwners(),
+ TreeType.OPERATIONAL);
private final EntityOwnershipListenerSupport mockListenerSupport = mock(EntityOwnershipListenerSupport.class);
private EntityOwnerChangeListener listener;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
public class EntityOwnershipStatisticsTest extends AbstractActorTest {
private static final String LOCAL_MEMBER_NAME = "member-1";
private static final YangInstanceIdentifier ENTITY_ID2 =
YangInstanceIdentifier.of(QName.create("test", "2015-08-14", "entity2"));
- private final ShardDataTree shardDataTree = new ShardDataTree(SchemaContextHelper.entityOwners());
+ private final ShardDataTree shardDataTree = new ShardDataTree(SchemaContextHelper.entityOwners(),
+ TreeType.OPERATIONAL);
private EntityOwnershipStatistics ownershipStatistics;
@Before