本文整理汇总了Java中org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode类的典型用法代码示例。如果您正苦于以下问题:Java OrderedLeafSetNode类的具体用法?Java OrderedLeafSetNode怎么用?Java OrderedLeafSetNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OrderedLeafSetNode类属于org.opendaylight.yangtools.yang.data.api.schema包,在下文中一共展示了OrderedLeafSetNode类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: immutableOrderedLeafSetNodeBuilderTest
import org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode; //导入依赖的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());
}
示例2: testNormalizedNodeWriter
import org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode; //导入依赖的package包/类
@Test
public void testNormalizedNodeWriter() throws IOException {
final NormalizedNodeStreamWriter loggingNormalizedNodeStreamWriter = new LoggingNormalizedNodeStreamWriter();
final NormalizedNodeWriter orderedNormalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(
loggingNormalizedNodeStreamWriter);
assertEquals(loggingNormalizedNodeStreamWriter, orderedNormalizedNodeWriter.getWriter());
final NormalizedNode<?, ?> mockedNormalizedNode = mock(NormalizedNode.class);
try {
orderedNormalizedNodeWriter.write(mockedNormalizedNode);
fail("An IllegalStateException should have been thrown!");
} catch (IllegalStateException ex) {
assertTrue(ex.getMessage().startsWith("It wasn't possible to serialize node"));
}
final NormalizedNode<?, ?> mockedLeafSetEntryNode = mock(LeafSetEntryNode.class);
doReturn(new NodeWithValue<>(myLeafList, "leaflist-value-1")).when(mockedLeafSetEntryNode).getIdentifier();
doReturn("leaflist-value-1").when(mockedLeafSetEntryNode).getValue();
assertNotNull(orderedNormalizedNodeWriter.write(mockedLeafSetEntryNode));
final NormalizedNode<?, ?> mockedLeafNode = mock(LeafNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedLeafNode));
doReturn("leaf-value-1").when(mockedLeafNode).getValue();
assertNotNull(orderedNormalizedNodeWriter.write(mockedLeafNode));
final NormalizedNode<?, ?> mockedAnyXmlNode = mock(AnyXmlNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedAnyXmlNode));
final NormalizedNode<?, ?> mockedContainerNode = mock(ContainerNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedContainerNode));
final NormalizedNode<?, ?> mockedYangModeledAnyXmlNode = mock(YangModeledAnyXmlNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedYangModeledAnyXmlNode));
final MapEntryNode mockedMapEntryNode = mock(MapEntryNode.class);
doReturn(new NodeIdentifierWithPredicates(myKeyedList, myKeyLeaf, "list-key-value-1"))
.when(mockedMapEntryNode).getIdentifier();
doReturn(Optional.empty()).when(mockedMapEntryNode).getChild(any(NodeIdentifier.class));
assertNotNull(orderedNormalizedNodeWriter.write(mockedMapEntryNode));
final UnkeyedListEntryNode mockedUnkeyedListEntryNode = mock(UnkeyedListEntryNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedUnkeyedListEntryNode));
final ChoiceNode mockedChoiceNode = mock(ChoiceNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedChoiceNode));
final AugmentationNode mockedAugmentationNode = mock(AugmentationNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedAugmentationNode));
final UnkeyedListNode mockedUnkeyedListNode = mock(UnkeyedListNode.class);
final Set<?> value = ImmutableSet.builder().add(mockedUnkeyedListEntryNode).build();
doReturn(value).when(mockedUnkeyedListNode).getValue();
assertNotNull(orderedNormalizedNodeWriter.write(mockedUnkeyedListNode));
final OrderedMapNode mockedOrderedMapNode = mock(OrderedMapNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedOrderedMapNode));
final MapNode mockedMapNode = mock(MapNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedMapNode));
final OrderedLeafSetNode<?> mockedOrderedLeafSetNode = mock(OrderedLeafSetNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedOrderedLeafSetNode));
final LeafSetNode<?> mockedLeafSetNode = mock(LeafSetNode.class);
assertNotNull(orderedNormalizedNodeWriter.write(mockedLeafSetNode));
orderedNormalizedNodeWriter.flush();
orderedNormalizedNodeWriter.close();
final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(
loggingNormalizedNodeStreamWriter, false);
assertNotNull(normalizedNodeWriter.write(mockedMapEntryNode));
normalizedNodeWriter.flush();
normalizedNodeWriter.close();
}
示例3: createBuilder
import org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
protected NormalizedNodeContainerBuilder createBuilder(final NormalizedNode<?, ?> original) {
checkArgument(original instanceof OrderedLeafSetNode<?>);
return ImmutableOrderedLeafSetNodeBuilder.create((OrderedLeafSetNode<?>) original);
}
示例4: createEmptyValue
import org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode; //导入依赖的package包/类
@Override
protected NormalizedNode<?, ?> createEmptyValue(final NormalizedNode<?, ?> original) {
checkArgument(original instanceof OrderedLeafSetNode<?>);
return ImmutableOrderedLeafSetNodeBuilder.create()
.withNodeIdentifier(((OrderedLeafSetNode<?>) original).getIdentifier()).build();
}
示例5: build
import org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode; //导入依赖的package包/类
@Override
public OrderedLeafSetNode<T> build() {
dirty = true;
return new ImmutableOrderedLeafSetNode<>(nodeIdentifier, value);
}