Fix raw type warnings 56/34556/7
authorRobert Varga <rovarga@cisco.com>
Fri, 12 Feb 2016 12:28:25 +0000 (13:28 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 15 Feb 2016 10:04:38 +0000 (10:04 +0000)
Fixes NodeWithValue and similar raw type warnings. Also imports
YangInstanceIdentifier inner interfaces for more readable code.

Change-Id: Iaff9e250fff26b0da70dd9f24d7ccc72121630e4
Signed-off-by: Robert Varga <rovarga@cisco.com>
18 files changed:
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/DefaultConfigParamsImpl.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithValueGenerator.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtils.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializer.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializer.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/AbstractNormalizedNodeDataOutput.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/schema/provider/impl/RemoteYangTextSourceProviderImpl.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/xml/codec/XmlUtils.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtilsTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializerTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeStreamReaderWriterTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/ValueTypesTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/transformer/NormalizedNodePrunerTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/schema/provider/impl/RemoteSchemaProviderTest.java

index 46949da..f5f410c 100644 (file)
@@ -173,7 +173,7 @@ public class DefaultConfigParamsImpl implements ConfigParams {
             try {
                 String className = DefaultConfigParamsImpl.this.customRaftPolicyImplementationClass;
                 LOG.info("Trying to use custom RaftPolicy {}", className);
-                Class c = Class.forName(className);
+                Class<?> c = Class.forName(className);
                 RaftPolicy obj = (RaftPolicy)c.newInstance();
                 return obj;
             } catch (Exception e) {
index bf94a09..9dce97f 100644 (file)
@@ -38,7 +38,7 @@ public class NodeIdentifierWithValueGenerator{
             final String name = matcher.group(1);
             final String value = matcher.group(2);
 
-            return new YangInstanceIdentifier.NodeWithValue(
+            return new YangInstanceIdentifier.NodeWithValue<>(
                 QNameFactory.create(name), getValue(value));
         }
 
index 2342bf8..8324b64 100644 (file)
@@ -15,6 +15,11 @@ import java.util.List;
 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.YangInstanceIdentifier.PathArgument;
 
 public class PathUtils {
     private static final Splitter SLASH_SPLITTER = Splitter.on('/').omitEmptyStrings();
@@ -27,8 +32,7 @@ public class PathUtils {
      * @return
      */
     public static String toString(YangInstanceIdentifier path) {
-        final Iterator<YangInstanceIdentifier.PathArgument> it =
-            path.getPathArguments().iterator();
+        final Iterator<PathArgument> it = path.getPathArguments().iterator();
         if (!it.hasNext()) {
             return "";
         }
@@ -52,15 +56,15 @@ public class PathUtils {
      * @param pathArgument
      * @return
      */
-    public static String toString(YangInstanceIdentifier.PathArgument pathArgument){
-        if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifier){
-            return toString((YangInstanceIdentifier.NodeIdentifier) pathArgument);
-        } else if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier){
-            return toString((YangInstanceIdentifier.AugmentationIdentifier) pathArgument);
-        } else if(pathArgument instanceof YangInstanceIdentifier.NodeWithValue){
-            return toString((YangInstanceIdentifier.NodeWithValue) pathArgument);
-        } else if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates){
-            return toString((YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument);
+    public static String toString(PathArgument pathArgument){
+        if(pathArgument instanceof NodeIdentifier){
+            return toString((NodeIdentifier) pathArgument);
+        } else if(pathArgument instanceof AugmentationIdentifier){
+            return toString((AugmentationIdentifier) pathArgument);
+        } else if(pathArgument instanceof NodeWithValue){
+            return toString((NodeWithValue<?>) pathArgument);
+        } else if(pathArgument instanceof NodeIdentifierWithPredicates){
+            return toString((NodeIdentifierWithPredicates) pathArgument);
         }
 
         return pathArgument.toString();
@@ -74,18 +78,18 @@ public class PathUtils {
      * @return
      */
     public static YangInstanceIdentifier toYangInstanceIdentifier(String path){
-        List<YangInstanceIdentifier.PathArgument> pathArguments = new ArrayList<>();
+        List<PathArgument> pathArguments = new ArrayList<>();
         for (String segment : SLASH_SPLITTER.split(path)) {
             pathArguments.add(NodeIdentifierFactory.getArgument(segment));
         }
         return YangInstanceIdentifier.create(pathArguments);
     }
 
-    private static String toString(YangInstanceIdentifier.NodeIdentifier pathArgument){
+    private static String toString(NodeIdentifier pathArgument){
         return pathArgument.getNodeType().toString();
     }
 
-    private static String toString(YangInstanceIdentifier.AugmentationIdentifier pathArgument){
+    private static String toString(AugmentationIdentifier pathArgument){
         Set<QName> childNames = pathArgument.getPossibleChildNames();
         final StringBuilder sb = new StringBuilder("AugmentationIdentifier{");
         sb.append("childNames=").append(childNames).append('}');
@@ -93,11 +97,11 @@ public class PathUtils {
 
     }
 
-    private static String toString(YangInstanceIdentifier.NodeWithValue pathArgument){
+    private static String toString(NodeWithValue<?> pathArgument) {
         return pathArgument.getNodeType().toString() + "[" + pathArgument.getValue() + "]";
     }
 
-    private static String toString(YangInstanceIdentifier.NodeIdentifierWithPredicates pathArgument){
+    private static String toString(NodeIdentifierWithPredicates pathArgument){
         return pathArgument.getNodeType().toString() + '[' + pathArgument.getKeyValues() + ']';
     }
 
index 9e75380..67c8c43 100644 (file)
@@ -83,12 +83,12 @@ public class NormalizedNodeSerializer {
      * @param node
      * @return
      */
-    public static NormalizedNodeMessages.Node serialize(NormalizedNode<?, ?> node){
+    public static NormalizedNodeMessages.Node serialize(final NormalizedNode<?, ?> node){
         Preconditions.checkNotNull(node, "node should not be null");
         return new Serializer(node).serialize();
     }
 
-    public static Serializer newSerializer(NormalizedNode<?, ?> node) {
+    public static Serializer newSerializer(final NormalizedNode<?, ?> node) {
         Preconditions.checkNotNull(node, "node should not be null");
         return new Serializer(node);
     }
@@ -99,13 +99,13 @@ public class NormalizedNodeSerializer {
      * @param node
      * @return
      */
-    public static NormalizedNode<?, ?> deSerialize(NormalizedNodeMessages.Node node) {
+    public static NormalizedNode<?, ?> deSerialize(final NormalizedNodeMessages.Node node) {
         Preconditions.checkNotNull(node, "node should not be null");
         return new DeSerializer(null, node).deSerialize();
     }
 
-    public static DeSerializer newDeSerializer(NormalizedNodeMessages.InstanceIdentifier path,
-            NormalizedNodeMessages.Node node) {
+    public static DeSerializer newDeSerializer(final NormalizedNodeMessages.InstanceIdentifier path,
+            final NormalizedNodeMessages.Node node) {
         Preconditions.checkNotNull(node, "node should not be null");
         return new DeSerializer(path, node);
     }
@@ -123,8 +123,8 @@ public class NormalizedNodeSerializer {
      * @param pathArgument
      * @return
      */
-    public static YangInstanceIdentifier.PathArgument deSerialize(NormalizedNodeMessages.Node node,
-            NormalizedNodeMessages.PathArgument pathArgument){
+    public static YangInstanceIdentifier.PathArgument deSerialize(final NormalizedNodeMessages.Node node,
+            final NormalizedNodeMessages.PathArgument pathArgument){
         Preconditions.checkNotNull(node, "node should not be null");
         Preconditions.checkNotNull(pathArgument, "pathArgument should not be null");
         return new DeSerializer(null, node).deSerialize(pathArgument);
@@ -137,7 +137,7 @@ public class NormalizedNodeSerializer {
 
         private NormalizedNodeMessages.InstanceIdentifier serializedPath;
 
-        private Serializer(NormalizedNode<?, ?> node) {
+        private Serializer(final NormalizedNode<?, ?> node) {
             this.node = node;
         }
 
@@ -149,14 +149,14 @@ public class NormalizedNodeSerializer {
             return this.serialize(node).addAllCode(getCodes()).build();
         }
 
-        public NormalizedNodeMessages.Node serialize(YangInstanceIdentifier path) {
+        public NormalizedNodeMessages.Node serialize(final YangInstanceIdentifier path) {
             Builder builder = serialize(node);
             serializedPath = InstanceIdentifierUtils.toSerializable(path, this);
             return builder.addAllCode(getCodes()).build();
         }
 
         private NormalizedNodeMessages.Node.Builder serialize(
-            NormalizedNode<?, ?> node) {
+            final NormalizedNode<?, ?> node) {
             NormalizedNodeMessages.Node.Builder builder =
                 NormalizedNodeMessages.Node.newBuilder();
 
@@ -210,7 +210,7 @@ public class NormalizedNodeSerializer {
 
             m.put(CONTAINER_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> builder = Builders.containerBuilder()
                             .withNodeIdentifier(deSerializer.toNodeIdentifier(node.getPathArgument()));
 
@@ -219,7 +219,7 @@ public class NormalizedNodeSerializer {
             });
             m.put(LEAF_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     NormalizedNodeAttrBuilder<NodeIdentifier, Object, LeafNode<Object>> builder = Builders.leafBuilder()
                             .withNodeIdentifier(deSerializer.toNodeIdentifier(node.getPathArgument()));
 
@@ -228,13 +228,13 @@ public class NormalizedNodeSerializer {
             });
             m.put(MAP_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     return deSerializer.buildCollectionNode(Builders.mapBuilder(), node);
                 }
             });
             m.put(MAP_ENTRY_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> builder =
                             Builders.mapEntryBuilder().withNodeIdentifier(deSerializer.toNodeIdentifierWithPredicates(
                                 node.getPathArgument()));
@@ -244,7 +244,7 @@ public class NormalizedNodeSerializer {
             });
             m.put(AUGMENTATION_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     DataContainerNodeBuilder<AugmentationIdentifier, AugmentationNode> builder =
                             Builders.augmentationBuilder().withNodeIdentifier(
                                 deSerializer.toAugmentationIdentifier(node.getPathArgument()));
@@ -254,13 +254,13 @@ public class NormalizedNodeSerializer {
             });
             m.put(LEAF_SET_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     return deSerializer.buildListNode(Builders.leafSetBuilder(), node);
                 }
             });
             m.put(LEAF_SET_ENTRY_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     NormalizedNodeAttrBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> builder =
                             Builders.leafSetEntryBuilder().withNodeIdentifier(deSerializer.toNodeWithValue(
                                 node.getPathArgument()));
@@ -270,7 +270,7 @@ public class NormalizedNodeSerializer {
             });
             m.put(CHOICE_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> builder = Builders.choiceBuilder()
                             .withNodeIdentifier(deSerializer.toNodeIdentifier(node.getPathArgument()));
 
@@ -279,25 +279,25 @@ public class NormalizedNodeSerializer {
             });
             m.put(ORDERED_LEAF_SET_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     return deSerializer.buildListNode(Builders.orderedLeafSetBuilder(), node);
                 }
             });
             m.put(ORDERED_MAP_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     return deSerializer.buildCollectionNode(Builders.orderedMapBuilder(), node);
                 }
             });
             m.put(UNKEYED_LIST_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     return deSerializer.buildCollectionNode(Builders.unkeyedListBuilder(), node);
                 }
             });
             m.put(UNKEYED_LIST_ENTRY_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> builder =
                             Builders.unkeyedListEntryBuilder().withNodeIdentifier(deSerializer.toNodeIdentifier(
                                 node.getPathArgument()));
@@ -307,7 +307,7 @@ public class NormalizedNodeSerializer {
             });
             m.put(ANY_XML_NODE_TYPE, new DeSerializationFunction() {
                 @Override
-                public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+                public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
                     NormalizedNodeAttrBuilder<NodeIdentifier, DOMSource, AnyXmlNode> builder = Builders.anyXmlBuilder()
                             .withNodeIdentifier(deSerializer.toNodeIdentifier(node.getPathArgument()));
 
@@ -322,8 +322,8 @@ public class NormalizedNodeSerializer {
         private final NormalizedNodeMessages.InstanceIdentifier path;
         private YangInstanceIdentifier deserializedPath;
 
-        public DeSerializer(NormalizedNodeMessages.InstanceIdentifier path,
-                NormalizedNodeMessages.Node node) {
+        public DeSerializer(final NormalizedNodeMessages.InstanceIdentifier path,
+                final NormalizedNodeMessages.Node node) {
             super(node.getCodeList());
             this.path = path;
             this.node = node;
@@ -342,7 +342,7 @@ public class NormalizedNodeSerializer {
             return deserializedNode;
         }
 
-        private NormalizedNode<?, ?> deSerialize(NormalizedNodeMessages.Node node){
+        private NormalizedNode<?, ?> deSerialize(final NormalizedNodeMessages.Node node){
             Preconditions.checkNotNull(node, "node should not be null");
 
             DeSerializationFunction deSerializationFunction = DESERIALIZATION_FUNCTIONS.get(
@@ -353,8 +353,8 @@ public class NormalizedNodeSerializer {
 
 
         private NormalizedNode<?, ?> buildCollectionNode(
-            CollectionNodeBuilder builder,
-            NormalizedNodeMessages.Node node) {
+            final CollectionNodeBuilder builder,
+            final NormalizedNodeMessages.Node node) {
 
             builder.withNodeIdentifier(toNodeIdentifier(node.getPathArgument()));
 
@@ -367,8 +367,8 @@ public class NormalizedNodeSerializer {
 
 
         private NormalizedNode<?, ?> buildListNode(
-            ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder,
-            NormalizedNodeMessages.Node node) {
+            final ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder,
+            final NormalizedNodeMessages.Node node) {
             builder.withNodeIdentifier(toNodeIdentifier(node.getPathArgument()));
 
             for(NormalizedNodeMessages.Node child : node.getChildList()){
@@ -378,7 +378,7 @@ public class NormalizedNodeSerializer {
             return builder.build();
         }
 
-        private NormalizedNode<?, ?> buildDataContainer(DataContainerNodeBuilder<?, ?> builder, NormalizedNodeMessages.Node node){
+        private NormalizedNode<?, ?> buildDataContainer(final DataContainerNodeBuilder<?, ?> builder, final NormalizedNodeMessages.Node node){
 
             for(NormalizedNodeMessages.Node child : node.getChildList()){
                 builder.withChild((DataContainerChild<?, ?>) deSerialize(child));
@@ -389,7 +389,7 @@ public class NormalizedNodeSerializer {
             return builder.build();
         }
 
-        private NormalizedNode<?, ?> buildNormalizedNode(NormalizedNodeAttrBuilder builder, NormalizedNodeMessages.Node node){
+        private NormalizedNode<?, ?> buildNormalizedNode(final NormalizedNodeAttrBuilder builder, final NormalizedNodeMessages.Node node){
 
             builder.withValue(ValueSerializer.deSerialize(this, node));
 
@@ -399,29 +399,25 @@ public class NormalizedNodeSerializer {
 
         }
 
-
-        private YangInstanceIdentifier.NodeIdentifierWithPredicates toNodeIdentifierWithPredicates(
-            NormalizedNodeMessages.PathArgument path) {
-            return (YangInstanceIdentifier.NodeIdentifierWithPredicates) PathArgumentSerializer.deSerialize(this, path);
+        private NodeIdentifierWithPredicates toNodeIdentifierWithPredicates(
+            final NormalizedNodeMessages.PathArgument path) {
+            return (NodeIdentifierWithPredicates) PathArgumentSerializer.deSerialize(this, path);
         }
 
-        private YangInstanceIdentifier.AugmentationIdentifier toAugmentationIdentifier(
-            NormalizedNodeMessages.PathArgument path) {
-            return (YangInstanceIdentifier.AugmentationIdentifier) PathArgumentSerializer.deSerialize(this, path);
+        private AugmentationIdentifier toAugmentationIdentifier(final NormalizedNodeMessages.PathArgument path) {
+            return (AugmentationIdentifier) PathArgumentSerializer.deSerialize(this, path);
         }
 
-        private YangInstanceIdentifier.NodeWithValue toNodeWithValue(
-            NormalizedNodeMessages.PathArgument path) {
-            return (YangInstanceIdentifier.NodeWithValue) PathArgumentSerializer.deSerialize(
-                this, path);
+        @SuppressWarnings("unchecked")
+        private <T> NodeWithValue<T> toNodeWithValue(final NormalizedNodeMessages.PathArgument path) {
+            return (NodeWithValue<T>) PathArgumentSerializer.deSerialize(this, path);
         }
 
-        private NodeIdentifier toNodeIdentifier(NormalizedNodeMessages.PathArgument path){
+        private NodeIdentifier toNodeIdentifier(final NormalizedNodeMessages.PathArgument path){
             return (NodeIdentifier) PathArgumentSerializer.deSerialize(this, path);
         }
 
-        public YangInstanceIdentifier.PathArgument deSerialize(
-            NormalizedNodeMessages.PathArgument pathArgument) {
+        public YangInstanceIdentifier.PathArgument deSerialize(final NormalizedNodeMessages.PathArgument pathArgument) {
             return PathArgumentSerializer.deSerialize(this, pathArgument);
         }
 
index bf10316..989bd26 100644 (file)
@@ -73,8 +73,8 @@ public class PathArgumentSerializer {
             public Iterable<? extends NormalizedNodeMessages.PathArgumentAttribute> get(
                     QNameSerializationContext context, YangInstanceIdentifier.PathArgument pathArgument) {
 
-                YangInstanceIdentifier.NodeWithValue identifier
-                    = (YangInstanceIdentifier.NodeWithValue) pathArgument;
+                YangInstanceIdentifier.NodeWithValue<?> identifier
+                    = (YangInstanceIdentifier.NodeWithValue<?>) pathArgument;
 
                 NormalizedNodeMessages.PathArgumentAttribute attribute =
                     buildAttribute(context, null, identifier.getValue());
@@ -211,8 +211,8 @@ public class PathArgumentSerializer {
         switch(PathArgumentType.values()[pathArgument.getIntType()]){
             case NODE_IDENTIFIER_WITH_VALUE : {
 
-                YangInstanceIdentifier.NodeWithValue nodeWithValue =
-                    new YangInstanceIdentifier.NodeWithValue(
+                YangInstanceIdentifier.NodeWithValue<?> nodeWithValue =
+                    new YangInstanceIdentifier.NodeWithValue<>(
                         QNameFactory.create(qNameToString(context, pathArgument.getNodeType())),
                         parseAttribute(context, pathArgument.getAttribute(0)));
 
index abe1f8c..5512f31 100644 (file)
@@ -17,6 +17,11 @@ import java.util.Map;
 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.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
@@ -147,7 +152,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void leafNode(final YangInstanceIdentifier.NodeIdentifier name, final Object value) throws IOException, IllegalArgumentException {
+    public void leafNode(final NodeIdentifier name, final Object value) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
         LOG.debug("Writing a new leaf node");
         startNode(name.getNodeType(), NodeTypes.LEAF_NODE);
@@ -156,7 +161,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startLeafSet(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startLeafSet(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
         LOG.debug("Starting a new leaf set");
 
@@ -165,7 +170,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startOrderedLeafSet(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startOrderedLeafSet(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
         LOG.debug("Starting a new ordered leaf set");
 
@@ -189,7 +194,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startContainerNode(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startContainerNode(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
 
         LOG.debug("Starting a new container node");
@@ -198,7 +203,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startYangModeledAnyXmlNode(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startYangModeledAnyXmlNode(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
 
         LOG.debug("Starting a new yang modeled anyXml node");
@@ -207,7 +212,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startUnkeyedList(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
         LOG.debug("Starting a new unkeyed list");
 
@@ -215,7 +220,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startUnkeyedListItem(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalStateException {
+    public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalStateException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
         LOG.debug("Starting a new unkeyed list item");
 
@@ -223,7 +228,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startMapNode(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startMapNode(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
         LOG.debug("Starting a new map node");
 
@@ -231,7 +236,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startMapEntryNode(final YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(identifier, "Node identifier should not be null");
         LOG.debug("Starting a new map entry node");
         startNode(identifier.getNodeType(), NodeTypes.MAP_ENTRY_NODE);
@@ -241,7 +246,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startOrderedMapNode(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startOrderedMapNode(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
         LOG.debug("Starting a new ordered map node");
 
@@ -249,7 +254,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startChoiceNode(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+    public void startChoiceNode(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
         LOG.debug("Starting a new choice node");
 
@@ -257,7 +262,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void startAugmentationNode(final YangInstanceIdentifier.AugmentationIdentifier identifier) throws IOException, IllegalArgumentException {
+    public void startAugmentationNode(final AugmentationIdentifier identifier) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(identifier, "Node identifier should not be null");
         LOG.debug("Starting a new augmentation node");
 
@@ -266,7 +271,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
-    public void anyxmlNode(final YangInstanceIdentifier.NodeIdentifier name, final Object value) throws IOException, IllegalArgumentException {
+    public void anyxmlNode(final NodeIdentifier name, final Object value) throws IOException, IllegalArgumentException {
         Preconditions.checkNotNull(name, "Node identifier should not be null");
         LOG.debug("Writing a new xml node");
 
@@ -323,16 +328,16 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     private void writeYangInstanceIdentifierInternal(final YangInstanceIdentifier identifier) throws IOException {
-        Collection<YangInstanceIdentifier.PathArgument> pathArguments = identifier.getPathArguments();
+        Collection<PathArgument> pathArguments = identifier.getPathArguments();
         output.writeInt(pathArguments.size());
 
-        for(YangInstanceIdentifier.PathArgument pathArgument : pathArguments) {
+        for(PathArgument pathArgument : pathArguments) {
             writePathArgument(pathArgument);
         }
     }
 
     @Override
-    public void writePathArgument(final YangInstanceIdentifier.PathArgument pathArgument) throws IOException {
+    public void writePathArgument(final PathArgument pathArgument) throws IOException {
 
         byte type = PathArgumentTypes.getSerializablePathArgumentType(pathArgument);
 
@@ -341,16 +346,15 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
         switch(type) {
             case PathArgumentTypes.NODE_IDENTIFIER:
 
-                YangInstanceIdentifier.NodeIdentifier nodeIdentifier =
-                    (YangInstanceIdentifier.NodeIdentifier) pathArgument;
+                NodeIdentifier nodeIdentifier = (NodeIdentifier) pathArgument;
 
                 writeQName(nodeIdentifier.getNodeType());
                 break;
 
             case PathArgumentTypes.NODE_IDENTIFIER_WITH_PREDICATES:
 
-                YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates =
-                    (YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument;
+                NodeIdentifierWithPredicates nodeIdentifierWithPredicates =
+                    (NodeIdentifierWithPredicates) pathArgument;
                 writeQName(nodeIdentifierWithPredicates.getNodeType());
 
                 writeKeyValueMap(nodeIdentifierWithPredicates.getKeyValues());
@@ -358,8 +362,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
             case PathArgumentTypes.NODE_IDENTIFIER_WITH_VALUE :
 
-                YangInstanceIdentifier.NodeWithValue nodeWithValue =
-                    (YangInstanceIdentifier.NodeWithValue) pathArgument;
+                NodeWithValue<?> nodeWithValue = (NodeWithValue<?>) pathArgument;
 
                 writeQName(nodeWithValue.getNodeType());
                 writeObject(nodeWithValue.getValue());
@@ -367,8 +370,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
 
             case PathArgumentTypes.AUGMENTATION_IDENTIFIER :
 
-                YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
-                    (YangInstanceIdentifier.AugmentationIdentifier) pathArgument;
+                AugmentationIdentifier augmentationIdentifier = (AugmentationIdentifier) pathArgument;
 
                 // No Qname in augmentation identifier
                 writeQNameSet(augmentationIdentifier.getPossibleChildNames());
index 7ed50ff..a31a611 100644 (file)
@@ -63,8 +63,7 @@ public class NormalizedNodeInputStreamReader implements NormalizedNodeDataInput,
     private NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier,
                                       Object, LeafNode<Object>> leafBuilder;
 
-    private NormalizedNodeAttrBuilder<NodeWithValue, Object,
-                                      LeafSetEntryNode<Object>> leafSetEntryBuilder;
+    private NormalizedNodeAttrBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> leafSetEntryBuilder;
 
     private final StringBuilder reusableStringBuilder = new StringBuilder(50);
 
@@ -140,7 +139,7 @@ public class NormalizedNodeInputStreamReader implements NormalizedNodeDataInput,
                 }
 
                 Object value = readObject();
-                NodeWithValue<?> leafIdentifier = new NodeWithValue<>(name, value);
+                NodeWithValue<Object> leafIdentifier = new NodeWithValue<>(name, value);
 
                 LOG.debug("Reading leaf set entry node {}, value {}", leafIdentifier, value);
 
@@ -390,7 +389,7 @@ public class NormalizedNodeInputStreamReader implements NormalizedNodeDataInput,
                 return new NodeIdentifierWithPredicates(readQName(), readKeyValueMap());
 
             case PathArgumentTypes.NODE_IDENTIFIER_WITH_VALUE :
-                return new NodeWithValue(readQName(), readObject());
+                return new NodeWithValue<>(readQName(), readObject());
 
             default :
                 return null;
index aeb3177..b72ca58 100644 (file)
@@ -19,6 +19,10 @@ import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessa
 import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder;
 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.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import java.util.ArrayList;
@@ -67,12 +71,11 @@ public class InstanceIdentifierUtils {
             NormalizedNodeMessages.InstanceIdentifier.newBuilder();
 
         try {
-            for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.
-                                            PathArgument pathArgument : path.getPathArguments()) {
+            for (PathArgument pathArgument : path.getPathArguments()) {
                 NormalizedNodeMessages.PathArgument serializablePathArgument;
                 if(context == null) {
                     String nodeType = "";
-                    if(!(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier)){
+                    if (!(pathArgument instanceof AugmentationIdentifier)) {
                         nodeType = pathArgument.getNodeType().toString();
                     }
 
@@ -109,7 +112,7 @@ public class InstanceIdentifierUtils {
     public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path,
             QNameDeSerializationContext context) {
 
-        List<YangInstanceIdentifier.PathArgument> pathArguments = new ArrayList<>();
+        List<PathArgument> pathArguments = new ArrayList<>();
 
         for(NormalizedNodeMessages.PathArgument pathArgument : path.getArgumentsList()) {
             if(context == null || pathArgument.hasType()) {
@@ -155,14 +158,11 @@ public class InstanceIdentifierUtils {
      * @return
      */
     private static Iterable<? extends NormalizedNodeMessages.Attribute> getPathArgumentAttributes(
-        YangInstanceIdentifier.PathArgument pathArgument) {
+        PathArgument pathArgument) {
         List<NormalizedNodeMessages.Attribute> attributes = new ArrayList<>();
 
-
-
-        if (pathArgument instanceof YangInstanceIdentifier.NodeWithValue) {
-            YangInstanceIdentifier.NodeWithValue identifier
-                = (YangInstanceIdentifier.NodeWithValue) pathArgument;
+        if (pathArgument instanceof NodeWithValue) {
+            NodeWithValue<?> identifier = (NodeWithValue<?>) pathArgument;
 
             NormalizedNodeMessages.Attribute attribute =
                 NormalizedNodeMessages.Attribute.newBuilder()
@@ -172,9 +172,8 @@ public class InstanceIdentifierUtils {
                     .build();
 
             attributes.add(attribute);
-        } else if (pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
-            YangInstanceIdentifier.NodeIdentifierWithPredicates identifier
-                = (YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument;
+        } else if (pathArgument instanceof NodeIdentifierWithPredicates) {
+            NodeIdentifierWithPredicates identifier = (NodeIdentifierWithPredicates) pathArgument;
 
             for (QName key : identifier.getKeyValues().keySet()) {
                 Object value = identifier.getKeyValues().get(key);
@@ -189,9 +188,8 @@ public class InstanceIdentifierUtils {
 
             }
 
-        } else if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier) {
-            YangInstanceIdentifier.AugmentationIdentifier identifier
-                = (YangInstanceIdentifier.AugmentationIdentifier) pathArgument;
+        } else if(pathArgument instanceof AugmentationIdentifier) {
+            AugmentationIdentifier identifier = (AugmentationIdentifier) pathArgument;
 
             for (QName key : identifier.getPossibleChildNames()) {
                 Object value = key;
@@ -217,27 +215,25 @@ public class InstanceIdentifierUtils {
      * @param pathArgument protocol buffer PathArgument
      * @return MD-SAL PathArgument
      */
-    private static YangInstanceIdentifier.PathArgument parsePathArgument(
+    private static PathArgument parsePathArgument(
             NormalizedNodeMessages.PathArgument pathArgument) {
-        if (YangInstanceIdentifier.NodeWithValue.class.getSimpleName().equals(pathArgument.getType())) {
+        if (NodeWithValue.class.getSimpleName().equals(pathArgument.getType())) {
 
-            YangInstanceIdentifier.NodeWithValue nodeWithValue =
-                new YangInstanceIdentifier.NodeWithValue(
+            NodeWithValue<?> nodeWithValue = new NodeWithValue<>(
                     QNameFactory.create(pathArgument.getNodeType().getValue()),
                     parseAttribute(pathArgument.getAttributes(0)));
 
             return nodeWithValue;
 
-        } else if(YangInstanceIdentifier.NodeIdentifierWithPredicates.class.getSimpleName().equals(pathArgument.getType())){
+        } else if(NodeIdentifierWithPredicates.class.getSimpleName().equals(pathArgument.getType())){
 
-            YangInstanceIdentifier.NodeIdentifierWithPredicates
-                nodeIdentifierWithPredicates =
-                new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+            NodeIdentifierWithPredicates nodeIdentifierWithPredicates =
+                new NodeIdentifierWithPredicates(
                     QNameFactory.create(pathArgument.getNodeType().getValue()), toAttributesMap(pathArgument.getAttributesList()));
 
             return nodeIdentifierWithPredicates;
 
-        } else if(YangInstanceIdentifier.AugmentationIdentifier.class.getSimpleName().equals(pathArgument.getType())){
+        } else if(AugmentationIdentifier.class.getSimpleName().equals(pathArgument.getType())){
 
             Set<QName> qNameSet = new HashSet<>();
 
@@ -245,7 +241,7 @@ public class InstanceIdentifierUtils {
                 qNameSet.add(QNameFactory.create(attribute.getValue()));
             }
 
-            return new YangInstanceIdentifier.AugmentationIdentifier(qNameSet);
+            return new AugmentationIdentifier(qNameSet);
         }
 
         return NodeIdentifierFactory.getArgument(pathArgument.getValue());
index 07d1714..0b07eeb 100644 (file)
@@ -48,7 +48,7 @@ public class RemoteYangTextSourceProviderImpl implements RemoteYangTextSourcePro
         LOG.trace("Sending yang schema source for {}", identifier);
 
         final Promise<YangTextSchemaSourceSerializationProxy> promise = akka.dispatch.Futures.promise();
-        CheckedFuture future = repository.getSchemaSource(identifier, YangTextSchemaSource.class);
+        CheckedFuture<YangTextSchemaSource, ?> future = repository.getSchemaSource(identifier, YangTextSchemaSource.class);
 
         Futures.addCallback(future, new FutureCallback<YangTextSchemaSource>() {
             @Override
index 85d2c31..7b12a68 100644 (file)
@@ -24,63 +24,63 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
  */
 public class XmlUtils {
 
-  public static final XmlCodecProvider DEFAULT_XML_CODEC_PROVIDER = new XmlCodecProvider() {
-    @Override
-    public TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codecFor(final TypeDefinition<?> baseType) {
-      return TypeDefinitionAwareCodec.from(baseType);
-    }
-  };
+    public static final XmlCodecProvider DEFAULT_XML_CODEC_PROVIDER = new XmlCodecProvider() {
+        @Override
+        public TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codecFor(final TypeDefinition<?> baseType) {
+            return TypeDefinitionAwareCodec.from(baseType);
+        }
+    };
 
-  private XmlUtils() {
-  }
+    private XmlUtils() {
+    }
 
-  public static TypeDefinition<?> resolveBaseTypeFrom(final @Nonnull TypeDefinition<?> type) {
-    TypeDefinition<?> superType = type;
-    while (superType.getBaseType() != null) {
-      superType = superType.getBaseType();
+    public static TypeDefinition<?> resolveBaseTypeFrom(final @Nonnull TypeDefinition<?> type) {
+        TypeDefinition<?> superType = type;
+        while (superType.getBaseType() != null) {
+            superType = superType.getBaseType();
+        }
+        return superType;
     }
-    return superType;
-  }
 
-  /**
-   * This code is picked from yangtools and modified to add type of instance identifier
-   * output of instance identifier something like below for a flow ref composite node of type instance identifier,
-   * which has path arguments with predicates, whose value is of type java.lang.short
-   * <flow-ref xmlns:bgkj="urn:opendaylight:flow:inventory" xmlns:jdlk="urn:opendaylight:inventory">
-   *   /jdlk:nodes/jdlk:node[jdlk:id='openflow:205558455098190@java.lang.String']
-   *   /bgkj:table[bgkj:id='3@java.lang.Short']
-   *   /bgkj:flow[bgkj:id='156@java.lang.String']
-   * </flow-ref>
-   *
-   */
+    /**
+     * This code is picked from yangtools and modified to add type of instance identifier
+     * output of instance identifier something like below for a flow ref composite node of type instance identifier,
+     * which has path arguments with predicates, whose value is of type java.lang.short
+     * <flow-ref xmlns:bgkj="urn:opendaylight:flow:inventory" xmlns:jdlk="urn:opendaylight:inventory">
+     *   /jdlk:nodes/jdlk:node[jdlk:id='openflow:205558455098190@java.lang.String']
+     *   /bgkj:table[bgkj:id='3@java.lang.Short']
+     *   /bgkj:flow[bgkj:id='156@java.lang.String']
+     * </flow-ref>
+     *
+     */
 
-  public static String encodeIdentifier(final RandomPrefix prefixes, final YangInstanceIdentifier id) {
-    final StringBuilder textContent = new StringBuilder();
-    for (final PathArgument pathArgument : id.getPathArguments()) {
-      textContent.append('/');
-      textContent.append(prefixes.encodeQName(pathArgument.getNodeType()));
-      if (pathArgument instanceof NodeIdentifierWithPredicates) {
-        final Map<QName, Object> predicates = ((NodeIdentifierWithPredicates) pathArgument).getKeyValues();
+    public static String encodeIdentifier(final RandomPrefix prefixes, final YangInstanceIdentifier id) {
+        final StringBuilder textContent = new StringBuilder();
+        for (final PathArgument pathArgument : id.getPathArguments()) {
+            textContent.append('/');
+            textContent.append(prefixes.encodeQName(pathArgument.getNodeType()));
+            if (pathArgument instanceof NodeIdentifierWithPredicates) {
+                final Map<QName, Object> predicates = ((NodeIdentifierWithPredicates) pathArgument).getKeyValues();
 
-        for (final QName keyValue : predicates.keySet()) {
-          final Object value = predicates.get(keyValue);
-          final String type = value.getClass().getName();
-          final String predicateValue = String.valueOf(value);
-          textContent.append('[');
-          textContent.append(prefixes.encodeQName(keyValue));
-          textContent.append("='");
-          textContent.append(predicateValue);
-          textContent.append("@");
-          textContent.append(type);
-          textContent.append("']");
+                for (final QName keyValue : predicates.keySet()) {
+                    final Object value = predicates.get(keyValue);
+                    final String type = value.getClass().getName();
+                    final String predicateValue = String.valueOf(value);
+                    textContent.append('[');
+                    textContent.append(prefixes.encodeQName(keyValue));
+                    textContent.append("='");
+                    textContent.append(predicateValue);
+                    textContent.append("@");
+                    textContent.append(type);
+                    textContent.append("']");
+                }
+            } else if (pathArgument instanceof NodeWithValue) {
+                textContent.append("[.='");
+                textContent.append(((NodeWithValue<?>) pathArgument).getValue());
+                textContent.append("']");
+            }
         }
-      } else if (pathArgument instanceof NodeWithValue) {
-        textContent.append("[.='");
-        textContent.append(((NodeWithValue) pathArgument).getValue());
-        textContent.append("']");
-      }
-    }
 
-    return textContent.toString();
-  }
+        return textContent.toString();
+    }
 }
index 9010f6e..a12f150 100644 (file)
@@ -13,6 +13,11 @@ import org.junit.Test;
 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;
@@ -22,7 +27,7 @@ public class PathUtilsTest {
 
     @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";
 
@@ -33,7 +38,7 @@ public class PathUtilsTest {
     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));
     }
@@ -41,7 +46,7 @@ public class PathUtilsTest {
     @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]";
 
@@ -52,7 +57,7 @@ public class PathUtilsTest {
     @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}]";
 
@@ -93,25 +98,25 @@ public class PathUtilsTest {
 
     }
 
-    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);
     }
 }
index fdd2a23..922bc1b 100644 (file)
@@ -16,8 +16,11 @@ import org.junit.rules.ExpectedException;
 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;
@@ -39,8 +42,7 @@ public class PathArgumentSerializerTest{
         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
@@ -80,7 +82,7 @@ public class PathArgumentSerializerTest{
 
         NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
             .serialize(serializationContext,
-                new YangInstanceIdentifier.NodeIdentifier(
+                new NodeIdentifier(
                     TestModel.TEST_QNAME));
 
         assertEquals(PathArgumentType.NODE_IDENTIFIER.ordinal(), actual.getIntType());
@@ -101,7 +103,7 @@ public class PathArgumentSerializerTest{
 
         NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
             .serialize(serializationContext,
-                new YangInstanceIdentifier.NodeWithValue(
+                new NodeWithValue<>(
                     TestModel.TEST_QNAME, "foo"));
 
         assertEquals(PathArgumentType.NODE_IDENTIFIER_WITH_VALUE.ordinal(), actual.getIntType());
@@ -134,8 +136,7 @@ public class PathArgumentSerializerTest{
 
         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());
@@ -161,8 +162,7 @@ public class PathArgumentSerializerTest{
 
         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());
 
@@ -190,11 +190,9 @@ public class PathArgumentSerializerTest{
         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);
 
     }
 
@@ -218,11 +216,9 @@ public class PathArgumentSerializerTest{
         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
@@ -244,11 +240,9 @@ public class PathArgumentSerializerTest{
         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);
 
     }
@@ -269,14 +263,8 @@ public class PathArgumentSerializerTest{
         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);
     }
-
-
-
 }
index 9985c69..9803df9 100644 (file)
@@ -19,6 +19,7 @@ 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.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;
@@ -69,26 +70,23 @@ public class NormalizedNodeStreamReaderWriterTest {
     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();
index be521ef..ff1ddad 100644 (file)
@@ -19,7 +19,7 @@ public class ValueTypesTest {
         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++){
index 2ee8594..57fbd99 100644 (file)
@@ -32,6 +32,10 @@ import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeVi
 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;
@@ -159,13 +163,13 @@ public class NormalizedNodePrunerTest {
 
             @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();
     }
@@ -173,7 +177,7 @@ public class NormalizedNodePrunerTest {
     @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();
@@ -183,9 +187,9 @@ public class NormalizedNodePrunerTest {
     @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();
@@ -195,14 +199,14 @@ public class NormalizedNodePrunerTest {
     @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();
@@ -212,9 +216,9 @@ public class NormalizedNodePrunerTest {
     @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();
@@ -223,7 +227,7 @@ public class NormalizedNodePrunerTest {
 
     @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, "");
@@ -234,7 +238,7 @@ public class NormalizedNodePrunerTest {
     @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);
 
@@ -245,10 +249,10 @@ public class NormalizedNodePrunerTest {
     @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();
@@ -258,7 +262,7 @@ public class NormalizedNodePrunerTest {
     @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));
     }
@@ -266,7 +270,7 @@ public class NormalizedNodePrunerTest {
 
     @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());
@@ -275,7 +279,7 @@ public class NormalizedNodePrunerTest {
 
     @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());
@@ -284,7 +288,7 @@ public class NormalizedNodePrunerTest {
 
     @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());
@@ -293,7 +297,7 @@ public class NormalizedNodePrunerTest {
 
     @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());
@@ -302,7 +306,7 @@ public class NormalizedNodePrunerTest {
 
     @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());
@@ -312,7 +316,7 @@ public class NormalizedNodePrunerTest {
     @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());
@@ -322,7 +326,7 @@ public class NormalizedNodePrunerTest {
 
     @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());
@@ -331,7 +335,7 @@ public class NormalizedNodePrunerTest {
 
     @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());
@@ -340,7 +344,7 @@ public class NormalizedNodePrunerTest {
 
     @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());
@@ -361,7 +365,7 @@ public class NormalizedNodePrunerTest {
 
     @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();
@@ -383,26 +387,25 @@ public class NormalizedNodePrunerTest {
     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();
index 8557dda..18b577f 100644 (file)
@@ -23,13 +23,13 @@ import java.util.List;
 
 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
@@ -64,7 +64,7 @@ public class InstanceIdentifierUtilsTest {
         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<>();
 
@@ -137,7 +137,7 @@ public class InstanceIdentifierUtilsTest {
         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));
 
index 7df43e0..99b8cf8 100644 (file)
@@ -25,6 +25,10 @@ import java.util.Map;
 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;
@@ -240,33 +244,33 @@ public class TestModel {
         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();
 
@@ -276,7 +280,7 @@ public class TestModel {
                 ImmutableLeafSetEntryNodeBuilder
                         .create()
                         .withNodeIdentifier(
-                                new YangInstanceIdentifier.NodeWithValue(QName.create(
+                                new NodeWithValue<>(QName.create(
                                         TEST_QNAME, "capability"), DESC_QNAME))
                         .withValue(DESC_QNAME).build();
 
@@ -284,14 +288,14 @@ public class TestModel {
                 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
@@ -299,19 +303,19 @@ public class TestModel {
                 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();
 
@@ -320,11 +324,10 @@ public class TestModel {
         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 =
@@ -333,12 +336,12 @@ public class TestModel {
 
         // 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);
index 2c48b2c..3429600 100644 (file)
@@ -60,7 +60,7 @@ public class RemoteSchemaProviderTest {
         Mockito.when(mockedRemoteSchemaRepository.getYangTextSchemaSource(ID)).thenReturn(
                 Futures.<YangTextSchemaSourceSerializationProxy>failed(new SchemaSourceException("Source not provided")));
 
-        CheckedFuture sourceFuture = remoteSchemaProvider.getSource(ID);
+        CheckedFuture<?, ?> sourceFuture = remoteSchemaProvider.getSource(ID);
         assertTrue(sourceFuture.isDone());
         sourceFuture.checkedGet();
     }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.