X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-rfc7950%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fstmt%2FEffectiveSchemaContextTest.java;h=ff484c63f9b9a6d60c9179822c1cefdcb9021c79;hb=1e9cce8bcaaffeecede6dd676c69265650ecdcab;hp=70fb76b8e8268ef4682f2e58c55f4f1646d3231b;hpb=19efe56f8f20f5692a100e765a581fbc8f0b4aca;p=yangtools.git diff --git a/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveSchemaContextTest.java b/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveSchemaContextTest.java index 70fb76b8e8..ff484c63f9 100644 --- a/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveSchemaContextTest.java +++ b/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveSchemaContextTest.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.yangtools.yang.stmt; import static org.junit.Assert.assertEquals; @@ -19,7 +18,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.text.ParseException; import java.util.Collection; -import java.util.List; +import java.util.Optional; import java.util.Set; import org.junit.Test; import org.opendaylight.yangtools.yang.common.QName; @@ -34,44 +33,38 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException; -import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; import org.opendaylight.yangtools.yang.model.util.SimpleSchemaContext; import org.opendaylight.yangtools.yang.parser.rfc7950.reactor.RFC7950Reactors; -import org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource; import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveSchemaContext; public class EffectiveSchemaContextTest { - @Test public void testEffectiveSchemaContext() throws ReactorException, ParseException, URISyntaxException, IOException, YangSyntaxErrorException { final EffectiveSchemaContext schemaContext = RFC7950Reactors.defaultReactor().newBuild() - .addSource(YangStatementStreamSource.create(YangTextSchemaSource.forResource( - "/effective-schema-context-test/foo.yang"))) - .addSource(YangStatementStreamSource.create(YangTextSchemaSource.forResource( - "/effective-schema-context-test/bar.yang"))) - .addSource(YangStatementStreamSource.create(YangTextSchemaSource.forResource( - "/effective-schema-context-test/baz.yang"))) - .buildEffective(); + .addSource(StmtTestUtils.sourceForResource("/effective-schema-context-test/foo.yang")) + .addSource(StmtTestUtils.sourceForResource("/effective-schema-context-test/bar.yang")) + .addSource(StmtTestUtils.sourceForResource("/effective-schema-context-test/baz.yang")) + .buildEffective(); assertNotNull(schemaContext); - final Set dataDefinitions = schemaContext.getDataDefinitions(); + final Collection dataDefinitions = schemaContext.getDataDefinitions(); assertEquals(3, dataDefinitions.size()); - final Collection childNodes = schemaContext.getChildNodes(); + final Collection childNodes = schemaContext.getChildNodes(); assertEquals(3, childNodes.size()); - final Set notifications = schemaContext.getNotifications(); + final Collection notifications = schemaContext.getNotifications(); assertEquals(3, notifications.size()); - final Set rpcs = schemaContext.getOperations(); + final Collection rpcs = schemaContext.getOperations(); assertEquals(3, rpcs.size()); - final Set extensions = schemaContext.getExtensions(); + final Collection extensions = schemaContext.getExtensions(); assertEquals(3, extensions.size()); - final List unknownSchemaNodes = schemaContext.getUnknownSchemaNodes(); + final Collection unknownSchemaNodes = schemaContext.getUnknownSchemaNodes(); assertEquals(3, unknownSchemaNodes.size()); assertNull(schemaContext.getDataChildByName(QName.create("foo-namespace", "2016-09-21", "foo-cont"))); @@ -81,8 +74,7 @@ public class EffectiveSchemaContextTest { assertFalse(schemaContext.isAugmenting()); assertFalse(schemaContext.isAddedByUses()); - assertFalse(schemaContext.isConfiguration()); - assertFalse(schemaContext.isPresenceContainer()); + assertEquals(Optional.empty(), schemaContext.effectiveConfig()); assertFalse(schemaContext.getWhenCondition().isPresent()); assertEquals(0, schemaContext.getMustConstraints().size()); assertFalse(schemaContext.getDescription().isPresent());