import org.opendaylight.controller.cluster.datastore.util.TestModel;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@Test
public void toStringNodeIdentifier(){
- YangInstanceIdentifier.PathArgument pathArgument = nodeIdentifier();
+ PathArgument pathArgument = nodeIdentifier();
String expected = "(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test";
public void toStringAugmentationIdentifier(){
String expected = "AugmentationIdentifier{childNames=[(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics]}";
- YangInstanceIdentifier.PathArgument pathArgument = augmentationIdentifier();
+ PathArgument pathArgument = augmentationIdentifier();
assertEquals(expected, PathUtils.toString(pathArgument));
}
@Test
public void toStringNodeWithValue(){
- YangInstanceIdentifier.PathArgument pathArgument = nodeWithValue();
+ PathArgument pathArgument = nodeWithValue();
String expected = "(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test[100]";
@Test
public void toStringNodeIdentifierWithPredicates(){
- YangInstanceIdentifier.PathArgument pathArgument = nodeIdentifierWithPredicates();
+ PathArgument pathArgument = nodeIdentifierWithPredicates();
String expected = "(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=100}]";
}
- private static YangInstanceIdentifier.NodeIdentifier nodeIdentifier(){
- return new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME);
+ private static NodeIdentifier nodeIdentifier(){
+ return new NodeIdentifier(TestModel.TEST_QNAME);
}
- private static YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier(){
+ private static AugmentationIdentifier augmentationIdentifier(){
Set<QName> childNames = ImmutableSet.of(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics"));
- return new YangInstanceIdentifier.AugmentationIdentifier(childNames);
+ return new AugmentationIdentifier(childNames);
}
- private static YangInstanceIdentifier.NodeWithValue nodeWithValue(){
- return new YangInstanceIdentifier.NodeWithValue(TestModel.TEST_QNAME, Integer.valueOf(100));
+ private static NodeWithValue<?> nodeWithValue(){
+ return new NodeWithValue<>(TestModel.TEST_QNAME, Integer.valueOf(100));
}
- private static YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates(){
+ private static NodeIdentifierWithPredicates nodeIdentifierWithPredicates(){
Map<QName, Object> keys = new HashMap<>();
keys.put(TestModel.ID_QNAME, Integer.valueOf(100));
- return new YangInstanceIdentifier.NodeIdentifierWithPredicates(TestModel.TEST_QNAME, keys);
+ return new NodeIdentifierWithPredicates(TestModel.TEST_QNAME, keys);
}
}
import org.opendaylight.controller.cluster.datastore.util.TestModel;
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import java.net.URI;
import java.util.Date;
import java.util.HashMap;
expectedException.expect(NullPointerException.class);
expectedException.expectMessage("context should not be null");
- PathArgumentSerializer.serialize(null, mock(
- YangInstanceIdentifier.PathArgument.class));
+ PathArgumentSerializer.serialize(null, mock(PathArgument.class));
}
@Test
NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
.serialize(serializationContext,
- new YangInstanceIdentifier.NodeIdentifier(
+ new NodeIdentifier(
TestModel.TEST_QNAME));
assertEquals(PathArgumentType.NODE_IDENTIFIER.ordinal(), actual.getIntType());
NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
.serialize(serializationContext,
- new YangInstanceIdentifier.NodeWithValue(
+ new NodeWithValue<>(
TestModel.TEST_QNAME, "foo"));
assertEquals(PathArgumentType.NODE_IDENTIFIER_WITH_VALUE.ordinal(), actual.getIntType());
NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
.serialize(serializationContext,
- new YangInstanceIdentifier.NodeIdentifierWithPredicates(
- TestModel.TEST_QNAME, predicates));
+ new NodeIdentifierWithPredicates(TestModel.TEST_QNAME, predicates));
assertEquals(PathArgumentType.NODE_IDENTIFIER_WITH_PREDICATES.ordinal(), actual.getIntType());
assertEquals(5, actual.getNodeType().getLocalName());
NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
.serialize(serializationContext,
- new YangInstanceIdentifier.AugmentationIdentifier(
- ImmutableSet.of(TestModel.TEST_QNAME)));
+ new AugmentationIdentifier(ImmutableSet.of(TestModel.TEST_QNAME)));
assertEquals(PathArgumentType.AUGMENTATION_IDENTIFIER.ordinal(), actual.getIntType());
nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
- YangInstanceIdentifier.PathArgument pathArgument =
- NormalizedNodeSerializer
- .deSerialize(nodeBuilder.build(), pathBuilder.build());
+ PathArgument pathArgument = NormalizedNodeSerializer.deSerialize(nodeBuilder.build(), pathBuilder.build());
- assertEquals(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME), pathArgument);
+ assertEquals(new NodeIdentifier(TestModel.TEST_QNAME), pathArgument);
}
nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
- YangInstanceIdentifier.PathArgument pathArgument =
- NormalizedNodeSerializer
- .deSerialize(nodeBuilder.build(), pathBuilder.build());
+ PathArgument pathArgument = NormalizedNodeSerializer.deSerialize(nodeBuilder.build(), pathBuilder.build());
- assertEquals(new YangInstanceIdentifier.NodeWithValue(TestModel.TEST_QNAME, "foo"), pathArgument);
+ assertEquals(new NodeWithValue<>(TestModel.TEST_QNAME, "foo"), pathArgument);
}
@Test
nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
- YangInstanceIdentifier.PathArgument pathArgument =
- NormalizedNodeSerializer
- .deSerialize(nodeBuilder.build(), pathBuilder.build());
+ PathArgument pathArgument = NormalizedNodeSerializer.deSerialize(nodeBuilder.build(), pathBuilder.build());
- assertEquals(new YangInstanceIdentifier.NodeIdentifierWithPredicates(TestModel.TEST_QNAME,
+ assertEquals(new NodeIdentifierWithPredicates(TestModel.TEST_QNAME,
ImmutableMap.<QName, Object>of(TestModel.TEST_QNAME, "foo")), pathArgument);
}
nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
- YangInstanceIdentifier.PathArgument pathArgument =
- NormalizedNodeSerializer
- .deSerialize(nodeBuilder.build(), pathBuilder.build());
-
- assertEquals(new YangInstanceIdentifier.AugmentationIdentifier(ImmutableSet.of(TestModel.TEST_QNAME)), pathArgument);
+ PathArgument pathArgument = NormalizedNodeSerializer.deSerialize(nodeBuilder.build(), pathBuilder.build());
+ assertEquals(new AugmentationIdentifier(ImmutableSet.of(TestModel.TEST_QNAME)), pathArgument);
}
-
-
-
}
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
private static NormalizedNode<?, ?> createTestContainer() {
byte[] bytes1 = {1,2,3};
LeafSetEntryNode<Object> entry1 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).
- withValue(bytes1).build();
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).withValue(bytes1).build();
byte[] bytes2 = {};
LeafSetEntryNode<Object> entry2 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, bytes2)).
- withValue(bytes2).build();
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes2)).withValue(bytes2).build();
LeafSetEntryNode<Object> entry3 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, null)).
- withValue(null).build();
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, null)).withValue(null).build();
return TestModel.createBaseTestContainerBuilder().
withChild(ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME)).
+ new NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME)).
withChild(entry1).withChild(entry2).withChild(entry3).build()).
withChild(ImmutableNodes.leafNode(TestModel.SOME_BINARY_DATA_QNAME, new byte[]{1,2,3,4})).
withChild(Builders.orderedMapBuilder().
- withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.ORDERED_LIST_QNAME)).
+ withNodeIdentifier(new NodeIdentifier(TestModel.ORDERED_LIST_QNAME)).
withChild(ImmutableNodes.mapEntry(TestModel.ORDERED_LIST_ENTRY_QNAME,
TestModel.ID_QNAME, 11)).build()).
build();
assertEquals(ValueTypes.STRING_BYTES_TYPE, ValueTypes.getSerializableType(largeString));
}
- private String largeString(int minSize){
+ private static String largeString(int minSize){
final int pow = (int) (Math.log(minSize * 2) / Math.log(2));
String s = "X";
for(int i=0;i<pow;i++){
import org.opendaylight.controller.cluster.datastore.util.TestModel;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
@Override
public void visitNode(int level, String parentPath, NormalizedNode<?, ?> normalizedNode) {
- if(!(normalizedNode.getIdentifier() instanceof YangInstanceIdentifier.AugmentationIdentifier)) {
+ if(!(normalizedNode.getIdentifier() instanceof AugmentationIdentifier)) {
if (normalizedNode.getIdentifier().getNodeType().getNamespace().toString().contains(namespaceFilter)) {
count.incrementAndGet();
}
}
}
- }).navigate(YangInstanceIdentifier.builder().build().toString(), normalizedNode);
+ }).navigate(YangInstanceIdentifier.EMPTY.toString(), normalizedNode);
return count.get();
}
@Test
public void testLeafNodeHasNoParent() throws IOException {
NormalizedNode<?, ?> input = Builders.leafBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.DESC_QNAME)).withValue("test").build();
+ new NodeIdentifier(TestModel.DESC_QNAME)).withValue("test").build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
NormalizedNode<?, ?> actual = prunerFullSchema.normalizedNode();
@Test
public void testLeafNodeHasParent() throws IOException {
LeafNode<Object> child = Builders.leafBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.DESC_QNAME)).withValue("test").build();
+ new NodeIdentifier(TestModel.DESC_QNAME)).withValue("test").build();
NormalizedNode<?, ?> input = Builders.containerBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME)).withChild(child).build();
+ new NodeIdentifier(TestModel.AUG_CONT_QNAME)).withChild(child).build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
NormalizedNode<?, ?> actual = prunerFullSchema.normalizedNode();
@Test
public void testLeafNodeSchemaMissing() throws IOException {
prunerNoAugSchema.stack().push(normalizedNodeBuilderWrapper);
- prunerNoAugSchema.leafNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME), mock(Object.class));
+ prunerNoAugSchema.leafNode(new NodeIdentifier(TestModel.AUG_CONT_QNAME), mock(Object.class));
verify(normalizedNodeContainerBuilder, never()).addChild(any(NormalizedNode.class));
}
@Test
public void testLeafSetEntryNodeHasNoParent() throws IOException {
NormalizedNode<?, ?> input = Builders.leafSetEntryBuilder().withValue("test").withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue<>(TestModel.FAMILY_QNAME, "test")).build();
+ new NodeWithValue<>(TestModel.FAMILY_QNAME, "test")).build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
NormalizedNode<?, ?> actual = prunerFullSchema.normalizedNode();
@Test
public void testLeafSetEntryNodeHasParent() throws IOException {
LeafSetEntryNode<Object> child = Builders.leafSetEntryBuilder().withValue("test").withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue<>(TestModel.FAMILY_QNAME, "test")).build();
+ new NodeWithValue<>(TestModel.FAMILY_QNAME, "test")).build();
NormalizedNode<?, ?> input = Builders.leafSetBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.FAMILY_QNAME)).withChild(child).build();
+ new NodeIdentifier(TestModel.FAMILY_QNAME)).withChild(child).build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
NormalizedNode<?, ?> actual = prunerFullSchema.normalizedNode();
@Test
public void testLeafSetEntryNodeSchemaMissing() throws IOException {
- doReturn(new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME)).when(normalizedNodeBuilderWrapper).identifier();
+ doReturn(new NodeIdentifier(TestModel.AUG_CONT_QNAME)).when(normalizedNodeBuilderWrapper).identifier();
prunerNoAugSchema.stack().push(normalizedNodeBuilderWrapper);
prunerNoAugSchema.leafSetEntryNode(TestModel.AUG_CONT_QNAME, "");
@Test
public void testAnyXMLNodeHasNoParent() throws IOException {
NormalizedNode<?, ?> input = Builders.anyXmlBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.CHILD_NAME_QNAME)).
+ new NodeIdentifier(TestModel.CHILD_NAME_QNAME)).
withValue(mock(DOMSource.class)).build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
@Test
public void testAnyXMLNodeHasParent() throws IOException {
AnyXmlNode child = Builders.anyXmlBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.CHILD_NAME_QNAME)).
+ new NodeIdentifier(TestModel.CHILD_NAME_QNAME)).
withValue(mock(DOMSource.class)).build();
NormalizedNode<?, ?> input = Builders.containerBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME)).withChild(child).build();
+ new NodeIdentifier(TestModel.AUG_CONT_QNAME)).withChild(child).build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
NormalizedNode<?, ?> actual = prunerFullSchema.normalizedNode();
@Test
public void testAnyXmlNodeSchemaMissing() throws IOException {
prunerNoAugSchema.stack().push(normalizedNodeBuilderWrapper);
- prunerNoAugSchema.anyxmlNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME), mock(DOMSource.class));
+ prunerNoAugSchema.anyxmlNode(new NodeIdentifier(TestModel.AUG_CONT_QNAME), mock(DOMSource.class));
verify(normalizedNodeContainerBuilder, never()).addChild(any(NormalizedNode.class));
}
@Test
public void testLeafSetPushesBuilderToStack() throws IOException {
- prunerFullSchema.startLeafSet(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startLeafSet(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartContainerNodePushesBuilderToStack() throws IOException {
- prunerFullSchema.startContainerNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startContainerNode(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartUnkeyedListPushesBuilderToStack() throws IOException {
- prunerFullSchema.startUnkeyedList(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startUnkeyedList(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartUnkeyedListItemPushesBuilderToStack() throws IOException {
- prunerFullSchema.startUnkeyedListItem(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startUnkeyedListItem(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartMapNodePushesBuilderToStack() throws IOException {
- prunerFullSchema.startMapNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startMapNode(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartMapEntryNodePushesBuilderToStack() throws IOException {
prunerFullSchema.startMapEntryNode(
- new YangInstanceIdentifier.NodeIdentifierWithPredicates(TestModel.BOOLEAN_LEAF_QNAME,
+ new NodeIdentifierWithPredicates(TestModel.BOOLEAN_LEAF_QNAME,
ImmutableMap.<QName, Object>of(TestModel.BOOLEAN_LEAF_QNAME, "value")), 10);
assertEquals(1, prunerFullSchema.stack().size());
@Test
public void testStartOrderedMapNodePushesBuilderToStack() throws IOException {
- prunerFullSchema.startOrderedMapNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startOrderedMapNode(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartChoiceNodePushesBuilderToStack() throws IOException {
- prunerFullSchema.startChoiceNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startChoiceNode(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartAugmentationPushesBuilderToStack() throws IOException {
- prunerFullSchema.startAugmentationNode(new YangInstanceIdentifier.AugmentationIdentifier(ImmutableSet.of(TestModel.AUG_CONT_QNAME)));
+ prunerFullSchema.startAugmentationNode(new AugmentationIdentifier(ImmutableSet.of(TestModel.AUG_CONT_QNAME)));
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testEndNodeSchemaMissing() throws IOException {
- doReturn(new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME)).when(normalizedNodeBuilderWrapper).identifier();
+ doReturn(new NodeIdentifier(TestModel.AUG_CONT_QNAME)).when(normalizedNodeBuilderWrapper).identifier();
prunerNoAugSchema.stack().push(normalizedNodeBuilderWrapper);
prunerNoAugSchema.endNode();
private static NormalizedNode<?, ?> createTestContainer() {
byte[] bytes1 = {1,2,3};
LeafSetEntryNode<Object> entry1 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).
withValue(bytes1).build();
byte[] bytes2 = {};
LeafSetEntryNode<Object> entry2 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, bytes2)).
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes2)).
withValue(bytes2).build();
LeafSetEntryNode<Object> entry3 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, null)).
- withValue(null).build();
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, null)).withValue(null).build();
return TestModel.createBaseTestContainerBuilder().
withChild(ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME)).
+ new NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME)).
withChild(entry1).withChild(entry2).withChild(entry3).build()).
withChild(ImmutableNodes.leafNode(TestModel.SOME_BINARY_DATA_QNAME, new byte[]{1, 2, 3, 4})).
withChild(Builders.orderedMapBuilder().
- withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.ORDERED_LIST_QNAME)).
+ withNodeIdentifier(new NodeIdentifier(TestModel.ORDERED_LIST_QNAME)).
withChild(ImmutableNodes.mapEntry(TestModel.ORDERED_LIST_ENTRY_QNAME,
TestModel.ID_QNAME, 11)).build()).
build();
public class InstanceIdentifierUtilsTest {
- private static QName TEST_QNAME = QName
+ private static final QName TEST_QNAME = QName
.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test");
- private static QName NODE_WITH_VALUE_QNAME = QName
+ private static final QName NODE_WITH_VALUE_QNAME = QName
.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)value");
- private static QName NODE_WITH_PREDICATES_QNAME = QName
+ private static final QName NODE_WITH_PREDICATES_QNAME = QName
.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)pred");
- private static QName NAME_QNAME = QName
+ private static final QName NAME_QNAME = QName
.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)name");
@Test
YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
YangInstanceIdentifier.PathArgument p2 =
- new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, value);
+ new YangInstanceIdentifier.NodeWithValue<>(NODE_WITH_VALUE_QNAME, value);
List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
List<YangInstanceIdentifier.PathArgument> arguments =
Arrays.<YangInstanceIdentifier.PathArgument>asList(
new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME),
- new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, 1),
+ new YangInstanceIdentifier.NodeWithValue<>(NODE_WITH_VALUE_QNAME, 1),
new YangInstanceIdentifier.NodeIdentifierWithPredicates(
NODE_WITH_PREDICATES_QNAME, NAME_QNAME, 2));
import java.util.Set;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
return ImmutableContainerNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
+ new NodeIdentifier(schemaContext.getQName()))
.withChild(createTestContainer()).build();
}
- public static DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> createBaseTestContainerBuilder() {
+ public static DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> createBaseTestContainerBuilder() {
// Create a list of shoes
// This is to test leaf list entry
final LeafSetEntryNode<Object> nike =
ImmutableLeafSetEntryNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(QName.create(
+ new NodeWithValue<>(QName.create(
TEST_QNAME, "shoe"), "nike")).withValue("nike").build();
final LeafSetEntryNode<Object> puma =
ImmutableLeafSetEntryNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(QName.create(
+ new NodeWithValue<>(QName.create(
TEST_QNAME, "shoe"), "puma")).withValue("puma").build();
final LeafSetNode<Object> shoes =
ImmutableLeafSetNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ new NodeIdentifier(QName.create(
TEST_QNAME, "shoe"))).withChild(nike).withChild(puma)
.build();
ImmutableLeafSetEntryNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(QName.create(
+ new NodeWithValue<>(QName.create(
TEST_QNAME, "capability"), DESC_QNAME))
.withValue(DESC_QNAME).build();
ImmutableLeafSetNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ new NodeIdentifier(QName.create(
TEST_QNAME, "capability"))).withChild(cap1).build();
ContainerNode switchFeatures =
ImmutableContainerNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(SWITCH_FEATURES_QNAME))
+ new NodeIdentifier(SWITCH_FEATURES_QNAME))
.withChild(capabilities).build();
// Create a leaf list with numbers
ImmutableLeafSetEntryNodeBuilder
.create()
.withNodeIdentifier(
- (new YangInstanceIdentifier.NodeWithValue(QName.create(
+ (new NodeWithValue<>(QName.create(
TEST_QNAME, "number"), 5))).withValue(5).build();
final LeafSetEntryNode<Object> fifteen =
ImmutableLeafSetEntryNodeBuilder
.create()
.withNodeIdentifier(
- (new YangInstanceIdentifier.NodeWithValue(QName.create(
+ (new NodeWithValue<>(QName.create(
TEST_QNAME, "number"), 15))).withValue(15).build();
final LeafSetNode<Object> numbers =
ImmutableLeafSetNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ new NodeIdentifier(QName.create(
TEST_QNAME, "number"))).withChild(five).withChild(fifteen)
.build();
MapEntryNode augMapEntry = createAugmentedListEntry(1, "First Test");
// Create a bits leaf
- NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>>
- myBits = Builders.leafBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(
- QName.create(TEST_QNAME, "my-bits"))).withValue(
- ImmutableSet.of("foo", "bar"));
+ NormalizedNodeAttrBuilder<NodeIdentifier, Object, LeafNode<Object>>
+ myBits = Builders.leafBuilder()
+ .withNodeIdentifier(new NodeIdentifier(QName.create(TEST_QNAME, "my-bits")))
+ .withValue(ImmutableSet.of("foo", "bar"));
// Create unkeyed list entry
UnkeyedListEntryNode unkeyedListEntry =
// Create YangInstanceIdentifier with all path arg types.
YangInstanceIdentifier instanceID = YangInstanceIdentifier.create(
- new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME, "qname")),
- new YangInstanceIdentifier.NodeIdentifierWithPredicates(QName.create(TEST_QNAME, "list-entry"),
+ new NodeIdentifier(QName.create(TEST_QNAME, "qname")),
+ new NodeIdentifierWithPredicates(QName.create(TEST_QNAME, "list-entry"),
QName.create(TEST_QNAME, "key"), 10),
- new YangInstanceIdentifier.AugmentationIdentifier(ImmutableSet.of(
+ new AugmentationIdentifier(ImmutableSet.of(
QName.create(TEST_QNAME, "aug1"), QName.create(TEST_QNAME, "aug2"))),
- new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME, "leaf-list-entry"), "foo"));
+ new NodeWithValue<>(QName.create(TEST_QNAME, "leaf-list-entry"), "foo"));
Map<QName, Object> keyValues = new HashMap<>();
keyValues.put(CHILDREN_QNAME, FIRST_CHILD_NAME);