Introduce WhenConditionAware
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / AugmentTest.java
index 8a72983dbd6f28377d32912e03ffc4daa14b698f..300111b7a879241c66df7344f1dba28e5f3f78a3 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.common.YangConstants;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
 import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
@@ -39,11 +39,11 @@ import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeUtils;
 
 public class AugmentTest {
     private static final QNameModule FOO = QNameModule.create(
-        URI.create("urn:opendaylight.foo"), Revision.valueOf("2013-10-13"));
+        URI.create("urn:opendaylight.foo"), Revision.of("2013-10-13"));
     private static final QNameModule BAR = QNameModule.create(
-        URI.create("urn:opendaylight.bar"), Revision.valueOf("2013-10-14"));
+        URI.create("urn:opendaylight.bar"), Revision.of("2013-10-14"));
     private static final QNameModule BAZ = QNameModule.create(
-        URI.create("urn:opendaylight.baz"), Revision.valueOf("2013-10-15"));
+        URI.create("urn:opendaylight.baz"), Revision.of("2013-10-15"));
 
     private static final QName Q0 = QName.create(BAR, "interfaces");
     private static final QName Q1 = QName.create(BAR, "ifEntry");
@@ -60,9 +60,9 @@ public class AugmentTest {
 
         // foo.yang
         final Module module1 = TestUtils.findModule(context, "foo").get();
-        Set<AugmentationSchema> augmentations = module1.getAugmentations();
+        Set<AugmentationSchemaNode> augmentations = module1.getAugmentations();
         assertEquals(1, augmentations.size());
-        final AugmentationSchema augment = augmentations.iterator().next();
+        final AugmentationSchemaNode augment = augmentations.iterator().next();
         assertNotNull(augment);
 
         SchemaPath expectedSchemaPath = SchemaPath.create(qnames, true);
@@ -129,15 +129,15 @@ public class AugmentTest {
         final Module module3 = TestUtils.findModule(context, "baz").get();
         augmentations = module3.getAugmentations();
         assertEquals(3, augmentations.size());
-        AugmentationSchema augment1 = null;
-        AugmentationSchema augment2 = null;
-        AugmentationSchema augment3 = null;
-        for (final AugmentationSchema as : augmentations) {
-            if (as.getWhenCondition() == null) {
+        AugmentationSchemaNode augment1 = null;
+        AugmentationSchemaNode augment2 = null;
+        AugmentationSchemaNode augment3 = null;
+        for (final AugmentationSchemaNode as : augmentations) {
+            if (!as.getWhenCondition().isPresent()) {
                 augment3 = as;
-            } else if ("if:ifType='ds0'".equals(as.getWhenCondition().toString())) {
+            } else if ("if:ifType='ds0'".equals(as.getWhenCondition().get().toString())) {
                 augment1 = as;
-            } else if ("if:ifType='ds2'".equals(as.getWhenCondition().toString())) {
+            } else if ("if:ifType='ds2'".equals(as.getWhenCondition().get().toString())) {
                 augment2 = as;
             }
         }
@@ -331,7 +331,7 @@ public class AugmentTest {
         final SchemaContext context = TestUtils.loadModules(getClass().getResource("/augment-test/rpc").toURI());
         final URI NS_BAR = URI.create("urn:opendaylight:bar");
         final URI NS_FOO = URI.create("urn:opendaylight:foo");
-        final Revision revision = Revision.valueOf("2013-10-11");
+        final Revision revision = Revision.of("2013-10-11");
         final Module bar = TestUtils.findModule(context, "bar").get();
         final Set<RpcDefinition> rpcs = bar.getRpcs();
         assertEquals(2, rpcs.size());
@@ -420,7 +420,7 @@ public class AugmentTest {
                 "nodes"));
         final ContainerSchemaNode node = (ContainerSchemaNode) nodes.getDataChildByName(QName.create(
                 test.getQNameModule(), "node"));
-        final Set<AugmentationSchema> augments = node.getAvailableAugmentations();
+        final Set<AugmentationSchemaNode> augments = node.getAvailableAugmentations();
         assertEquals(1, augments.size());
         assertEquals(1, node.getChildNodes().size());
         final LeafSchemaNode id = (LeafSchemaNode) node.getDataChildByName(QName.create(test.getQNameModule(), "id"));