X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fstmt%2FIfFeatureResolutionTest.java;h=a4c6cc1e5d8cfa3cfe7d3324d7678ae781e32d6e;hb=ae76efb1486909a2a57102a23b4d0fc7efee95a0;hp=5a2a5f9d0e07760909e7ce47099f93a7852eda73;hpb=d9f80c396ec9947316be896a0a0489069fa35b7d;p=yangtools.git diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IfFeatureResolutionTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IfFeatureResolutionTest.java index 5a2a5f9d0e..a4c6cc1e5d 100644 --- a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IfFeatureResolutionTest.java +++ b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IfFeatureResolutionTest.java @@ -11,6 +11,7 @@ package org.opendaylight.yangtools.yang.stmt; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource; import com.google.common.collect.ImmutableSet; import java.util.Set; @@ -25,14 +26,11 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource; import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor; import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline; -import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl; public class IfFeatureResolutionTest { - private static final StatementStreamSource FOO_MODULE = - new YangStatementSourceImpl("/if-feature-resolution-test/foo.yang", false); - private static final StatementStreamSource BAR_MODULE = - new YangStatementSourceImpl("/if-feature-resolution-test/bar.yang", false); + private static final StatementStreamSource FOO_MODULE = sourceForResource("/if-feature-resolution-test/foo.yang"); + private static final StatementStreamSource BAR_MODULE = sourceForResource("/if-feature-resolution-test/bar.yang"); @Test public void testSomeFeaturesSupported() throws ReactorException { @@ -42,13 +40,14 @@ public class IfFeatureResolutionTest { QName.create("foo-namespace", "1970-01-01", "test-feature-3"), QName.create("bar-namespace", "1970-01-01", "imp-feature")); - final CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild(supportedFeatures); + final CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild(); reactor.addSources(FOO_MODULE, BAR_MODULE); + reactor.setSupportedFeatures(supportedFeatures); final SchemaContext schemaContext = reactor.buildEffective(); assertNotNull(schemaContext); - final Module testModule = schemaContext.findModuleByName("foo", null); + final Module testModule = schemaContext.findModules("foo").iterator().next(); assertNotNull(testModule); assertEquals(9, testModule.getChildNodes().size()); @@ -154,7 +153,7 @@ public class IfFeatureResolutionTest { final SchemaContext schemaContext = reactor.buildEffective(); assertNotNull(schemaContext); - final Module testModule = schemaContext.findModuleByName("foo", null); + final Module testModule = schemaContext.findModules("foo").iterator().next(); assertNotNull(testModule); assertEquals(11, testModule.getChildNodes().size()); @@ -275,15 +274,14 @@ public class IfFeatureResolutionTest { @Test public void testNoFeaturesSupported() throws ReactorException { - final Set supportedFeatures = ImmutableSet.of(); - - final CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild(supportedFeatures); + final CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild(); reactor.addSources(FOO_MODULE, BAR_MODULE); + reactor.setSupportedFeatures(ImmutableSet.of()); final SchemaContext schemaContext = reactor.buildEffective(); assertNotNull(schemaContext); - final Module testModule = schemaContext.findModuleByName("foo", null); + final Module testModule = schemaContext.findModules("foo").iterator().next(); assertNotNull(testModule); assertEquals(6, testModule.getChildNodes().size());