Map system-ordered leaf-lists to Set<T>
[mdsal.git] / binding / mdsal-binding-dom-codec / src / test / java / org / opendaylight / mdsal / binding / dom / codec / impl / NormalizedNodeSerializeDeserializeTest.java
index 629cc230523e454d3ff7f2ffb6741990c72ab99b..88a3f40e636db9c83b1998e72af63715969667b5 100644 (file)
@@ -22,26 +22,20 @@ import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.ma
 import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
 import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TopChoiceAugment1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TopChoiceAugment1Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TopChoiceAugment2;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TopChoiceAugment2Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeComplexUsesAugment;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeLeafOnlyAugment;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.TreeLeafOnlyAugmentBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.AugmentChoice1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.augment.choice1.Case1Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.augment.choice1.case1.augment.choice2.Case11Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.augment.choice1.case1.augment.choice2.case11.Case11ChoiceCaseContainerBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.choice.augment1.AugmentChoice1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.choice.augment1.augment.choice1.Case1Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.choice.augment2.augment.choice2.Case11Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.augment.rev140709.top.choice.augment2.augment.choice2.case11.Case11ChoiceCaseContainerBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.ChoiceContainer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.ChoiceContainerBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.Top;
@@ -55,7 +49,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.te
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.TopLevelListKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.top.level.list.NestedList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.top.level.list.NestedListBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.two.level.list.top.level.list.NestedListKey;
 import org.opendaylight.yang.gen.v1.urn.test.foo4798.rev160101.Root;
@@ -72,8 +65,8 @@ 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.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableAugmentationNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableChoiceNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
@@ -81,8 +74,8 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLe
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableOrderedLeafSetNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableOrderedMapNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUserLeafSetNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUserMapNodeBuilder;
 
 public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodecTest {
 
@@ -121,7 +114,7 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
 
     @Test
     public void containerToNormalized() {
-        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(
+        final Entry<YangInstanceIdentifier, NormalizedNode> entry = codecContext.toNormalizedNode(
             InstanceIdentifier.create(Top.class), top());
         final ContainerNode topNormalized = getEmptyTop();
         assertEquals(topNormalized, entry.getValue());
@@ -130,7 +123,8 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
     @Test
     public void containerFromNormalized() {
         final ContainerNode topNormalized = getEmptyTop();
-        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH, topNormalized);
+        final Entry<InstanceIdentifier<?>, DataObject> entry = codecContext.fromNormalizedNode(BI_TOP_PATH,
+            topNormalized);
         assertEquals(top(), entry.getValue());
     }
 
@@ -154,8 +148,9 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
                 .build());
         final ContainerNode topNormalized = getEmptyTop();
 
-        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH, topNormalized);
-        final Entry<InstanceIdentifier<?>, DataObject> entryWithAugments = registry.fromNormalizedNode(BI_TOP_PATH,
+        final Entry<InstanceIdentifier<?>, DataObject> entry = codecContext.fromNormalizedNode(BI_TOP_PATH,
+            topNormalized);
+        final Entry<InstanceIdentifier<?>, DataObject> entryWithAugments = codecContext.fromNormalizedNode(BI_TOP_PATH,
             topNormalizedWithAugments);
 
         // Equals on other with no augmentation should be false
@@ -167,8 +162,8 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
         // Equals on other(lazy, reversed) with no augmentation should be false
         assertNotEquals(entryWithAugments.getValue(), entry.getValue());
 
-        final Top topWithAugments = topWithAugments(Collections.<Class<? extends Augmentation<Top>>, Augmentation<Top>>
-            singletonMap(Top1.class, new Top1Builder().setAugmentedString(AUGMENT_STRING_VALUE).build()));
+        final Top topWithAugments = topWithAugments(
+            Map.of(Top1.class, new Top1Builder().setAugmentedString(AUGMENT_STRING_VALUE).build()));
         // Equals other with same augment should be true
         assertEquals(topWithAugments, entryWithAugments.getValue());
         // Equals other with same augment should be true
@@ -177,8 +172,7 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
         assertEquals(entryWithAugments.getValue(), entryWithAugments.getValue());
 
         final Top topWithAugmentsDiffValue = topWithAugments(
-            Collections.<Class<? extends Augmentation<Top>>, Augmentation<Top>>singletonMap(Top1.class,
-                new Top1Builder().setAugmentedString("differentValue").build()));
+            Map.of(Top1.class, new Top1Builder().setAugmentedString("differentValue").build()));
         assertNotEquals(topWithAugmentsDiffValue, entryWithAugments.getValue());
         assertNotEquals(entryWithAugments.getValue(), topWithAugmentsDiffValue);
     }
