Migrate getDataChildByName() users
[yangtools.git] / yang / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / EffectiveSchemaContextTest.java
index 70766bf24b3e2388b3a39bb9e1a77b4946cbdd4f..73080218fb77d70dee16cc6b799fcdf0f72821b1 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,7 +18,6 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.text.ParseException;
 import java.util.Collection;
-import java.util.List;
 import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -34,47 +32,41 @@ 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<DataSchemaNode> dataDefinitions = schemaContext.getDataDefinitions();
+        final Collection<? extends DataSchemaNode> dataDefinitions = schemaContext.getDataDefinitions();
         assertEquals(3, dataDefinitions.size());
 
-        final Collection<DataSchemaNode> childNodes = schemaContext.getChildNodes();
+        final Collection<? extends DataSchemaNode> childNodes = schemaContext.getChildNodes();
         assertEquals(3, childNodes.size());
 
-        final Set<NotificationDefinition> notifications = schemaContext.getNotifications();
+        final Collection<? extends NotificationDefinition> notifications = schemaContext.getNotifications();
         assertEquals(3, notifications.size());
 
-        final Set<RpcDefinition> rpcs = schemaContext.getOperations();
+        final Collection<? extends RpcDefinition> rpcs = schemaContext.getOperations();
         assertEquals(3, rpcs.size());
 
-        final Set<ExtensionDefinition> extensions = schemaContext.getExtensions();
+        final Collection<? extends ExtensionDefinition> extensions = schemaContext.getExtensions();
         assertEquals(3, extensions.size());
 
-        final List<UnknownSchemaNode> unknownSchemaNodes = schemaContext.getUnknownSchemaNodes();
+        final Collection<? extends UnknownSchemaNode> unknownSchemaNodes = schemaContext.getUnknownSchemaNodes();
         assertEquals(3, unknownSchemaNodes.size());
 
-        assertNull(schemaContext.getDataChildByName(QName.create("foo-namespace", "2016-09-21", "foo-cont")));
+        assertNull(schemaContext.dataChildByName(QName.create("foo-namespace", "2016-09-21", "foo-cont")));
 
         assertFalse(schemaContext.findModule("foo", Revision.of("2016-08-21")).isPresent());
         assertFalse(schemaContext.findModule(URI.create("foo-namespace"), Revision.of("2016-08-21")).isPresent());
@@ -82,7 +74,6 @@ public class EffectiveSchemaContextTest {
         assertFalse(schemaContext.isAugmenting());
         assertFalse(schemaContext.isAddedByUses());
         assertFalse(schemaContext.isConfiguration());
-        assertFalse(schemaContext.isPresenceContainer());
         assertFalse(schemaContext.getWhenCondition().isPresent());
         assertEquals(0, schemaContext.getMustConstraints().size());
         assertFalse(schemaContext.getDescription().isPresent());
@@ -98,7 +89,7 @@ public class EffectiveSchemaContextTest {
         Module fooModule = schemaContext.findModule("foo", Revision.of("2016-09-21")).get();
         assertEquals(3, schemaContext.getModules().size());
         assertEquals(3, schemaContext.getRootDeclaredStatements().size());
-        assertEquals(3, schemaContext.getRootEffectiveStatements().size());
+        assertEquals(3, schemaContext.getModuleStatements().size());
 
         final Set<Module> modules = schemaContext.getModules();
         final SchemaContext copiedSchemaContext =  SimpleSchemaContext.forModules(modules);