import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntry;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-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.DataTreeConfiguration;
import org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification;
import org.opendaylight.yangtools.yang.data.tree.impl.di.InMemoryDataTreeFactory;
.node(TestModel.VALUE_QNAME)
.build();
- private static final MapEntryNode BAR_NODE = mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID)
- .withChild(mapNodeBuilder(TestModel.INNER_LIST_QNAME)
- .withChild(mapEntry(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, TWO_ONE_NAME))
- .withChild(mapEntry(TestModel.INNER_LIST_QNAME,TestModel.NAME_QNAME, TWO_TWO_NAME))
- .build())
- .build();
+ private static final MapEntryNode BAR_NODE = ImmutableNodes.newMapEntryBuilder()
+ .withNodeIdentifier(NodeIdentifierWithPredicates.of(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID))
+ .withChild(ImmutableNodes.leafNode(TestModel.ID_QNAME, TWO_ID))
+ .withChild(ImmutableNodes.newSystemMapBuilder()
+ .withNodeIdentifier(new NodeIdentifier(TestModel.INNER_LIST_QNAME))
+ .withChild(ImmutableNodes.newMapEntryBuilder()
+ .withNodeIdentifier(
+ NodeIdentifierWithPredicates.of(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, TWO_ONE_NAME))
+ .withChild(ImmutableNodes.leafNode(TestModel.NAME_QNAME, TWO_ONE_NAME))
+ .build())
+ .withChild(ImmutableNodes.newMapEntryBuilder()
+ .withNodeIdentifier(
+ NodeIdentifierWithPredicates.of(TestModel.INNER_LIST_QNAME,TestModel.NAME_QNAME, TWO_TWO_NAME))
+ .withChild(ImmutableNodes.leafNode(TestModel.NAME_QNAME, TWO_TWO_NAME))
+ .build())
+ .build())
+ .build();
private RootApplyStrategy rootOper;
* @return a test document
*/
public ContainerNode createDocumentOne() {
- return Builders.containerBuilder()
+ return ImmutableNodes.newContainerBuilder()
.withNodeIdentifier(new NodeIdentifier(SchemaContext.NAME))
.withChild(createTestContainer())
.build();
}
private static ContainerNode createTestContainer() {
- return Builders.containerBuilder()
+ return ImmutableNodes.newContainerBuilder()
.withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
- .withChild(mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
- .withChild(mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID))
+ .withChild(ImmutableNodes.newSystemMapBuilder()
+ .withNodeIdentifier(new NodeIdentifier(TestModel.OUTER_LIST_QNAME))
+ .withChild(ImmutableNodes.newMapEntryBuilder()
+ .withNodeIdentifier(
+ NodeIdentifierWithPredicates.of(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID))
+ .withChild(ImmutableNodes.leafNode(TestModel.ID_QNAME, ONE_ID))
+ .build())
.withChild(BAR_NODE).build())
.build();
}
final var modificationTree = createEmptyModificationTree();
// Writes empty container node to /test
- modificationTree.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
+ modificationTree.write(TestModel.TEST_PATH,
+ ImmutableNodes.newContainerBuilder().withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME)).build());
// Writes empty list node to /test/outer-list
- modificationTree.write(TestModel.OUTER_LIST_PATH, ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
+ modificationTree.write(TestModel.OUTER_LIST_PATH, ImmutableNodes.newSystemMapBuilder()
+ .withNodeIdentifier(new NodeIdentifier(TestModel.OUTER_LIST_QNAME))
.build());
// Reads list node from /test/outer-list.