import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource;
import com.google.common.collect.ImmutableSet;
-import java.util.Optional;
import java.util.Set;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
@Test
public void testSomeFeaturesSupported() throws ReactorException {
final Set<QName> supportedFeatures = ImmutableSet.of(
- QName.create("foo-namespace", "1970-01-01", "test-feature-1"),
- QName.create("foo-namespace", "1970-01-01", "test-feature-2"),
- QName.create("foo-namespace", "1970-01-01", "test-feature-3"),
- QName.create("bar-namespace", "1970-01-01", "imp-feature"));
+ QName.create("foo-namespace", "test-feature-1"),
+ QName.create("foo-namespace", "test-feature-2"),
+ QName.create("foo-namespace", "test-feature-3"),
+ QName.create("bar-namespace", "imp-feature"));
- final CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild(
- Optional.of(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);
- assertNotNull(testModule);
-
+ final Module testModule = schemaContext.findModule("foo", null).get();
assertEquals(9, testModule.getChildNodes().size());
final ContainerSchemaNode testContainerA = (ContainerSchemaNode) testModule.getDataChildByName(
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());
@Test
public void testNoFeaturesSupported() throws ReactorException {
- final CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild(
- Optional.of(ImmutableSet.of()));
+ 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());