import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.SystemMapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
public class Bug5830Test {
private static final String NS = "foo";
private static final QName PRESENCE_CONTAINER_2 = QName.create(NS, REV, "presence-container-2");
private static final QName MANDATORY_LEAF_2 = QName.create(NS, REV, "mandatory-leaf-2");
- private static DataTree initDataTree(final SchemaContext schemaContext)
+ private static DataTree initDataTree(final EffectiveModelContext schemaContext)
throws DataValidationFailedException {
DataTree inMemoryDataTree = new InMemoryDataTreeFactory().create(
DataTreeConfiguration.DEFAULT_CONFIGURATION, schemaContext);
- final MapNode taskNode = Builders.mapBuilder().withNodeIdentifier(new NodeIdentifier(TASK)).build();
+ final SystemMapNode taskNode = Builders.mapBuilder().withNodeIdentifier(new NodeIdentifier(TASK)).build();
final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
modificationTree.write(YangInstanceIdentifier.of(TASK_CONTAINER).node(TASK), taskNode);
modificationTree.ready();
}
private static void testPresenceContainer() throws DataValidationFailedException {
- final SchemaContext schemaContext = TestModel.createTestContext("/bug5830/foo-presence.yang");
+ final EffectiveModelContext schemaContext = TestModel.createTestContext("/bug-5830/foo-presence.yang");
assertNotNull("Schema context must not be null.", schemaContext);
testContainerIsNotPresent(schemaContext);
}
private static void testNonPresenceContainer() throws DataValidationFailedException {
- final SchemaContext schemaContext = TestModel.createTestContext("/bug5830/foo-non-presence.yang");
+ final EffectiveModelContext schemaContext = TestModel.createTestContext("/bug-5830/foo-non-presence.yang");
assertNotNull("Schema context must not be null.", schemaContext);
try {
}
private static void testMultipleContainers() throws DataValidationFailedException {
- final SchemaContext schemaContext = TestModel.createTestContext("/bug5830/foo-multiple.yang");
+ final EffectiveModelContext schemaContext = TestModel.createTestContext("/bug-5830/foo-multiple.yang");
assertNotNull("Schema context must not be null.", schemaContext);
testContainerIsNotPresent(schemaContext);
}
}
- private static void testContainerIsNotPresent(final SchemaContext schemaContext)
+ private static void testContainerIsNotPresent(final EffectiveModelContext schemaContext)
throws DataValidationFailedException {
final DataTree inMemoryDataTree = initDataTree(schemaContext);
final MapEntryNode taskEntryNode = Builders.mapEntryBuilder()
inMemoryDataTree.commit(prepare);
}
- private static void testContainerIsPresent(final SchemaContext schemaContext) throws DataValidationFailedException {
+ private static void testContainerIsPresent(final EffectiveModelContext schemaContext)
+ throws DataValidationFailedException {
final DataTree inMemoryDataTree = initDataTree(schemaContext);
final MapEntryNode taskEntryNode = Builders.mapEntryBuilder()
inMemoryDataTree.commit(prepare);
}
- private static void testMandatoryDataLeafIsPresent(final SchemaContext schemaContext)
+ private static void testMandatoryDataLeafIsPresent(final EffectiveModelContext schemaContext)
throws DataValidationFailedException {
final DataTree inMemoryDataTree = initDataTree(schemaContext);
inMemoryDataTree.commit(prepare);
}
- private static void testMandatoryLeaf2IsPresent(final SchemaContext schemaContext,
+ private static void testMandatoryLeaf2IsPresent(final EffectiveModelContext schemaContext,
final boolean withPresenceContianer) throws DataValidationFailedException {
final DataTree inMemoryDataTree = initDataTree(schemaContext);
inMemoryDataTree.commit(prepare);
}
- private static DataContainerChild<?, ?> createTaskDataContainer(final boolean withMandatoryNode) {
+ private static DataContainerChild createTaskDataContainer(final boolean withMandatoryNode) {
DataContainerNodeBuilder<NodeIdentifier, ContainerNode> taskDataBuilder = Builders.containerBuilder()
.withNodeIdentifier(new NodeIdentifier(TASK_DATA))
.withChild(ImmutableNodes.leafNode(OTHER_DATA, "foo"));
return taskDataBuilder.build();
}
- private static DataContainerChild<?, ?> createTaskDataMultipleContainer(final boolean withPresenceContianer) {
+ private static DataContainerChild createTaskDataMultipleContainer(final boolean withPresenceContianer) {
DataContainerNodeBuilder<NodeIdentifier, ContainerNode> nonPresenceContainerBuilder = Builders
.containerBuilder()
.withNodeIdentifier(new NodeIdentifier(NON_PRESENCE_CONTAINER))