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


Java ImmutableUnkeyedListEntryNodeBuilder类代码示例

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


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

示例1: unkeyedListTestPass

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Test
public void unkeyedListTestPass() throws DataValidationFailedException {
    final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();

    final UnkeyedListEntryNode foo = ImmutableUnkeyedListEntryNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(UNKEYED_LEAF_QNAME))
            .withChild(ImmutableNodes.leafNode(UNKEYED_LEAF_QNAME, "foo")).build();
    final List<UnkeyedListEntryNode> unkeyedEntries = new ArrayList<>();
    unkeyedEntries.add(foo);
    final UnkeyedListNode unkeyedListNode = ImmutableUnkeyedListNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(UNKEYED_LIST_QNAME))
            .withValue(unkeyedEntries).build();

    modificationTree.write(MASTER_CONTAINER_PATH, ImmutableNodes.containerNode(MASTER_CONTAINER_QNAME));
    modificationTree.merge(UNKEYED_LIST_PATH, unkeyedListNode);
    modificationTree.ready();

    inMemoryDataTree.validate(modificationTree);
    final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree);
    inMemoryDataTree.commit(prepare1);

    final DataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
    final Optional<NormalizedNode<?, ?>> unkeyedListRead = snapshotAfterCommit.readNode(UNKEYED_LIST_PATH);
    assertTrue(unkeyedListRead.isPresent());
    assertTrue(((UnkeyedListNode) unkeyedListRead.get()).getSize() == 1);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:27,代码来源:ListConstraintsValidation.java

示例2: unkeyedListTestFail

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Test(expected = DataValidationFailedException.class)
public void unkeyedListTestFail() throws DataValidationFailedException {
    final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();

    final UnkeyedListEntryNode foo = ImmutableUnkeyedListEntryNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(UNKEYED_LEAF_QNAME))
            .withChild(ImmutableNodes.leafNode(UNKEYED_LEAF_QNAME, "foo")).build();
    final UnkeyedListEntryNode bar = ImmutableUnkeyedListEntryNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(UNKEYED_LEAF_QNAME))
            .withChild(ImmutableNodes.leafNode(UNKEYED_LEAF_QNAME, "bar")).build();
    final List<UnkeyedListEntryNode> unkeyedEntries = new ArrayList<>();
    unkeyedEntries.add(foo);
    unkeyedEntries.add(bar);
    final UnkeyedListNode unkeyedListNode = ImmutableUnkeyedListNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(UNKEYED_LIST_QNAME))
            .withValue(unkeyedEntries).build();

    modificationTree.write(UNKEYED_LIST_PATH, unkeyedListNode);
    modificationTree.ready();

    inMemoryDataTree.validate(modificationTree);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:23,代码来源:ListConstraintsValidation.java

