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


Java Module.getDataChildByName方法代码示例

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


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

示例1: createDefaultInstance

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public T createDefaultInstance(final FallbackConfigProvider fallback) throws ConfigXMLReaderException,
        URISyntaxException, ParserConfigurationException, XMLStreamException, SAXException, IOException {
    YangInstanceIdentifier yangPath = bindingSerializer.toYangInstanceIdentifier(bindingContext.appConfigPath);

    LOG.debug("{}: Creating app config instance from path {}, Qname: {}", logName, yangPath,
            bindingContext.bindingQName);

    checkNotNull(schemaService, "%s: Could not obtain the SchemaService OSGi service", logName);

    SchemaContext schemaContext = schemaService.getGlobalContext();

    Module module = schemaContext.findModuleByNamespaceAndRevision(bindingContext.bindingQName.getNamespace(),
            bindingContext.bindingQName.getRevision());
    checkNotNull(module, "%s: Could not obtain the module schema for namespace %s, revision %s",
            logName, bindingContext.bindingQName.getNamespace(), bindingContext.bindingQName.getRevision());

    DataSchemaNode dataSchema = module.getDataChildByName(bindingContext.bindingQName);
    checkNotNull(dataSchema, "%s: Could not obtain the schema for %s", logName, bindingContext.bindingQName);

    checkCondition(bindingContext.schemaType.isAssignableFrom(dataSchema.getClass()),
            "%s: Expected schema type %s for %s but actual type is %s", logName,
            bindingContext.schemaType, bindingContext.bindingQName, dataSchema.getClass());

    NormalizedNode<?, ?> dataNode = parsePossibleDefaultAppConfigXMLFile(schemaContext, dataSchema);
    if (dataNode == null) {
        dataNode = fallback.get(schemaService.getGlobalContext(), dataSchema);
    }

    DataObject appConfig = bindingSerializer.fromNormalizedNode(yangPath, dataNode).getValue();

    // This shouldn't happen but need to handle it in case...
    checkNotNull(appConfig, "%s: Could not create instance for app config binding %s", logName,
            bindingContext.appConfigBindingClass);

    return (T) appConfig;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:38,代码来源:DataStoreAppConfigDefaultXMLReader.java

示例2: testYangDataBeingIgnored

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testYangDataBeingIgnored() throws Exception {
    // yang-data statement is ignored if it does not appear as a top-level statement
    // i.e., it will not appear in the final SchemaContext
    final SchemaContext schemaContext = reactor.newBuild().addSources(BAR_MODULE, IETF_RESTCONF_MODULE)
            .buildEffective();
    assertNotNull(schemaContext);

    final Module bar = schemaContext.findModule("bar", REVISION).get();
    final ContainerSchemaNode cont = (ContainerSchemaNode) bar.getDataChildByName(
            QName.create(bar.getQNameModule(), "cont"));
    assertNotNull(cont);

    final Set<ExtensionDefinition> extensions = schemaContext.getExtensions();
    assertEquals(1, extensions.size());

    final List<UnknownSchemaNode> unknownSchemaNodes = cont.getUnknownSchemaNodes();
    assertEquals(0, unknownSchemaNodes.size());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:20,代码来源:YangDataExtensionTest.java

示例3: testAugmentInUsesResolving

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testAugmentInUsesResolving() throws Exception {
    final SchemaContext context = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-uses")
        .toURI());
    assertEquals(1, context.getModules().size());

    final Module test = context.getModules().iterator().next();
    final DataNodeContainer links = (DataNodeContainer) test.getDataChildByName(QName.create(test.getQNameModule(),
            "links"));
    final DataNodeContainer link = (DataNodeContainer) links.getDataChildByName(QName.create(test.getQNameModule(),
            "link"));
    final DataNodeContainer nodes = (DataNodeContainer) link.getDataChildByName(QName.create(test.getQNameModule(),
            "nodes"));
    final ContainerSchemaNode node = (ContainerSchemaNode) nodes.getDataChildByName(QName.create(
            test.getQNameModule(), "node"));
    final Set<AugmentationSchemaNode> augments = node.getAvailableAugmentations();
    assertEquals(1, augments.size());
    assertEquals(1, node.getChildNodes().size());
    final LeafSchemaNode id = (LeafSchemaNode) node.getDataChildByName(QName.create(test.getQNameModule(), "id"));
    assertTrue(id.isAugmenting());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:22,代码来源:AugmentTest.java

示例4: testInstanceIdentifier2

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testInstanceIdentifier2() {
    Module tested = TestUtils.findModule(context, "custom-types-test").get();
    LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName(
            QName.create(tested.getQNameModule(), "inst-id-leaf2"));
    InstanceIdentifierTypeDefinition leafType = (InstanceIdentifierTypeDefinition) leaf.getType();
    assertFalse(leafType.requireInstance());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:9,代码来源:TypesResolutionTest.java

示例5: testStringPatternCheckingCodec

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testStringPatternCheckingCodec() {
    final SchemaContext schemaContext = YangParserTestUtils.parseYangResource(
        "/string-pattern-checking-codec-test.yang");
    assertNotNull(schemaContext);

    final QNameModule testModuleQName = QNameModule.create(URI.create("string-pattern-checking-codec-test"));

    final Module testModule = schemaContext.findModules("string-pattern-checking-codec-test").iterator().next();
    final ContainerSchemaNode testContainer = (ContainerSchemaNode) testModule.getDataChildByName(
            QName.create(testModuleQName, "test-container"));
    assertNotNull(testContainer);

    final LeafSchemaNode testLeaf = (LeafSchemaNode) testContainer.getDataChildByName(
            QName.create(testModuleQName, "string-leaf-with-valid-pattern"));
    assertNotNull(testLeaf);

    final StringCodec<String> codec = getCodec(testLeaf.getType(), StringCodec.class);
    assertNotNull(codec);
    assertEquals("ABCD", codec.serialize("ABCD"));
    assertEquals("ABCD", codec.deserialize("ABCD"));

    try {
        codec.deserialize("abcd");
        fail("Exception should have been thrown.");
    } catch (final IllegalArgumentException ex) {
        LOG.debug("IllegalArgumentException was thrown as expected", ex);
        assertEquals("Supplied value does not match the regular expression ^[A-Z]+$.", ex.getMessage());
    }
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:31,代码来源:StringPatternCheckingCodecTest.java

示例6: setup

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Before
public void setup() throws URISyntaxException {
    final File leafRefTestYang = new File(getClass().getResource("/builder-test/immutable-ordered-map-node.yang")
            .toURI());
    final SchemaContext schema = YangParserTestUtils.parseYangFiles(leafRefTestYang);
    final Module module = schema.getModules().iterator().next();
    final DataSchemaNode root = module.getDataChildByName(ROOT_CONTAINER);
    list = (ListSchemaNode)((ContainerSchemaNode) root).getDataChildByName(LIST_MAIN);
    leafList = (LeafListSchemaNode)((ContainerSchemaNode) root).getDataChildByName(LEAF_LIST_MAIN);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:11,代码来源:BuilderTest.java

示例7: testInstanceIdentifier1

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testInstanceIdentifier1() {
    Module tested = TestUtils.findModule(context, "custom-types-test").get();
    LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName(
            QName.create(tested.getQNameModule(), "inst-id-leaf1"));
    InstanceIdentifierTypeDefinition leafType = (InstanceIdentifierTypeDefinition) leaf.getType();
    assertFalse(leafType.requireInstance());
    assertEquals(1, leaf.getUnknownSchemaNodes().size());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:10,代码来源:TypesResolutionTest.java

示例8: testStrictParsing

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testStrictParsing() throws Exception {
    // should fail because strictParsing is switched on and the top-level-container node contains child nodes
    // which are not defined in the provided YANG model
    final SchemaContext schemaContext = YangParserTestUtils.parseYangResource(
            "/strict-parsing-mode-test/foo.yang");
    final Module fooModule = schemaContext.getModules().iterator().next();
    final ContainerSchemaNode topLevelContainer = (ContainerSchemaNode) fooModule.getDataChildByName(
            QName.create(fooModule.getQNameModule(), "top-level-container"));

    final InputStream resourceAsStream = StrictParsingModeTest.class.getResourceAsStream(
            "/strict-parsing-mode-test/foo.xml");

    final XMLInputFactory factory = XMLInputFactory.newInstance();
    final XMLStreamReader reader = factory.createXMLStreamReader(resourceAsStream);

    final NormalizedNodeResult result = new NormalizedNodeResult();
    final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);

    final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, schemaContext, topLevelContainer, true);
    try {
        xmlParser.parse(reader);
        fail("IllegalStateException should have been thrown because of an unknown child node.");
    } catch (IllegalStateException ex) {
        assertEquals("Schema for node with name unknown-container-a and namespace foo doesn't exist at "
                + "AbsoluteSchemaPath{path=[(foo)top-level-container]}", ex.getMessage());
    }
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:29,代码来源:StrictParsingModeTest.java

示例9: testSharedSchemaRepositoryWithNoFeaturesSupported

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testSharedSchemaRepositoryWithNoFeaturesSupported() throws Exception {
    final Set<QName> supportedFeatures = ImmutableSet.of();

    final SharedSchemaRepository sharedSchemaRepository = new SharedSchemaRepository(
            "shared-schema-repo-with-features-test");

    final SettableSchemaProvider<ASTSchemaSource> foobar = getImmediateYangSourceProviderFromResource(
        "/if-feature-resolution-test/shared-schema-repository/foobar.yang");
    foobar.register(sharedSchemaRepository);
    foobar.setResult();

    final SchemaContextFactory fact = sharedSchemaRepository
            .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);

    final ListenableFuture<SchemaContext> testSchemaContextFuture =
            fact.createSchemaContext(ImmutableList.of(foobar.getId()), supportedFeatures);
    assertTrue(testSchemaContextFuture.isDone());
    assertSchemaContext(testSchemaContextFuture.get(), 1);

    final Module module = testSchemaContextFuture.get().findModules("foobar").iterator().next();
    assertNotNull(module);
    assertEquals(1, module.getChildNodes().size());

    final ContainerSchemaNode testContainerC = (ContainerSchemaNode) module.getDataChildByName(
            QName.create(module.getQNameModule(), "test-container-c"));
    assertNotNull(testContainerC);
    final LeafSchemaNode testLeafC = (LeafSchemaNode) testContainerC.getDataChildByName(
            QName.create(module.getQNameModule(), "test-leaf-c"));
    assertNotNull(testLeafC);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:32,代码来源:SharedSchemaRepositoryWithFeaturesTest.java

示例10: testModels

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

    final Set<Module> modules = context.getModules();
    assertEquals(2, modules.size());

    Module bar = null;
    for (final Module module : modules) {
        if ("bar".equals(module.getName())) {
            bar = module;
            break;
        }
    }

    assertNotNull(bar);
    assertTrue(bar.getDataChildByName(QName.create(NS, REV, "foo-grp-con")) instanceof ContainerSchemaNode);
    assertTrue(bar.getDataChildByName(QName.create(NS, REV, "sub-foo-grp-con")) instanceof ContainerSchemaNode);

    assertEquals(1, bar.getSubmodules().size());

    final DataSchemaNode dataChildByName = bar.getDataChildByName(QName.create(NS, REV, "sub-bar-con"));
    assertTrue(dataChildByName instanceof ContainerSchemaNode);
    final ContainerSchemaNode subBarCon = (ContainerSchemaNode) dataChildByName;

    assertTrue(subBarCon.getDataChildByName(QName.create(NS, REV, "foo-grp-con")) instanceof ContainerSchemaNode);
    assertTrue(subBarCon.getDataChildByName(QName.create(NS, REV, "sub-foo-grp-con"))
        instanceof ContainerSchemaNode);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:31,代码来源:Bug6240Test.java

示例11: whenStmtTest

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

    final Module testModule = result.findModules("when-test").iterator().next();
    assertNotNull(testModule);

    final ContainerSchemaNode container = (ContainerSchemaNode) testModule.getDataChildByName(
        QName.create(testModule.getQNameModule(), "test-container"));
    assertNotNull(container);
    assertEquals("conditional-leaf = 'autumn-leaf'", container.getWhenCondition().get().toString());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:16,代码来源:MustAndWhenStmtTest.java

示例12: testDeclaredContainer

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testDeclaredContainer() throws ReactorException {
    final StatementStreamSource containerStmtModule =
            sourceForResource("/declared-statements-test/container-declared-test.yang");

    final SchemaContext schemaContext = StmtTestUtils.parseYangSources(containerStmtModule);
    assertNotNull(schemaContext);

    final Module testModule = schemaContext.findModules("container-declared-test").iterator().next();
    assertNotNull(testModule);

    final ContainerSchemaNode containerSchemaNode = (ContainerSchemaNode) testModule.getDataChildByName(
            QName.create(testModule.getQNameModule(), "test-container"));
    assertNotNull(containerSchemaNode);
    final ContainerStatement containerStatement =
            ((ContainerEffectiveStatement) containerSchemaNode).getDeclared();

    final QName name = containerStatement.getName();
    assertNotNull(name);

    final WhenStatement containerStatementWhen = containerStatement.getWhenStatement();
    assertNotNull(containerStatementWhen);

    final Collection<? extends IfFeatureStatement> containerStatementIfFeatures =
            containerStatement.getIfFeatures();
    assertNotNull(containerStatementIfFeatures);
    assertEquals(1, containerStatementIfFeatures.size());

    final Collection<? extends MustStatement> containerStatementMusts = containerStatement.getMusts();
    assertNotNull(containerStatementMusts);
    assertEquals(1, containerStatementMusts.size());

    final PresenceStatement containerStatementPresence = containerStatement.getPresence();
    assertNotNull(containerStatementPresence);
    assertNotNull(containerStatementPresence.getValue());

    final ConfigStatement containerStatementConfig = containerStatement.getConfig();
    assertNotNull(containerStatementConfig);

    final StatusStatement containerStatementStatus = containerStatement.getStatus();
    assertNotNull(containerStatementStatus);

    final DescriptionStatement containerStatementDescription = containerStatement.getDescription();
    assertNotNull(containerStatementDescription);

    final ReferenceStatement containerStatementReference = containerStatement.getReference();
    assertNotNull(containerStatementReference);

    final Collection<? extends TypedefStatement> containerStatementTypedefs = containerStatement.getTypedefs();
    assertNotNull(containerStatementTypedefs);
    assertEquals(1, containerStatementTypedefs.size());

    final Collection<? extends GroupingStatement> containerStatementGroupings = containerStatement.getGroupings();
    assertNotNull(containerStatementGroupings);
    assertEquals(1, containerStatementGroupings.size());

    final Collection<? extends DataDefinitionStatement> containerStatementDataDefinitions =
            containerStatement.getDataDefinitions();

    assertNotNull(containerStatementDataDefinitions);
    assertEquals(1, containerStatementDataDefinitions.size());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:63,代码来源:DeclaredStatementsTest.java

示例13: findNodeInModule

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private static SchemaNode findNodeInModule(final Module module, final Iterable<QName> path) {

        Preconditions.checkArgument(module != null, "Parent reference cannot be NULL");
        Preconditions.checkArgument(path != null, "Path reference cannot be NULL");

        if (!path.iterator().hasNext()) {
            LOG.debug("No node matching {} found in node {}", path, module);
            return null;
        }

        final QName current = path.iterator().next();
        LOG.trace("Looking for node {} in module {}", current, module);

        SchemaNode foundNode = null;
        final Iterable<QName> nextPath = nextLevel(path);

        foundNode = module.getDataChildByName(current);
        if (foundNode != null && nextPath.iterator().hasNext()) {
            foundNode = findNodeIn(foundNode, nextPath);
        }

        if (foundNode == null) {
            foundNode = getGroupingByName(module, current);
            if (foundNode != null && nextPath.iterator().hasNext()) {
                foundNode = findNodeIn(foundNode, nextPath);
            }
        }

        if (foundNode == null) {
            foundNode = getRpcByName(module, current);
            if (foundNode != null && nextPath.iterator().hasNext()) {
                foundNode = findNodeIn(foundNode, nextPath);
            }
        }

        if (foundNode == null) {
            foundNode = getNotificationByName(module, current);
            if (foundNode != null && nextPath.iterator().hasNext()) {
                foundNode = findNodeIn(foundNode, nextPath);
            }
        }

        if (foundNode == null) {
            LOG.debug("No node matching {} found in node {}", path, module);
        }

        return foundNode;

    }
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:50,代码来源:SchemaContextUtil.java

示例14: testSharedSchemaRepositoryWithSomeFeaturesSupported

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
@Test
public void testSharedSchemaRepositoryWithSomeFeaturesSupported() throws Exception {
    final Set<QName> supportedFeatures = ImmutableSet.of(QName.create("foobar-namespace", "test-feature-1"));

    final SharedSchemaRepository sharedSchemaRepository = new SharedSchemaRepository(
            "shared-schema-repo-with-features-test");

    final SettableSchemaProvider<ASTSchemaSource> foobar = getImmediateYangSourceProviderFromResource(
        "/if-feature-resolution-test/shared-schema-repository/foobar.yang");
    foobar.register(sharedSchemaRepository);
    foobar.setResult();

    final SchemaContextFactory fact = sharedSchemaRepository
            .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);

    final ListenableFuture<SchemaContext> testSchemaContextFuture =
            fact.createSchemaContext(ImmutableList.of(foobar.getId()), supportedFeatures);
    assertTrue(testSchemaContextFuture.isDone());
    assertSchemaContext(testSchemaContextFuture.get(), 1);

    final Module module = testSchemaContextFuture.get().findModules("foobar").iterator().next();
    assertNotNull(module);
    assertEquals(2, module.getChildNodes().size());

    final ContainerSchemaNode testContainerA = (ContainerSchemaNode) module.getDataChildByName(
            QName.create(module.getQNameModule(), "test-container-a"));
    assertNotNull(testContainerA);
    final LeafSchemaNode testLeafA = (LeafSchemaNode) testContainerA.getDataChildByName(
            QName.create(module.getQNameModule(), "test-leaf-a"));
    assertNotNull(testLeafA);

    final ContainerSchemaNode testContainerB = (ContainerSchemaNode) module.getDataChildByName(
            QName.create(module.getQNameModule(), "test-container-b"));
    assertNull(testContainerB);

    final ContainerSchemaNode testContainerC = (ContainerSchemaNode) module.getDataChildByName(
            QName.create(module.getQNameModule(), "test-container-c"));
    assertNotNull(testContainerC);
    final LeafSchemaNode testLeafC = (LeafSchemaNode) testContainerC.getDataChildByName(
            QName.create(module.getQNameModule(), "test-leaf-c"));
    assertNotNull(testLeafC);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:43,代码来源:SharedSchemaRepositoryWithFeaturesTest.java

示例15: configModuleTest

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private static void configModuleTest(final SchemaContext context) {
    final Module configModule = context.findModule("config", Revision.of("2013-04-05")).get();
    final Module module = context.findModule("opendaylight-sal-dom-broker-impl", Revision.of("2013-10-28")).get();

    final DataSchemaNode dataNode = configModule.getDataChildByName(QName.create(configModule.getQNameModule(),
        "modules"));
    assertTrue(dataNode instanceof ContainerSchemaNode);

    final ContainerSchemaNode moduleContainer = (ContainerSchemaNode) dataNode;
    final DataSchemaNode dataChildList = moduleContainer
            .getDataChildByName(QName.create(configModule.getQNameModule(), "module"));

    assertTrue(dataChildList instanceof ListSchemaNode);

    final ListSchemaNode listModule = (ListSchemaNode) dataChildList;
    final DataSchemaNode dataChildChoice = listModule
            .getDataChildByName(QName.create(configModule.getQNameModule(), "configuration"));

    assertTrue(dataChildChoice instanceof ChoiceSchemaNode);

    final ChoiceSchemaNode confChoice = (ChoiceSchemaNode) dataChildChoice;
    final CaseSchemaNode caseNodeByName = confChoice.findCaseNodes("dom-broker-impl").iterator().next();

    assertNotNull(caseNodeByName);
    final DataSchemaNode dataNode2 = caseNodeByName
            .getDataChildByName(QName.create(module.getQNameModule(), "async-data-broker"));
    assertTrue(dataNode2 instanceof ContainerSchemaNode);

    final ContainerSchemaNode containerNode = (ContainerSchemaNode) dataNode2;
    final DataSchemaNode leaf = containerNode.getDataChildByName(QName.create(module.getQNameModule(), "type"));
    final List<UnknownSchemaNode> unknownSchemaNodes = leaf.getUnknownSchemaNodes();

    assertEquals(1, unknownSchemaNodes.size());

    final UnknownSchemaNode unknownSchemaNode = unknownSchemaNodes.get(0);

    assertEquals(unknownSchemaNode.getQName(), unknownSchemaNode.getPath().getLastComponent());
    assertEquals("dom-async-data-broker", unknownSchemaNode.getQName().getLocalName());

    final CaseSchemaNode domInmemoryDataBroker = confChoice.findCaseNodes("dom-inmemory-data-broker").iterator()
            .next();

    assertNotNull(domInmemoryDataBroker);
    final DataSchemaNode schemaService = domInmemoryDataBroker
            .getDataChildByName(QName.create(module.getQNameModule(), "schema-service"));
    assertTrue(schemaService instanceof ContainerSchemaNode);

    final ContainerSchemaNode schemaServiceContainer = (ContainerSchemaNode) schemaService;

    assertEquals(1, schemaServiceContainer.getUses().size());
    final UsesNode uses = schemaServiceContainer.getUses().iterator().next();
    final QName groupingQName = QName.create("urn:opendaylight:params:xml:ns:yang:controller:config", "2013-04-05",
        "service-ref");
    final QName usesGroupingPathLastComponent = uses.getGroupingPath().getLastComponent();
    assertEquals(groupingQName, usesGroupingPathLastComponent);
    assertEquals(0, getChildNodeSizeWithoutUses(schemaServiceContainer));

    final DataSchemaNode type = schemaServiceContainer.getDataChildByName(QName.create(module.getQNameModule(),
        "type"));
    final List<UnknownSchemaNode> typeUnknownSchemaNodes = type.getUnknownSchemaNodes();
    assertEquals(1, typeUnknownSchemaNodes.size());

    final UnknownSchemaNode typeUnknownSchemaNode = typeUnknownSchemaNodes.get(0);
    final QNameModule qNameModule = QNameModule.create(
        URI.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom"), Revision.of("2013-10-28"));
    final QName qName = QName.create(qNameModule, "schema-service");

    assertEquals(qName, typeUnknownSchemaNode.getQName());
    assertEquals(typeUnknownSchemaNode.getQName(), typeUnknownSchemaNode
            .getPath().getLastComponent());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:72,代码来源:ControllerStmtParserTest.java


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