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 Bug5968Test {
- private static final String NS = "foo";
+ private static final String NS = "bug5968";
private static final String REV = "2016-07-28";
private static final QName ROOT = QName.create(NS, REV, "root");
private static final QName MY_LIST = QName.create(NS, REV, "my-list");
private static final QName MANDATORY_LEAF = QName.create(NS, REV, "mandatory-leaf");
private static final QName COMMON_LEAF = QName.create(NS, REV, "common-leaf");
- private static SchemaContext SCHEMA_CONTEXT;
+ private static EffectiveModelContext SCHEMA_CONTEXT;
@BeforeClass
public static void beforeClass() {
- SCHEMA_CONTEXT = TestModel.createTestContext("/bug5968/foo.yang");
+ SCHEMA_CONTEXT = TestModel.createTestContext("/bug5968.yang");
}
@AfterClass
SCHEMA_CONTEXT = null;
}
- private static DataTree initDataTree(final SchemaContext schemaContext, final boolean withMapNode)
+ private static DataTree initDataTree(final EffectiveModelContext schemaContext, final boolean withMapNode)
throws DataValidationFailedException {
final DataTree inMemoryDataTree = new InMemoryDataTreeFactory().create(
DataTreeConfiguration.DEFAULT_CONFIGURATION, schemaContext);
return inMemoryDataTree;
}
- private static DataTree emptyDataTree(final SchemaContext schemaContext)
+ private static DataTree emptyDataTree(final EffectiveModelContext schemaContext)
throws DataValidationFailedException {
return new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_CONFIGURATION, schemaContext);
}
inMemoryDataTree.commit(prepare);
fail("Should fail due to missing mandatory leaf.");
} catch (final IllegalArgumentException e) {
- assertEquals(
- "Node (foo?revision=2016-07-28)my-list[{(foo?revision=2016-07-28)list-id=1}] is missing mandatory "
- + "descendant /(foo?revision=2016-07-28)mandatory-leaf", e.getMessage());
+ assertEquals("Node (bug5968?revision=2016-07-28)my-list[{(bug5968?revision=2016-07-28)list-id=1}] is "
+ + "missing mandatory descendant /(bug5968?revision=2016-07-28)mandatory-leaf", e.getMessage());
}
}
inMemoryDataTree.commit(prepare);
fail("Should fail due to missing mandatory leaf.");
} catch (final IllegalArgumentException e) {
- assertEquals(
- "Node (foo?revision=2016-07-28)my-list[{(foo?revision=2016-07-28)list-id=1}] is missing mandatory "
- + "descendant /(foo?revision=2016-07-28)mandatory-leaf", e.getMessage());
+ assertEquals("Node (bug5968?revision=2016-07-28)my-list[{(bug5968?revision=2016-07-28)list-id=1}] is "
+ + "missing mandatory descendant /(bug5968?revision=2016-07-28)mandatory-leaf", e.getMessage());
}
}
inMemoryDataTree.commit(prepare);
fail("Should fail due to missing mandatory leaf.");
} catch (final IllegalArgumentException e) {
- assertEquals(
- "Node (foo?revision=2016-07-28)my-list[{(foo?revision=2016-07-28)list-id=1}] is missing mandatory "
- + "descendant /(foo?revision=2016-07-28)mandatory-leaf", e.getMessage());
+ assertEquals("Node (bug5968?revision=2016-07-28)my-list[{(bug5968?revision=2016-07-28)list-id=1}] is "
+ + "missing mandatory descendant /(bug5968?revision=2016-07-28)mandatory-leaf", e.getMessage());
}
}
modificationTree.write(
YangInstanceIdentifier.of(ROOT).node(MY_LIST)
- .node(new NodeIdentifierWithPredicates(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue))),
+ .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue))),
taskEntryNode);
}
private static MapEntryNode createMapEntry(final Object listIdValue, final Object mandatoryLeafValue,
final Object commonLeafValue) {
return Builders.mapEntryBuilder()
- .withNodeIdentifier(new NodeIdentifierWithPredicates(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue)))
+ .withNodeIdentifier(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue)))
.withChild(ImmutableNodes.leafNode(LIST_ID, listIdValue))
.withChild(ImmutableNodes.leafNode(MANDATORY_LEAF, mandatoryLeafValue))
.withChild(ImmutableNodes.leafNode(COMMON_LEAF, commonLeafValue)).build();
private static MapEntryNode createMapEntry(final Object listIdValue, final Object commonLeafValue) {
return Builders.mapEntryBuilder()
- .withNodeIdentifier(new NodeIdentifierWithPredicates(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue)))
+ .withNodeIdentifier(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue)))
.withChild(ImmutableNodes.leafNode(LIST_ID, listIdValue))
.withChild(ImmutableNodes.leafNode(COMMON_LEAF, commonLeafValue)).build();
}