示例3: testExtractEvpnDestination

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Test
public void testExtractEvpnDestination() throws BGPParsingException {
    final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> evpnBI =
            ImmutableUnkeyedListEntryNodeBuilder.create();
    evpnBI.withNodeIdentifier(EVPN_NID);
    evpnBI.withChild(createMACIpAdvChoice());
    evpnBI.withChild(createValueBuilder(RD_MODEL, RD_NID).build());
    final EvpnDestination destResult = EvpnNlriParser.extractEvpnDestination(evpnBI.build());
    final EvpnDestination expected = new EvpnDestinationBuilder()
            .setRouteDistinguisher(RD)
            .setEvpnChoice(MACIpAdvRParserTest.createdExpectedResult()).build();
    assertEquals(expected, destResult);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:14,代码来源:EvpnNlriParserTest.java

示例4: testExtractRouteKey

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Test
public void testExtractRouteKey() throws BGPParsingException {
    final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> evpnBI =
            ImmutableUnkeyedListEntryNodeBuilder.create();
    evpnBI.withNodeIdentifier(EVPN_CHOICE_NID);
    evpnBI.withChild(createValueBuilder(RD_MODEL, RD_NID).build());
    evpnBI.withChild(createMACIpAdvChoice());
    final EvpnDestination destResult = EvpnNlriParser.extractRouteKeyDestination(evpnBI.build());
    final EvpnDestination expected = new EvpnDestinationBuilder().setRouteDistinguisher(RD)
            .setEvpnChoice(MACIpAdvRParserTest.createdExpectedRouteKey()).build();
    assertEquals(expected, destResult);
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:13,代码来源:EvpnNlriParserTest.java

示例5: applyWrite

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Override
protected TreeNode applyWrite(final ModifiedNode modification,
        final Optional<TreeNode> currentMeta, final Version version) {
    final NormalizedNode<?, ?> newValue = modification.getWrittenValue();
    final TreeNode newValueMeta = TreeNodeFactory.createTreeNode(newValue, version);

    if (modification.getChildren().isEmpty()) {
        return newValueMeta;
    }

    /*
     * This is where things get interesting. The user has performed a write and
     * then she applied some more modifications to it. So we need to make sense
     * of that an apply the operations on top of the written value. We could have
     * done it during the write, but this operation is potentially expensive, so
     * we have left it out of the fast path.
     *
     * As it turns out, once we materialize the written data, we can share the
     * code path with the subtree change. So let's create an unsealed TreeNode
     * and run the common parts on it -- which end with the node being sealed.
     */
    final MutableTreeNode mutable = newValueMeta.mutable();
    mutable.setSubtreeVersion(version);

    @SuppressWarnings("rawtypes")
    final NormalizedNodeContainerBuilder dataBuilder = ImmutableUnkeyedListEntryNodeBuilder
        .create((UnkeyedListEntryNode) newValue);

    return mutateChildren(mutable, dataBuilder, version, modification.getChildren());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:31,代码来源:UnkeyedListModificationStrategy.java

示例6: startUnkeyedListItem

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Override
public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) {
    Preconditions.checkArgument(getCurrent() instanceof NormalizedNodeResultBuilder
            || getCurrent() instanceof ImmutableUnkeyedListNodeBuilder);
    final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> builder =
            UNKNOWN_SIZE == childSizeHint ? ImmutableUnkeyedListEntryNodeBuilder.create()
                    : ImmutableUnkeyedListEntryNodeBuilder.create(childSizeHint);
    enter(builder.withNodeIdentifier(name));
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:10,代码来源:ImmutableNormalizedNodeStreamWriter.java

示例7: immutableUnkeyedListEntryNodeBuilderTest

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Test
public void immutableUnkeyedListEntryNodeBuilderTest() {
    final UnkeyedListEntryNode unkeyedListEntryNode = ImmutableUnkeyedListEntryNodeBuilder.create()
            .withNodeIdentifier(NODE_IDENTIFIER_LIST)
            .build();
    final UnkeyedListEntryNode unkeyedListEntryNodeSize = ImmutableUnkeyedListEntryNodeBuilder.create(1)
            .withNodeIdentifier(NODE_IDENTIFIER_LIST)
            .build();
    final UnkeyedListEntryNode unkeyedListEntryNodeNode = ImmutableUnkeyedListEntryNodeBuilder
            .create(unkeyedListEntryNode).build();
    assertEquals(unkeyedListEntryNode.getNodeType().getLocalName(), unkeyedListEntryNodeSize.getNodeType()
            .getLocalName());
    assertEquals(unkeyedListEntryNodeSize.getNodeType().getLocalName(), unkeyedListEntryNodeNode.getNodeType()
            .getLocalName());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:16,代码来源:BuilderTest.java

示例8: immutableUnkeyedListNodeBuilderTest

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Test
public void immutableUnkeyedListNodeBuilderTest() {
    final UnkeyedListEntryNode unkeyedListEntryNode = ImmutableUnkeyedListEntryNodeBuilder.create()
            .withNodeIdentifier(NODE_IDENTIFIER_LEAF)
            .build();
    final ImmutableUnkeyedListNodeBuilder immutableUnkeyedListNodeBuilder = (ImmutableUnkeyedListNodeBuilder)
            ImmutableUnkeyedListNodeBuilder.create();
    final UnkeyedListNode unkeyedListNode = immutableUnkeyedListNodeBuilder
            .withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST)
            .addChild(unkeyedListEntryNode)
            .build();
    final UnkeyedListNode unkeyedListNodeSize = ImmutableUnkeyedListNodeBuilder.create(1)
            .withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST)
            .build();
    final UnkeyedListNode unkeyedListNodeCreated = ImmutableUnkeyedListNodeBuilder.create(unkeyedListNode)
            .build();
    try {
        unkeyedListNodeSize.getChild(1);
    } catch (IndexOutOfBoundsException e) {
        // Ignored on purpose
    }

    assertNotNull(unkeyedListNodeSize.getValue());
    assertEquals(unkeyedListEntryNode, unkeyedListNodeCreated.getChild(0));
    assertEquals(unkeyedListNode.getNodeType().getLocalName(), unkeyedListNodeSize.getNodeType()
            .getLocalName());
    assertNotNull(unkeyedListNodeCreated);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:29,代码来源:BuilderTest.java

示例9: testNodeNlri

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Test
public void testNodeNlri() throws BGPParsingException {
    setUp(this.nodeNlri);

    // test BA form
    assertNull(this.dest.getDistinguisher());
    assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
    assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
    final NodeCase nCase = ((NodeCase) this.dest.getObjectType());

    final NodeDescriptors nodeD = nCase.getNodeDescriptors();
    assertEquals(new AsNumber(72L), nodeD.getAsNumber());
    assertEquals(new DomainIdentifier(0x28282828L), nodeD.getDomainId());
    assertEquals(new IsisPseudonodeCaseBuilder().setIsisPseudonode(
        new IsisPseudonodeBuilder().setPsn((short) 5).setIsIsRouterIdentifier(
           new IsIsRouterIdentifierBuilder().setIsoSystemId(new IsoSystemIdentifier(new byte[] { 0, 0, 0, 0, 0, (byte) 0x39 })).build()).build()).build(), nodeD.getCRouterIdentifier());

    final ByteBuf buffer = Unpooled.buffer();
    this.registry.serializeNlriType(this.dest, buffer);
    assertArrayEquals(this.nodeNlri, ByteArray.readAllBytes(buffer));

    // test BI form
    final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder
            .create();
    linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);

    final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
    protocolId.withNodeIdentifier(LinkstateNlriParser.PROTOCOL_ID_NID);
    protocolId.withValue("isis-level2");
    linkstateBI.addChild(protocolId.build());

    final ImmutableLeafNodeBuilder<BigInteger> identifier = new ImmutableLeafNodeBuilder<>();
    identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
    identifier.withValue(BigInteger.ONE);
    linkstateBI.addChild(identifier.build());

    final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
    objectType.withNodeIdentifier(LinkstateNlriParser.OBJECT_TYPE_NID);

    final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> nodeDescriptors = Builders.containerBuilder();
    nodeDescriptors.withNodeIdentifier(LinkstateNlriParser.NODE_DESCRIPTORS_NID);

    final ImmutableLeafNodeBuilder<Long> asNumber = new ImmutableLeafNodeBuilder<>();
    asNumber.withNodeIdentifier(NodeNlriParser.AS_NUMBER_NID);
    asNumber.withValue(72L);
    nodeDescriptors.addChild(asNumber.build());

    final ImmutableLeafNodeBuilder<Long> areaID = new ImmutableLeafNodeBuilder<>();
    areaID.withNodeIdentifier(NodeNlriParser.AREA_NID);
    areaID.withValue(2697513L); nodeDescriptors.addChild(areaID.build());

    final ImmutableLeafNodeBuilder<Long> domainID = new ImmutableLeafNodeBuilder<>();
    domainID.withNodeIdentifier(NodeNlriParser.DOMAIN_NID);
    domainID.withValue(0x28282828L);
    nodeDescriptors.addChild(domainID.build());

    final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId = Builders.choiceBuilder();
    crouterId.withNodeIdentifier(C_ROUTER_ID_NID);

    final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> isisNode = Builders.containerBuilder();
    isisNode.withNodeIdentifier(NodeNlriParser.ISIS_PSEUDONODE_NID);

    final ImmutableLeafNodeBuilder<byte[]> isoSystemID = new ImmutableLeafNodeBuilder<>();
    isoSystemID.withNodeIdentifier(NodeNlriParser.ISO_SYSTEM_NID);
    isoSystemID.withValue(new byte[]{0, 0, 0, 0, 0, (byte) 0x39});

    final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> isisPseudoRouter = Builders.containerBuilder();
    isisPseudoRouter.withNodeIdentifier(NodeNlriParser.ISIS_ROUTER_NID);
    isisPseudoRouter.addChild(isoSystemID.build());

    isisNode.addChild(isisPseudoRouter.build());
    isisNode.addChild(Builders.leafBuilder().withNodeIdentifier(NodeNlriParser.PSN_NID).withValue((short) 5).build());
    crouterId.addChild(isisNode.build());

    nodeDescriptors.addChild(crouterId.build());
    objectType.addChild(nodeDescriptors.build());
    linkstateBI.addChild(objectType.build());

    assertEquals(this.dest, LinkstateNlriParser.extractLinkstateDestination(linkstateBI.build()));
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:81,代码来源:LinkstateNlriParserTest.java

示例10: testTELspNlri

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Test
public void testTELspNlri() throws BGPParsingException {
    setUp(this.teLspNlri);
    // test BA form
    assertNull(this.dest.getDistinguisher());
    assertEquals(ProtocolId.RsvpTe, this.dest.getProtocolId());
    assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
    final TeLspCase teCase = (TeLspCase) this.dest.getObjectType();

    assertEquals(new LspId(1L), teCase.getLspId());
    assertEquals(new TunnelId(1), teCase.getTunnelId());
    assertEquals(new Ipv4Address("1.2.3.4"), ((Ipv4Case) teCase.getAddressFamily()).getIpv4TunnelSenderAddress());
    assertEquals(new Ipv4Address("4.3.2.1"), ((Ipv4Case) teCase.getAddressFamily()).getIpv4TunnelEndpointAddress());

    // test BI form
    final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder.create();
    linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);

    final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
    protocolId.withNodeIdentifier(LinkstateNlriParser.PROTOCOL_ID_NID);
    protocolId.withValue("rsvp-te");
    linkstateBI.addChild(protocolId.build());

    final ImmutableLeafNodeBuilder<BigInteger> identifier = new ImmutableLeafNodeBuilder<>();
    identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
    identifier.withValue(BigInteger.ONE);
    linkstateBI.addChild(identifier.build());

    final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
    objectType.withNodeIdentifier(LinkstateNlriParser.OBJECT_TYPE_NID);

    final ImmutableLeafNodeBuilder<Long> lspId = new ImmutableLeafNodeBuilder<>();
    lspId.withNodeIdentifier(AbstractTeLspNlriCodec.LSP_ID);
    lspId.withValue(1L);

    final ImmutableLeafNodeBuilder<Integer> tunnelId = new ImmutableLeafNodeBuilder<>();
    tunnelId.withNodeIdentifier(AbstractTeLspNlriCodec.TUNNEL_ID);
    tunnelId.withValue(1);

    final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> addressFamily = Builders.choiceBuilder();
    addressFamily.withNodeIdentifier(AbstractTeLspNlriCodec.ADDRESS_FAMILY);

    final ImmutableLeafNodeBuilder<String> ipv4TunnelSenderAddress = new ImmutableLeafNodeBuilder<>();
    ipv4TunnelSenderAddress.withNodeIdentifier(AbstractTeLspNlriCodec.IPV4_TUNNEL_SENDER_ADDRESS);
    ipv4TunnelSenderAddress.withValue("1.2.3.4");

    final ImmutableLeafNodeBuilder<String> ipv4TunnelEndPointAddress = new ImmutableLeafNodeBuilder<>();
    ipv4TunnelEndPointAddress.withNodeIdentifier(AbstractTeLspNlriCodec.IPV4_TUNNEL_ENDPOINT_ADDRESS);
    ipv4TunnelEndPointAddress.withValue("4.3.2.1");

    addressFamily.addChild(ipv4TunnelSenderAddress.build());
    addressFamily.addChild(ipv4TunnelEndPointAddress.build());

    objectType.addChild(lspId.build());
    objectType.addChild(tunnelId.build());
    objectType.addChild(addressFamily.build());

    linkstateBI.addChild(objectType.build());
    assertEquals(this.dest, LinkstateNlriParser.extractLinkstateDestination(linkstateBI.build()));
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:61,代码来源:LinkstateNlriParserTest.java

示例11: unkeyedListEntryBuilder

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
public static DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> unkeyedListEntryBuilder() {
    return ImmutableUnkeyedListEntryNodeBuilder.create();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:4,代码来源:Builders.java

示例12: createBuilder

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
protected DataContainerNodeBuilder createBuilder(final NormalizedNode<?, ?> original) {
    checkArgument(original instanceof UnkeyedListEntryNode);
    return ImmutableUnkeyedListEntryNodeBuilder.create((UnkeyedListEntryNode) original);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:7,代码来源:UnkeyedListItemModificationStrategy.java

示例13: createEmptyValue

import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder; //导入依赖的package包/类
@Override
protected NormalizedNode<?, ?> createEmptyValue(final NormalizedNode<?, ?> original) {
    checkArgument(original instanceof UnkeyedListEntryNode);
    return ImmutableUnkeyedListEntryNodeBuilder.create()
            .withNodeIdentifier(((UnkeyedListEntryNode) original).getIdentifier()).build();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:7,代码来源:UnkeyedListItemModificationStrategy.java


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