Java Code Examples for org.opendaylight.yangtools.yang.model.api.Module#getFeatures()
The following examples show how to use
org.opendaylight.yangtools.yang.model.api.Module#getFeatures() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: YinFileFeatureStmtTest.java From yangtools with Eclipse Public License 1.0 | 6 votes |
@Test public void testFeature() { Module testModule = TestUtils.findModule(context, "yang-with-features").get(); assertNotNull(testModule); Collection<? extends FeatureDefinition> features = testModule.getFeatures(); assertEquals(2, features.size()); Iterator<? extends FeatureDefinition> featuresIterator = features.iterator(); FeatureDefinition feature = featuresIterator.next(); assertThat(feature.getQName().getLocalName(), anyOf(is("arbitrary-names"), is("pre-provisioning"))); feature = featuresIterator.next(); assertThat(feature.getQName().getLocalName(), anyOf(is("arbitrary-names"), is("pre-provisioning"))); }
Example 2
Source File: IncludedStmtsTest.java From yangtools with Eclipse Public License 1.0 | 5 votes |
@Test public void includedFeaturesTest() { final Module testModule = result.findModules("root-module").iterator().next(); assertNotNull(testModule); final Collection<? extends FeatureDefinition> features = testModule.getFeatures(); assertEquals(2, features.size()); final Iterator<? extends FeatureDefinition> featuresIterator = features.iterator(); FeatureDefinition feature = featuresIterator.next(); assertThat(feature.getQName().getLocalName(), anyOf(is("new-feature1"), is("new-feature2"))); feature = featuresIterator.next(); assertThat(feature.getQName().getLocalName(), anyOf(is("new-feature1"), is("new-feature2"))); }
Example 3
Source File: EffectiveModuleTest.java From yangtools with Eclipse Public License 1.0 | 4 votes |
@Test public void effectiveBuildTest() throws SourceException, ReactorException { SchemaContext result = RFC7950Reactors.defaultReactor().newBuild() .addSources(ROOT_MODULE, IMPORTED_MODULE, SUBMODULE) .buildEffective(); assertNotNull(result); Module rootModule = result.findModules("root").iterator().next(); assertNotNull(rootModule); assertEquals("root-pref", rootModule.getPrefix()); assertEquals(YangVersion.VERSION_1, rootModule.getYangVersion()); assertEquals(Optional.of("cisco"), rootModule.getOrganization()); assertEquals(Optional.of("cisco email"), rootModule.getContact()); final ContainerSchemaNode contSchemaNode = (ContainerSchemaNode) rootModule.getDataChildByName(CONT); assertNotNull(contSchemaNode); final Collection<? extends AugmentationSchemaNode> augmentations = rootModule.getAugmentations(); assertEquals(1, augmentations.size()); assertEquals(Absolute.of(CONT), augmentations.iterator().next().getTargetPath()); final Collection<? extends ModuleImport> imports = rootModule.getImports(); assertEquals(1, imports.size()); final ModuleImport importStmt = imports.iterator().next(); assertNotNull(importStmt); assertEquals("imported", importStmt.getModuleName()); assertEquals(Optional.of(REVISION), importStmt.getRevision()); assertEquals("imp-pref", importStmt.getPrefix()); final Collection<? extends Module> submodules = rootModule.getSubmodules(); assertEquals(1, submodules.size()); assertEquals("submod", submodules.iterator().next().getName()); final Collection<? extends NotificationDefinition> notifications = rootModule.getNotifications(); assertEquals(1, notifications.size()); assertEquals("notif1", notifications.iterator().next().getQName().getLocalName()); final Collection<? extends RpcDefinition> rpcs = rootModule.getRpcs(); assertEquals(1, rpcs.size()); assertEquals("rpc1", rpcs.iterator().next().getQName().getLocalName()); final Collection<? extends Deviation> deviations = rootModule.getDeviations(); assertEquals(1, deviations.size()); final Deviation deviationStmt = deviations.iterator().next(); assertNotNull(deviationStmt); final QNameModule importedModuleQName = QNameModule.create(URI.create("imported"), REVISION); final QName importedContQName = QName.create(importedModuleQName, "cont"); assertEquals(Absolute.of(importedContQName), deviationStmt.getTargetPath()); assertEquals(DeviateKind.ADD, deviationStmt.getDeviates().iterator().next().getDeviateType()); assertEquals(Optional.of("deviate reference"), deviationStmt.getReference()); final Collection<? extends IdentitySchemaNode> identities = rootModule.getIdentities(); assertEquals(1, identities.size()); assertEquals("identity1", identities.iterator().next().getQName().getLocalName()); final Collection<? extends FeatureDefinition> features = rootModule.getFeatures(); assertEquals(1, features.size()); final FeatureDefinition featureStmt = features.iterator().next(); assertNotNull(featureStmt); assertEquals(FEATURE1, featureStmt.getQName()); assertEquals(FEATURE1_SCHEMA_PATH, featureStmt.getPath()); assertEquals(Optional.of("feature1 description"), featureStmt.getDescription()); assertEquals(Optional.of("feature1 reference"), featureStmt.getReference()); assertEquals(Status.CURRENT, featureStmt.getStatus()); final Collection<? extends ExtensionDefinition> extensionSchemaNodes = rootModule.getExtensionSchemaNodes(); assertEquals(1, extensionSchemaNodes.size()); assertEquals("ext1", extensionSchemaNodes.iterator().next().getQName().getLocalName()); }