BUG-509: Rename MutableDataTree to DataTreeModification
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / test / java / org / opendaylight / controller / md / sal / dom / store / impl / ModificationMetadataTreeTest.java
index 7610a78364f4f46d7c01b003202b6da104f9f054..efa5068fb61a2ebbcfc7eb8e9e4ca35d7fd3ac40 100644 (file)
@@ -135,18 +135,11 @@ public class ModificationMetadataTreeTest {
                                 .withChild(BAR_NODE).build()).build();
     }
 
-    private StoreMetadataNode createDocumentOneMetadata() {
-        UnsignedLong version = UnsignedLong.valueOf(0);
-        return StoreMetadataNode.createRecursivelly(createDocumentOne(), version);
-    }
-
     @Test
     public void basicReadWrites() {
-        MutableDataTree modificationTree = MutableDataTree.from(
-                DataAndMetadataSnapshot.builder() //
-                        .setMetadataTree(createDocumentOneMetadata()) //
-                        .setSchemaContext(schemaContext) //
-                        .build(), new SchemaAwareApplyOperationRoot(schemaContext));
+        DataTreeModification modificationTree = DataTreeModification.from(new DataTree.Snapshot(schemaContext,
+                StoreMetadataNode.createRecursively(createDocumentOne(), UnsignedLong.valueOf(5))),
+                new SchemaAwareApplyOperationRoot(schemaContext));
         Optional<NormalizedNode<?, ?>> originalBarNode = modificationTree.read(OUTER_LIST_2_PATH);
         assertTrue(originalBarNode.isPresent());
         assertSame(BAR_NODE, originalBarNode.get());
@@ -167,11 +160,11 @@ public class ModificationMetadataTreeTest {
     }
 
 
-    public MutableDataTree createEmptyModificationTree() {
+    public DataTreeModification createEmptyModificationTree() {
         /**
          * Creates empty Snapshot with associated schema context.
          */
-        DataAndMetadataSnapshot emptySnapshot = DataAndMetadataSnapshot.createEmpty(schemaContext);
+        DataTree t = DataTree.create(schemaContext);
 
         /**
          *
@@ -179,7 +172,7 @@ public class ModificationMetadataTreeTest {
          * context.
          *
          */
-        MutableDataTree modificationTree = MutableDataTree.from(emptySnapshot, new SchemaAwareApplyOperationRoot(
+        DataTreeModification modificationTree = DataTreeModification.from(t.takeSnapshot(), new SchemaAwareApplyOperationRoot(
                 schemaContext));
         return modificationTree;
     }
@@ -187,7 +180,7 @@ public class ModificationMetadataTreeTest {
     @Test
     public void createFromEmptyState() {
 
-        MutableDataTree modificationTree = createEmptyModificationTree();
+        DataTreeModification modificationTree = createEmptyModificationTree();
         /**
          * Writes empty container node to /test
          *
@@ -224,7 +217,7 @@ public class ModificationMetadataTreeTest {
 
     @Test
     public void writeSubtreeReadChildren() {
-        MutableDataTree modificationTree = createEmptyModificationTree();
+        DataTreeModification modificationTree = createEmptyModificationTree();
         modificationTree.write(TEST_PATH, createTestContainer());
         Optional<NormalizedNode<?, ?>> potential = modificationTree.read(TWO_TWO_PATH);
         MapEntryNode node = assertPresentAndType(potential, MapEntryNode.class);
@@ -232,7 +225,7 @@ public class ModificationMetadataTreeTest {
 
     @Test
     public void writeSubtreeDeleteChildren() {
-        MutableDataTree modificationTree = createEmptyModificationTree();
+        DataTreeModification modificationTree = createEmptyModificationTree();
         modificationTree.write(TEST_PATH, createTestContainer());
 
         // We verify data are present