.toURI());
// foo.yang
- final Module module1 = TestUtils.findModule(context, "foo").get();
+ final Module module1 = context.findModules("foo").iterator().next();
Collection<? extends AugmentationSchemaNode> augmentations = module1.getAugmentations();
assertEquals(1, augmentations.size());
final AugmentationSchemaNode augment = augmentations.iterator().next();
assertFalse(odl.isAugmenting());
// baz.yang
- final Module module3 = TestUtils.findModule(context, "baz").get();
+ final Module module3 = context.findModules("baz").iterator().next();
augmentations = module3.getAugmentations();
assertEquals(3, augmentations.size());
AugmentationSchemaNode augment1 = null;
public void testAugmentResolving() throws Exception {
final SchemaContext context = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-augment")
.toURI());
- final Module module2 = TestUtils.findModule(context, "bar").get();
+ final Module module2 = context.findModules("bar").iterator().next();
final ContainerSchemaNode interfaces = (ContainerSchemaNode) module2.getDataChildByName(QName.create(
module2.getQNameModule(), "interfaces"));
final ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName(QName.create(
public void testAugmentedChoice() throws Exception {
final SchemaContext context = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-augment")
.toURI());
- final Module module2 = TestUtils.findModule(context, "bar").get();
+ final Module module2 = context.findModules("bar").iterator().next();
final ContainerSchemaNode interfaces = (ContainerSchemaNode) module2.getDataChildByName(QName.create(
module2.getQNameModule(), "interfaces"));
final ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName(QName.create(
final XMLNamespace NS_BAR = XMLNamespace.of("urn:opendaylight:bar");
final XMLNamespace NS_FOO = XMLNamespace.of("urn:opendaylight:foo");
final Revision revision = Revision.of("2013-10-11");
- final Module bar = TestUtils.findModule(context, "bar").get();
+ final Module bar = context.findModules("bar").iterator().next();
final Collection<? extends RpcDefinition> rpcs = bar.getRpcs();
assertEquals(2, rpcs.size());
context = TestUtils.loadModules(getClass().getResource(
"/augment-to-extension-test/correct-path-into-unsupported-target").toURI());
- final Module devicesModule = TestUtils.findModule(context, "augment-module").get();
+ final Module devicesModule = context.findModules("augment-module").iterator().next();
final ContainerSchemaNode devicesContainer = (ContainerSchemaNode) devicesModule.getDataChildByName(
QName.create(devicesModule.getQNameModule(), "my-container"));
for (final UsesNode usesNode : devicesContainer.getUses()) {
}
}
-
@Test
public void testCorrectAugment() throws Exception {
context = TestUtils.loadModules(getClass().getResource("/augment-to-extension-test/correct-augment").toURI());
- final Module devicesModule = TestUtils.findModule(context, "augment-module").get();
+ final Module devicesModule = context.findModules("augment-module").iterator().next();
final ContainerSchemaNode devicesContainer = (ContainerSchemaNode) devicesModule.getDataChildByName(QName
.create(devicesModule.getQNameModule(), "my-container"));
assertTrue(augmentationIsInContainer);
}
-
}
@Test
public void test() throws Exception {
- final Module bug1412 = TestUtils.findModule(
- TestUtils.loadModules(getClass().getResource("/bugs/bug1412").toURI()), "bug1412").get();
+ final Module bug1412 = TestUtils.loadModules(getClass().getResource("/bugs/bug1412").toURI())
+ .findModules("bug1412").iterator().next();
final ContainerSchemaNode node = (ContainerSchemaNode) bug1412.getDataChildByName(QName.create(
bug1412.getQNameModule(), "node"));
package org.opendaylight.yangtools.yang.stmt;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.Collection;
import org.junit.Test;
import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.Module;
/**
* Test ANTLR4 grammar capability to parse unknown node in extension argument
* Note: Everything under unknown node is unknown node.
*/
public class Bug1413Test {
-
@Test
public void test() throws Exception {
- final Module bug1413 = TestUtils.findModule(
- TestUtils.loadModules(getClass().getResource("/bugs/bug1413").toURI()), "bug1413").get();
- assertNotNull(bug1413);
-
- Collection<? extends ExtensionDefinition> extensions = bug1413.getExtensionSchemaNodes();
+ Collection<? extends ExtensionDefinition> extensions = TestUtils.loadModules(
+ getClass().getResource("/bugs/bug1413").toURI())
+ .findModules("bug1413").iterator().next().getExtensionSchemaNodes();
assertEquals(1, extensions.size());
ExtensionDefinition info = extensions.iterator().next();
assertEquals("text", info.getArgument());
assertTrue(info.isYinElement());
}
-
}
*/
package org.opendaylight.yangtools.yang.stmt;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.Module;
public class Bug3859Test {
@Test
public void test() throws Exception {
- final Module bug3859 = TestUtils.findModule(
- TestUtils.loadModules(getClass().getResource("/bugs/bug3859").toURI()), "reference-in-unknown").get();
- assertNotNull(bug3859);
+ assertEquals(1, TestUtils.loadModules(getClass().getResource("/bugs/bug3859").toURI())
+ .findModules("reference-in-unknown").size());
}
}
@Test
public void testParseList() throws Exception {
final SchemaContext context = TestUtils.loadModules(getClass().getResource("/bugs/bug394-retest").toURI());
- final Module bug394 = TestUtils.findModule(context, "bug394").get();
- final Module bug394_ext = TestUtils.findModule(context, "bug394-ext").get();
+ final Module bug394 = context.findModules("bug394").iterator().next();
+ final Module bug394_ext = context.findModules("bug394-ext").iterator().next();
final ContainerSchemaNode logrecords = (ContainerSchemaNode) bug394.getDataChildByName(QName.create(
bug394.getQNameModule(), "logrecords"));
@Before
public void setup() throws ReactorException, IOException, YangSyntaxErrorException, URISyntaxException {
context = TestUtils.loadModules(getClass().getResource("/model").toURI());
- foo = TestUtils.findModule(context, "foo").get();
- bar = TestUtils.findModule(context, "bar").get();
- baz = TestUtils.findModule(context, "baz").get();
+ foo = context.findModules("foo").iterator().next();
+ bar = context.findModules("bar").iterator().next();
+ baz = context.findModules("baz").iterator().next();
}
@Test
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.Optional;
-import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.YangConstants;
import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
import org.opendaylight.yangtools.yang.model.repo.api.YinTextSchemaSource;
.getModules().iterator().next();
}
- @Deprecated(forRemoval = true)
- public static Optional<? extends @NonNull Module> findModule(final SchemaContext context, final String moduleName) {
- return context.getModules().stream().filter(module -> moduleName.equals(module.getName())).findAny();
- }
-
public static ModuleImport findImport(final Collection<? extends ModuleImport> imports, final String prefix) {
for (ModuleImport moduleImport : imports) {
if (moduleImport.getPrefix().equals(prefix)) {
@Test
public void testIPVersion() {
- Module tested = TestUtils.findModule(context, "ietf-inet-types").get();
+ Module tested = context.findModules("ietf-inet-types").iterator().next();
Collection<? extends TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
assertEquals(14, typedefs.size());
@Test
public void testEnumeration() {
- Module tested = TestUtils.findModule(context, "custom-types-test").get();
+ Module tested = context.findModules("custom-types-test").iterator().next();
Collection<? extends TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
TypeDefinition<?> type = TestUtils.findTypedef(typedefs, "ip-version");
@Test
public void testIpAddress() {
- Module tested = TestUtils.findModule(context, "ietf-inet-types").get();
+ Module tested = context.findModules("ietf-inet-types").iterator().next();
Collection<? extends TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
TypeDefinition<?> type = TestUtils.findTypedef(typedefs, "ip-address");
UnionTypeDefinition baseType = (UnionTypeDefinition) type.getBaseType();
@Test
public void testDomainName() {
- Module tested = TestUtils.findModule(context, "ietf-inet-types").get();
+ Module tested = context.findModules("ietf-inet-types").iterator().next();
Collection<? extends TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
StringTypeDefinition type = (StringTypeDefinition) TestUtils.findTypedef(typedefs, "domain-name");
assertNotNull(type.getBaseType());
@Test
public void testInstanceIdentifier1() {
- Module tested = TestUtils.findModule(context, "custom-types-test").get();
+ Module tested = context.findModules("custom-types-test").iterator().next();
LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName(
QName.create(tested.getQNameModule(), "inst-id-leaf1"));
InstanceIdentifierTypeDefinition leafType = (InstanceIdentifierTypeDefinition) leaf.getType();
@Test
public void testInstanceIdentifier2() {
- Module tested = TestUtils.findModule(context, "custom-types-test").get();
+ Module tested = context.findModules("custom-types-test").iterator().next();
LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName(
QName.create(tested.getQNameModule(), "inst-id-leaf2"));
InstanceIdentifierTypeDefinition leafType = (InstanceIdentifierTypeDefinition) leaf.getType();
@Test
public void testIdentity() {
- Module tested = TestUtils.findModule(context, "custom-types-test").get();
+ Module tested = context.findModules("custom-types-test").iterator().next();
Collection<? extends IdentitySchemaNode> identities = tested.getIdentities();
assertEquals(5, identities.size());
IdentitySchemaNode cryptoAlg = null;
@Test
public void testBitsType1() {
- Module tested = TestUtils.findModule(context, "custom-types-test").get();
+ Module tested = context.findModules("custom-types-test").iterator().next();
LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName(
QName.create(tested.getQNameModule(), "mybits"));
BitsTypeDefinition leafType = (BitsTypeDefinition) leaf.getType();
@Test
public void testBitsType2() {
- Module tested = TestUtils.findModule(context, "custom-types-test").get();
+ Module tested = context.findModules("custom-types-test").iterator().next();
Collection<? extends TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "access-operations-type");
@Test
public void testIanaTimezones() {
- Module tested = TestUtils.findModule(context, "iana-timezones").get();
+ Module tested = context.findModules("iana-timezones").iterator().next();
Collection<? extends TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "iana-timezone");
@Test
public void testObjectId128() {
- Module tested = TestUtils.findModule(context, "ietf-yang-types").get();
+ Module tested = context.findModules("ietf-yang-types").iterator().next();
Collection<? extends TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
StringTypeDefinition testedType = (StringTypeDefinition) TestUtils.findTypedef(typedefs,
"object-identifier-128");
@Test
public void testIdentityref() {
- Module tested = TestUtils.findModule(context, "custom-types-test").get();
+ Module tested = context.findModules("custom-types-test").iterator().next();
Collection<? extends TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "service-type-ref");
IdentityrefTypeDefinition baseType = (IdentityrefTypeDefinition) testedType.getBaseType();
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-import java.net.URISyntaxException;
import java.util.Collection;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yangtools.yang.model.api.type.Uint8TypeDefinition;
import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
import org.opendaylight.yangtools.yang.model.ri.type.BaseTypes;
-import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
public class UsesAugmentTest {
-
private static final QNameModule UG = QNameModule.create(
XMLNamespace.of("urn:opendaylight:params:xml:ns:yang:uses-grouping"), Revision.of("2013-07-30"));
private static final QNameModule GD = QNameModule.create(
private SchemaContext context;
@Before
- public void init() throws ReactorException, IOException, YangSyntaxErrorException, URISyntaxException {
+ public void init() throws Exception {
context = TestUtils.loadModules(getClass().getResource("/grouping-test").toURI());
}
*/
@Test
public void testAugmentInUses() throws Exception {
- final Module testModule = TestUtils.findModule(context, "uses-grouping").get();
+ final Module testModule = context.findModules("uses-grouping").iterator().next();
// * notification pcreq
final Collection<? extends NotificationDefinition> notifications = testModule.getNotifications();
@Test
public void testTypedefs() throws Exception {
- final Module testModule = TestUtils.findModule(context, "grouping-definitions").get();
+ final Module testModule = context.findModules("grouping-definitions").iterator().next();
final Collection<? extends TypeDefinition<?>> types = testModule.getTypeDefinitions();
TypeDefinition<?> intExt = null;
assertNotNull(pv);
assertEquals(QName.create(GD, "union"), union.getQName());
}
-
}
// prefix differs
@Test
public void testParsingImportPrefixIdentityTestModule() throws Exception {
- Module module = TestUtils.findModule(StmtTestUtils.parseYangSources("/identity/import"),
- "prefiximportidentitytest").get();
+ Module module = StmtTestUtils.parseYangSources("/identity/import").findModules("prefiximportidentitytest")
+ .iterator().next();
Collection<? extends ModuleImport> imports = module.getImports();
assertEquals(imports.size(), 1);
ModuleImport dummy = TestUtils.findImport(imports, "dummy");
@Before
public void init() throws Exception {
context = TestUtils.loadModules(getClass().getResource("/simple-test").toURI());
- testModule = TestUtils.findModule(context, "simple-nodes").get();
+ testModule = context.findModules("simple-nodes").iterator().next();
}
@Test
@Before
public void init() throws Exception {
context = TestUtils.loadModules(getClass().getResource("/model").toURI());
- foo = TestUtils.findModule(context, "foo").get();
- bar = TestUtils.findModule(context, "bar").get();
- baz = TestUtils.findModule(context, "baz").get();
+ foo = context.findModules("foo").iterator().next();
+ bar = context.findModules("bar").iterator().next();
+ baz = context.findModules("baz").iterator().next();
}
@Test
final StatementStreamSource test2 = sourceForResource("/context-augment-test/test2.yang");
final StatementStreamSource test3 = sourceForResource("/context-augment-test/test3.yang");
- final SchemaContext context = TestUtils.parseYangSources(resource, test1, test2, test3);
- final Module t4 = TestUtils.findModule(context, "test4").get();
+ final Module t4 = TestUtils.parseYangSources(resource, test1, test2, test3).findModules("test4").iterator()
+ .next();
final ContainerSchemaNode interfaces = (ContainerSchemaNode) t4.getDataChildByName(QName.create(
t4.getQNameModule(), "interfaces"));
final ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName(QName.create(t4.getQNameModule(),
import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileAugmentStmtTest extends AbstractYinModulesTest {
-
@Test
public void testAugment() {
- final Module testModule = TestUtils.findModule(context, "main-impl").get();
+ final Module testModule = context.findModules("main-impl").iterator().next();
assertNotNull(testModule);
final Collection<? extends AugmentationSchemaNode> augmentations = testModule.getAugmentations();
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileChoiceStmtTest extends AbstractYinModulesTest {
-
@Test
public void testChoiceAndCases() {
- final Module testModule = TestUtils.findModule(context, "config").get();
+ final Module testModule = context.findModules("config").iterator().next();
assertNotNull(testModule);
final ListSchemaNode list = (ListSchemaNode) testModule.findDataChildByName(
import org.junit.Test;
import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileExtensionStmtTest extends AbstractYinModulesTest {
@Test
public void testExtensions() {
- Module testModule = TestUtils.findModule(context, "config").get();
+ Module testModule = context.findModules("config").iterator().next();
assertNotNull(testModule);
Collection<? extends ExtensionDefinition> extensions = testModule.getExtensionSchemaNodes();
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import java.io.IOException;
-import java.net.URISyntaxException;
import java.util.Collection;
import java.util.Iterator;
import org.junit.Before;
import org.opendaylight.yangtools.yang.model.api.FeatureDefinition;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.stmt.TestUtils;
-import org.xml.sax.SAXException;
public class YinFileFeatureStmtTest {
-
private SchemaContext context;
@Before
- public void init() throws ReactorException, SAXException, IOException, URISyntaxException {
+ public void init() throws Exception {
context = TestUtils.loadYinModules(getClass().getResource("/semantic-statement-parser/yin/feature-test/")
.toURI());
assertEquals(1, context.getModules().size());
@Test
public void testFeature() {
- Module testModule = TestUtils.findModule(context, "yang-with-features").get();
+ Module testModule = context.findModules("yang-with-features").iterator().next();
assertNotNull(testModule);
Collection<? extends FeatureDefinition> features = testModule.getFeatures();
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import java.net.URISyntaxException;
import java.util.Collection;
import java.util.Iterator;
import java.util.Optional;
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileGroupingStmtTest extends AbstractYinModulesTest {
-
@Test
- public void testGrouping() throws URISyntaxException {
- final Module testModule = TestUtils.findModule(context, "config").get();
+ public void testGrouping() {
+ final Module testModule = context.findModules("config").iterator().next();
assertNotNull(testModule);
final Collection<? extends GroupingDefinition> groupings = testModule.getGroupings();
import static org.junit.Assert.assertEquals;
-import java.net.URISyntaxException;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.XMLNamespace;
import org.opendaylight.yangtools.yang.common.YangVersion;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileHeaderStmtsTest extends AbstractYinModulesTest {
@Test
- public void testYinFileHeader() throws URISyntaxException {
- Module testModule = TestUtils.findModule(context, "config").get();
-
+ public void testYinFileHeader() {
+ Module testModule = context.findModules("config").iterator().next();
assertEquals(YangVersion.VERSION_1, testModule.getYangVersion());
assertEquals(XMLNamespace.of("urn:opendaylight:params:xml:ns:yang:controller:config"),
testModule.getNamespace());
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import java.net.URISyntaxException;
import java.util.Collection;
import java.util.Iterator;
import org.junit.Test;
import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileIdentityStmtTest extends AbstractYinModulesTest {
-
@Test
- public void testIdentity() throws URISyntaxException {
- Module testModule = TestUtils.findModule(context, "config").get();
+ public void testIdentity() {
+ Module testModule = context.findModules("config").iterator().next();
assertNotNull(testModule);
Collection<? extends IdentitySchemaNode> identities = testModule.getIdentities();
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import java.text.ParseException;
import java.util.Collection;
import java.util.Iterator;
import org.junit.Test;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileImportStmtTest extends AbstractYinModulesTest {
@Test
- public void testImport() throws ParseException {
- Module testModule = TestUtils.findModule(context, "ietf-netconf-monitoring").get();
+ public void testImport() {
+ Module testModule = context.findModules("ietf-netconf-monitoring").iterator().next();
assertNotNull(testModule);
Collection<? extends ModuleImport> imports = testModule.getImports();
package org.opendaylight.yangtools.yang.stmt.yin;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Iterator;
-import org.junit.Before;
+import java.util.Collection;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.XMLNamespace;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.Submodule;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.stmt.TestUtils;
-import org.xml.sax.SAXException;
public class YinFileIncludeStmtTest {
- private SchemaContext context;
-
- @Before
- public void init() throws URISyntaxException, ReactorException, SAXException, IOException {
- context = TestUtils.loadYinModules(getClass().getResource(
- "/semantic-statement-parser/yin/include-belongs-to-test").toURI());
- assertEquals(1, context.getModules().size());
- }
-
@Test
- public void testInclude() throws URISyntaxException {
- Module parentModule = TestUtils.findModule(context, "parent").get();
- assertNotNull(parentModule);
-
- assertEquals(1, parentModule.getSubmodules().size());
- Iterator<? extends Submodule> submodulesIterator = parentModule.getSubmodules().iterator();
+ public void testInclude() throws Exception {
+ Collection<? extends Submodule> submodules = TestUtils.loadYinModules(getClass().getResource(
+ "/semantic-statement-parser/yin/include-belongs-to-test").toURI()).findModules("parent").iterator().next()
+ .getSubmodules();
+ assertEquals(1, submodules.size());
- Submodule childModule = submodulesIterator.next() ;
- assertNotNull(childModule);
+ Submodule childModule = submodules.iterator().next();
assertEquals("child", childModule.getName());
assertEquals(XMLNamespace.of("urn:opendaylight/parent"), childModule.getNamespace());
}
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileLeafListStmtTest extends AbstractYinModulesTest {
-
@Test
public void testLeafList() {
- final Module testModule = TestUtils.findModule(context, "ietf-netconf-monitoring").get();
+ final Module testModule = context.findModules("ietf-netconf-monitoring").iterator().next();
final LeafListSchemaNode leafList = (LeafListSchemaNode) testModule.findDataChildByName(
QName.create(testModule.getQNameModule(), "netconf-state"),
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
import org.opendaylight.yangtools.yang.model.ri.type.BaseTypes;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileListStmtTest extends AbstractYinModulesTest {
@Test
public void testListAndLeaves() {
- final Module testModule = TestUtils.findModule(context, "config").get();
+ final Module testModule = context.findModules("config").iterator().next();
assertNotNull(testModule);
final ListSchemaNode list = (ListSchemaNode) testModule.findDataChildByName(QName.create(
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import java.net.URISyntaxException;
import java.util.Optional;
import org.junit.Test;
import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileMetaStmtsTest extends AbstractYinModulesTest {
-
@Test
- public void testMetaStatements() throws URISyntaxException {
- Module testModule = TestUtils.findModule(context, "ietf-netconf-monitoring").get();
+ public void testMetaStatements() {
+ Module testModule = context.findModules("ietf-netconf-monitoring").iterator().next();
assertNotNull(testModule);
assertEquals(Optional.of("IETF NETCONF (Network Configuration) Working Group"), testModule.getOrganization());
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.OutputSchemaNode;
import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileRpcStmtTest extends AbstractYinModulesTest {
-
@Test
public void testRpc() {
- Module testModule = TestUtils.findModule(context, "ietf-netconf-monitoring").get();
+ Module testModule = context.findModules("ietf-netconf-monitoring").iterator().next();
Collection<? extends RpcDefinition> rpcs = testModule.getRpcs();
assertEquals(1, rpcs.size());
import org.junit.Test;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileTypeDefStmtTest extends AbstractYinModulesTest {
@Test
public void testTypedef() {
- Module testModule = TestUtils.findModule(context, "config").get();
+ Module testModule = context.findModules("config").iterator().next();
assertNotNull(testModule);
Collection<? extends TypeDefinition<?>> typeDefs = testModule.getTypeDefinitions();
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.UsesNode;
-import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileUsesStmtTest extends AbstractYinModulesTest {
@Test
public void testUses() {
- final Module testModule = TestUtils.findModule(context, "main-impl").get();
+ final Module testModule = context.findModules("main-impl").iterator().next();
final Collection<? extends AugmentationSchemaNode> augmentations = testModule.getAugmentations();
assertEquals(1, augmentations.size());