X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-data-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fdata%2Fimpl%2Fschema%2Ftree%2FBug5968Test.java;h=dfc5a42e04d7e3e09b27513413e39b2b82f00738;hb=9041b2200d7c48962615f414ed884cb54a7573df;hp=a544eab0b3badba73a9167b17f08eb2522dcccfa;hpb=300edc1d6d200c612eb76281ad573d035529bb3e;p=yangtools.git diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug5968Test.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug5968Test.java index a544eab0b3..dfc5a42e04 100644 --- a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug5968Test.java +++ b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug5968Test.java @@ -29,10 +29,10 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailed 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"); @@ -40,11 +40,11 @@ public class Bug5968Test { 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 @@ -52,7 +52,7 @@ public class Bug5968Test { 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); @@ -74,7 +74,7 @@ public class Bug5968Test { 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); } @@ -97,9 +97,8 @@ public class Bug5968Test { 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()); } } @@ -116,9 +115,8 @@ public class Bug5968Test { 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()); } } @@ -136,9 +134,8 @@ public class Bug5968Test { 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()); } } @@ -163,14 +160,14 @@ public class Bug5968Test { 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(); @@ -178,7 +175,7 @@ public class Bug5968Test { 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(); }