• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LeafSetNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testExportedAttributesSetFirst

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
@Test
public void testExportedAttributesSetFirst() {
    final Long ourAs = 72L;
    final ContainerNode attributesSetBefore = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(ATTRS_EXTENSION_Q))
        .addChild(Builders.containerBuilder().withNodeIdentifier(AS_PATH_NID)
            .addChild(Builders.unkeyedListBuilder().withNodeIdentifier(SEGMENTS_NID)
                .addChild(SET_SEGMENT)
                .addChild(SEQ_SEGMENT)
                .build())
        .build())
        .build();
    final AttributeOperations operations  = AttributeOperations.getInstance(attributesSetBefore);
    final ContainerNode exportedAttributes = operations.exportedAttributes(attributesSetBefore, ourAs);

    // make sure our AS is prepended to the list (as the AS-PATH starts with AS-SET)
    final LeafSetNode<?> list = checkFirstLeafList(exportedAttributes);
    assertEquals(ourAs, list.getValue().iterator().next().getValue());
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:19,代码来源:AttributeOperationsTest.java


示例2: testExportedAttributesListFirst

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
@Test
public void testExportedAttributesListFirst() {
    final Long ourAs = 72L;
    final ContainerNode attributesListBefore = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(ATTRS_EXTENSION_Q))
        .addChild(Builders.containerBuilder().withNodeIdentifier(AS_PATH_NID)
            .addChild(Builders.unkeyedListBuilder().withNodeIdentifier(SEGMENTS_NID)
                .addChild(SEQ_SEGMENT)
                .addChild(SET_SEGMENT)
                .build())
        .build())
        .build();
    final AttributeOperations operations  = AttributeOperations.getInstance(attributesListBefore);
    final ContainerNode exportedAttributes = operations.exportedAttributes(attributesListBefore, ourAs);

    // make sure our AS is appended to the a-list (as the AS-PATH starts with A-LIST)
    final LeafSetNode<?> list = checkFirstLeafList(exportedAttributes);
    final Iterator<?> iter = list.getValue().iterator();
    assertEquals(ourAs, ((LeafSetEntryNode<?>)iter.next()).getValue());
    assertEquals(1L, ((LeafSetEntryNode<?>)iter.next()).getValue());
    assertEquals(2L, ((LeafSetEntryNode<?>)iter.next()).getValue());
    assertEquals(3L, ((LeafSetEntryNode<?>)iter.next()).getValue());
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:23,代码来源:AttributeOperationsTest.java


示例3: testExportedAttributesEmptyWithTransitive

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
@Test
public void testExportedAttributesEmptyWithTransitive() {
    final Long ourAs = 72L;
    final ContainerNode attributesSetBefore = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(ATTRS_EXTENSION_Q))
        .addChild(Builders.containerBuilder().withNodeIdentifier(ORIGIN_NID)
            .addChild(Builders.leafBuilder().withNodeIdentifier(ORIGIN_VALUE_NID).withValue(BgpOrigin.Egp).build())
        .build())
        .addChild(Builders.containerBuilder().withNodeIdentifier(AS_PATH_NID)
            .addChild(Builders.unkeyedListBuilder().withNodeIdentifier(SEGMENTS_NID).build())
        .build())
        .addChild(Builders.containerBuilder().withNodeIdentifier(ATOMIC_NID).build())
        .build();
    final AttributeOperations operations  = AttributeOperations.getInstance(attributesSetBefore);
    final ContainerNode exportedAttributes = operations.exportedAttributes(attributesSetBefore, ourAs);

    // Origin should be within exportedAttributes as it is Transitive
    assertTrue(exportedAttributes.getChild(ORIGIN_NID).isPresent());

    // AS-PATH should also be there with our AS
    final LeafSetNode<?> list = checkFirstLeafList(exportedAttributes);
    assertEquals(1, list.getValue().size());
    assertEquals(ourAs, list.getValue().iterator().next().getValue());

    // Atomic Aggregate should be filtered out
    assertFalse(exportedAttributes.getChild(ATOMIC_NID).isPresent());
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:27,代码来源:AttributeOperationsTest.java


