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


Java ContainerNode类代码示例

本文整理汇总了Java中org.opendaylight.yangtools.yang.data.api.schema.ContainerNode的典型用法代码示例。如果您正苦于以下问题:Java ContainerNode类的具体用法?Java ContainerNode怎么用?Java ContainerNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ContainerNode类属于org.opendaylight.yangtools.yang.data.api.schema包,在下文中一共展示了ContainerNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeInitialParent

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
private void writeInitialParent() {
    final ClientTransaction tx = history.createTransaction();

    final DOMDataTreeWriteCursor cursor = tx.openCursor();

    final ContainerNode root = ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(ClusterUtils.PREFIX_SHARDS_QNAME))
            .withChild(ImmutableMapNodeBuilder.create()
                    .withNodeIdentifier(new NodeIdentifier(ClusterUtils.SHARD_LIST_QNAME))
                    .build())
            .build();

    cursor.merge(ClusterUtils.PREFIX_SHARDS_PATH.getLastPathArgument(), root);
    cursor.close();

    final DOMStoreThreePhaseCommitCohort cohort = tx.ready();

    submitBlocking(cohort);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:PrefixedShardConfigWriter.java

示例2: verifyEntityCandidate

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
protected void verifyEntityCandidate(NormalizedNode<?, ?> node, String entityType,
        YangInstanceIdentifier entityId, String candidateName, boolean expectPresent) {
    try {
        assertNotNull("Missing " + EntityOwners.QNAME.toString(), node);
        assertTrue(node instanceof ContainerNode);

        ContainerNode entityOwnersNode = (ContainerNode) node;

        MapEntryNode entityTypeEntry = getMapEntryNodeChild(entityOwnersNode, EntityType.QNAME,
                ENTITY_TYPE_QNAME, entityType, true);

        MapEntryNode entityEntry = getMapEntryNodeChild(entityTypeEntry, ENTITY_QNAME, ENTITY_ID_QNAME,
                entityId, true);

        getMapEntryNodeChild(entityEntry, Candidate.QNAME, CANDIDATE_NAME_QNAME, candidateName, expectPresent);
    } catch (AssertionError e) {
        throw new AssertionError("Verification of entity candidate failed - returned data was: " + node, e);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:AbstractEntityOwnershipTest.java

示例3: testMergeWithInvalidChildNodeNames

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
@Test
public void testMergeWithInvalidChildNodeNames() throws DataValidationFailedException {
    ContainerNode augContainer = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
            new YangInstanceIdentifier.NodeIdentifier(AUG_CONTAINER)).withChild(
                    ImmutableNodes.containerNode(AUG_INNER_CONTAINER)).build();

    DataContainerChild<?, ?> outerNode = outerNode(outerNodeEntry(1, innerNode("one", "two")));
    ContainerNode normalizedNode = ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)).withChild(outerNode)
            .withChild(augContainer).withChild(ImmutableNodes.leafNode(AUG_QNAME, "aug")).build();

    YangInstanceIdentifier path = TestModel.TEST_PATH;

    pruningDataTreeModification.merge(path, normalizedNode);

    dataTree.commit(getCandidate());

    ContainerNode prunedNode = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
            new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)).withChild(outerNode).build();

    Optional<NormalizedNode<?, ?>> actual = dataTree.takeSnapshot().readNode(path);
    assertEquals("After pruning present", true, actual.isPresent());
    assertEquals("After pruning", prunedNode, actual.get());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:PruningDataTreeModificationTest.java

示例4: testWriteWithInvalidChildNodeNames

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
@Test
public void testWriteWithInvalidChildNodeNames() throws DataValidationFailedException {
    ContainerNode augContainer = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
            new YangInstanceIdentifier.NodeIdentifier(AUG_CONTAINER)).withChild(
                    ImmutableNodes.containerNode(AUG_INNER_CONTAINER)).build();

    DataContainerChild<?, ?> outerNode = outerNode(outerNodeEntry(1, innerNode("one", "two")));
    ContainerNode normalizedNode = ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)).withChild(outerNode)
            .withChild(augContainer).withChild(ImmutableNodes.leafNode(AUG_QNAME, "aug"))
            .withChild(ImmutableNodes.leafNode(NAME_QNAME, "name")).build();

    YangInstanceIdentifier path = TestModel.TEST_PATH;

    pruningDataTreeModification.write(path, normalizedNode);

    dataTree.commit(getCandidate());

    ContainerNode prunedNode = ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)).withChild(outerNode)
            .withChild(ImmutableNodes.leafNode(NAME_QNAME, "name")).build();

    Optional<NormalizedNode<?, ?>> actual = dataTree.takeSnapshot().readNode(path);
    assertEquals("After pruning present", true, actual.isPresent());
    assertEquals("After pruning", prunedNode, actual.get());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:PruningDataTreeModificationTest.java

