Add ImmutableNode.newXYXBuilder() methods
[yangtools.git] / data / yang-data-tree-ri / src / test / java / org / opendaylight / yangtools / yang / data / tree / impl / Bug4454Test.java
index 320624ab2171e7642439cb31e91a4505263c1266..1b376b54220fbffbd63f1bd18fa2df3afd7e1bf1 100644 (file)
@@ -30,8 +30,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.DistinctNodeContainer;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
 import org.opendaylight.yangtools.yang.data.api.schema.SystemMapNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.spi.node.ImmutableNodes;
 import org.opendaylight.yangtools.yang.data.tree.api.DataTree;
 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeConfiguration;
 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeSnapshot;
@@ -64,11 +63,11 @@ class Bug4454Test {
     private static final YangInstanceIdentifier MIN_MAX_LEAF_LIST_PATH =
         YangInstanceIdentifier.builder(MASTER_CONTAINER_PATH).node(MIN_MAX_LEAF_LIST_QNAME).build();
 
-    private final MapEntryNode fooEntryNodeWithValue = Builders.mapEntryBuilder()
+    private final MapEntryNode fooEntryNodeWithValue = ImmutableNodes.newMapEntryBuilder()
         .withNodeIdentifier(NodeIdentifierWithPredicates.of(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "foo"))
         .withChild(ImmutableNodes.leafNode(MIN_MAX_VALUE_LEAF_QNAME, "footest"))
         .build();
-    private final MapEntryNode bazEntryNodeWithValue = Builders.mapEntryBuilder()
+    private final MapEntryNode bazEntryNodeWithValue = ImmutableNodes.newMapEntryBuilder()
         .withNodeIdentifier(NodeIdentifierWithPredicates.of(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "baz"))
         .withChild(ImmutableNodes.leafNode(MIN_MAX_VALUE_LEAF_QNAME, "baztest"))
         .build();
@@ -78,18 +77,18 @@ class Bug4454Test {
             "bar");
     private final MapEntryNode bazEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME,
             "baz");
-    private final SystemMapNode mapNodeBazFuzWithNodes = ImmutableNodes.mapNodeBuilder()
+    private final SystemMapNode mapNodeBazFuzWithNodes = ImmutableNodes.newSystemMapBuilder()
             .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
             .withChild(bazEntryNode).withChild(bazEntryNodeWithValue).withChild(fooEntryNode)
             .build();
-    private final SystemMapNode mapNodeFooWithNodes = ImmutableNodes.mapNodeBuilder()
+    private final SystemMapNode mapNodeFooWithNodes = ImmutableNodes.newSystemMapBuilder()
             .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
             .withChild(fooEntryNode).withChild(fooEntryNodeWithValue).withChild(barEntryNode).withChild(bazEntryNode)
             .build();
-    private final SystemMapNode mapNodeBar = ImmutableNodes.mapNodeBuilder()
+    private final SystemMapNode mapNodeBar = ImmutableNodes.newSystemMapBuilder()
             .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
             .withChild(barEntryNode).build();
-    private final SystemMapNode mapNodeBaz = ImmutableNodes.mapNodeBuilder()
+    private final SystemMapNode mapNodeBaz = ImmutableNodes.newSystemMapBuilder()
             .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
             .withChild(bazEntryNode).build();
 
@@ -165,7 +164,9 @@ class Bug4454Test {
         final var initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
         final var modificationTree = initialDataTreeSnapshot.newModification();
 
-        modificationTree.write(MASTER_CONTAINER_PATH, ImmutableNodes.containerNode(MASTER_CONTAINER_QNAME));
+        modificationTree.write(MASTER_CONTAINER_PATH, ImmutableNodes.newContainerBuilder()
+            .withNodeIdentifier(new NodeIdentifier(MASTER_CONTAINER_QNAME))
+            .build());
         modificationTree.ready();
         inMemoryDataTree.commit(inMemoryDataTree.prepare(modificationTree));
     }
@@ -308,14 +309,10 @@ class Bug4454Test {
         final var barPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "bar");
         final var gooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "goo");
 
-        final var barLeafSetEntry = Builders.<String>leafSetEntryBuilder()
-                .withNodeIdentifier(barPath)
-                .withValue("bar").build();
-        final var gooLeafSetEntry = Builders.<String>leafSetEntryBuilder()
-                .withNodeIdentifier(gooPath)
-                .withValue("goo").build();
+        final var barLeafSetEntry = ImmutableNodes.leafSetEntry(barPath);
+        final var gooLeafSetEntry = ImmutableNodes.leafSetEntry(gooPath);
 
-        final var fooLeafSetNode = Builders.leafSetBuilder()
+        final var fooLeafSetNode = ImmutableNodes.newSystemLeafSetBuilder()
                 .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME))
                 .withChildValue("foo")
                 .build();
@@ -405,7 +402,8 @@ class Bug4454Test {
 
         final var minMaxLeafBaz = PRESENCE_PATH.node(MIN_MAX_LIST_QNAME).node(mapEntryPath2);
 
-        modificationTree.write(PRESENCE_PATH, ImmutableNodes.containerNode(PRESENCE_QNAME));
+        modificationTree.write(PRESENCE_PATH,
+            ImmutableNodes.newContainerBuilder().withNodeIdentifier(new NodeIdentifier(PRESENCE_QNAME)).build());
         modificationTree.write(PRESENCE_MIN_MAX_LIST_PATH, mapNodeFooWithNodes);
         modificationTree.merge(PRESENCE_MIN_MAX_LIST_PATH, mapNodeBar);
         modificationTree.merge(PRESENCE_MIN_MAX_LIST_PATH, mapNodeBaz);
@@ -429,7 +427,7 @@ class Bug4454Test {
     void minMaxListNoMinMaxDeleteTest() throws DataValidationFailedException {
         final var fooEntryNoMinMaxNode =
                 ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME_NO_MINMAX, MIN_MAX_KEY_LEAF_QNAME, "foo");
-        final var mapNode1 = ImmutableNodes.mapNodeBuilder()
+        final var mapNode1 = ImmutableNodes.newSystemMapBuilder()
                 .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME_NO_MINMAX))
                 .withChild(fooEntryNoMinMaxNode).build();