示例4: getNodeReferencedByLeafref

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private static NormalizedNode<?, ?> getNodeReferencedByLeafref(final RevisionAwareXPath xpath,
        final NormalizedNodeContext currentNodeContext, final SchemaContext schemaContext,
        final TypedDataSchemaNode correspondingSchemaNode, final Object nodeValue) {
    final NormalizedNode<?, ?> referencedNode = xpath.isAbsolute() ? getNodeReferencedByAbsoluteLeafref(xpath,
            currentNodeContext, schemaContext, correspondingSchemaNode) : getNodeReferencedByRelativeLeafref(xpath,
            currentNodeContext, schemaContext, correspondingSchemaNode);

    if (referencedNode instanceof LeafSetNode) {
        return getReferencedLeafSetEntryNode((LeafSetNode<?>) referencedNode, nodeValue);
    }

    if (referencedNode instanceof LeafNode && referencedNode.getValue().equals(nodeValue)) {
        return referencedNode;
    }

    return null;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:18,代码来源:YangFunctionContext.java


示例5: resolveWrittenShard

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void resolveWrittenShard(final DataTreeCandidateNode childNode) {
    final MapEntryNode entryNode = (MapEntryNode) childNode.getDataAfter().get();
    final LeafNode<YangInstanceIdentifier> prefix =
            (LeafNode<YangInstanceIdentifier>) entryNode.getChild(new NodeIdentifier(SHARD_PREFIX_QNAME)).get();

    final YangInstanceIdentifier identifier = prefix.getValue();

    LOG.debug("{}: Deserialized {} from datastore", logName, identifier);

    final ContainerNode replicas =
            (ContainerNode) entryNode.getChild(new NodeIdentifier(SHARD_REPLICAS_QNAME)).get();

    final LeafSetNode<String> replicaList =
            (LeafSetNode<String>) replicas.getChild(new NodeIdentifier(SHARD_REPLICA_QNAME)).get();

    final List<MemberName> retReplicas = replicaList.getValue().stream()
            .map(child -> MemberName.forName(child.getValue()))
            .collect(Collectors.toList());

    LOG.debug("{}: Replicas read from ds {}", logName, retReplicas.toString());

    final PrefixShardConfiguration newConfig =
            new PrefixShardConfiguration(new DOMDataTreeIdentifier(type, identifier),
                    PrefixShardStrategy.NAME, retReplicas);

    LOG.debug("{}: Resulting config {} - sending PrefixShardCreated to {}", logName, newConfig, handlingActor);

    handlingActor.tell(new PrefixShardCreated(newConfig), noSender());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:31,代码来源:PrefixedShardConfigUpdateHandler.java


示例6: createTestContainer

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

        final LeafSetEntryNode<Object> nike = ImmutableLeafSetEntryNodeBuilder.create()
                .withNodeIdentifier(
                        new YangInstanceIdentifier.NodeWithValue<>(QName.create(TEST_QNAME, "shoe"), "nike"))
                .withValue("nike").build();
        final LeafSetEntryNode<Object> puma = ImmutableLeafSetEntryNodeBuilder.create()
                .withNodeIdentifier(
                        new YangInstanceIdentifier.NodeWithValue<>(QName.create(TEST_QNAME, "shoe"), "puma"))
                .withValue("puma").build();
        final LeafSetNode<Object> shoes = ImmutableLeafSetNodeBuilder.create()
                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME, "shoe")))
                .withChild(nike).withChild(puma).build();

        final LeafSetEntryNode<Object> five = ImmutableLeafSetEntryNodeBuilder.create()
                .withNodeIdentifier(new YangInstanceIdentifier.NodeWithValue<>(QName.create(TEST_QNAME, "number"), 5))
                .withValue(5).build();
        final LeafSetEntryNode<Object> fifteen = ImmutableLeafSetEntryNodeBuilder.create()
                .withNodeIdentifier(
                        new YangInstanceIdentifier.NodeWithValue<>(QName.create(TEST_QNAME, "number"), 15))
                .withValue(15).build();
        final LeafSetNode<Object> numbers = ImmutableLeafSetNodeBuilder.create()
                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME, "number")))
                .withChild(five).withChild(fifteen).build();

        Set<QName> childAugmentations = new HashSet<>();
        childAugmentations.add(AUG_QNAME);
        final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
                new YangInstanceIdentifier.AugmentationIdentifier(childAugmentations);
        final AugmentationNode augmentationNode = Builders.augmentationBuilder()
                .withNodeIdentifier(augmentationIdentifier).withChild(ImmutableNodes.leafNode(AUG_QNAME, "First Test"))
                .build();
        return ImmutableContainerNodeBuilder.create()
                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
                .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC)).withChild(augmentationNode).withChild(shoes)
                .withChild(numbers).withChild(mapNodeBuilder(OUTER_LIST_QNAME)
                        .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID)).withChild(BAR_NODE).build())
                .build();

    }
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:41,代码来源:CompositeModel.java