示例5: createCrossShardContainer

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
private static ContainerNode createCrossShardContainer() {

        final MapEntryNode outerListEntry1 =
                ImmutableNodes.mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1)
                        .withChild(createInnerMapNode(1))
                        .build();
        final MapEntryNode outerListEntry2 =
                ImmutableNodes.mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 2)
                        .withChild(createInnerMapNode(2))
                        .build();

        final MapNode outerList = ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
                .withChild(outerListEntry1)
                .withChild(outerListEntry2)
                .build();

        final ContainerNode testContainer = ImmutableContainerNodeBuilder.create()
                .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
                .withChild(outerList)
                .build();

        return testContainer;
    }
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:DistributedShardFrontendTest.java

示例6: testWritesIntoDefaultShard

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
@Test
public void testWritesIntoDefaultShard() throws Exception {
    initEmptyDatastores();

    final DOMDataTreeIdentifier configRoot =
            new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY);

    final DOMDataTreeProducer producer = leaderShardFactory.createProducer(Collections.singleton(configRoot));

    final DOMDataTreeCursorAwareTransaction tx = producer.createTransaction(true);
    final DOMDataTreeWriteCursor cursor =
            tx.createCursor(new DOMDataTreeIdentifier(
                    LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY));
    Assert.assertNotNull(cursor);

    final ContainerNode test =
            ImmutableContainerNodeBuilder.create()
                    .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME)).build();

    cursor.write(test.getIdentifier(), test);
    cursor.close();

    tx.submit().checkedGet();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:DistributedShardedDOMDataTreeTest.java

示例7: bindingRoutedRpcProvider_DomInvokerTest

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
@Test
public void bindingRoutedRpcProvider_DomInvokerTest() throws Exception {

    knockService//
            .registerPath(TestContext.class, BA_NODE_A_ID) //
            .registerPath(TestContext.class, BA_NODE_B_ID) //
            .setKnockKnockResult(knockResult(true, "open"));

    OpendaylightOfMigrationTestModelService baKnockInvoker =
            providerRegistry.getRpcService(OpendaylightOfMigrationTestModelService.class);
    assertNotSame(knockService, baKnockInvoker);

    KnockKnockInput knockKnockA = knockKnock(BA_NODE_A_ID) //
            .setQuestion("who's there?").build();

    ContainerNode knockKnockDom = toDomRpc(KNOCK_KNOCK_QNAME, knockKnockA);
    assertNotNull(knockKnockDom);
    DOMRpcResult domResult = biRpcInvoker.invokeRpc(KNOCK_KNOCK_PATH, knockKnockDom).get();
    assertNotNull(domResult);
    assertNotNull("DOM result is successful.", domResult.getResult());
    assertTrue("Bidning Add Flow RPC was captured.", knockService.getReceivedKnocks().containsKey(BA_NODE_A_ID));
    assertEquals(knockKnockA, knockService.getReceivedKnocks().get(BA_NODE_A_ID).iterator().next());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:CrossBrokerRpcTest.java

示例8: bindingRpcInvoker_DomRoutedProviderTest

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
@Test
public void bindingRpcInvoker_DomRoutedProviderTest() throws Exception {
    KnockKnockOutputBuilder builder = new KnockKnockOutputBuilder();
    builder.setAnswer("open");
    final KnockKnockOutput output = builder.build();

    provisionRegistry.registerRpcImplementation((rpc, input) -> {
        ContainerNode result = testContext.getCodec().getCodecFactory().toNormalizedNodeRpcData(output);
        return Futures.immediateCheckedFuture(new DefaultDOMRpcResult(result));
    }, DOMRpcIdentifier.create(KNOCK_KNOCK_PATH, BI_NODE_C_ID));

    OpendaylightOfMigrationTestModelService baKnockInvoker =
            providerRegistry.getRpcService(OpendaylightOfMigrationTestModelService.class);
    Future<RpcResult<KnockKnockOutput>> baResult = baKnockInvoker.knockKnock((knockKnock(BA_NODE_C_ID).setQuestion("Who's there?").build()));
    assertNotNull(baResult);
    assertEquals(output, baResult.get().getResult());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:CrossBrokerRpcTest.java

示例9: testExecuteRpc

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
@Test
public void testExecuteRpc() {
    new JavaTestKit(node1) {
        {

            final ContainerNode invokeRpcResult = makeRPCOutput("bar");
            final DOMRpcResult rpcResult = new DefaultDOMRpcResult(invokeRpcResult);
            when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), Mockito.<NormalizedNode<?, ?>>any())).thenReturn(
                    Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));

            final ExecuteRpc executeMsg = ExecuteRpc.from(TEST_RPC_ID, null);

            rpcInvoker1.tell(executeMsg, getRef());

            final RpcResponse rpcResponse = expectMsgClass(duration("5 seconds"), RpcResponse.class);

            assertEquals(rpcResult.getResult(), rpcResponse.getResultNormalizedNode());
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:RpcBrokerTest.java

示例10: testInvokeRpc

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
/**
 * This test method invokes and executes the remote rpc.
 */
@Test
public void testInvokeRpc() throws Exception {
    final ContainerNode rpcOutput = makeRPCOutput("bar");
    final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);

    final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
    @SuppressWarnings({"unchecked", "rawtypes"})
    final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
            (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);

    when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
            Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));

    final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
            remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
    assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);

    final DOMRpcResult result = frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
    assertEquals(rpcOutput, result.getResult());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:RemoteRpcImplementationTest.java

