Bug 2358: Fixed warnings in Restconf 21/18021/3
authorTony Tkacik <ttkacik@cisco.com>
Thu, 9 Apr 2015 13:00:39 +0000 (15:00 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Thu, 9 Apr 2015 17:32:03 +0000 (19:32 +0200)
Removed dead-code and fixed generics and casts
related warnings in restconf codebase.

Change-Id: I5cfad51fbf8856685259bcedd77ebe6d7527c899
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
33 files changed:
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/md/sal/rest/schema/SchemaRetrievalServiceImpl.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/AbstractIdentifierAwareJaxRsProvider.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonNormalizedNodeBodyReader.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfCompositeWrapper.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfDocumentedExceptionMapper.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlNormalizedNodeBodyReader.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIncorrectTopLevelTest.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonLeafrefType.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/input/to/cnsn/test/RestPutListDataTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CnSnToXmlAndJsonInstanceIdentifierTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestDeleteOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetAugmentedElementWhenEqualNamesTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URIParametersParsing.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/CompareLf.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Cont.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lf.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LfLst.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lst.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LstItem.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/YangElement.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlLeafrefToCnSnTest.java [deleted file]

index b7308c1fbae67d8f29267e69b2d6921ade172483..3d32427b18de6c0c877e35612a88dc04975862a2 100644 (file)
@@ -27,7 +27,6 @@ public class SchemaRetrievalServiceImpl implements SchemaRetrievalService {
     private final ControllerContext salContext;
 
     private static final Splitter SLASH_SPLITTER = Splitter.on("/");
-    private static final Splitter AT_SPLITTER = Splitter.on("@");
     private static final String MOUNT_ARG = ControllerContext.MOUNT;
 
     public SchemaRetrievalServiceImpl(final ControllerContext controllerContext) {
@@ -82,7 +81,7 @@ public class SchemaRetrievalServiceImpl implements SchemaRetrievalService {
     }
 
     private SchemaContext getMountSchemaContext(final String identifier) {
-        final InstanceIdentifierContext mountContext = salContext.toMountPointIdentifier(identifier);
+        final InstanceIdentifierContext<?> mountContext = salContext.toMountPointIdentifier(identifier);
         return mountContext.getSchemaContext();
     }
 
index 7b190e0dc439675a06a4b8892c8292a4c8b2c0d0..3486d2265bb6bc17aad501d50cf338e01f9af0cf 100644 (file)
@@ -1,6 +1,5 @@
 package org.opendaylight.controller.sal.rest.impl;
 
-import com.google.common.base.Optional;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Request;
 import javax.ws.rs.core.UriInfo;
@@ -22,11 +21,7 @@ public class AbstractIdentifierAwareJaxRsProvider {
         return uriInfo.getPathParameters(false).getFirst(RestconfConstants.IDENTIFIER);
     }
 
-    protected final Optional<InstanceIdentifierContext> getIdentifierWithSchema() {
-        return Optional.of(getInstanceIdentifierContext());
-    }
-
-    protected InstanceIdentifierContext getInstanceIdentifierContext() {
+    protected InstanceIdentifierContext<?> getInstanceIdentifierContext() {
         return ControllerContext.getInstance().toInstanceIdentifier(getIdentifier());
     }
 
index 5f7bd02ecf1bc46e4d0b84f8973d665139978dd0..e11cac2eb3fb0bc2e5a18abc219c239ce1587cad 100644 (file)
@@ -59,7 +59,7 @@ public class JsonNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsPr
             final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException,
             WebApplicationException {
         try {
-            final InstanceIdentifierContext<?> path = getIdentifierWithSchema().get();
+            final InstanceIdentifierContext<?> path = getInstanceIdentifierContext();
             if (entityStream.available() < 1) {
                 return new NormalizedNodeContext(path, null);
             }
index c8c032248f7a6d7243f42bdc4e95ce2e4b768b1c..f551904cb38b4940780cfc55d8d2dfacc0beeea3 100644 (file)
@@ -54,6 +54,7 @@ public class RestconfCompositeWrapper implements RestconfService, SchemaRetrieva
     }
 
     @Override
+    @Deprecated
     public NormalizedNodeContext invokeRpc(final String identifier, final String noPayload, final UriInfo uriInfo) {
         return restconf.invokeRpc(identifier, noPayload, uriInfo);
     }
index f52b42337e2a759ed52b01f9c85aa5bd5fba227f..721864f973a95d25bc00d674c056c922d0be4441 100644 (file)
@@ -138,7 +138,7 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
         }
         errContBuild.withChild(listErorsBuilder.build());
 
-        final NormalizedNodeContext errContext =  new NormalizedNodeContext(new InstanceIdentifierContext<DataSchemaNode>(null,
+        final NormalizedNodeContext errContext =  new NormalizedNodeContext(new InstanceIdentifierContext<>(null,
                 (DataSchemaNode) errorsSchemaNode, null, context.getGlobalSchema()), errContBuild.build());
 
         Object responseBody;
@@ -197,8 +197,8 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
 
         final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
         NormalizedNode<?, ?> data = errorsNode.getData();
-        final InstanceIdentifierContext<DataSchemaNode> context = (InstanceIdentifierContext<DataSchemaNode>) errorsNode.getInstanceIdentifierContext();
-        final DataSchemaNode schema = context.getSchemaNode();
+        final InstanceIdentifierContext<?> context = errorsNode.getInstanceIdentifierContext();
+        final DataSchemaNode schema = (DataSchemaNode) context.getSchemaNode();
 
         SchemaPath path = context.getSchemaNode().getPath();
         final OutputStreamWriter outputWriter = new OutputStreamWriter(outStream, Charsets.UTF_8);
@@ -241,7 +241,7 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
 
     private Object toXMLResponseBody(final NormalizedNodeContext errorsNode, final DataNodeContainer errorsSchemaNode) {
 
-        final InstanceIdentifierContext<DataSchemaNode> pathContext = (InstanceIdentifierContext<DataSchemaNode>) errorsNode.getInstanceIdentifierContext();
+        final InstanceIdentifierContext<?> pathContext = errorsNode.getInstanceIdentifierContext();
         final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
 
         XMLStreamWriter xmlWriter;
index bf668fa7fdd1583a2d0f3626d8f5e633a5da51b7..df990af7e12e9d8fc326e4a3796251813a04d9fa 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.sal.rest.impl;
 
-import com.google.common.base.Optional;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
@@ -83,11 +82,11 @@ public class XmlNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsPro
             final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException,
             WebApplicationException {
         try {
-            final Optional<InstanceIdentifierContext> path = getIdentifierWithSchema();
+            final InstanceIdentifierContext<?> path = getInstanceIdentifierContext();
 
             if (entityStream.available() < 1) {
                 // represent empty nopayload input
-                return new NormalizedNodeContext(path.get(), null);
+                return new NormalizedNodeContext(path, null);
             }
 
             final DocumentBuilder dBuilder;
@@ -98,8 +97,8 @@ public class XmlNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsPro
             }
             final Document doc = dBuilder.parse(entityStream);
 
-            final NormalizedNode<?, ?> result = parse(path.get(),doc);
-            return new NormalizedNodeContext(path.get(),result);
+            final NormalizedNode<?, ?> result = parse(path,doc);
+            return new NormalizedNodeContext(path,result);
         } catch (final Exception e) {
             LOG.debug("Error parsing xml input", e);
 
index e3beaa2287d01f5734b50a467b4e5cdd47cfcf6f..2da58a38203de35102e0cc5e7e667ec83adedeec 100644 (file)
@@ -119,7 +119,7 @@ public class ControllerContext implements SchemaContextListener {
         onGlobalContextUpdated(schemas);
     }
 
-    public InstanceIdentifierContext toInstanceIdentifier(final String restconfInstance) {
+    public InstanceIdentifierContext<?> toInstanceIdentifier(final String restconfInstance) {
         return toIdentifier(restconfInstance, false);
     }
 
@@ -127,11 +127,11 @@ public class ControllerContext implements SchemaContextListener {
         return globalSchema;
     }
 
-    public InstanceIdentifierContext toMountPointIdentifier(final String restconfInstance) {
+    public InstanceIdentifierContext<?> toMountPointIdentifier(final String restconfInstance) {
         return toIdentifier(restconfInstance, true);
     }
 
-    private InstanceIdentifierContext toIdentifier(final String restconfInstance, final boolean toMountPointIdentifier) {
+    private InstanceIdentifierContext<?> toIdentifier(final String restconfInstance, final boolean toMountPointIdentifier) {
         checkPreconditions();
 
         if(restconfInstance == null) {
@@ -153,7 +153,7 @@ public class ControllerContext implements SchemaContextListener {
 
         final InstanceIdentifierBuilder builder = YangInstanceIdentifier.builder();
         final Module latestModule = globalSchema.findModuleByName(startModule, null);
-        final InstanceIdentifierContext iiWithSchemaNode = collectPathArguments(builder, pathArgs, latestModule, null,
+        final InstanceIdentifierContext<?> iiWithSchemaNode = collectPathArguments(builder, pathArgs, latestModule, null,
                 toMountPointIdentifier);
 
         if (iiWithSchemaNode == null) {
@@ -494,7 +494,7 @@ public class ControllerContext implements SchemaContextListener {
         return object == null ? "" : URLEncoder.encode(codec.serialize(object).toString(), ControllerContext.URI_ENCODING_CHAR_SET);
     }
 
-    private InstanceIdentifierContext collectPathArguments(final InstanceIdentifierBuilder builder,
+    private InstanceIdentifierContext<?> collectPathArguments(final InstanceIdentifierBuilder builder,
             final List<String> strings, final DataNodeContainer parentNode, final DOMMountPoint mountPoint,
             final boolean returnJustMountPoint) {
         Preconditions.<List<String>> checkNotNull(strings);
@@ -543,7 +543,7 @@ public class ControllerContext implements SchemaContextListener {
 
                 if (returnJustMountPoint || strings.size() == 1) {
                     final YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance();
-                    return new InstanceIdentifierContext(instance, mountPointSchema, mount,mountPointSchema);
+                    return new InstanceIdentifierContext<>(instance, mountPointSchema, mount,mountPointSchema);
                 }
 
                 final String moduleNameBehindMountPoint = toModuleName(strings.get(1));
@@ -672,11 +672,11 @@ public class ControllerContext implements SchemaContextListener {
         return createContext(builder.build(), targetNode, mountPoint,mountPoint != null ? mountPoint.getSchemaContext() : globalSchema);
     }
 
-    private InstanceIdentifierContext createContext(final YangInstanceIdentifier instance, final DataSchemaNode dataSchemaNode,
+    private InstanceIdentifierContext<?> createContext(final YangInstanceIdentifier instance, final DataSchemaNode dataSchemaNode,
             final DOMMountPoint mountPoint, final SchemaContext schemaContext) {
 
         final YangInstanceIdentifier instanceIdentifier = new DataNormalizer(schemaContext).toNormalized(instance);
-        return new InstanceIdentifierContext(instanceIdentifier, dataSchemaNode, mountPoint,schemaContext);
+        return new InstanceIdentifierContext<>(instanceIdentifier, dataSchemaNode, mountPoint,schemaContext);
     }
 
     public static DataSchemaNode findInstanceDataChildByNameAndNamespace(final DataNodeContainer container, final String name,
index 1bdbe6b66398a0b67c10d98a13842d642fb41787..33795889a122536c14f9e6c61f368b8b7c949ece 100644 (file)
@@ -24,8 +24,6 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
@@ -77,7 +75,6 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNo
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
@@ -90,8 +87,6 @@ import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -114,29 +109,19 @@ public class RestconfImpl implements RestconfService {
         }
     }
 
-    private static class TypeDef {
-        public final TypeDefinition<? extends Object> typedef;
-        public final QName qName;
-
-        TypeDef(final TypeDefinition<? extends Object> typedef, final QName qName) {
-            this.typedef = typedef;
-            this.qName = qName;
-        }
-    }
-
-    private final static RestconfImpl INSTANCE = new RestconfImpl();
+    private static final RestconfImpl INSTANCE = new RestconfImpl();
 
     private static final int NOTIFICATION_PORT = 8181;
 
     private static final int CHAR_NOT_FOUND = -1;
 
-    private final static String MOUNT_POINT_MODULE_NAME = "ietf-netconf";
+    private static final String MOUNT_POINT_MODULE_NAME = "ietf-netconf";
 
-    private final static SimpleDateFormat REVISION_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
+    private static final SimpleDateFormat REVISION_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
 
-    private final static String SAL_REMOTE_NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote";
+    private static final String SAL_REMOTE_NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote";
 
-    private final static String SAL_REMOTE_RPC_SUBSRCIBE = "create-data-change-event-subscription";
+    private static final String SAL_REMOTE_RPC_SUBSRCIBE = "create-data-change-event-subscription";
 
     private BrokerFacade broker;
 
@@ -214,7 +199,7 @@ public class RestconfImpl implements RestconfService {
                 Builders.containerBuilder((ContainerSchemaNode) modulesSchemaNode);
         moduleContainerBuilder.withChild(allModuleMap);
 
-        return new NormalizedNodeContext(new InstanceIdentifierContext(null, modulesSchemaNode,
+        return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, modulesSchemaNode,
                 null, schemaContext), moduleContainerBuilder.build());
     }
 
@@ -230,10 +215,9 @@ public class RestconfImpl implements RestconfService {
             throw new RestconfDocumentedException(errMsg, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
         }
 
-        final InstanceIdentifierContext mountPointIdentifier = controllerContext.toMountPointIdentifier(identifier);
+        final InstanceIdentifierContext<?> mountPointIdentifier = controllerContext.toMountPointIdentifier(identifier);
         final DOMMountPoint mountPoint = mountPointIdentifier.getMountPoint();
         final Set<Module> modules = controllerContext.getAllModules(mountPoint);
-        final SchemaContext schemaContext = mountPoint.getSchemaContext();
         final MapNode mountPointModulesMap = makeModuleMapNode(modules);
 
         final Module restconfModule = getRestconfModule();
@@ -245,7 +229,7 @@ public class RestconfImpl implements RestconfService {
                 Builders.containerBuilder((ContainerSchemaNode) modulesSchemaNode);
         moduleContainerBuilder.withChild(mountPointModulesMap);
 
-        return new NormalizedNodeContext(new InstanceIdentifierContext(null, modulesSchemaNode,
+        return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, modulesSchemaNode,
                 mountPoint, controllerContext.getGlobalSchema()), moduleContainerBuilder.build());
     }
 
@@ -257,7 +241,7 @@ public class RestconfImpl implements RestconfService {
         DOMMountPoint mountPoint = null;
         final SchemaContext schemaContext;
         if (identifier.contains(ControllerContext.MOUNT)) {
-            final InstanceIdentifierContext mountPointIdentifier = controllerContext.toMountPointIdentifier(identifier);
+            final InstanceIdentifierContext<?> mountPointIdentifier = controllerContext.toMountPointIdentifier(identifier);
             mountPoint = mountPointIdentifier.getMountPoint();
             module = controllerContext.findModuleByNameAndRevision(mountPoint, moduleNameAndRevision);
             schemaContext = mountPoint.getSchemaContext();
@@ -280,7 +264,7 @@ public class RestconfImpl implements RestconfService {
                 restconfModule, Draft02.RestConfModule.MODULE_LIST_SCHEMA_NODE);
         Preconditions.checkState(moduleSchemaNode instanceof ListSchemaNode);
 
-        return new NormalizedNodeContext(new InstanceIdentifierContext(null, moduleSchemaNode, mountPoint,
+        return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, moduleSchemaNode, mountPoint,
                 schemaContext), moduleMap);
     }
 
@@ -309,7 +293,7 @@ public class RestconfImpl implements RestconfService {
         streamsContainerBuilder.withChild(listStreamsBuilder.build());
 
 
-        return new NormalizedNodeContext(new InstanceIdentifierContext(null, streamsContainerSchemaNode, null,
+        return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, streamsContainerSchemaNode, null,
                 schemaContext), streamsContainerBuilder.build());
     }
 
@@ -324,7 +308,7 @@ public class RestconfImpl implements RestconfService {
         Set<Module> modules = null;
         DOMMountPoint mountPoint = null;
         if (identifier.contains(ControllerContext.MOUNT)) {
-            final InstanceIdentifierContext mountPointIdentifier = controllerContext.toMountPointIdentifier(identifier);
+            final InstanceIdentifierContext<?> mountPointIdentifier = controllerContext.toMountPointIdentifier(identifier);
             mountPoint = mountPointIdentifier.getMountPoint();
             modules = controllerContext.getAllModules(mountPoint);
 
@@ -540,7 +524,7 @@ public class RestconfImpl implements RestconfService {
         final SchemaContext schemaContext;
         if (identifier.contains(ControllerContext.MOUNT)) {
             // mounted RPC call - look up mount instance.
-            final InstanceIdentifierContext mountPointId = controllerContext.toMountPointIdentifier(identifier);
+            final InstanceIdentifierContext<?> mountPointId = controllerContext.toMountPointIdentifier(identifier);
             mountPoint = mountPointId.getMountPoint();
             schemaContext = mountPoint.getSchemaContext();
             final int startOfRemoteRpcName = identifier.lastIndexOf(ControllerContext.MOUNT)
@@ -597,7 +581,7 @@ public class RestconfImpl implements RestconfService {
             resultNodeSchema = rpcDataSchemaNode.getDataChildByName(result.getResult().getNodeType());
         }
 
-        return new NormalizedNodeContext(new InstanceIdentifierContext(null, resultNodeSchema, mountPoint,
+        return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, resultNodeSchema, mountPoint,
                 schemaContext), resultData);
     }
 
@@ -622,7 +606,7 @@ public class RestconfImpl implements RestconfService {
 
     @Override
     public NormalizedNodeContext readConfigurationData(final String identifier, final UriInfo uriInfo) {
-        final InstanceIdentifierContext iiWithData = controllerContext.toInstanceIdentifier(identifier);
+        final InstanceIdentifierContext<?> iiWithData = controllerContext.toInstanceIdentifier(identifier);
         final DOMMountPoint mountPoint = iiWithData.getMountPoint();
         NormalizedNode<?, ?> data = null;
         final YangInstanceIdentifier normalizedII = iiWithData.getInstanceIdentifier();
@@ -639,6 +623,8 @@ public class RestconfImpl implements RestconfService {
         return new NormalizedNodeContext(iiWithData, data);
     }
 
+    // FIXME: Move this to proper place
+    @SuppressWarnings("unused")
     private Integer parseDepthParameter(final UriInfo info) {
         final String param = info.getQueryParameters(false).getFirst(UriParameters.DEPTH.toString());
         if (Strings.isNullOrEmpty(param) || "unbounded".equals(param)) {
@@ -663,7 +649,7 @@ public class RestconfImpl implements RestconfService {
 
     @Override
     public NormalizedNodeContext readOperationalData(final String identifier, final UriInfo info) {
-        final InstanceIdentifierContext iiWithData = controllerContext.toInstanceIdentifier(identifier);
+        final InstanceIdentifierContext<?> iiWithData = controllerContext.toInstanceIdentifier(identifier);
         final DOMMountPoint mountPoint = iiWithData.getMountPoint();
         NormalizedNode<?, ?> data = null;
         final YangInstanceIdentifier normalizedII = iiWithData.getInstanceIdentifier();
@@ -680,16 +666,10 @@ public class RestconfImpl implements RestconfService {
         return new NormalizedNodeContext(iiWithData, data);
     }
 
-    private boolean parsePrettyPrintParameter(final UriInfo info) {
-        final String param = info.getQueryParameters(false).getFirst(UriParameters.PRETTY_PRINT.toString());
-        return Boolean.parseBoolean(param);
-    }
-
     @Override
     public Response updateConfigurationData(final String identifier, final NormalizedNodeContext payload) {
         Preconditions.checkNotNull(identifier);
-        final InstanceIdentifierContext<DataSchemaNode> iiWithData =
-                (InstanceIdentifierContext<DataSchemaNode>) payload.getInstanceIdentifierContext();
+        final InstanceIdentifierContext<?> iiWithData = payload.getInstanceIdentifierContext();
 
         validateInput(iiWithData.getSchemaNode(), payload);
         validateTopLevelNodeName(payload, iiWithData.getInstanceIdentifier());
@@ -769,7 +749,7 @@ public class RestconfImpl implements RestconfService {
      *             if key values or key count in payload and URI isn't equal
      *
      */
-    private void validateListKeysEqualityInPayloadAndUri(final InstanceIdentifierContext<DataSchemaNode> iiWithData,
+    private void validateListKeysEqualityInPayloadAndUri(final InstanceIdentifierContext<?> iiWithData,
             final NormalizedNode<?, ?> payload) {
         if (iiWithData.getSchemaNode() instanceof ListSchemaNode) {
             final List<QName> keyDefinitions = ((ListSchemaNode) iiWithData.getSchemaNode()).getKeyDefinition();
@@ -825,7 +805,7 @@ public class RestconfImpl implements RestconfService {
         if (payloadNodeQname.compareTo(yangIdent.getLastPathArgument().getNodeType()) > 0) {
             return yangIdent;
         }
-        final InstanceIdentifierContext parentContext = payload.getInstanceIdentifierContext();
+        final InstanceIdentifierContext<?> parentContext = payload.getInstanceIdentifierContext();
         final SchemaNode parentSchemaNode = parentContext.getSchemaNode();
         if(parentSchemaNode instanceof DataNodeContainer) {
             final DataNodeContainer cast = (DataNodeContainer) parentSchemaNode;
@@ -856,9 +836,8 @@ public class RestconfImpl implements RestconfService {
         }
 
         final DOMMountPoint mountPoint = payload.getInstanceIdentifierContext().getMountPoint();
-        final InstanceIdentifierContext<DataSchemaNode> iiWithData = (InstanceIdentifierContext<DataSchemaNode>) payload.getInstanceIdentifierContext();
+        final InstanceIdentifierContext<?> iiWithData = payload.getInstanceIdentifierContext();
         final YangInstanceIdentifier normalizedII = iiWithData.getInstanceIdentifier();
-        final YangInstanceIdentifier resultII;
         try {
             if (mountPoint != null) {
                 broker.commitConfigurationDataPost(mountPoint, normalizedII, payload.getData()).checkedGet();
@@ -894,7 +873,7 @@ public class RestconfImpl implements RestconfService {
 
     @Override
     public Response deleteConfigurationData(final String identifier) {
-        final InstanceIdentifierContext<DataSchemaNode> iiWithData = controllerContext.toInstanceIdentifier(identifier);
+        final InstanceIdentifierContext<?> iiWithData = controllerContext.toInstanceIdentifier(identifier);
         final DOMMountPoint mountPoint = iiWithData.getMountPoint();
         final YangInstanceIdentifier normalizedII = iiWithData.getInstanceIdentifier();
 
@@ -1028,79 +1007,6 @@ public class RestconfImpl implements RestconfService {
         return result;
     }
 
-    private boolean endsWithMountPoint(final String identifier) {
-        return identifier.endsWith(ControllerContext.MOUNT) || identifier.endsWith(ControllerContext.MOUNT + "/");
-    }
-
-    private String addMountPointIdentifier(final String identifier) {
-        final boolean endsWith = identifier.endsWith("/");
-        if (endsWith) {
-            return (identifier + ControllerContext.MOUNT);
-        }
-
-        return identifier + "/" + ControllerContext.MOUNT;
-    }
-
-    private TypeDef typeDefinition(final TypeDefinition<?> type, final QName nodeQName) {
-        TypeDefinition<?> baseType = type;
-        QName qName = nodeQName;
-        while (baseType.getBaseType() != null) {
-            if (baseType instanceof ExtendedType) {
-                qName = baseType.getQName();
-            }
-            baseType = baseType.getBaseType();
-        }
-
-        return new TypeDef(baseType, qName);
-
-    }
-
-    private TypeDef typeDefinition(final DataSchemaNode node) {
-        if (node instanceof LeafListSchemaNode) {
-            return typeDefinition(((LeafListSchemaNode)node).getType(), node.getQName());
-        } else if (node instanceof LeafSchemaNode) {
-            return typeDefinition(((LeafSchemaNode)node).getType(), node.getQName());
-        } else if (node instanceof AnyXmlSchemaNode) {
-            return null;
-        } else {
-            throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object> asList(node).toString());
-        }
-    }
-
-    private InstanceIdentifierContext normalizeInstanceIdentifierWithSchemaNode(
-            final InstanceIdentifierContext iiWithSchemaNode) {
-        return normalizeInstanceIdentifierWithSchemaNode(iiWithSchemaNode, false);
-    }
-
-    private InstanceIdentifierContext normalizeInstanceIdentifierWithSchemaNode(
-            final InstanceIdentifierContext iiWithSchemaNode, final boolean unwrapLastListNode) {
-        return new InstanceIdentifierContext(instanceIdentifierToReadableFormForNormalizeNode(
-                iiWithSchemaNode.getInstanceIdentifier(), unwrapLastListNode), iiWithSchemaNode.getSchemaNode(),
-                iiWithSchemaNode.getMountPoint(),iiWithSchemaNode.getSchemaContext());
-    }
-
-    private YangInstanceIdentifier instanceIdentifierToReadableFormForNormalizeNode(
-            final YangInstanceIdentifier instIdentifier, final boolean unwrapLastListNode) {
-        Preconditions.checkNotNull(instIdentifier, "Instance identifier can't be null");
-        final List<PathArgument> result = new ArrayList<PathArgument>();
-        final Iterator<PathArgument> iter = instIdentifier.getPathArguments().iterator();
-        while (iter.hasNext()) {
-            final PathArgument pathArgument = iter.next();
-            if (pathArgument instanceof NodeIdentifierWithPredicates && (iter.hasNext() || unwrapLastListNode)) {
-                result.add(new YangInstanceIdentifier.NodeIdentifier(pathArgument.getNodeType()));
-            }
-            result.add(pathArgument);
-        }
-        return YangInstanceIdentifier.create(result);
-    }
-
-    private boolean isDataContainerNode(final DataSchemaNode schemaNode) {
-        if (schemaNode instanceof ContainerSchemaNode || schemaNode instanceof ListSchemaNode) {
-            return true;
-        }
-        return false;
-    }
-
     public BigInteger getOperationalReceived() {
         // TODO Auto-generated method stub
         return null;
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java
deleted file mode 100644 (file)
index 1be9294..0000000
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonToken;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Map;
-import java.util.Set;
-import org.junit.BeforeClass;
-import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
-import org.opendaylight.controller.sal.restconf.impl.test.structures.Cont;
-import org.opendaylight.controller.sal.restconf.impl.test.structures.Lf;
-import org.opendaylight.controller.sal.restconf.impl.test.structures.LfLst;
-import org.opendaylight.controller.sal.restconf.impl.test.structures.Lst;
-import org.opendaylight.controller.sal.restconf.impl.test.structures.LstItem;
-
-public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader {
-
-    @BeforeClass
-    public static void initialize() {
-        dataLoad("/cnsn-to-json/simple-yang-types", 1, "simple-yang-types", "cont1");
-    }
-
-    private void verifyJsonOutputForEmptyData(final String jsonOutput) {
-        assertNotNull(jsonOutput);
-        final StringReader strReader = new StringReader(jsonOutput);
-        final JsonReader jReader = new JsonReader(strReader);
-
-        String exception = null;
-        Cont dataFromJson = null;
-        try {
-            dataFromJson = jsonReadCont1(jReader);
-        } catch (final IOException e) {
-            exception = e.getMessage();
-        }
-
-        assertNotNull("Data structures from json are missing.", dataFromJson);
-        checkDataFromJsonEmpty(dataFromJson);
-
-        assertNull("Error during reading Json output: " + exception, exception);
-    }
-
-    private void verifyJsonOutput(final String jsonOutput) {
-        assertNotNull(jsonOutput);
-        final StringReader strReader = new StringReader(jsonOutput);
-        final JsonReader jReader = new JsonReader(strReader);
-
-        String exception = null;
-        Cont dataFromJson = null;
-        try {
-            dataFromJson = jsonReadCont1(jReader);
-        } catch (final IOException e) {
-            exception = e.getMessage();
-        }
-
-        assertNotNull("Data structures from json are missing.", dataFromJson);
-        checkDataFromJson(dataFromJson);
-
-        assertNull("Error during reading Json output: " + exception, exception);
-    }
-
-    private Cont jsonReadCont1(final JsonReader jReader) throws IOException {
-        jReader.beginObject();
-        assertNotNull("cont1 is missing.", jReader.hasNext());
-
-        Cont dataFromJson = new Cont(jReader.nextName());
-        dataFromJson = jsonReadCont1Elements(jReader, dataFromJson);
-
-        assertFalse("cont shouldn't have other element.", jReader.hasNext());
-        jReader.endObject();
-        return dataFromJson;
-
-    }
-
-    private Cont jsonReadCont1Elements(final JsonReader jReader, final Cont redData) throws IOException {
-        jReader.beginObject();
-        while (jReader.hasNext()) {
-            final String keyName = jReader.nextName();
-            if (keyName.equals("lf11")) {
-                redData.addLf(new Lf(keyName, nextValue(jReader)));
-            } else if (keyName.equals("lflst11")) {
-                LfLst lfLst = new LfLst(keyName);
-                lfLst = jsonReadLflstValues(jReader, lfLst);
-                redData.addLfLst(lfLst);
-            } else if (keyName.equals("lflst12")) {
-                final LfLst lfLst = new LfLst(keyName);
-                jsonReadLflstValues(jReader, lfLst);
-                redData.addLfLst(lfLst);
-            } else if (keyName.equals("lst11")) {
-                Lst lst = new Lst(keyName);
-                lst = jsonReadLst11(jReader, lst);
-                redData.addLst(lst);
-            } else {
-                assertTrue("Key " + keyName + " doesn't exists in yang file.", false);
-            }
-        }
-        jReader.endObject();
-        return redData;
-
-    }
-
-    private Lst jsonReadLst11(final JsonReader jReader, final Lst lst) throws IOException {
-        jReader.beginArray();
-
-        while (jReader.hasNext()) {
-            final LstItem lstItem = jsonReadLst11Elements(jReader);
-            lst.addLstItem(lstItem);
-        }
-        jReader.endArray();
-        return lst;
-    }
-
-    private LstItem jsonReadLst11Elements(final JsonReader jReader) throws IOException {
-        final LstItem lstItem = new LstItem();
-        jReader.beginObject();
-        while (jReader.hasNext()) {
-            final String keyName = jReader.nextName();
-            if (keyName.equals("lf111")) {
-                lstItem.addLf(new Lf(keyName, nextValue(jReader)));
-            } else if (keyName.equals("lf112")) {
-                lstItem.addLf(new Lf(keyName, nextValue(jReader)));
-            } else if (keyName.equals("cont111")) {
-                Cont cont = new Cont(keyName);
-                cont = jsonReadCont111(jReader, cont);
-                lstItem.addCont(cont);
-            } else if (keyName.equals("lst111")) {
-                Lst lst = new Lst(keyName);
-                lst = jsonReadLst111(jReader, lst);
-                lstItem.addLst(lst);
-            } else if (keyName.equals("lst112")) {
-                Lst lst = new Lst(keyName);
-                lst = jsonReadLst112(jReader, lst);
-                lstItem.addLst(lst);
-            } else {
-                assertTrue("Key " + keyName + " doesn't exists in yang file.", false);
-            }
-        }
-        jReader.endObject();
-        return lstItem;
-    }
-
-    private Lst jsonReadLst112(final JsonReader jReader, final Lst lst) throws IOException {
-        jReader.beginArray();
-        while (jReader.hasNext()) {
-            final LstItem lstItem = jsonReadLst112Elements(jReader);
-            lst.addLstItem(lstItem);
-        }
-        jReader.endArray();
-        return lst;
-    }
-
-    private LstItem jsonReadLst112Elements(final JsonReader jReader) throws IOException {
-        final LstItem lstItem = new LstItem();
-        jReader.beginObject();
-        if (jReader.hasNext()) {
-            final String keyName = jReader.nextName();
-            if (keyName.equals("lf1121")) {
-                lstItem.addLf(new Lf(keyName, nextValue(jReader)));
-            }
-        }
-        jReader.endObject();
-        return lstItem;
-
-    }
-
-    private Lst jsonReadLst111(final JsonReader jReader, final Lst lst) throws IOException {
-        jReader.beginArray();
-        while (jReader.hasNext()) {
-            final LstItem lstItem = jsonReadLst111Elements(jReader);
-            lst.addLstItem(lstItem);
-        }
-        jReader.endArray();
-        return lst;
-    }
-
-    private LstItem jsonReadLst111Elements(final JsonReader jReader) throws IOException {
-        final LstItem lstItem = new LstItem();
-        jReader.beginObject();
-        if (jReader.hasNext()) {
-            final String keyName = jReader.nextName();
-            if (keyName.equals("lf1111")) {
-                lstItem.addLf(new Lf(keyName, nextValue(jReader)));
-            }
-        }
-        jReader.endObject();
-        return lstItem;
-    }
-
-    private Object nextValue(final JsonReader jReader) throws IOException {
-        if (jReader.peek().equals(JsonToken.NULL)) {
-            jReader.nextNull();
-            return null;
-        } else if (jReader.peek().equals(JsonToken.NUMBER)) {
-            return jReader.nextInt();
-        } else {
-            return jReader.nextString();
-        }
-    }
-
-    private Cont jsonReadCont111(final JsonReader jReader, Cont cont) throws IOException {
-        jReader.beginObject();
-        cont = jsonReadCont111Elements(jReader, cont);
-        jReader.endObject();
-        return cont;
-    }
-
-    private Cont jsonReadCont111Elements(final JsonReader jReader, final Cont cont) throws IOException {
-        while (jReader.hasNext()) {
-            final String keyName = jReader.nextName();
-            if (keyName.equals("lf1111")) {
-                cont.addLf(new Lf(keyName, nextValue(jReader)));
-            } else if (keyName.equals("lflst1111")) {
-                LfLst lfLst = new LfLst(keyName);
-                lfLst = jsonReadLflstValues(jReader, lfLst);
-                cont.addLfLst(lfLst);
-            } else if (keyName.equals("lst1111")) {
-                Lst lst = new Lst(keyName);
-                lst = jsonReadLst1111(jReader, lst);
-                cont.addLst(lst);
-            } else {
-                assertTrue("Key " + keyName + " doesn't exists in yang file.", false);
-            }
-        }
-        return cont;
-
-    }
-
-    private Lst jsonReadLst1111(final JsonReader jReader, final Lst lst) throws IOException {
-        jReader.beginArray();
-        while (jReader.hasNext()) {
-            final LstItem lstItem = jsonReadLst1111Elements(jReader);
-            lst.addLstItem(lstItem);
-        }
-        jReader.endArray();
-        return lst;
-    }
-
-    private LstItem jsonReadLst1111Elements(final JsonReader jReader) throws IOException {
-        jReader.beginObject();
-        final LstItem lstItem = new LstItem();
-        while (jReader.hasNext()) {
-            final String keyName = jReader.nextName();
-            if (keyName.equals("lf1111A") || keyName.equals("lf1111B")) {
-                lstItem.addLf(new Lf(keyName, nextValue(jReader)));
-            }
-        }
-        jReader.endObject();
-        return lstItem;
-    }
-
-    private LfLst jsonReadLflstValues(final JsonReader jReader, final LfLst lfLst) throws IOException {
-        jReader.beginArray();
-        while (jReader.hasNext()) {
-            lfLst.addLf(new Lf(nextValue(jReader)));
-        }
-        jReader.endArray();
-        return lfLst;
-    }
-
-    private void checkDataFromJsonEmpty(final Cont dataFromJson) {
-        assertTrue(dataFromJson.getLfs().isEmpty());
-        assertTrue(dataFromJson.getLfLsts().isEmpty());
-        assertTrue(dataFromJson.getConts().isEmpty());
-
-        final Map<String, Lst> lsts = dataFromJson.getLsts();
-        assertEquals(1, lsts.size());
-        final Lst lst11 = lsts.get("lst11");
-        assertNotNull(lst11);
-        final Set<LstItem> lstItems = lst11.getLstItems();
-        assertNotNull(lstItems);
-
-        LstItem lst11_1 = null;
-        LstItem lst11_2 = null;
-        LstItem lst11_3 = null;
-        for (final LstItem lstItem : lstItems) {
-            if (lstItem.getLfs().get("lf111").getValue().equals(1)) {
-                lst11_1 = lstItem;
-            } else if (lstItem.getLfs().get("lf111").getValue().equals(2)) {
-                lst11_2 = lstItem;
-            } else if (lstItem.getLfs().get("lf111").getValue().equals(3)) {
-                lst11_3 = lstItem;
-            }
-        }
-
-        assertNotNull(lst11_1);
-        assertNotNull(lst11_2);
-        assertNotNull(lst11_3);
-
-        // lst11_1
-        assertTrue(lst11_1.getLfLsts().isEmpty());
-        assertEquals(1, lst11_1.getLfs().size());
-        assertEquals(1, lst11_1.getConts().size());
-        assertEquals(1, lst11_1.getLsts().size());
-        assertEquals(lst11_1.getLsts().get("lst111"), new Lst("lst111").addLstItem(new LstItem().addLf("lf1111", 35))
-                .addLstItem(new LstItem().addLf("lf1111", 34)).addLstItem(new LstItem()).addLstItem(new LstItem()));
-        assertEquals(lst11_1.getConts().get("cont111"), new Cont("cont111"));
-        // : lst11_1
-
-        // lst11_2
-        assertTrue(lst11_2.getLfLsts().isEmpty());
-        assertEquals(1, lst11_2.getLfs().size());
-        assertEquals(1, lst11_2.getConts().size());
-        assertEquals(1, lst11_2.getLsts().size());
-
-        final Cont lst11_2_cont111 = lst11_2.getConts().get("cont111");
-
-        // -cont111
-        assertNotNull(lst11_2_cont111);
-        assertTrue(lst11_2_cont111.getLfs().isEmpty());
-        assertEquals(1, lst11_2_cont111.getLfLsts().size());
-        assertEquals(1, lst11_2_cont111.getLsts().size());
-        assertTrue(lst11_2_cont111.getConts().isEmpty());
-
-        assertEquals(new LfLst("lflst1111").addLf(1024).addLf(4096), lst11_2_cont111.getLfLsts().get("lflst1111"));
-        assertEquals(
-                new Lst("lst1111").addLstItem(new LstItem().addLf("lf1111B", 4)).addLstItem(
-                        new LstItem().addLf("lf1111A", "lf1111A str12")), lst11_2_cont111.getLsts().get("lst1111"));
-        // :-cont111
-        assertEquals(lst11_2.getLsts().get("lst112"), new Lst("lst112").addLstItem(new LstItem()));
-        // : lst11_2
-
-        // lst11_3
-        assertEquals(1, lst11_3.getLfs().size());
-        assertTrue(lst11_3.getLfLsts().isEmpty());
-        assertTrue(lst11_3.getLsts().isEmpty());
-        assertTrue(lst11_3.getLsts().isEmpty());
-
-        // -cont111
-        final Cont lst11_3_cont111 = lst11_3.getConts().get("cont111");
-        assertEquals(0, lst11_3_cont111.getLfs().size());
-        assertEquals(0, lst11_3_cont111.getLfLsts().size());
-        assertEquals(1, lst11_3_cont111.getLsts().size());
-        assertTrue(lst11_3_cont111.getConts().isEmpty());
-
-        assertEquals(new Lst("lst1111").addLstItem(new LstItem()).addLstItem(new LstItem()), lst11_3_cont111.getLsts()
-                .get("lst1111"));
-        // :-cont111
-        // : lst11_3
-
-    }
-
-    private void checkDataFromJson(final Cont dataFromJson) {
-        assertNotNull(dataFromJson.getLfs().get("lf11"));
-        assertEquals(dataFromJson.getLfs().get("lf11"), new Lf("lf11", "lf"));
-
-        LfLst lflst11 = null;
-        LfLst lflst12 = null;
-
-        lflst11 = dataFromJson.getLfLsts().get("lflst11");
-        lflst12 = dataFromJson.getLfLsts().get("lflst12");
-
-        assertNotNull(lflst11);
-        assertNotNull(lflst12);
-
-        assertEquals(3, lflst11.getLfs().size());
-        assertTrue(lflst11.getLfs().contains(new Lf(55)));
-        assertTrue(lflst11.getLfs().contains(new Lf(56)));
-        assertTrue(lflst11.getLfs().contains(new Lf(57)));
-
-        assertEquals(3, lflst12.getLfs().size());
-        assertTrue(lflst12.getLfs().contains(new Lf("lflst12 str1")));
-        assertTrue(lflst12.getLfs().contains(new Lf("lflst12 str2")));
-        assertTrue(lflst12.getLfs().contains(new Lf("lflst12 str3")));
-
-        assertEquals(1, dataFromJson.getLsts().size());
-        final Lst lst11 = dataFromJson.getLsts().get("lst11");
-        assertNotNull(lst11);
-        assertEquals(2, lst11.getLstItems().size());
-
-        LstItem lst11_1 = null;
-        LstItem lst11_2 = null;
-        for (final LstItem lstItem : lst11.getLstItems()) {
-            final Lf lf = lstItem.getLfs().get("lf111");
-            if (lf != null && lf.getValue().equals(140)) {
-                lst11_1 = lstItem;
-            } else if (lf != null && lf.getValue().equals(141)) {
-                lst11_2 = lstItem;
-            }
-        }
-
-        checkLst11_1(lst11_1);
-        checkLst11_2(lst11_2);
-    }
-
-    private void checkLst11_2(final LstItem lst11_2) {
-        assertNotNull(lst11_2);
-        assertEquals(2, lst11_2.getLfs().size());
-        assertEquals(1, lst11_2.getConts().size());
-        assertEquals(2, lst11_2.getLsts().size());
-
-        assertEquals(lst11_2.getLfs().get("lf112"), new Lf("lf112", "lf112 str2"));
-
-        final Cont lst11_2_cont = lst11_2.getConts().get("cont111");
-        assertEquals(0, lst11_2_cont.getConts().size());
-        assertEquals(1, lst11_2_cont.getLfLsts().size());
-        assertEquals(1, lst11_2_cont.getLfs().size());
-        assertEquals(1, lst11_2_cont.getLsts().size());
-
-        // cont111 check
-        assertEquals(new Lf("lf1111", "lf1111 str2"), lst11_2_cont.getLfs().get("lf1111"));
-        assertEquals(new LfLst("lflst1111").addLf(new Lf(2049)).addLf(new Lf(1025)).addLf(new Lf(4097)), lst11_2_cont
-                .getLfLsts().get("lflst1111"));
-
-        assertNotNull(lst11_2_cont.getLsts().get("lst1111"));
-        checkLst1111(lst11_2_cont.getLsts().get("lst1111").getLstItems(), new Lf("lf1111A", "lf1111A str21"), new Lf(
-                "lf1111B", 5), new Lf("lf1111A", "lf1111A str22"), new Lf("lf1111B", 8));
-
-        checkLst11x(lst11_2.getLsts().get("lst111"), new LstItem().addLf(new Lf("lf1111", 55)),
-                new LstItem().addLf(new Lf("lf1111", 56)));
-        checkLst11x(lst11_2.getLsts().get("lst112"), new LstItem().addLf(new Lf("lf1121", "lf1121 str22")),
-                new LstItem().addLf(new Lf("lf1121", "lf1121 str21")));
-    }
-
-    private void checkLst11_1(final LstItem lst11_1) {
-        assertNotNull(lst11_1);
-
-        assertEquals(2, lst11_1.getLfs().size());
-        assertEquals(1, lst11_1.getConts().size());
-        assertEquals(2, lst11_1.getLsts().size());
-
-        assertEquals(lst11_1.getLfs().get("lf112"), new Lf("lf112", "lf112 str"));
-
-        final Cont lst11_1_cont = lst11_1.getConts().get("cont111");
-        assertEquals(0, lst11_1_cont.getConts().size());
-        assertEquals(1, lst11_1_cont.getLfLsts().size());
-        assertEquals(1, lst11_1_cont.getLfs().size());
-        assertEquals(1, lst11_1_cont.getLsts().size());
-
-        // cont111 check
-        assertEquals(new Lf("lf1111", "lf1111 str"), lst11_1_cont.getLfs().get("lf1111"));
-        assertEquals(new LfLst("lflst1111").addLf(new Lf(2048)).addLf(new Lf(1024)).addLf(new Lf(4096)), lst11_1_cont
-                .getLfLsts().get("lflst1111"));
-
-        assertNotNull(lst11_1_cont.getLsts().get("lst1111"));
-        checkLst1111(lst11_1_cont.getLsts().get("lst1111").getLstItems(), new Lf("lf1111A", "lf1111A str11"), new Lf(
-                "lf1111B", 4), new Lf("lf1111A", "lf1111A str12"), new Lf("lf1111B", 7));
-
-        checkLst11x(lst11_1.getLsts().get("lst111"), new LstItem().addLf(new Lf("lf1111", 65)));
-        checkLst11x(lst11_1.getLsts().get("lst112"), new LstItem().addLf(new Lf("lf1121", "lf1121 str11")));
-    }
-
-    private void checkLst11x(final Lst lst, final LstItem... lstItems) {
-        assertNotNull(lst);
-
-        final Lst requiredLst = new Lst(lst.getName());
-        for (final LstItem lstItem : lstItems) {
-            requiredLst.addLstItem(lstItem);
-        }
-
-        assertEquals(requiredLst, lst);
-
-    }
-
-    private void checkLst1111(final Set<LstItem> lstItems, final Lf lf11, final Lf lf12, final Lf lf21, final Lf lf22) {
-        LstItem lst11_1_cont_lst1111_1 = null;
-        LstItem lst11_1_cont_lst1111_2 = null;
-        for (final LstItem lstItem : lstItems) {
-            if (new LstItem().addLf(lf11).addLf(lf12).equals(lstItem)) {
-                lst11_1_cont_lst1111_1 = lstItem;
-            } else if (new LstItem().addLf(lf21).addLf(lf22).equals(lstItem)) {
-                lst11_1_cont_lst1111_2 = lstItem;
-            }
-        }
-
-        assertNotNull(lst11_1_cont_lst1111_1);
-        assertNotNull(lst11_1_cont_lst1111_2);
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIncorrectTopLevelTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonIncorrectTopLevelTest.java
deleted file mode 100644 (file)
index 66f442c..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test;
-
-import java.util.List;
-import java.util.Set;
-import org.junit.BeforeClass;
-import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CnSnToJsonIncorrectTopLevelTest extends YangAndXmlAndDataSchemaLoader {
-
-    private static final Logger LOG = LoggerFactory.getLogger(CnSnToJsonIncorrectTopLevelTest.class);
-
-    @BeforeClass
-    public static void initialize() {
-        dataLoad("/cnsn-to-json/simple-data-types");
-    }
-
-    private class IncorrectDataSchema implements DataSchemaNode, DataNodeContainer {
-
-        @Override
-        public String getDescription() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public SchemaPath getPath() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public QName getQName() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public String getReference() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public Status getStatus() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public Set<DataSchemaNode> getChildNodes() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public DataSchemaNode getDataChildByName(final QName arg0) {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public DataSchemaNode getDataChildByName(final String arg0) {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public Set<GroupingDefinition> getGroupings() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public Set<TypeDefinition<?>> getTypeDefinitions() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public Set<UsesNode> getUses() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public ConstraintDefinition getConstraints() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-        @Override
-        public boolean isAddedByUses() {
-            // TODO Auto-generated method stub
-            return false;
-        }
-
-        @Override
-        public boolean isAugmenting() {
-            // TODO Auto-generated method stub
-            return false;
-        }
-
-        @Override
-        public boolean isConfiguration() {
-            // TODO Auto-generated method stub
-            return false;
-        }
-
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonLeafrefType.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonLeafrefType.java
deleted file mode 100644 (file)
index 07b3d55..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.junit.BeforeClass;
-import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
-
-/**
- *
- * All tests are commented now because leafref isn't supported now
- *
- */
-
-public class CnSnToJsonLeafrefType extends YangAndXmlAndDataSchemaLoader {
-
-    @BeforeClass
-    public static void initialization() {
-        dataLoad("/cnsn-to-json/leafref", 2, "main-module", "cont");
-    }
-
-    private void validateJson(final String regex, final String value) {
-        assertNotNull(value);
-        final Pattern ptrn = Pattern.compile(regex, Pattern.DOTALL);
-        final Matcher mtch = ptrn.matcher(value);
-        assertTrue(mtch.matches());
-    }
-
-}
index a1f48badcefe0521c78140822283ce74d9b53151..c04a40ffc5fd691c7c9490240adccb636e73b504 100644 (file)
@@ -16,18 +16,15 @@ import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.parser.builder.impl.ContainerSchemaNodeBuilder;
 import org.opendaylight.yangtools.yang.parser.builder.impl.LeafSchemaNodeBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class CnSnToJsonNotExistingLeafTypeTest extends YangAndXmlAndDataSchemaLoader {
 
-    private static final Logger LOG = LoggerFactory.getLogger(CnSnToJsonNotExistingLeafTypeTest.class);
-
     @BeforeClass
     public static void initialize() {
         dataLoad("/cnsn-to-json/simple-data-types");
     }
 
+    @SuppressWarnings("unused")
     private DataSchemaNode prepareDataSchemaNode() {
         final ContainerSchemaNodeBuilder contBuild = new ContainerSchemaNodeBuilder("module", 1, TestUtils.buildQName("cont",
                 "simple:uri", "2012-12-17"), SchemaPath.create(true, QName.create("dummy")));
index 97c42924cf3cd1f5d8eddc68a7a919e794a637e9..b696854dbb8b2e9d97655270f520dda8e95c1158 100644 (file)
@@ -13,6 +13,7 @@ import static org.junit.Assert.fail;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
+
 import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.CheckedFuture;
 import java.io.FileNotFoundException;
@@ -190,7 +191,7 @@ public class RestPutListDataTest {
             testNodeContainer.withChild(leafKey2.build());
         }
 
-        final NormalizedNodeContext testCompositeContext = new NormalizedNodeContext(new InstanceIdentifierContext(
+        final NormalizedNodeContext testCompositeContext = new NormalizedNodeContext(new InstanceIdentifierContext<>(
                 null, testNodeSchemaNode, null, schemaContextTestModule), testNodeContainer.build());
 
         restconfImpl.updateConfigurationData(toUri(uriKey1, uriKey2), testCompositeContext);
index 5f1d54a4867b4ebd031ef4b6b42922f6386350ef..dc1f968805a1f97d032d3d1b5ded964ab67c7b42 100644 (file)
@@ -18,6 +18,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 import static org.mockito.Mockito.when;
+
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
@@ -84,7 +85,7 @@ public class BrokerFacadeTest {
 
     SchemaPath type = SchemaPath.create(true, qname);
 
-    YangInstanceIdentifier instanceID = YangInstanceIdentifier.builder().node(qname).toInstance();
+    YangInstanceIdentifier instanceID = YangInstanceIdentifier.builder().node(qname).build();
 
     @Mock
     DOMDataReadOnlyTransaction rTransaction;
@@ -154,7 +155,6 @@ public class BrokerFacadeTest {
         brokerFacade.readOperationalData(instanceID);
     }
 
-    @SuppressWarnings("unchecked")
     @Test
     public void testInvokeRpc() throws Exception {
         final DOMRpcResult expResult = mock(DOMRpcResult.class);
@@ -176,6 +176,7 @@ public class BrokerFacadeTest {
     @Ignore
     @Test
     public void testCommitConfigurationDataPut() {
+        @SuppressWarnings("unchecked")
         final CheckedFuture<Void, TransactionCommitFailedException> expFuture = mock(CheckedFuture.class);
 
         when(wTransaction.submit()).thenReturn(expFuture);
@@ -192,6 +193,7 @@ public class BrokerFacadeTest {
 
     @Test
     public void testCommitConfigurationDataPost() {
+        @SuppressWarnings("unchecked")
         final CheckedFuture<Void, TransactionCommitFailedException> expFuture = mock(CheckedFuture.class);
 
         final NormalizedNode<?, ?> dummyNode2 = createDummyNode("dummy:namespace2", "2014-07-01", "dummy local name2");
@@ -230,13 +232,11 @@ public class BrokerFacadeTest {
 
     @Test
     public void testCommitConfigurationDataDelete() {
+        @SuppressWarnings("unchecked")
         final CheckedFuture<Void, TransactionCommitFailedException> expFuture = mock(CheckedFuture.class);
 
         when(wTransaction.submit()).thenReturn(expFuture);
 
-        final NormalizedNode<?, ?> dummyNode2 = createDummyNode("dummy:namespace2", "2014-07-01", "dummy local name2");
-
-
         final CheckedFuture<Void, TransactionCommitFailedException> actualFuture = brokerFacade
                 .commitConfigurationDataDelete(instanceID);
 
index b45ba019593a4fe73bdbc5fd41c8c5adf48935a7..df2b01070adf06ef6c8fadae8bbcf0bdb80ddef1 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.sal.restconf.impl.test;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+
 import java.io.ByteArrayInputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
index 3eb97f478f6cd137197c37e0af5d2e31f4242035..731d6a2bc8e466813796643cdea0e762141cd978 100644 (file)
@@ -18,6 +18,7 @@ import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
+
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
@@ -156,7 +157,7 @@ public class InvokeRpcMethodTest {
         contNode.withChild(lfNode);
         container.withChild(contNode.build());
 
-        return new NormalizedNodeContext(new InstanceIdentifierContext(null, rpcInputSchemaNode, null, schema), container.build());
+        return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, rpcInputSchemaNode, null, schema), container.build());
     }
 
     @Test
@@ -309,7 +310,7 @@ public class InvokeRpcMethodTest {
         final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> containerBuilder =
                 Builders.containerBuilder(rpcInputSchemaNode);
 
-        final NormalizedNodeContext payload = new NormalizedNodeContext(new InstanceIdentifierContext(null, rpcInputSchemaNode,
+        final NormalizedNodeContext payload = new NormalizedNodeContext(new InstanceIdentifierContext<>(null, rpcInputSchemaNode,
                 null, schemaContext), containerBuilder.build());
 
         final BrokerFacade brokerFacade = mock(BrokerFacade.class);
index a2a57631c959450f411684290251b0c45998613e..519680ba3cbb34d8ce06162c6640d287ef026cf8 100644 (file)
@@ -13,6 +13,7 @@ import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
+
 import com.google.common.util.concurrent.CheckedFuture;
 import java.io.FileNotFoundException;
 import java.io.UnsupportedEncodingException;
@@ -70,6 +71,7 @@ public class RestDeleteOperationTest extends JerseyTest {
         return resourceConfig;
     }
 
+    @SuppressWarnings("unchecked")
     @Test
     public void deleteConfigStatusCodes() throws UnsupportedEncodingException {
         final String uri = "/config/test-interface:interfaces";
index 856d8c006b6c40349d2a1fd646cc70db6bd5fd62..746ae504831982e8a74f13de6fb1241fd74a5763 100644 (file)
@@ -30,13 +30,13 @@ public class RestGetAugmentedElementWhenEqualNamesTest {
 
     @BeforeClass
     public static void init() throws FileNotFoundException {
-        SchemaContext schemaContextTestModule = TestUtils.loadSchemaContext("/common/augment/yang");
+        final SchemaContext schemaContextTestModule = TestUtils.loadSchemaContext("/common/augment/yang");
         controllerContext.setSchemas(schemaContextTestModule);
     }
 
     @Test
     public void augmentedNodesInUri() {
-        InstanceIdentifierContext iiWithData = controllerContext.toInstanceIdentifier("main:cont/augment-main-a:cont1");
+        InstanceIdentifierContext<?> iiWithData = controllerContext.toInstanceIdentifier("main:cont/augment-main-a:cont1");
         assertEquals("ns:augment:main:a", iiWithData.getSchemaNode().getQName().getNamespace().toString());
         iiWithData = controllerContext.toInstanceIdentifier("main:cont/augment-main-b:cont1");
         assertEquals("ns:augment:main:b", iiWithData.getSchemaNode().getQName().getNamespace().toString());
@@ -47,7 +47,7 @@ public class RestGetAugmentedElementWhenEqualNamesTest {
         try {
             controllerContext.toInstanceIdentifier("main:cont/cont1");
             fail("Expected exception");
-        } catch (RestconfDocumentedException e) {
+        } catch (final RestconfDocumentedException e) {
             assertTrue(e.getErrors().get(0).getErrorMessage().contains("is added as augment from more than one module"));
         }
     }
index 8e1121a562c964debf3da74c870a8801a763e6b3..1dc5d672f39c0dd37c329b4905dd574298780c5e 100644 (file)
@@ -17,8 +17,8 @@ import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
+
 import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import java.io.FileNotFoundException;
 import java.io.UnsupportedEncodingException;
@@ -91,6 +91,7 @@ public class RestGetOperationTest extends JerseyTest {
     private static RestconfImpl restconfImpl;
     private static SchemaContext schemaContextYangsIetf;
     private static SchemaContext schemaContextTestModule;
+    @SuppressWarnings("rawtypes")
     private static NormalizedNode answerFromGet;
 
     private static SchemaContext schemaContextModules;
@@ -163,6 +164,7 @@ public class RestGetOperationTest extends JerseyTest {
     /**
      * MountPoint test. URI represents mount point.
      */
+    @SuppressWarnings("unchecked")
     @Test
     public void getDataWithUrlMountPoint() throws UnsupportedEncodingException, URISyntaxException, ParseException {
         when(brokerFacade.readConfigurationData(any(DOMMountPoint.class), any(YangInstanceIdentifier.class))).thenReturn(
@@ -187,7 +189,7 @@ public class RestGetOperationTest extends JerseyTest {
      * Slashes in URI behind mount point. lst1 element with key GigabitEthernet0%2F0%2F0%2F0 (GigabitEthernet0/0/0/0) is
      * requested via GET HTTP operation. It is tested whether %2F character is replaced with simple / in
      * InstanceIdentifier parameter in method
-     * {@link BrokerFacade#readConfigurationDataBehindMountPoint(MountInstance, YangInstanceIdentifier)} which is called in
+     * {@link BrokerFacade#readConfigurationData(DOMMountPoint, YangInstanceIdentifier)} which is called in
      * method {@link RestconfImpl#readConfigurationData}
      *
      * @throws ParseException
@@ -628,13 +630,6 @@ public class RestGetOperationTest extends JerseyTest {
     }
 
 
-    private void prepareMockForModulesTest(final ControllerContext mockedControllerContext)
-            throws FileNotFoundException {
-        final SchemaContext schemaContext = TestUtils.loadSchemaContext("/modules");
-        mockedControllerContext.setGlobalSchema(schemaContext);
-        // when(mockedControllerContext.getGlobalSchema()).thenReturn(schemaContext);
-    }
-
     private int get(final String uri, final String mediaType) {
         return target(uri).request(mediaType).get().getStatus();
     }
@@ -646,6 +641,7 @@ public class RestGetOperationTest extends JerseyTest {
                 type string;
             }
     */
+    @SuppressWarnings("rawtypes")
     private NormalizedNode prepareCnDataForMountPointTest(final boolean wrapToCont) throws URISyntaxException, ParseException {
         final String testModuleDate = "2014-01-09";
         final ContainerNode contChild = Builders
@@ -665,14 +661,17 @@ public class RestGetOperationTest extends JerseyTest {
 
     }
 
+    @SuppressWarnings("unchecked")
     private void mockReadOperationalDataMethod() {
         when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(answerFromGet);
     }
 
+    @SuppressWarnings("unchecked")
     private void mockReadConfigurationDataMethod() {
         when(brokerFacade.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(answerFromGet);
     }
 
+    @SuppressWarnings("rawtypes")
     private NormalizedNode prepareCnDataForSlashesBehindMountPointTest() throws ParseException {
         return ImmutableMapEntryNodeBuilder
                 .create()
@@ -746,6 +745,7 @@ public class RestGetOperationTest extends JerseyTest {
         getDataWithInvalidDepthParameterTest(mockInfo);
     }
 
+    @SuppressWarnings({"rawtypes", "unchecked"})
     private void getDataWithInvalidDepthParameterTest(final UriInfo uriInfo) {
         try {
             final QName qNameDepth1Cont = QName.create("urn:nested:module", "2014-06-3", "depth1-cont");
@@ -760,6 +760,7 @@ public class RestGetOperationTest extends JerseyTest {
         }
     }
 
+    @SuppressWarnings("unused")
     private void verifyXMLResponse(final Response response, final NodeData nodeData) {
         final Document doc = response.readEntity(Document.class);
 //        Document doc = TestUtils.loadDocumentFrom((InputStream) response.getEntity());
@@ -812,28 +813,4 @@ public class RestGetOperationTest extends JerseyTest {
         }
     }
 
-    private NodeData expectContainer(final String name, final NodeData... childData) {
-        return new NodeData(name, Lists.newArrayList(childData));
-    }
-
-    private NodeData expectEmptyContainer(final String name) {
-        return new NodeData(name, null);
-    }
-
-    private NodeData expectLeaf(final String name, final Object value) {
-        return new NodeData(name, value);
-    }
-
-    private QName toNestedQName(final String localName) {
-        return QName.create("urn:nested:module", "2014-06-3", localName);
-    }
-
-    private NodeData toCompositeNodeData(final QName key, final NodeData... childData) {
-        return new NodeData(key, Lists.newArrayList(childData));
-    }
-
-    private NodeData toSimpleNodeData(final QName key, final Object value) {
-        return new NodeData(key, value);
-    }
-
 }
index 96e0132f5dcd0196d4c5192385b5e8354f60f947..62a37ed1473c9e2fa74aac1b763ab8d130d6d99e 100644 (file)
@@ -14,6 +14,7 @@ import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.XML;
+
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 import com.google.common.util.concurrent.CheckedFuture;
@@ -104,6 +105,7 @@ public class RestPostOperationTest extends JerseyTest {
         restconfImpl.setControllerContext(context);
     }
 
+    @SuppressWarnings("unchecked")
     @Test
     @Ignore /// xmlData* need netconf-yang
     public void postDataViaUrlMountPoint() throws UnsupportedEncodingException {
@@ -127,6 +129,7 @@ public class RestPostOperationTest extends JerseyTest {
         assertEquals(400, post(uri, MediaType.APPLICATION_JSON, ""));
     }
 
+    @SuppressWarnings("unchecked")
     @Test
     @Ignore //jenkins has problem with JerseyTest - we expecting problems with singletons ControllerContext as schemaContext holder
     public void createConfigurationDataTest() throws UnsupportedEncodingException, ParseException {
@@ -138,6 +141,7 @@ public class RestPostOperationTest extends JerseyTest {
                 .thenReturn(mock(CheckedFuture.class));
 
         final ArgumentCaptor<YangInstanceIdentifier> instanceIdCaptor = ArgumentCaptor.forClass(YangInstanceIdentifier.class);
+        @SuppressWarnings("rawtypes")
         final ArgumentCaptor<NormalizedNode> compNodeCaptor = ArgumentCaptor.forClass(NormalizedNode.class);
 
 
index ac1820abea752e41a1078acc94d6bb1c4d36c3dc..39646f3ffd5197d26e212139da5607221190923a 100644 (file)
@@ -13,6 +13,7 @@ import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
+
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import java.io.FileNotFoundException;
@@ -112,6 +113,7 @@ public class RestPutOperationTest extends JerseyTest {
     @Test
     public void putConfigStatusCodesEmptyBody() throws UnsupportedEncodingException {
         final String uri = "/config/ietf-interfaces:interfaces/interface/eth0";
+        @SuppressWarnings("unused")
         final Response resp = target(uri).request(MediaType.APPLICATION_JSON).put(
                 Entity.entity("", MediaType.APPLICATION_JSON));
         assertEquals(400, put(uri, MediaType.APPLICATION_JSON, ""));
@@ -122,6 +124,7 @@ public class RestPutOperationTest extends JerseyTest {
     public void testRpcResultCommitedToStatusCodesWithMountPoint() throws UnsupportedEncodingException,
             FileNotFoundException, URISyntaxException {
 
+        @SuppressWarnings("unchecked")
         final CheckedFuture<Void, TransactionCommitFailedException> dummyFuture = mock(CheckedFuture.class);
 
         when(
@@ -144,6 +147,7 @@ public class RestPutOperationTest extends JerseyTest {
 
     @Test
     public void putDataMountPointIntoHighestElement() throws UnsupportedEncodingException, URISyntaxException {
+        @SuppressWarnings("unchecked")
         final CheckedFuture<Void, TransactionCommitFailedException> dummyFuture = mock(CheckedFuture.class);
         when(
                 brokerFacade.commitConfigurationDataPut(any(DOMMountPoint.class), any(YangInstanceIdentifier.class),
index 906695b3aab9fbad4c7b38fc2fd30db95c7d2037..fa878b68e51d3bc939d949af3df9d8f1687f3e92 100644 (file)
@@ -39,9 +39,9 @@ public class RestconfImplTest {
 
     @BeforeClass
     public static void init() throws FileNotFoundException {
-        Set<Module> allModules = TestUtils.loadModulesFrom("/full-versions/yangs");
+        final Set<Module> allModules = TestUtils.loadModulesFrom("/full-versions/yangs");
         assertNotNull(allModules);
-        SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules);
+        final SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules);
         controllerContext = spy(ControllerContext.getInstance());
         controllerContext.setSchemas(schemaContext);
 
@@ -53,10 +53,13 @@ public class RestconfImplTest {
         restconfImpl.setControllerContext(controllerContext);
     }
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testExample() throws FileNotFoundException, ParseException {
+        @SuppressWarnings("rawtypes")
+        final
         NormalizedNode normalizedNodeData = TestUtils.prepareNormalizedNodeWithIetfInterfacesInterfacesData();
-        BrokerFacade brokerFacade = mock(BrokerFacade.class);
+        final BrokerFacade brokerFacade = mock(BrokerFacade.class);
         when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(normalizedNodeData);
         assertEquals(normalizedNodeData,
                 brokerFacade.readOperationalData(null));
index 090b060c23496eeea97febe50ca066be120a6301..75cce14d09c197946ea3d9cdfe3b128d3986dca7 100644 (file)
@@ -8,11 +8,8 @@
 package org.opendaylight.controller.sal.restconf.impl.test;
 
 import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+
 import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
 import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -25,7 +22,6 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.sql.Date;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -42,9 +38,6 @@ import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
-import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
-import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
@@ -66,7 +59,7 @@ public final class TestUtils {
 
     private static final Logger LOG = LoggerFactory.getLogger(TestUtils.class);
 
-    private final static YangContextParser parser = new YangParserImpl();
+    private final static YangContextParser PARSER = new YangParserImpl();
 
     private static Set<Module> loadModules(final String resourceDirectory) throws FileNotFoundException {
         final File testDir = new File(resourceDirectory);
@@ -81,7 +74,7 @@ public final class TestUtils {
                 testFiles.add(new File(testDir, fileName));
             }
         }
-        return parser.parseYangModels(testFiles);
+        return PARSER.parseYangModels(testFiles);
     }
 
     public static Set<Module> loadModulesFrom(final String yangPath) {
@@ -95,11 +88,11 @@ public final class TestUtils {
     }
 
     public static SchemaContext loadSchemaContext(final Set<Module> modules) {
-        return parser.resolveSchemaContext(modules);
+        return PARSER.resolveSchemaContext(modules);
     }
 
     public static SchemaContext loadSchemaContext(final String resourceDirectory) throws FileNotFoundException {
-        return parser.resolveSchemaContext(loadModulesFrom(resourceDirectory));
+        return PARSER.resolveSchemaContext(loadModulesFrom(resourceDirectory));
     }
 
     public static Module findModule(final Set<Module> modules, final String moduleName) {
@@ -200,19 +193,6 @@ public final class TestUtils {
         return buildQName(name, "", null);
     }
 
-    private static void prepareMocksForRestconf(final Set<Module> modules, final RestconfImpl restconf) {
-        final ControllerContext controllerContext = ControllerContext.getInstance();
-        final BrokerFacade mockedBrokerFacade = mock(BrokerFacade.class);
-
-        controllerContext.setSchemas(TestUtils.loadSchemaContext(modules));
-
-        when(mockedBrokerFacade.commitConfigurationDataPut(any(YangInstanceIdentifier.class), any(NormalizedNode.class)))
-                .thenReturn(mock(CheckedFuture.class));
-
-        restconf.setControllerContext(controllerContext);
-        restconf.setBroker(mockedBrokerFacade);
-    }
-
     public static String loadTextFile(final String filePath) throws IOException {
         final FileReader fileReader = new FileReader(filePath);
         final BufferedReader bufReader = new BufferedReader(fileReader);
@@ -262,7 +242,6 @@ public final class TestUtils {
 
     public static YangInstanceIdentifier.NodeIdentifierWithPredicates getNodeIdentifierPredicate(final String localName,
             final String namespace, final String revision, final String... keysAndValues) throws ParseException {
-        final java.util.Date date = new SimpleDateFormat("yyyy-MM-dd").parse(revision);
         if (keysAndValues.length % 2 != 0) {
             new IllegalArgumentException("number of keys argument have to be divisible by 2 (map)");
         }
index 2f251799155963c583c9d80abbad8657f9b1b311..0514e03ac76885d329e52bd8c63b77537271578c 100644 (file)
@@ -13,6 +13,7 @@ import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 import static org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil.getRevisionFormat;
+
 import java.io.FileNotFoundException;
 import java.text.ParseException;
 import java.util.Date;
@@ -88,6 +89,7 @@ public class URIParametersParsing {
                 + scopeValue);
 
         final UriInfo mockedUriInfo = mock(UriInfo.class);
+        @SuppressWarnings("unchecked")
         final MultivaluedMap<String, String> mockedMultivaluedMap = mock(MultivaluedMap.class);
         when(mockedMultivaluedMap.getFirst(eq("datastore"))).thenReturn(datastoreValue);
         when(mockedMultivaluedMap.getFirst(eq("scope"))).thenReturn(scopeValue);
@@ -154,6 +156,6 @@ public class URIParametersParsing {
                 .withValue(scope)).build();
         container.withChild(scopeNode);
 
-        return new NormalizedNodeContext(new InstanceIdentifierContext(null, rpcInputSchemaNode, null, schema), container.build());
+        return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, rpcInputSchemaNode, null, schema), container.build());
     }
 }
index bb05514c0b43bb39e5601d518ba28e9951c51d86..3121fc0685a907fa50d7e85486c39bb21c231679 100644 (file)
@@ -13,6 +13,7 @@ import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
+
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
@@ -52,7 +53,7 @@ public class URITest {
 
     @Test
     public void testToInstanceIdentifierList() throws FileNotFoundException {
-        InstanceIdentifierContext instanceIdentifier = controllerContext
+        InstanceIdentifierContext<?> instanceIdentifier = controllerContext
                 .toInstanceIdentifier("simple-nodes:userWithoutClass/foo");
         assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "userWithoutClass");
 
@@ -81,7 +82,7 @@ public class URITest {
 
     @Test
     public void testToInstanceIdentifierContainer() throws FileNotFoundException {
-        final InstanceIdentifierContext instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:users");
+        final InstanceIdentifierContext<?> instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:users");
         assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "users");
         assertTrue(instanceIdentifier.getSchemaNode() instanceof ContainerSchemaNode);
         assertEquals(2, ((ContainerSchemaNode) instanceIdentifier.getSchemaNode()).getChildNodes().size());
@@ -90,7 +91,7 @@ public class URITest {
     @Test
     @Ignore //jenkins has problem with JerseyTest - we expecting problems with singletons ControllerContext as schemaContext holder
     public void testToInstanceIdentifierChoice() throws FileNotFoundException {
-        final InstanceIdentifierContext instanceIdentifier = controllerContext
+        final InstanceIdentifierContext<?> instanceIdentifier = controllerContext
                 .toInstanceIdentifier("simple-nodes:food/nonalcoholic");
         assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "nonalcoholic");
     }
@@ -122,7 +123,7 @@ public class URITest {
     @Test
     public void testMountPointWithExternModul() throws FileNotFoundException {
         initMountService(true);
-        final InstanceIdentifierContext instanceIdentifier = controllerContext
+        final InstanceIdentifierContext<?> instanceIdentifier = controllerContext
                 .toInstanceIdentifier("simple-nodes:users/yang-ext:mount/test-interface2:class/student/name");
         assertEquals(
                 "[(urn:ietf:params:xml:ns:yang:test-interface2?revision=2014-08-01)class, (urn:ietf:params:xml:ns:yang:test-interface2?revision=2014-08-01)student, (urn:ietf:params:xml:ns:yang:test-interface2?revision=2014-08-01)student[{(urn:ietf:params:xml:ns:yang:test-interface2?revision=2014-08-01)name=name}]]",
@@ -132,7 +133,7 @@ public class URITest {
     @Test
     public void testMountPointWithoutExternModul() throws FileNotFoundException {
         initMountService(true);
-        final InstanceIdentifierContext instanceIdentifier = controllerContext
+        final InstanceIdentifierContext<?> instanceIdentifier = controllerContext
                 .toInstanceIdentifier("simple-nodes:users/yang-ext:mount/");
         assertTrue(Iterables.isEmpty(instanceIdentifier.getInstanceIdentifier().getPathArguments()));
     }
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/CompareLf.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/CompareLf.java
deleted file mode 100644 (file)
index 12ab073..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.test.structures;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-public class CompareLf {
-
-    @Test
-    public void test() {
-        Lf lf1 = new Lf("name", "value");
-        Lf lf2 = new Lf("name", "value");
-        Lf lf3 = new Lf("name1", "value");
-        Lf lf4 = new Lf("name", "value1");
-
-        assertTrue(lf1.equals(lf2));
-        assertFalse(lf1.equals(lf3));
-        assertFalse(lf1.equals(lf4));
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Cont.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Cont.java
deleted file mode 100644 (file)
index 0f4e43a..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.test.structures;
-
-public class Cont extends LstItem {
-    String name = null;
-
-    public Cont(String name) {
-        super();
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!this.getClass().equals(obj.getClass())) {
-            return false;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        Cont cont = (Cont) obj;
-        if (this.name == null) {
-            if (cont.name != null) {
-                return false;
-            }
-        } else if (!this.name.equals(cont.name)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + ((this.name == null) ? 0 : this.name.hashCode());
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        return name;
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lf.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lf.java
deleted file mode 100644 (file)
index 2ab7fbc..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.test.structures;
-
-public class Lf extends YangElement {
-    private Object value;
-    private int numOfEqualItems = 0;
-
-    public Lf(String name, Object value) {
-        super(name);
-        this.value = value;
-    }
-
-    public Lf(Object value) {
-        super("");
-        this.value = value;
-    }
-
-    public Object getValue() {
-        return value;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!this.getClass().equals(obj.getClass())) {
-            return false;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        Lf lf = (Lf) obj;
-        if (this.value == null) {
-            if (lf.value != null) {
-                return false;
-            }
-        } else if (!this.value.equals(lf.value)) {
-            return false;
-        }
-        if (this.numOfEqualItems != lf.numOfEqualItems) {
-            return false;
-        }
-        return true;
-    }
-
-    public void incNumOfEqualItems() {
-        this.numOfEqualItems++;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + ((value == null) ? 0 : value.hashCode());
-        result = prime * result + numOfEqualItems;
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        return super.toString() + ":" + value;
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LfLst.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LfLst.java
deleted file mode 100644 (file)
index 719adf7..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.test.structures;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class LfLst extends YangElement {
-    Set<Lf> lfs;
-
-    public LfLst(String name) {
-        super(name);
-        lfs = new HashSet<>();
-    }
-
-    public LfLst addLf(Object value) {
-        return addLf(new Lf(value));
-    }
-
-    public LfLst addLf(Lf lf) {
-        while (this.lfs.contains(lf)) {
-            lf.incNumOfEqualItems();
-        }
-        this.lfs.add(lf);
-        return this;
-    }
-
-    public Set<Lf> getLfs() {
-        return lfs;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!this.getClass().equals(obj.getClass())) {
-            return false;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        LfLst lfLst = (LfLst) obj;
-        if (this.lfs == null) {
-            if (lfLst.lfs != null) {
-                return false;
-            }
-        } else if (!this.lfs.equals(lfLst.lfs)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + ((lfs == null) ? 0 : lfs.hashCode());
-        return result;
-    }
-
-    @Override
-    public String toString() {
-
-        return super.toString();
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lst.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/Lst.java
deleted file mode 100644 (file)
index 8eccf37..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.test.structures;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class Lst extends YangElement {
-    private final Set<LstItem> lstItems;
-
-    public Lst(final String name) {
-        super(name);
-        lstItems = new HashSet<>();
-    }
-
-    public Lst addLstItem(final LstItem lstItem) {
-        lstItem.setLstName(name);
-        while (this.lstItems.contains(lstItem)) {
-            lstItem.incNumOfEqualItems();
-        }
-        this.lstItems.add(lstItem);
-        return this;
-    }
-
-    public Set<LstItem> getLstItems() {
-        return lstItems;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!this.getClass().equals(obj.getClass())) {
-            return false;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        Lst lst = (Lst) obj;
-        if (this.lstItems == null) {
-            if (lst.lstItems != null) {
-                return false;
-            }
-        } else if (!this.lstItems.equals(lst.lstItems)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + ((lstItems == null) ? 0 : lstItems.hashCode());
-        return result;
-    }
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LstItem.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/LstItem.java
deleted file mode 100644 (file)
index ae07571..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.test.structures;
-
-import static org.junit.Assert.assertFalse;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class LstItem {
-    String lstName;
-    Map<String, Lf> lfs;
-    Map<String, LfLst> lfLsts;
-    Map<String, Lst> lsts;
-    Map<String, Cont> conts;
-    private int numOfEqualItems = 0;
-
-    public LstItem() {
-        lfs = new HashMap<>();
-        conts = new HashMap<>();
-        lfLsts = new HashMap<>();
-        lsts = new HashMap<>();
-    }
-
-    public Map<String, Lst> getLsts() {
-        return lsts;
-    }
-
-    public Map<String, Cont> getConts() {
-        return conts;
-    }
-
-    public Map<String, LfLst> getLfLsts() {
-        return lfLsts;
-    }
-
-    public Map<String, Lf> getLfs() {
-        return lfs;
-    }
-
-    public String getLstName() {
-        return lstName;
-    }
-
-    public LstItem addLf(Lf lf) {
-        lfs.put(lf.getName(), lf);
-        return this;
-    }
-
-    public LstItem addLf(String name, Object value) {
-        lfs.put(name, new Lf(name, value));
-        return this;
-    }
-
-    public void addLfLst(LfLst lfLst) {
-        assertFalse("Found multiple leaf list elements for " + lfLst.getName(), lfLsts.containsKey(lfLst.getName()));
-        lfLsts.put(lfLst.getName(), lfLst);
-    }
-
-    public void addLst(Lst lst) {
-        assertFalse("Found multiple list elements for " + lst.getName(), lsts.containsKey(lst.getName()));
-        lsts.put(lst.getName(), lst);
-    }
-
-    public void addCont(Cont cont) {
-        conts.put(cont.getName(), cont);
-    }
-
-    public void incNumOfEqualItems() {
-        this.numOfEqualItems++;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!this.getClass().equals(obj.getClass())) {
-            return false;
-        }
-        LstItem lstItem = (LstItem) obj;
-        if (this.conts == null) {
-            if (lstItem.conts != null) {
-                return false;
-            }
-        } else if (!this.conts.equals(lstItem.conts)) {
-            return false;
-        }
-        if (this.lfs == null) {
-            if (lstItem.lfs != null) {
-                return false;
-            }
-        } else if (!this.lfs.equals(lstItem.lfs)) {
-            return false;
-        }
-        if (this.lfLsts == null) {
-            if (lstItem.lfLsts != null) {
-                return false;
-            }
-        } else if (!this.lfLsts.equals(lstItem.lfLsts)) {
-            return false;
-        }
-        if (this.lsts == null) {
-            if (lstItem.lsts != null) {
-                return false;
-            }
-        } else if (!this.lsts.equals(lstItem.lsts)) {
-            return false;
-        }
-        if (this.numOfEqualItems != lstItem.numOfEqualItems) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((lfs == null) ? 0 : lfs.hashCode());
-        result = prime * result + ((lfLsts == null) ? 0 : lfLsts.hashCode());
-        result = prime * result + ((lsts == null) ? 0 : lsts.hashCode());
-        result = prime * result + ((conts == null) ? 0 : conts.hashCode());
-        result = prime * result + numOfEqualItems;
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        return "lst item of " + lstName;
-    }
-
-    public void setLstName(String name) {
-        this.lstName = name;
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/YangElement.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/structures/YangElement.java
deleted file mode 100644 (file)
index 005e5fe..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.test.structures;
-
-public class YangElement {
-    protected String name;
-
-    protected YangElement(String name) {
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!this.getClass().equals(obj.getClass())) {
-            return false;
-        }
-        YangElement yangElement = (YangElement) obj;
-        if (this.name == null) {
-            if (yangElement.name != null) {
-                return false;
-            }
-        } else if (!this.name.equals(yangElement.name)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((name == null) ? 0 : name.hashCode());
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        return name;
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlLeafrefToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlLeafrefToCnSnTest.java
deleted file mode 100644 (file)
index dccf970..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.restconf.impl.xml.to.cnsn.test;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class XmlLeafrefToCnSnTest {
-    private static final Logger LOG = LoggerFactory.getLogger(XmlLeafrefToCnSnTest.class);
-
-}