示例7: extractAsList

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private static List<AsNumber> extractAsList(final UnkeyedListEntryNode segment, final NodeIdentifier nid) {
    final List<AsNumber> ases = new ArrayList<>();
    final Optional<NormalizedNode<?, ?>> maybeAsList = NormalizedNodes.findNode(segment, nid);
    if (maybeAsList.isPresent()) {
        final LeafSetNode<?> list = (LeafSetNode<?>)maybeAsList.get();
        for (final LeafSetEntryNode<?> as : list.getValue())  {
            ases.add(new AsNumber((Long)as.getValue()));
        }
        return ases;
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:13,代码来源:BestPathStateImpl.java


示例8: effectiveAttributes

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
@Override
public ContainerNode effectiveAttributes(final ContainerNode attributes) {
    final AttributeOperations oper = AttributeOperations.getInstance(attributes);

    /*
     * This is an implementation of https://tools.ietf.org/html/rfc4456#section-8
     *
     * We first check the ORIGINATOR_ID, if present. If it matches our BGP identifier,
     * we filter the route.
     */
    final Object originatorId = oper.getOriginatorId(attributes);
    if (this.bgpIdentifier.getValue().equals(originatorId)) {
        LOG.debug("Filtering route with our ORIGINATOR_ID {}", this.bgpIdentifier);
        return null;
    }

    /*
     * Second we check CLUSTER_LIST, if present. If it contains our CLUSTER_ID, we issue
     * a warning and ignore the route.
     */
    final LeafSetNode<?> clusterList = oper.getClusterList(attributes);
    if (clusterList != null) {
        for (final LeafSetEntryNode<?> node : clusterList.getValue()) {
            if (this.clusterIdentifier.getValue().equals(node.getValue())) {
                LOG.info("Received a route with our CLUSTER_ID {} in CLUSTER_LIST {}, filtering it", this.clusterIdentifier.getValue(), clusterList);
                return null;
            }
        }
    }

    return attributes;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:33,代码来源:FromInternalImportPolicy.java


示例9: reusableSegment

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private LeafSetNode<?> reusableSegment(final UnkeyedListEntryNode segment) {
    final Optional<NormalizedNode<?, ?>> maybeAsSequence = NormalizedNodes.findNode(segment, this.asPathSequence);
    if (maybeAsSequence.isPresent()) {
        final LeafSetNode<?> asList = (LeafSetNode<?>) maybeAsSequence.get();
        if (asList.getValue().size() < Values.UNSIGNED_BYTE_MAX_VALUE) {
            return asList;
        }
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:11,代码来源:AttributeOperations.java


示例10: addOtherClusterEntries

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private static void addOtherClusterEntries(final Optional<NormalizedNode<?, ?>> maybeClusterList, final ListNodeBuilder<Object,
    LeafSetEntryNode<Object>> clb) {
    final NormalizedNode<?, ?> clusterList = maybeClusterList.get();
    if (clusterList instanceof LeafSetNode) {
        for (final LeafSetEntryNode<?> n : ((LeafSetNode<?>) clusterList).getValue()) {
            // There's no way we can safely avoid this cast
            @SuppressWarnings("unchecked")
            final LeafSetEntryNode<Object> child = (LeafSetEntryNode<Object>) n;
            clb.addChild(child);
        }
    } else {
        LOG.warn("Ignoring malformed CLUSTER_LIST {}", clusterList);
    }
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:15,代码来源:AttributeOperations.java


示例11: getClusterList

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
LeafSetNode<?> getClusterList(final ContainerNode attributes) {
    final Optional<NormalizedNode<?, ?>> maybeClusterList = NormalizedNodes.findNode(attributes, this.clusterListPath);
    if (maybeClusterList.isPresent()) {
        final NormalizedNode<?, ?> clusterList = maybeClusterList.get();
        if (clusterList instanceof LeafSetNode) {
            return (LeafSetNode<?>) clusterList;
        }

        LOG.warn("Unexpected CLUSTER_LIST node {}, ignoring it", clusterList);
    }

    return null;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:14,代码来源:AttributeOperations.java


示例12: checkFirstLeafList

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private static LeafSetNode<?> checkFirstLeafList(final ContainerNode exportedAttributes) {
    assertTrue(NormalizedNodes.findNode(exportedAttributes, AS_PATH_NID, SEGMENTS_NID).isPresent());
    final UnkeyedListNode segments = (UnkeyedListNode) NormalizedNodes.findNode(exportedAttributes, AS_PATH_NID, SEGMENTS_NID).get();
    final UnkeyedListEntryNode seg = segments.getValue().iterator().next();
    final DataContainerChild<? extends PathArgument, ?> firstLeafList = seg.getValue().iterator().next();
    return (LeafSetNode<?>) firstLeafList;
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:8,代码来源:AttributeOperationsTest.java


示例13: create

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
public static <T> ListNodeBuilder<T, LeafSetEntryNode<T>> create(final LeafSetNode<T> node) {
    if (!(node instanceof ImmutableOrderedLeafSetNode<?>)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableOrderedLeafSetNodeBuilder<>((ImmutableOrderedLeafSetNode<T>) node);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:8,代码来源:ImmutableOrderedLeafSetNodeBuilder.java


示例14: create

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
public static <T> ListNodeBuilder<T, LeafSetEntryNode<T>> create(final LeafListSchemaNode schema,
        final LeafSetNode<T> node) {
    if (!(node instanceof ImmutableOrderedLeafSetNode<?>)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableOrderedLeafSetNodeSchemaAwareBuilder<>(schema, (ImmutableOrderedLeafSetNode<T>) node);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:9,代码来源:ImmutableOrderedLeafSetNodeSchemaAwareBuilder.java


示例15: create

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
public static <T> ListNodeBuilder<T, LeafSetEntryNode<T>> create(final LeafListSchemaNode schema,
        final LeafSetNode<T> node) {
    if (!(node instanceof ImmutableLeafSetNode<?>)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableLeafSetNodeSchemaAwareBuilder<>(schema, (ImmutableLeafSetNode<T>) node);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:9,代码来源:ImmutableLeafSetNodeSchemaAwareBuilder.java


示例16: create

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
public static <T> ListNodeBuilder<T, LeafSetEntryNode<T>> create(final LeafSetNode<T> node) {
    if (!(node instanceof ImmutableLeafSetNode<?>)) {
        throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
    }

    return new ImmutableLeafSetNodeBuilder<>((ImmutableLeafSetNode<T>) node);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:8,代码来源:ImmutableLeafSetNodeBuilder.java


示例17: createLeafRefLeafListNode

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
private static LeafSetNode<?> createLeafRefLeafListNode() {

        final ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafSetBuilder = Builders
                .leafSetBuilder();
        leafSetBuilder.withNodeIdentifier(new NodeIdentifier(leafrefLeafList));

        leafSetBuilder.addChild(createLeafSetEntry(leafrefLeafList, "k1"));
        leafSetBuilder.addChild(createLeafSetEntry(leafrefLeafList, "k2"));
        leafSetBuilder.addChild(createLeafSetEntry(leafrefLeafList, "k3"));

        return leafSetBuilder.build();
    }
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:13,代码来源:DataTreeCandidateValidatorTest.java


示例18: minMaxLeafListPass

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

    final NodeWithValue<Object> barPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "bar");
    final NodeWithValue<Object> gooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "goo");

    final LeafSetEntryNode<Object> barLeafSetEntry = ImmutableLeafSetEntryNodeBuilder.create()
            .withNodeIdentifier(barPath)
            .withValue("bar").build();
    final LeafSetEntryNode<Object> gooLeafSetEntry = ImmutableLeafSetEntryNodeBuilder.create()
            .withNodeIdentifier(gooPath)
            .withValue("goo").build();

    final LeafSetNode<Object> fooLeafSetNode = ImmutableLeafSetNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME))
            .withChildValue("foo").build();

    modificationTree.write(MIN_MAX_LEAF_LIST_PATH, fooLeafSetNode);
    modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(barPath), barLeafSetEntry);
    modificationTree.merge(MIN_MAX_LEAF_LIST_PATH.node(gooPath), gooLeafSetEntry);
    modificationTree.delete(MIN_MAX_LEAF_LIST_PATH.node(gooPath));
    modificationTree.ready();

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

    final DataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
    final Optional<NormalizedNode<?, ?>> masterContainer = snapshotAfterCommit.readNode(MASTER_CONTAINER_PATH);
    assertTrue(masterContainer.isPresent());
    final Optional<NormalizedNodeContainer<?, ?, ?>> leafList = ((NormalizedNodeContainer) masterContainer.get())
            .getChild(new NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME));
    assertTrue(leafList.isPresent());
    assertTrue(leafList.get().getValue().size() == 2);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:37,代码来源:ListConstraintsValidation.java


示例19: minMaxLeafListFail

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

    final NodeWithValue<Object> fooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "foo");
    final NodeWithValue<Object> barPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "bar");
    final NodeWithValue<Object> gooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "goo");
    final NodeWithValue<Object> fuuPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "fuu");

    final LeafSetEntryNode<Object> barLeafSetEntry = ImmutableLeafSetEntryNodeBuilder.create()
            .withNodeIdentifier(barPath)
            .withValue("bar").build();
    final LeafSetEntryNode<Object> gooLeafSetEntry = ImmutableLeafSetEntryNodeBuilder.create()
            .withNodeIdentifier(gooPath)
            .withValue("goo").build();
    final LeafSetEntryNode<Object> fuuLeafSetEntry = ImmutableLeafSetEntryNodeBuilder.create()
            .withNodeIdentifier(fuuPath)
            .withValue("fuu").build();

    final LeafSetNode<Object> fooLeafSetNode = ImmutableLeafSetNodeBuilder.create()
            .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME))
            .withChildValue("foo").build();

    modificationTree.write(MIN_MAX_LEAF_LIST_PATH, fooLeafSetNode);
    modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(barPath), barLeafSetEntry);
    modificationTree.merge(MIN_MAX_LEAF_LIST_PATH.node(gooPath), gooLeafSetEntry);
    modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(fuuPath), fuuLeafSetEntry);
    modificationTree.ready();

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


示例20: immutableOrderedLeafSetNodeBuilderTest

import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; //导入依赖的package包/类
@Test
public void immutableOrderedLeafSetNodeBuilderTest() {
    final NormalizedNode<?, ?> orderedLeafSet = ImmutableOrderedLeafSetNodeBuilder.<String>create()
            .withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST)
            .withChild(LEAF_SET_ENTRY_NODE)
            .withChildValue("baz")
            .removeChild(BAR_PATH)
            .build();
    final LinkedList<LeafSetNode<?>> mapEntryNodeColl = new LinkedList<>();
    mapEntryNodeColl.add((LeafSetNode<?>)orderedLeafSet);
    final UnmodifiableCollection<?> leafSetCollection = (UnmodifiableCollection<?>)orderedLeafSet.getValue();
    final NormalizedNode<?, ?> orderedMapNodeSchemaAware = ImmutableOrderedLeafSetNodeSchemaAwareBuilder.create(
        leafList).withChildValue("baz").build();
    final UnmodifiableCollection<?> SchemaAwareleafSetCollection =
            (UnmodifiableCollection<?>)orderedMapNodeSchemaAware.getValue();
    final NormalizedNode<?, ?> orderedLeafSetShemaAware = ImmutableOrderedLeafSetNodeSchemaAwareBuilder.create(
        leafList,(LeafSetNode<?>)orderedLeafSet).build();

    assertNotNull(Builders.orderedLeafSetBuilder(leafList));
    assertNotNull(Builders.anyXmlBuilder());
    assertNotNull(orderedLeafSetShemaAware);
    assertEquals(1, ((OrderedLeafSetNode<?>)orderedLeafSet).getSize());
    assertEquals("baz", ((OrderedLeafSetNode<?>)orderedLeafSet).getChild(0).getValue());
    assertNotNull(((OrderedLeafSetNode<?>)orderedLeafSet).getChild(BAR_PATH));
    assertEquals(1, leafSetCollection.size());
    assertEquals(1, SchemaAwareleafSetCollection.size());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:28,代码来源:BuilderTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RequestException类代码示例发布时间:2022-05-22
下一篇:
Java AllowedSolution类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap