当前位置: 首页>>代码示例>>Java>>正文


Java Module.getDeviations方法代码示例

本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.Module.getDeviations方法的典型用法代码示例。如果您正苦于以下问题:Java Module.getDeviations方法的具体用法?Java Module.getDeviations怎么用?Java Module.getDeviations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.yangtools.yang.model.api.Module的用法示例。


在下文中一共展示了Module.getDeviations方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: emitBodyNodes

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private void emitBodyNodes(final Module input) {

            for (final ExtensionDefinition extension : input.getExtensionSchemaNodes()) {
                emitExtension(extension);
            }
            for (final FeatureDefinition definition : input.getFeatures()) {
                emitFeature(definition);
            }
            for (final IdentitySchemaNode identity : input.getIdentities()) {
                emitIdentity(identity);
            }
            for (final Deviation deviation : input.getDeviations()) {
                emitDeviation(deviation);
            }

            emitDataNodeContainer(input);

            for (final AugmentationSchemaNode augmentation : input.getAugmentations()) {
                emitAugment(augmentation);
            }
            for (final RpcDefinition rpc : input.getRpcs()) {
                emitRpc(rpc);
            }

            emitNotifications(input.getNotifications());
        }
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:27,代码来源:SchemaContextEmitter.java

示例2: testDeviation

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testDeviation() throws ReactorException {
    final SchemaContext context = RFC7950Reactors.defaultReactor().newBuild()
            .addSource(sourceForResource("/model/bar.yang"))
            .addSource(sourceForResource("/context-test/deviation-test.yang"))
            .buildEffective();

    final Module testModule = context.findModule("deviation-test", Revision.of("2013-02-27")).get();
    final Set<Deviation> deviations = testModule.getDeviations();
    assertEquals(1, deviations.size());
    final Deviation dev = deviations.iterator().next();

    assertEquals(Optional.of("system/user ref"), dev.getReference());

    final URI expectedNS = URI.create("urn:opendaylight.bar");
    final Revision expectedRev = Revision.of("2013-07-03");
    final List<QName> path = new ArrayList<>();
    path.add(QName.create(expectedNS, expectedRev, "interfaces"));
    path.add(QName.create(expectedNS, expectedRev, "ifEntry"));
    final SchemaPath expectedPath = SchemaPath.create(path, true);

    assertEquals(expectedPath, dev.getTargetPath());
    assertEquals(DeviateKind.ADD, dev.getDeviates().iterator().next().getDeviateType());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:25,代码来源:YangParserWithContextTest.java

示例3: testRestrictedTypeParentSchemaPathInDeviate

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testRestrictedTypeParentSchemaPathInDeviate() throws Exception {
    final SchemaContext schemaContext = StmtTestUtils.parseYangSources("/bugs/bug7440");
    assertNotNull(schemaContext);

    final Revision revision = Revision.of("2016-12-23");
    final Module foo = schemaContext.findModule("foo", revision).get();
    final Module bar = schemaContext.findModule("bar", revision).get();

    final Set<Deviation> deviations = foo.getDeviations();
    assertEquals(1, deviations.size());
    final Deviation deviation = deviations.iterator().next();

    final List<DeviateDefinition> deviates = deviation.getDeviates();
    assertEquals(1, deviates.size());
    final DeviateDefinition deviateReplace = deviates.iterator().next();

    final SchemaPath deviatedTypePath = SchemaPath.create(true, QName.create(bar.getQNameModule(), "test-leaf"),
            QName.create(bar.getQNameModule(), "uint32"));

    final TypeDefinition<?> deviatedType = deviateReplace.getDeviatedType();
    assertEquals(deviatedTypePath, deviatedType.getPath());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:24,代码来源:Bug7440Test.java

示例4: testDeviateReplaceWithUserDefinedTypes

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testDeviateReplaceWithUserDefinedTypes() throws Exception {
    final SchemaContext schemaContext = StmtTestUtils.parseYangSources("/bugs/bug9242/");
    assertNotNull(schemaContext);

    final Revision revision = Revision.of("2017-10-13");
    final Module rootModule = schemaContext.findModule("root-module", revision).get();
    final Module impModule = schemaContext.findModule("imp-module", revision).get();

    TypeDefinition<?> deviatedMyLeafType = null;
    TypeDefinition<?> deviatedMyLeaf2Type = null;

    for (final Deviation deviation : rootModule.getDeviations()) {
        if (deviation.getTargetPath().getLastComponent().equals(QName.create(
                impModule.getQNameModule(), "my-leaf"))) {
            deviatedMyLeafType = deviation.getDeviates().iterator().next().getDeviatedType();
        }

        if (deviation.getTargetPath().getLastComponent().equals(QName.create(
                impModule.getQNameModule(), "my-leaf-2"))) {
            deviatedMyLeaf2Type = deviation.getDeviates().iterator().next().getDeviatedType();
        }
    }

    assertNotNull(deviatedMyLeafType);
    assertNotNull(deviatedMyLeaf2Type);

    final LeafSchemaNode myLeaf = (LeafSchemaNode) impModule.getDataChildByName(QName.create(
            impModule.getQNameModule(), "my-leaf"));
    assertSame(deviatedMyLeafType, myLeaf.getType());

    final LeafSchemaNode myLeaf2 = (LeafSchemaNode) impModule.getDataChildByName(QName.create(
            impModule.getQNameModule(), "my-leaf-2"));
    assertSame(deviatedMyLeaf2Type, myLeaf2.getType());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:36,代码来源:Bug9242Test.java

示例5: test

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void test() throws Exception {
    SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug4933/correct");
    assertNotNull(context);

    final Module foo = context.findModules("foo").iterator().next();
    Set<Deviation> deviations = foo.getDeviations();
    assertEquals(4, deviations.size());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:10,代码来源:Bug4933Test.java

示例6: effectiveBuildTest

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@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 Set<AugmentationSchemaNode> augmentations = rootModule.getAugmentations();
    assertEquals(1, augmentations.size());
    assertEquals(CONT_SCHEMA_PATH, augmentations.iterator().next().getTargetPath());

    final Set<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 Set<Module> submodules = rootModule.getSubmodules();
    assertEquals(1, submodules.size());
    assertEquals("submod", submodules.iterator().next().getName());

    final Set<NotificationDefinition> notifications = rootModule.getNotifications();
    assertEquals(1, notifications.size());
    assertEquals("notif1", notifications.iterator().next().getQName().getLocalName());

    final Set<RpcDefinition> rpcs = rootModule.getRpcs();
    assertEquals(1, rpcs.size());
    assertEquals("rpc1", rpcs.iterator().next().getQName().getLocalName());

    final Set<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");
    final SchemaPath importedContSchemaPath = SchemaPath.create(true, importedContQName);
    assertEquals(importedContSchemaPath, deviationStmt.getTargetPath());
    assertEquals(DeviateKind.ADD, deviationStmt.getDeviates().iterator().next().getDeviateType());
    assertEquals(Optional.of("deviate reference"), deviationStmt.getReference());

    final Set<IdentitySchemaNode> identities = rootModule.getIdentities();
    assertEquals(1, identities.size());
    assertEquals("identity1", identities.iterator().next().getQName().getLocalName());

    final Set<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 List<ExtensionDefinition> extensionSchemaNodes = rootModule.getExtensionSchemaNodes();
    assertEquals(1, extensionSchemaNodes.size());
    assertEquals("ext1", extensionSchemaNodes.iterator().next().getQName().getLocalName());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:73,代码来源:EffectiveModuleTest.java


注:本文中的org.opendaylight.yangtools.yang.model.api.Module.getDeviations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。