import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+
import java.util.AbstractMap;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+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 org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+@Deprecated
public class DataNormalizerTest {
static class NormalizedNodeData {
Class<?> nodeClass;
Object nodeData; // List for a container, value Object for a leaf
- NormalizedNodeData(PathArgument nodeID, Class<?> nodeClass, Object nodeData) {
+ NormalizedNodeData(final PathArgument nodeID, final Class<?> nodeClass, final Object nodeData) {
this.nodeID = nodeID;
this.nodeClass = nodeClass;
this.nodeData = nodeData;
static class LegacyNodeData {
QName nodeKey;
Object nodeData; // List for a CompositeNode, value Object for a
- // SimpeNode
+ // SimpeNode
- LegacyNodeData(QName nodeKey, Object nodeData) {
+ LegacyNodeData(final QName nodeKey, final Object nodeData) {
this.nodeKey = nodeKey;
this.nodeData = nodeData;
}
static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
- static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME);
- static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME)
+ static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
+ static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME)
.build();
static final QName ONE_QNAME = QName.create(TEST_QNAME, "one");
static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
static final Short OUTER_LIST_ID = (short) 10;
- static final InstanceIdentifier OUTER_LIST_PATH_LEGACY = InstanceIdentifier.builder(TEST_QNAME)
+ static final YangInstanceIdentifier OUTER_LIST_PATH_LEGACY = YangInstanceIdentifier.builder(TEST_PATH)
.nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID).build();
- static final InstanceIdentifier LEAF_TWO_PATH_LEGACY = InstanceIdentifier.builder(OUTER_LIST_PATH_LEGACY)
+ static final YangInstanceIdentifier LEAF_TWO_PATH_LEGACY = YangInstanceIdentifier.builder(OUTER_LIST_PATH_LEGACY)
.node(TWO_QNAME).build();
static final QName ANY_XML_LEAF_QNAME = QName.create(TEST_QNAME, "leaf");;
SchemaContext testCtx = createTestContext();
DataNormalizer normalizer = new DataNormalizer(testCtx);
- InstanceIdentifier normalizedPath = normalizer.toNormalized(LEAF_TWO_PATH_LEGACY);
+ YangInstanceIdentifier normalizedPath = normalizer.toNormalized(LEAF_TWO_PATH_LEGACY);
verifyNormalizedInstanceIdentifier(normalizedPath, TEST_QNAME, OUTER_LIST_QNAME, new Object[] {
OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID }, OUTER_CHOICE_QNAME, TWO_QNAME);
}
- private void verifyNormalizedInstanceIdentifier(InstanceIdentifier actual, Object... expPath) {
+ private void verifyNormalizedInstanceIdentifier(final YangInstanceIdentifier actual, final Object... expPath) {
assertNotNull("Actual InstanceIdentifier is null", actual);
- assertEquals("InstanceIdentifier path length", expPath.length, actual.getPath().size());
+ assertEquals("InstanceIdentifier path length", expPath.length, Iterables.size(actual.getPathArguments()));
for (int i = 0; i < expPath.length; i++) {
- PathArgument actualArg = actual.getPath().get(i);
+ PathArgument actualArg = Iterables.get(actual.getPathArguments(), i);
if (expPath[i] instanceof Object[]) { // NodeIdentifierWithPredicates
Object[] exp = (Object[]) expPath[i];
assertEquals("Actual path arg " + (i + 1) + " class", NodeIdentifierWithPredicates.class,
DataNormalizer normalizer = new DataNormalizer(createTestContext());
- InstanceIdentifier normalized = InstanceIdentifier.builder().node(TEST_QNAME).node(OUTER_LIST_QNAME)
+ YangInstanceIdentifier normalized = YangInstanceIdentifier.builder().node(TEST_QNAME).node(OUTER_LIST_QNAME)
.nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID).node(OUTER_CHOICE_QNAME).node(TWO_QNAME)
.build();
- InstanceIdentifier legacy = normalizer.toLegacy(normalized);
+ YangInstanceIdentifier legacy = normalizer.toLegacy(normalized);
assertEquals("Legacy InstanceIdentifier", LEAF_TWO_PATH_LEGACY, legacy);
}
expectCompositeNode(INNER_LIST_QNAME, expectSimpleNode(NAME_QNAME, "inner-name1"),
expectSimpleNode(VALUE_QNAME, "inner-value1")),
- expectCompositeNode(INNER_LIST_QNAME, expectSimpleNode(NAME_QNAME, "inner-name2"),
- expectSimpleNode(VALUE_QNAME, "inner-value2"))),
- expectCompositeNode(OUTER_LIST_QNAME, expectSimpleNode(ID_QNAME, outerListID2),
- expectSimpleNode(ONE_QNAME, "one")),
- expectCompositeNode(UNKEYED_LIST_QNAME, expectSimpleNode(NAME_QNAME, "unkeyed1")),
- expectCompositeNode(UNKEYED_LIST_QNAME, expectSimpleNode(NAME_QNAME, "unkeyed2"))));
+ expectCompositeNode(INNER_LIST_QNAME, expectSimpleNode(NAME_QNAME, "inner-name2"),
+ expectSimpleNode(VALUE_QNAME, "inner-value2"))),
+ expectCompositeNode(OUTER_LIST_QNAME, expectSimpleNode(ID_QNAME, outerListID2),
+ expectSimpleNode(ONE_QNAME, "one")),
+ expectCompositeNode(UNKEYED_LIST_QNAME, expectSimpleNode(NAME_QNAME, "unkeyed1")),
+ expectCompositeNode(UNKEYED_LIST_QNAME, expectSimpleNode(NAME_QNAME, "unkeyed2"))));
// Conversion of Mixin type nodes is not supported.
.withNodeIdentifier(new NodeIdentifier(TEST_QNAME)).withChild(testAnyXmlNode).build();
DataNormalizer normalizer = new DataNormalizer(createTestContext());
- Node<?> legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
+ Node<?> legacyNode = normalizer.toLegacy(YangInstanceIdentifier.builder().node(TEST_QNAME).build(), testContainerNode);
verifyLegacyNode(
legacyNode,
DataNormalizer normalizer = new DataNormalizer(createTestContext());
- Node<?> legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
+ Node<?> legacyNode = normalizer.toLegacy(YangInstanceIdentifier.builder().node(TEST_QNAME).build(), testContainerNode);
verifyLegacyNode(
legacyNode,
DataNormalizer normalizer = new DataNormalizer(createTestContext());
- Node<?> legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
+ Node<?> legacyNode = normalizer.toLegacy(YangInstanceIdentifier.builder().node(TEST_QNAME).build(), testContainerNode);
verifyLegacyNode(
legacyNode,
expectSimpleNode(AUGMENTED_LEAF_QNAME, "augmented-value"))));
}
- private boolean isOrdered(QName nodeName) {
+ private boolean isOrdered(final QName nodeName) {
return ORDERED_LEAF_LIST_QNAME.equals(nodeName) || INNER_LIST_QNAME.equals(nodeName);
}
@SuppressWarnings("unchecked")
- private void verifyLegacyNode(Node<?> actual, LegacyNodeData expNodeData) {
+ private void verifyLegacyNode(final Node<?> actual, final LegacyNodeData expNodeData) {
assertNotNull("Actual Node is null", actual);
assertTrue("Expected CompositeNode instance", actual instanceof CompositeNode);
Collections.sort(unorderdChildData, new Comparator<LegacyNodeData>() {
@Override
- public int compare(LegacyNodeData arg1, LegacyNodeData arg2) {
- String str1 = arg1.nodeKey.getLocalName();
- if (!(arg1.nodeData instanceof List))
- str1 += arg1.nodeData; // add simple node value
-
- String str2 = arg2.nodeKey.getLocalName();
- if (!(arg2.nodeData instanceof List))
- str2 += arg2.nodeData; // add simple node value
-
- return str1.compareTo(str2);
+ public int compare(final LegacyNodeData arg1, final LegacyNodeData arg2) {
+ if (!(arg1.nodeData instanceof List) && !(arg2.nodeData instanceof List)) {
+ // if neither is a list, just compare them
+ String str1 = arg1.nodeKey.getLocalName() + arg1.nodeData;
+ String str2 = arg2.nodeKey.getLocalName() + arg2.nodeData;
+ return str1.compareTo(str2);
+ } else if (arg1.nodeData instanceof List && arg2.nodeData instanceof List) {
+ // if both are lists, first check their local name
+ String str1 = arg1.nodeKey.getLocalName();
+ String str2 = arg2.nodeKey.getLocalName();
+ if (!str1.equals(str2)) {
+ return str1.compareTo(str2);
+ } else {
+ // if local names are the same, then look at the list contents
+ List<LegacyNodeData> l1 = (List<LegacyNodeData>) arg1.nodeData;
+ List<LegacyNodeData> l2 = (List<LegacyNodeData>) arg2.nodeData;
+
+ if (l1.size() != l2.size()) {
+ // if the sizes are different, use that
+ return l2.size() - l1.size();
+ } else {
+ // lastly sort and recursively check the list contents
+ Collections.sort(l1, this);
+ Collections.sort(l2, this);
+
+ for (int i = 0 ; i < l1.size() ; i++) {
+ int diff = this.compare(l1.get(i), l2.get(i));
+ if (diff != 0) {
+ return diff;
+ }
+ }
+ return 0;
+ }
+ }
+ } else if( arg1.nodeData instanceof List ) {
+ return -1;
+ } else{
+ return 1;
+ }
}
});
Collections.sort(unorderedChildNodes, new Comparator<Node<?>>() {
@Override
- public int compare(Node<?> n1, Node<?> n2) {
- String str1 = n1.getKey().getLocalName();
- if (n1 instanceof SimpleNode)
- str1 += ((SimpleNode<?>) n1).getValue();
-
- String str2 = n2.getKey().getLocalName();
- if (n2 instanceof SimpleNode)
- str2 += ((SimpleNode<?>) n2).getValue();
-
- return str1.compareTo(str2);
+ public int compare(final Node<?> n1, final Node<?> n2) {
+ if (n1 instanceof SimpleNode && n2 instanceof SimpleNode) {
+ // if they're SimpleNodes just compare their strings
+ String str1 = n1.getKey().getLocalName() + ((SimpleNode<?>)n1).getValue();
+ String str2 = n2.getKey().getLocalName() + ((SimpleNode<?>)n2).getValue();
+ return str1.compareTo(str2);
+ } else if (n1 instanceof CompositeNode && n2 instanceof CompositeNode) {
+ // if they're CompositeNodes, things are more interesting
+ String str1 = n1.getKey().getLocalName();
+ String str2 = n2.getKey().getLocalName();
+ if (!str1.equals(str2)) {
+ // if their local names differ, return that difference
+ return str1.compareTo(str2);
+ } else {
+ // otherwise, we need to look at their contents
+ ArrayList<Node<?>> l1 = new ArrayList<Node<?>>( ((CompositeNode)n1).getValue() );
+ ArrayList<Node<?>> l2 = new ArrayList<Node<?>>( ((CompositeNode)n2).getValue() );
+
+ if (l1.size() != l2.size()) {
+ // if they have different numbers of things in them return that
+ return l2.size() - l1.size();
+ } else {
+ // otherwise, compare the individual elements, first sort them
+ Collections.sort(l1, this);
+ Collections.sort(l2, this);
+
+ // then compare them individually
+ for(int i = 0 ; i < l2.size() ; i++) {
+ int diff = this.compare(l1.get(i), l2.get(i));
+ if(diff != 0){
+ return diff;
+ }
+ }
+ return 0;
+ }
+ }
+ } else if (n1 instanceof CompositeNode && n2 instanceof SimpleNode) {
+ return -1;
+ } else if (n2 instanceof CompositeNode && n1 instanceof SimpleNode) {
+ return 1;
+ } else {
+ assertTrue("Expected either SimpleNodes CompositeNodes", false);
+ return 0;
+ }
}
});
assertEquals("Child node QName", expData.nodeKey, actualChild.getKey());
if (expData.nodeData instanceof List) { // List represents a
- // composite node
+ // composite node
verifyLegacyNode(actualChild, expData);
} else { // else a simple node
assertTrue("Expected SimpleNode instance", actualChild instanceof SimpleNode);
}
}
- private LegacyNodeData expectCompositeNode(QName key, LegacyNodeData... childData) {
+ private LegacyNodeData expectCompositeNode(final QName key, final LegacyNodeData... childData) {
return new LegacyNodeData(key, Lists.newArrayList(childData));
}
- private LegacyNodeData expectSimpleNode(QName key, Object value) {
+ private LegacyNodeData expectSimpleNode(final QName key, final Object value) {
return new LegacyNodeData(key, value);
}
testBuilder.add(unkeyedListBuilder.toInstance());
}
- Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
- .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(new InstanceIdentifier(
+ Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+ .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
expectMapEntryNode(INNER_LIST_QNAME, NAME_QNAME, "inner-name3",
expectLeafNode(NAME_QNAME, "inner-name3"),
expectLeafNode(VALUE_QNAME, "inner-value3")),
- expectMapEntryNode(INNER_LIST_QNAME, NAME_QNAME, "inner-name2",
- expectLeafNode(NAME_QNAME, "inner-name2"),
- expectLeafNode(VALUE_QNAME, "inner-value2")),
- expectMapEntryNode(INNER_LIST_QNAME, NAME_QNAME, "inner-name1",
- expectLeafNode(NAME_QNAME, "inner-name1"),
- expectLeafNode(VALUE_QNAME, "inner-value1")))),
- expectMapEntryNode(
- OUTER_LIST_QNAME,
- ID_QNAME,
- 20,
- expectLeafNode(ID_QNAME, 20),
- expectChoiceNode(OUTER_CHOICE_QNAME, expectLeafNode(TWO_QNAME, "two"),
- expectLeafNode(THREE_QNAME, "three")))),
- expectUnkeyedListNode(
- UNKEYED_LIST_QNAME,
- expectUnkeyedListEntryNode(UNKEYED_LIST_QNAME,
- expectLeafNode(NAME_QNAME, "unkeyed-name1")),
- expectUnkeyedListEntryNode(UNKEYED_LIST_QNAME,
- expectLeafNode(NAME_QNAME, "unkeyed-name2")))));
+ expectMapEntryNode(INNER_LIST_QNAME, NAME_QNAME, "inner-name2",
+ expectLeafNode(NAME_QNAME, "inner-name2"),
+ expectLeafNode(VALUE_QNAME, "inner-value2")),
+ expectMapEntryNode(INNER_LIST_QNAME, NAME_QNAME, "inner-name1",
+ expectLeafNode(NAME_QNAME, "inner-name1"),
+ expectLeafNode(VALUE_QNAME, "inner-value1")))),
+ expectMapEntryNode(
+ OUTER_LIST_QNAME,
+ ID_QNAME,
+ 20,
+ expectLeafNode(ID_QNAME, 20),
+ expectChoiceNode(OUTER_CHOICE_QNAME, expectLeafNode(TWO_QNAME, "two"),
+ expectLeafNode(THREE_QNAME, "three")))),
+ expectUnkeyedListNode(
+ UNKEYED_LIST_QNAME,
+ expectUnkeyedListEntryNode(UNKEYED_LIST_QNAME,
+ expectLeafNode(NAME_QNAME, "unkeyed-name1")),
+ expectUnkeyedListEntryNode(UNKEYED_LIST_QNAME,
+ expectLeafNode(NAME_QNAME, "unkeyed-name2")))));
}
@Test
CompositeNode anyXmlLegacy = anyXmlBuilder.toInstance();
testBuilder.add(anyXmlLegacy);
- Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
- .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(new InstanceIdentifier(
+ Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+ .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
testBuilder.add(outerContBuilder.toInstance());
- Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
- .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(new InstanceIdentifier(
+ Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+ .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
verifyNormalizedNode(normalizedNodeEntry.getValue(),
expectContainerNode(TEST_QNAME, expectContainerNode(OUTER_CONTAINER_QNAME, expAugmentation)));
- normalizedNodeEntry = normalizer.toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(
- new InstanceIdentifier(Lists.newArrayList(new NodeIdentifier(TEST_QNAME), new NodeIdentifier(
+ normalizedNodeEntry = normalizer.toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(
+ YangInstanceIdentifier.create(Lists.newArrayList(new NodeIdentifier(TEST_QNAME), new NodeIdentifier(
OUTER_CONTAINER_QNAME))), outerContBuilder.toInstance()));
verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME, OUTER_CONTAINER_QNAME,
testBuilder.addLeaf(ORDERED_LEAF_LIST_QNAME, "ordered-value" + i);
}
- Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
- .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(new InstanceIdentifier(
+ Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+ .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
expectLeafSetEntryNode(UNORDERED_LEAF_LIST_QNAME, "unordered-value1"),
expectLeafSetEntryNode(UNORDERED_LEAF_LIST_QNAME, "unordered-value2"),
expectLeafSetEntryNode(UNORDERED_LEAF_LIST_QNAME, "unordered-value3")),
- expectOrderedLeafSetNode(ORDERED_LEAF_LIST_QNAME,
- expectLeafSetEntryNode(ORDERED_LEAF_LIST_QNAME, "ordered-value3"),
- expectLeafSetEntryNode(ORDERED_LEAF_LIST_QNAME, "ordered-value2"),
- expectLeafSetEntryNode(ORDERED_LEAF_LIST_QNAME, "ordered-value1"))));
+ expectOrderedLeafSetNode(ORDERED_LEAF_LIST_QNAME,
+ expectLeafSetEntryNode(ORDERED_LEAF_LIST_QNAME, "ordered-value3"),
+ expectLeafSetEntryNode(ORDERED_LEAF_LIST_QNAME, "ordered-value2"),
+ expectLeafSetEntryNode(ORDERED_LEAF_LIST_QNAME, "ordered-value1"))));
}
@SuppressWarnings("unchecked")
- private void verifyNormalizedNode(NormalizedNode<?, ?> actual, NormalizedNodeData expNodeData) {
+ private void verifyNormalizedNode(final NormalizedNode<?, ?> actual, final NormalizedNodeData expNodeData) {
Class<?> expNodeClass = expNodeData.nodeClass;
PathArgument expNodeID = expNodeData.nodeID;
NormalizedNodeData expChildData = expNodeClass.equals(UnkeyedListNode.class) ? expChildDataList
.remove(0) : expChildDataMap.remove(actualChild.getIdentifier());
- assertNotNull(
- "Unexpected child node " + actualChild.getClass() + " with identifier "
- + actualChild.getIdentifier() + " for parent node " + actual.getClass()
- + " with identifier " + actual.getIdentifier(), expChildData);
+ assertNotNull(
+ "Unexpected child node " + actualChild.getClass() + " with identifier "
+ + actualChild.getIdentifier() + " for parent node " + actual.getClass()
+ + " with identifier " + actual.getIdentifier(), expChildData);
- if (orderingMap != null) {
- assertEquals("Order index for child node " + actualChild.getIdentifier(),
- orderingMap.get(actualChild.getIdentifier()), Integer.valueOf(i));
- }
+ if (orderingMap != null) {
+ assertEquals("Order index for child node " + actualChild.getIdentifier(),
+ orderingMap.get(actualChild.getIdentifier()), Integer.valueOf(i));
+ }
- verifyNormalizedNode(actualChild, expChildData);
- i++;
+ verifyNormalizedNode(actualChild, expChildData);
+ i++;
}
if (expNodeClass.equals(UnkeyedListNode.class)) {
}
}
- private NormalizedNodeData expectOrderedLeafSetNode(QName nodeName, NormalizedNodeData... childData) {
+ private NormalizedNodeData expectOrderedLeafSetNode(final QName nodeName, final NormalizedNodeData... childData) {
return new NormalizedNodeData(new NodeIdentifier(nodeName), OrderedLeafSetNode.class,
Lists.newArrayList(childData));
}
- private NormalizedNodeData expectLeafSetNode(QName nodeName, NormalizedNodeData... childData) {
+ private NormalizedNodeData expectLeafSetNode(final QName nodeName, final NormalizedNodeData... childData) {
return new NormalizedNodeData(new NodeIdentifier(nodeName), LeafSetNode.class, Lists.newArrayList(childData));
}
- private NormalizedNodeData expectLeafSetEntryNode(QName nodeName, Object value) {
+ private NormalizedNodeData expectLeafSetEntryNode(final QName nodeName, final Object value) {
return new NormalizedNodeData(new NodeWithValue(nodeName, value), LeafSetEntryNode.class, value);
}
- private NormalizedNodeData expectUnkeyedListNode(QName nodeName, NormalizedNodeData... childData) {
+ private NormalizedNodeData expectUnkeyedListNode(final QName nodeName, final NormalizedNodeData... childData) {
return new NormalizedNodeData(new NodeIdentifier(nodeName), UnkeyedListNode.class,
Lists.newArrayList(childData));
}
- private NormalizedNodeData expectUnkeyedListEntryNode(QName nodeName, NormalizedNodeData... childData) {
+ private NormalizedNodeData expectUnkeyedListEntryNode(final QName nodeName, final NormalizedNodeData... childData) {
return new NormalizedNodeData(new NodeIdentifier(nodeName), UnkeyedListEntryNode.class,
Lists.newArrayList(childData));
}
- private NormalizedNodeData expectAugmentation(QName augmentedNodeName, NormalizedNodeData... childData) {
+ private NormalizedNodeData expectAugmentation(final QName augmentedNodeName, final NormalizedNodeData... childData) {
return new NormalizedNodeData(new AugmentationIdentifier(Sets.newHashSet(augmentedNodeName)),
AugmentationNode.class, Lists.newArrayList(childData));
}
- private NormalizedNodeData expectAnyXmlNode(QName nodeName, Object value) {
+ private NormalizedNodeData expectAnyXmlNode(final QName nodeName, final Object value) {
return new NormalizedNodeData(new NodeIdentifier(nodeName), AnyXmlNode.class, value);
}
- private NormalizedNodeData expectContainerNode(QName nodeName, NormalizedNodeData... childData) {
+ private NormalizedNodeData expectContainerNode(final QName nodeName, final NormalizedNodeData... childData) {
return new NormalizedNodeData(new NodeIdentifier(nodeName), ContainerNode.class, Lists.newArrayList(childData));
}
- private NormalizedNodeData expectChoiceNode(QName nodeName, NormalizedNodeData... childData) {
+ private NormalizedNodeData expectChoiceNode(final QName nodeName, final NormalizedNodeData... childData) {
return new NormalizedNodeData(new NodeIdentifier(nodeName), ChoiceNode.class, Lists.newArrayList(childData));
}
- private NormalizedNodeData expectLeafNode(QName nodeName, Object value) {
+ private NormalizedNodeData expectLeafNode(final QName nodeName, final Object value) {
return new NormalizedNodeData(new NodeIdentifier(nodeName), LeafNode.class, value);
}
- private NormalizedNodeData expectMapEntryNode(QName nodeName, QName key, Object value,
- NormalizedNodeData... childData) {
+ private NormalizedNodeData expectMapEntryNode(final QName nodeName, final QName key, final Object value,
+ final NormalizedNodeData... childData) {
return new NormalizedNodeData(new NodeIdentifierWithPredicates(nodeName, key, value), MapEntryNode.class,
Lists.newArrayList(childData));
}
- private NormalizedNodeData expectMapNode(QName key, NormalizedNodeData... childData) {
+ private NormalizedNodeData expectMapNode(final QName key, final NormalizedNodeData... childData) {
return new NormalizedNodeData(new NodeIdentifier(key), MapNode.class, Lists.newArrayList(childData));
}
- private NormalizedNodeData expectOrderedMapNode(QName key, NormalizedNodeData... childData) {
+ private NormalizedNodeData expectOrderedMapNode(final QName key, final NormalizedNodeData... childData) {
return new NormalizedNodeData(new NodeIdentifier(key), OrderedMapNode.class, Lists.newArrayList(childData));
}
}