@@ -195,20 +189,18 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
                 .withChild(ImmutableNodes.leafNode(AUGMENT_INT_Q, AUGMENT_INT_VALUE))
                 .build());
 
-        final Entry<InstanceIdentifier<?>, DataObject> entryWithAugments = registry.fromNormalizedNode(BI_TOP_PATH,
+        final Entry<InstanceIdentifier<?>, DataObject> entryWithAugments = codecContext.fromNormalizedNode(BI_TOP_PATH,
             topNormalizedWithAugments);
-        Map<Class<? extends Augmentation<Top>>, Augmentation<Top>> augments = new HashMap<>();
-        augments.put(Top1.class, new Top1Builder().setAugmentedString(AUGMENT_STRING_VALUE).build());
-        augments.put(Top2.class, new Top2Builder().setAugmentedInt(AUGMENT_INT_VALUE).build());
-        Top topWithAugments = topWithAugments(augments);
+        Top topWithAugments = topWithAugments(Map.of(
+            Top1.class, new Top1Builder().setAugmentedString(AUGMENT_STRING_VALUE).build(),
+            Top2.class, new Top2Builder().setAugmentedInt(AUGMENT_INT_VALUE).build()));
 
         assertEquals(topWithAugments, entryWithAugments.getValue());
         assertEquals(entryWithAugments.getValue(), topWithAugments);
 
-        augments = new HashMap<>();
-        augments.put(Top1.class, new Top1Builder().setAugmentedString(AUGMENT_STRING_VALUE).build());
-        augments.put(Top2.class, new Top2Builder().setAugmentedInt(999).build());
-        topWithAugments = topWithAugments(augments);
+        topWithAugments = topWithAugments(Map.of(
+            Top1.class, new Top1Builder().setAugmentedString(AUGMENT_STRING_VALUE).build(),
+            Top2.class, new Top2Builder().setAugmentedInt(999).build()));
 
         assertNotEquals(topWithAugments, entryWithAugments.getValue());
         assertNotEquals(entryWithAugments.getValue(), topWithAugments);
@@ -227,16 +219,16 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
     private static Top topWithAugments(
             final Map<Class<? extends Augmentation<Top>>, ? extends Augmentation<Top>> augments) {
         final TopBuilder topBuilder = new TopBuilder();
-        for (Entry<Class<? extends Augmentation<Top>>, ? extends Augmentation<Top>> augment : augments.entrySet()) {
-            topBuilder.addAugmentation(augment.getKey(), augment.getValue());
+        for (Augmentation<Top> augment : augments.values()) {
+            topBuilder.addAugmentation(augment);
         }
-        return topBuilder.setTopLevelList(Collections.emptyMap()).build();
+        return topBuilder.build();
     }
 
     @Test
     public void listWithKeysToNormalized() {
-        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(BA_TOP_LEVEL_LIST,
-            topLevelList(TOP_LEVEL_LIST_FOO_KEY));
+        final Entry<YangInstanceIdentifier, NormalizedNode> entry = codecContext.toNormalizedNode(
+            BA_TOP_LEVEL_LIST, topLevelList(TOP_LEVEL_LIST_FOO_KEY));
         final MapEntryNode topLevelListNormalized = ImmutableMapEntryNodeBuilder.create()
                 .withNodeIdentifier(NodeIdentifierWithPredicates.of(TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME,
                     TOP_LEVEL_LIST_FOO_KEY_VALUE))
@@ -252,19 +244,17 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
                     TOP_LEVEL_LIST_FOO_KEY_VALUE))
                 .withChild(leafNode(TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
                 .build();
-        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_LEVEL_LIST_FOO_PATH,
-            topLevelListNormalized);
+        final Entry<InstanceIdentifier<?>, DataObject> entry = codecContext.fromNormalizedNode(
+            BI_TOP_LEVEL_LIST_FOO_PATH, topLevelListNormalized);
         assertEquals(topLevelList(TOP_LEVEL_LIST_FOO_KEY), entry.getValue());
     }
 
     @Test
     public void leafOnlyAugmentationToNormalized() {
-        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(BA_TREE_LEAF_ONLY,
-            new TreeLeafOnlyAugmentBuilder().setSimpleValue("simpleValue").build());
-        final Set<QName> augmentationChildren = new HashSet<>();
-        augmentationChildren.add(SIMPLE_VALUE_QNAME);
+        final Entry<YangInstanceIdentifier, NormalizedNode> entry = codecContext.toNormalizedNode(
+            BA_TREE_LEAF_ONLY, new TreeLeafOnlyAugmentBuilder().setSimpleValue("simpleValue").build());
         final AugmentationNode augmentationNode = ImmutableAugmentationNodeBuilder.create()
-                .withNodeIdentifier(new AugmentationIdentifier(augmentationChildren))
+                .withNodeIdentifier(new AugmentationIdentifier(Set.of(SIMPLE_VALUE_QNAME)))
                 .withChild(leafNode(SIMPLE_VALUE_QNAME, "simpleValue"))
                 .build();
         assertEquals(augmentationNode, entry.getValue());
@@ -272,29 +262,25 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
 
     @Test
     public void leafOnlyAugmentationFromNormalized() {
-        final Set<QName> augmentationChildren = new HashSet<>();
-        augmentationChildren.add(SIMPLE_VALUE_QNAME);
+        final AugmentationIdentifier augmentationId = new AugmentationIdentifier(Set.of(SIMPLE_VALUE_QNAME));
         final AugmentationNode augmentationNode = ImmutableAugmentationNodeBuilder.create()
-                .withNodeIdentifier(new AugmentationIdentifier(augmentationChildren))
+                .withNodeIdentifier(augmentationId)
                 .withChild(leafNode(SIMPLE_VALUE_QNAME, "simpleValue"))
                 .build();
-        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(
-            BI_TOP_LEVEL_LIST_FOO_PATH.node(new AugmentationIdentifier(augmentationChildren)),
-            augmentationNode);
+        final Entry<InstanceIdentifier<?>, DataObject> entry = codecContext.fromNormalizedNode(
+            BI_TOP_LEVEL_LIST_FOO_PATH.node(augmentationId), augmentationNode);
         assertEquals(new TreeLeafOnlyAugmentBuilder().setSimpleValue("simpleValue").build(), entry.getValue());
     }
 
     @Test
     public void orderedleafListToNormalized() {
-        List<String> topLevelLeafList = new ArrayList<>();
-        topLevelLeafList.add("foo");
-        Top top = new TopBuilder().setTopLevelOrderedLeafList(topLevelLeafList).build();
+        Top top = new TopBuilder().setTopLevelOrderedLeafList(List.of("foo")).build();
 
-        Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(
+        Entry<YangInstanceIdentifier, NormalizedNode> entry = codecContext.toNormalizedNode(
             InstanceIdentifier.create(Top.class), top);
         ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
                 .withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
-                .withChild(ImmutableOrderedLeafSetNodeBuilder.create()
+                .withChild(ImmutableUserLeafSetNodeBuilder.create()
                         .withNodeIdentifier(new NodeIdentifier(TOP_LEVEL_ORDERED_LEAF_LIST_QNAME))
                         .withChild(
                                 ImmutableLeafSetEntryNodeBuilder.create()
@@ -309,11 +295,9 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
 
     @Test
     public void leafListToNormalized() {
-        final List<String> topLevelLeafList = new ArrayList<>();
-        topLevelLeafList.add("foo");
-        final Top top = new TopBuilder().setTopLevelLeafList(topLevelLeafList).build();
+        final Top top = new TopBuilder().setTopLevelLeafList(Set.of("foo")).build();
 
-        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(
+        final Entry<YangInstanceIdentifier, NormalizedNode> entry = codecContext.toNormalizedNode(
             InstanceIdentifier.create(Top.class), top);
         final ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
                 .withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
@@ -339,11 +323,9 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
                         .withNodeIdentifier(new NodeWithValue<>(TOP_LEVEL_LEAF_LIST_QNAME, "foo"))
                         .withValue("foo").build()).build())
                 .build();
-        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH,
+        final Entry<InstanceIdentifier<?>, DataObject> entry = codecContext.fromNormalizedNode(BI_TOP_PATH,
             topWithLeafList);
-        final List<String> topLevelLeafList = new ArrayList<>();
-        topLevelLeafList.add("foo");
-        final Top top = new TopBuilder().setTopLevelLeafList(topLevelLeafList).build();
+        final Top top = new TopBuilder().setTopLevelLeafList(Set.of("foo")).build();
         assertEquals(top, entry.getValue());
     }
 
@@ -351,16 +333,14 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
     public void orderedLeafListFromNormalized() {
         ContainerNode topWithLeafList = ImmutableContainerNodeBuilder.create()
                 .withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
-                .withChild(ImmutableOrderedLeafSetNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(
+                .withChild(ImmutableUserLeafSetNodeBuilder.create().withNodeIdentifier(new NodeIdentifier(
                     TOP_LEVEL_ORDERED_LEAF_LIST_QNAME))
                     .withChild(ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
                         new NodeWithValue<>(TOP_LEVEL_ORDERED_LEAF_LIST_QNAME, "foo")).withValue("foo").build())
                     .build())
                 .build();
-        Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_PATH, topWithLeafList);
-        List<String> topLevelLeafList = new ArrayList<>();
-        topLevelLeafList.add("foo");
-        Top top = new TopBuilder().setTopLevelOrderedLeafList(topLevelLeafList).build();
+        Entry<InstanceIdentifier<?>, DataObject> entry = codecContext.fromNormalizedNode(BI_TOP_PATH, topWithLeafList);
+        Top top = new TopBuilder().setTopLevelOrderedLeafList(List.of("foo")).build();
         assertEquals(top, entry.getValue());
     }
 
@@ -368,7 +348,7 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
     public void choiceToNormalized() {
         final ChoiceContainer choiceContainerBA = new ChoiceContainerBuilder().setIdentifier(new ExtendedBuilder()
             .setExtendedId(new ExtendedIdBuilder().setId("identifier_value").build()).build()).build();
-        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(
+        final Entry<YangInstanceIdentifier, NormalizedNode> entry = codecContext.toNormalizedNode(
             InstanceIdentifier.create(ChoiceContainer.class), choiceContainerBA);
         final ContainerNode choiceContainer = ImmutableContainerNodeBuilder.create()
                 .withNodeIdentifier(new NodeIdentifier(CHOICE_CONTAINER_QNAME))
@@ -401,7 +381,7 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
                         .withChild(leafNode(nestedContainerLeafOuterQname, "bar"))
                         .build())
                 .build();
-        final Entry<InstanceIdentifier<?>, DataObject> entryContainer = registry.fromNormalizedNode(
+        final Entry<InstanceIdentifier<?>, DataObject> entryContainer = codecContext.fromNormalizedNode(
             yangInstanceIdentifierOuter, containerNodeOuter);
         assertNotNull(entryContainer.getValue());
         assertNotNull(entryContainer.getKey());
@@ -435,7 +415,7 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
                         .build())
                 .build();
         try {
-            registry.fromNormalizedNode(yangInstanceIdentifierValid, containerNodeValid);
+            codecContext.fromNormalizedNode(yangInstanceIdentifierValid, containerNodeValid);
             fail("Incorect YangInstanceIdentifier should fail");
         } catch (IllegalStateException e) {
             // Expected
@@ -453,7 +433,7 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
                         .build())
                 .build();
         try {
-            registry.fromNormalizedNode(yangInstanceIdentifier4798, containerNode4798);
+            codecContext.fromNormalizedNode(yangInstanceIdentifier4798, containerNode4798);
             fail("Incorect YangInstanceIdentifier should fail");
         } catch (IllegalStateException e) {
             // Expected
@@ -470,7 +450,7 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
                         .withNodeIdentifier(new NodeIdentifier(EXTENDED_ID_QNAME))
                         .withChild(leafNode(CHOICE_IDENTIFIER_ID_QNAME, "identifier_value")).build()).build())
                 .build();
-        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_CHOICE_CONTAINER_PATH,
+        final Entry<InstanceIdentifier<?>, DataObject> entry = codecContext.fromNormalizedNode(BI_CHOICE_CONTAINER_PATH,
             choiceContainerBI);
         final ChoiceContainer choiceContainerBA = new ChoiceContainerBuilder().setIdentifier(new ExtendedBuilder()
             .setExtendedId(new ExtendedIdBuilder().setId("identifier_value").build()).build()).build();
@@ -479,17 +459,18 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
 
     @Test
     public void orderedLisToNormalized() {
-        final InstanceIdentifier<TopLevelList> ii = BA_TOP_LEVEL_LIST;
-        final List<NestedList> nestedLists = new ArrayList<>();
-        nestedLists.add(new NestedListBuilder().withKey(new NestedListKey("foo")).build());
-        nestedLists.add(new NestedListBuilder().withKey(new NestedListKey("bar")).build());
-        final TopLevelList topLevelList = new TopLevelListBuilder().withKey(TOP_LEVEL_LIST_FOO_KEY).setNestedList(
-            nestedLists).build();
-        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry = registry.toNormalizedNode(ii, topLevelList);
+        final TopLevelList topLevelList = new TopLevelListBuilder()
+            .withKey(TOP_LEVEL_LIST_FOO_KEY)
+            .setNestedList(List.of(
+                new NestedListBuilder().withKey(new NestedListKey("foo")).build(),
+                new NestedListBuilder().withKey(new NestedListKey("bar")).build()))
+            .build();
+        final Entry<YangInstanceIdentifier, NormalizedNode> entry = codecContext.toNormalizedNode(BA_TOP_LEVEL_LIST,
+            topLevelList);
         final MapEntryNode foo = mapEntryBuilder().withNodeIdentifier(NodeIdentifierWithPredicates.of(
                 TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
                 .withChild(leafNode(TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
-                .withChild(ImmutableOrderedMapNodeBuilder.create()
+                .withChild(ImmutableUserMapNodeBuilder.create()
                     .withNodeIdentifier(new NodeIdentifier(NESTED_LIST_QNAME))
                     .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "foo"))
                     .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "bar")).build()).build();
@@ -501,17 +482,18 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
         final MapEntryNode foo = mapEntryBuilder().withNodeIdentifier(NodeIdentifierWithPredicates.of(
                 TOP_LEVEL_LIST_QNAME, TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
                 .withChild(leafNode(TOP_LEVEL_LIST_KEY_QNAME, TOP_LEVEL_LIST_FOO_KEY_VALUE))
-                .withChild(ImmutableOrderedMapNodeBuilder.create()
+                .withChild(ImmutableUserMapNodeBuilder.create()
                     .withNodeIdentifier(new NodeIdentifier(NESTED_LIST_QNAME))
                     .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "foo"))
                     .withChild(mapEntry(NESTED_LIST_QNAME, NESTED_LIST_KEY_QNAME, "bar")).build()).build();
-        final Entry<InstanceIdentifier<?>, DataObject> entry = registry.fromNormalizedNode(BI_TOP_LEVEL_LIST_FOO_PATH,
-            foo);
-        final List<NestedList> nestedLists = new ArrayList<>();
-        nestedLists.add(new NestedListBuilder().withKey(new NestedListKey("foo")).build());
-        nestedLists.add(new NestedListBuilder().withKey(new NestedListKey("bar")).build());
-        final TopLevelList topLevelList = new TopLevelListBuilder().withKey(TOP_LEVEL_LIST_FOO_KEY).setNestedList(
-            nestedLists).build();
+        final Entry<InstanceIdentifier<?>, DataObject> entry = codecContext.fromNormalizedNode(
+            BI_TOP_LEVEL_LIST_FOO_PATH, foo);
+        final TopLevelList topLevelList = new TopLevelListBuilder()
+            .withKey(TOP_LEVEL_LIST_FOO_KEY)
+            .setNestedList(List.of(
+                new NestedListBuilder().withKey(new NestedListKey("foo")).build(),
+                new NestedListBuilder().withKey(new NestedListKey("bar")).build()))
+            .build();
         assertEquals(topLevelList, entry.getValue());
     }
 
@@ -522,8 +504,8 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
         final QName containerQName = QName.create(augmentChoice1QName, "case11-choice-case-container");
         final QName leafQName = QName.create(augmentChoice1QName, "case11-choice-case-leaf");
 
-        final AugmentationIdentifier aug1Id = new AugmentationIdentifier(Collections.singleton(augmentChoice1QName));
-        final AugmentationIdentifier aug2Id = new AugmentationIdentifier(Collections.singleton(augmentChoice2QName));
+        final AugmentationIdentifier aug1Id = new AugmentationIdentifier(Set.of(augmentChoice1QName));
+        final AugmentationIdentifier aug2Id = new AugmentationIdentifier(Set.of(augmentChoice2QName));
         final NodeIdentifier augmentChoice1Id = new NodeIdentifier(augmentChoice1QName);
         final NodeIdentifier augmentChoice2Id = new NodeIdentifier(augmentChoice2QName);
         final NodeIdentifier containerId = new NodeIdentifier(containerQName);
@@ -537,16 +519,16 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
         cccc1Builder.setCase11ChoiceCaseLeaf("leaf-value");
         c11Builder.setCase11ChoiceCaseContainer(cccc1Builder.build());
         tca2Builder.setAugmentChoice2(c11Builder.build());
-        c1Builder.addAugmentation(TopChoiceAugment2.class, tca2Builder.build());
+        c1Builder.addAugmentation(tca2Builder.build());
         tca1Builder.setAugmentChoice1(c1Builder.build());
-        tBuilder.addAugmentation(TopChoiceAugment1.class, tca1Builder.build());
+        tBuilder.addAugmentation(tca1Builder.build());
         final Top top = tBuilder.build();
 
-        final Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> biResult = registry.toNormalizedNode(
+        final Entry<YangInstanceIdentifier, NormalizedNode> biResult = codecContext.toNormalizedNode(
             InstanceIdentifier.create(Top.class), top);
 
-        final NormalizedNode<?, ?> topNormalized =
-                containerBuilder().withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
+        final NormalizedNode topNormalized = containerBuilder()
+                .withNodeIdentifier(new NodeIdentifier(TOP_QNAME))
                 .withChild(augmentationBuilder().withNodeIdentifier(aug1Id)
                         .withChild(choiceBuilder().withNodeIdentifier(augmentChoice1Id)
                                 .withChild(augmentationBuilder().withNodeIdentifier(aug2Id)
@@ -562,7 +544,7 @@ public class NormalizedNodeSerializeDeserializeTest extends AbstractBindingCodec
         assertEquals(BI_TOP_PATH, biResult.getKey());
         assertEquals(topNormalized, biResult.getValue());
 
-        final Entry<InstanceIdentifier<?>, DataObject> baResult = registry.fromNormalizedNode(BI_TOP_PATH,
+        final Entry<InstanceIdentifier<?>, DataObject> baResult = codecContext.fromNormalizedNode(BI_TOP_PATH,
             topNormalized);
 
         assertEquals(InstanceIdentifier.create(Top.class), baResult.getKey());