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));
assertEquals(expected, actual);
}
- private NormalizedNode<?, ?> getCars(ShardDataTree shardDataTree) {
+ private static NormalizedNode<?, ?> getCars(ShardDataTree shardDataTree) {
ReadOnlyShardDataTreeTransaction readOnlyShardDataTreeTransaction = shardDataTree.newReadOnlyTransaction("txn-2", null);
DataTreeSnapshot snapshot1 = readOnlyShardDataTreeTransaction.getSnapshot();
return optional.get();
}
- private DataTreeCandidateTip addCar(ShardDataTree shardDataTree) throws ExecutionException, InterruptedException {
+ private static DataTreeCandidateTip addCar(ShardDataTree shardDataTree) throws ExecutionException, InterruptedException {
return doTransaction(shardDataTree, new DataTreeOperation() {
@Override
public void execute(DataTreeModification snapshot) {
});
}
- private DataTreeCandidateTip removeCar(ShardDataTree shardDataTree) throws ExecutionException, InterruptedException {
+ private static DataTreeCandidateTip removeCar(ShardDataTree shardDataTree) throws ExecutionException, InterruptedException {
return doTransaction(shardDataTree, new DataTreeOperation() {
@Override
public void execute(DataTreeModification snapshot) {
public abstract void execute(DataTreeModification snapshot);
}
- private DataTreeCandidateTip doTransaction(ShardDataTree shardDataTree, DataTreeOperation operation)
+ private static DataTreeCandidateTip doTransaction(ShardDataTree shardDataTree, DataTreeOperation operation)
throws ExecutionException, InterruptedException {
ReadWriteShardDataTreeTransaction transaction = shardDataTree.newReadWriteTransaction("txn-1", null);
DataTreeModification snapshot = transaction.getSnapshot();
return candidate;
}
- private DataTreeCandidateTip applyCandidates(ShardDataTree shardDataTree, List<DataTreeCandidateTip> candidates)
+ private static DataTreeCandidateTip applyCandidates(ShardDataTree shardDataTree, List<DataTreeCandidateTip> candidates)
throws ExecutionException, InterruptedException {
ReadWriteShardDataTreeTransaction transaction = shardDataTree.newReadWriteTransaction("txn-1", null);
DataTreeModification snapshot = transaction.getSnapshot();