Add DataSchemaNode.effectiveConfig()
[yangtools.git] / yang / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / EffectiveSchemaContextTest.java
index f80e6dd7ffbe37797e065a7cf8053581f1bc2b91..ff484c63f9b9a6d60c9179822c1cefdcb9021c79 100644 (file)
@@ -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,6 +18,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.text.ParseException;
 import java.util.Collection;
+import java.util.Optional;
 import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -33,26 +33,20 @@ 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 Collection<? extends DataSchemaNode> dataDefinitions = schemaContext.getDataDefinitions();
@@ -80,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());