Realign ImmutableMapNodeBuilder and XML JSON builder 81/68381/5
authorAtul Gosain <agosain@luminanetworks.com>
Fri, 16 Feb 2018 20:41:32 +0000 (12:41 -0800)
committerRobert Varga <nite@hq.sk>
Thu, 8 Mar 2018 14:44:26 +0000 (14:44 +0000)
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 <agosain@luminanetworks.com>
(cherry picked from commit 69af38512473463b4e8be9f8b30c80f727b31d84)

yang/yang-data-codec-xml/src/test/java/org/opendaylight/yangtools/yang/data/codec/xml/XmlToNormalizedNodesTest.java
yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/CompositeNodeDataWithSchema.java

index ecde264cda4fe8214c70f3b686e60e7f2f444b02..bfd9ba517d4cc7dd3c293262b7de3dd4a2520194 100644 (file)
@@ -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;
     }
index 45791b1effe884a1abda9fc3f1bdea4ce16ec8a9..6ee6fa5c61eef0119419484e5d3b42d75edb06f4 100644 (file)
@@ -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) {