示例11: testInvokeRpcWithNullInput

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
/**
 * This test method invokes and executes the remote rpc.
 */
@Test
public void testInvokeRpcWithNullInput() throws Exception {
    final ContainerNode rpcOutput = makeRPCOutput("bar");
    final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);

    @SuppressWarnings({"unchecked", "rawtypes"})
    final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
            (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);

    when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
            Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));

    final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
            remoteRpcImpl1.invokeRpc(TEST_RPC_ID, null);
    assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);

    final DOMRpcResult result = frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
    assertEquals(rpcOutput, result.getResult());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:RemoteRpcImplementationTest.java

示例12: testInvokeRpcWithNoOutput

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
/**
 * This test method invokes and executes the remote rpc.
 */
@Test
public void testInvokeRpcWithNoOutput() throws Exception {
    final ContainerNode rpcOutput = null;
    final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);

    final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
    @SuppressWarnings({"unchecked", "rawtypes"})
    final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
            (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);

    when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
            Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));

    final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
            remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
    assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);

    final DOMRpcResult result = frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
    assertNull(result.getResult());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:RemoteRpcImplementationTest.java

示例13: invokeRpc

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
@Nonnull
@Override
public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull DOMRpcIdentifier rpc, @Nullable NormalizedNode<?, ?> input) {
    LOG.debug("get-singleton-constant invoked, current value: {}", constant);

    final LeafNode<Object> value = ImmutableLeafNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(CONSTANT))
            .withValue(constant)
            .build();

    final ContainerNode result = ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(OUTPUT))
            .withChild(value)
            .build();

    return Futures.immediateCheckedFuture(new DefaultDOMRpcResult(result));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:SingletonGetConstantService.java

示例14: invokeRpc

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
@Nonnull
@Override
public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc,
                                                              @Nullable final NormalizedNode<?, ?> input) {
    LOG.debug("get-contexted-constant invoked, current value: {}", constant);

    final LeafNode<Object> value = ImmutableLeafNodeBuilder.create()
            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CONSTANT))
            .withValue(constant)
            .build();

    final ContainerNode result = ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(OUTPUT))
            .withChild(value)
            .build();

    return Futures.immediateCheckedFuture(new DefaultDOMRpcResult(result));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:RoutedGetConstantService.java

示例15: invokeRpc

import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入依赖的package包/类
@Nonnull
@Override
public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc,
                                                              @Nullable final NormalizedNode<?, ?> input) {
    LOG.debug("get-constant invoked, current value: {}", constant);

    final LeafNode<Object> value = ImmutableLeafNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(CONSTANT))
            .withValue(constant)
            .build();

    final ContainerNode result = ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(OUTPUT))
            .withChild(value)
            .build();

    return Futures.immediateCheckedFuture(new DefaultDOMRpcResult(result));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:GetConstantService.java


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