Implement suspend leader in Shard
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / ShardDataTreeTest.java
index 26787f63d6a79bc569823b4ac96d3a69b6710170..c31db3205f2cca111a695c5eb4c21a4c30b1cdfe 100644 (file)
@@ -25,6 +25,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip
 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 {
@@ -38,12 +39,12 @@ 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);
     }
 
 
@@ -87,7 +88,7 @@ public class ShardDataTreeTest {
 
     @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));
@@ -104,7 +105,7 @@ public class ShardDataTreeTest {
 
     @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));
@@ -121,7 +122,7 @@ public class ShardDataTreeTest {
         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();
 
@@ -134,7 +135,7 @@ public class ShardDataTreeTest {
         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) {
@@ -145,7 +146,7 @@ public class ShardDataTreeTest {
         });
     }
 
-    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) {
@@ -158,7 +159,7 @@ public class ShardDataTreeTest {
         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();
@@ -173,7 +174,7 @@ public class ShardDataTreeTest {
         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();