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


Java Module.getNotifications方法代码示例

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


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

示例1: testValidYang11Model

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

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

    final Set<NotificationDefinition> notifications = foo.getNotifications();
    assertEquals(1, notifications.size());
    final NotificationDefinition myNotification = notifications.iterator().next();
    Collection<MustDefinition> mustConstraints = myNotification.getMustConstraints();
    assertEquals(2, mustConstraints.size());

    final Set<RpcDefinition> rpcs = foo.getRpcs();
    assertEquals(1, rpcs.size());
    final RpcDefinition myRpc = rpcs.iterator().next();

    final ContainerSchemaNode input = myRpc.getInput();
    assertNotNull(input);
    mustConstraints = input.getMustConstraints();
    assertEquals(2, mustConstraints.size());

    final ContainerSchemaNode output = myRpc.getOutput();
    assertNotNull(output);
    mustConstraints = output.getMustConstraints();
    assertEquals(2, mustConstraints.size());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:28,代码来源:Bug6871Test.java

示例2: getNotificationByName

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private static NotificationDefinition getNotificationByName(final Module module, final String name) {
    for (final NotificationDefinition notification : module.getNotifications()) {
        if (notification.getQName().getLocalName().equals(name)) {
            return notification;
        }
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:9,代码来源:SchemaContextUtilTest.java

示例3: test

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

    Set<Module> modules = schema.getModules();
    assertNotNull(modules);
    assertEquals(1, modules.size());

    Module testModule = modules.iterator().next();
    Set<Module> subModules = testModule.getSubmodules();
    assertNotNull(subModules);
    assertEquals(1, subModules.size());

    Module testSubmodule = subModules.iterator().next();

    Set<NotificationDefinition> notifications = testSubmodule
            .getNotifications();
    assertNotNull(notifications);
    assertEquals(1, notifications.size());

    NotificationDefinition bazNotification = notifications.iterator()
            .next();
    Collection<DataSchemaNode> childNodes = bazNotification.getChildNodes();
    assertNotNull(childNodes);
    assertEquals(1, childNodes.size());

    DataSchemaNode child = childNodes.iterator().next();
    assertTrue(child instanceof LeafSchemaNode);

    LeafSchemaNode leafBar = (LeafSchemaNode) child;
    String bar = leafBar.getQName().getLocalName();
    assertEquals("bar", bar);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:35,代码来源:Bug3799Test.java

示例4: getNotificationByName

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private static NotificationDefinition getNotificationByName(final Module module, final QName name) {
    for (final NotificationDefinition notification : module.getNotifications()) {
        if (notification.getQName().equals(name)) {
            return notification;
        }
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:9,代码来源:SchemaContextUtil.java

示例5: 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.getNotifications方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。