From 86d0422023815ba00acbd6bc73d0f6244ae7641e Mon Sep 17 00:00:00 2001 From: Atul Gosain Date: Fri, 16 Feb 2018 12:41:32 -0800 Subject: [PATCH] Realign ImmutableMapNodeBuilder and XML JSON builder This patch removes the AugmentationNode wrapper for mapEntryNodes as the ImutableMapNodeBuilder expects a different heirarchy. This made the JSON parsing to normalized node in parity with XML codec. JIRA: NETCONF-486 Change-Id: I25d32acfe7797e0744b42ef7a5f46ab01971c2a8 Signed-off-by: Atul Gosain (cherry picked from commit 69af38512473463b4e8be9f8b30c80f727b31d84) --- .../data/codec/xml/XmlToNormalizedNodesTest.java | 15 ++------------- .../data/util/CompositeNodeDataWithSchema.java | 7 +------ 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/yang/yang-data-codec-xml/src/test/java/org/opendaylight/yangtools/yang/data/codec/xml/XmlToNormalizedNodesTest.java b/yang/yang-data-codec-xml/src/test/java/org/opendaylight/yangtools/yang/data/codec/xml/XmlToNormalizedNodesTest.java index ecde264cda..bfd9ba517d 100644 --- a/yang/yang-data-codec-xml/src/test/java/org/opendaylight/yangtools/yang/data/codec/xml/XmlToNormalizedNodesTest.java +++ b/yang/yang-data-codec-xml/src/test/java/org/opendaylight/yangtools/yang/data/codec/xml/XmlToNormalizedNodesTest.java @@ -13,7 +13,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import com.google.common.collect.Sets; import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -30,11 +29,9 @@ import org.junit.Test; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil; -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.ChoiceNode; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.LeafNode; @@ -375,23 +372,15 @@ public class XmlToNormalizedNodesTest { new NodeIdentifier(myLeafInList3)).withValue("listleafvalue1").build()).build()) .build(); - AugmentationNode myDoublyKeyedListAugNode = Builders.augmentationBuilder().withNodeIdentifier( - new AugmentationIdentifier(Sets.newHashSet(myDoublyKeyedList))) - .withChild(myDoublyKeyedListNode).build(); - ContainerNode myContainer3Node = Builders.containerBuilder().withNodeIdentifier( new NodeIdentifier(myContainer3)) - .withChild(myDoublyKeyedListAugNode).build(); - - AugmentationNode myContainer3AugNode = Builders.augmentationBuilder().withNodeIdentifier( - new AugmentationIdentifier(Sets.newHashSet(myContainer3))) - .withChild(myContainer3Node).build(); + .withChild(myDoublyKeyedListNode).build(); ContainerNode outerContainerNode = Builders.containerBuilder().withNodeIdentifier( new NodeIdentifier(outerContainer)) .withChild(myContainer1Node) .withChild(myContainer2Node) - .withChild(myContainer3AugNode).build(); + .withChild(myContainer3Node).build(); return outerContainerNode; } diff --git a/yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/CompositeNodeDataWithSchema.java b/yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/CompositeNodeDataWithSchema.java index 45791b1eff..6ee6fa5c61 100644 --- a/yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/CompositeNodeDataWithSchema.java +++ b/yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/CompositeNodeDataWithSchema.java @@ -161,12 +161,7 @@ public class CompositeNodeDataWithSchema extends AbstractNodeDataWithSchema { } void addCompositeChild(final CompositeNodeDataWithSchema newChild) { - AugmentationSchema augSchema = findCorrespondingAugment(getSchema(), newChild.getSchema()); - if (augSchema != null) { - augmentationsToChild.put(augSchema, newChild); - } else { - addChild(newChild); - } + addChild(newChild); } private AbstractNodeDataWithSchema addChild(final DataSchemaNode schema) { -- 2.36.6