Bug 5528 - Preparing enviroment for impl of restful services 47/38747/23
authorJakub Toth <jatoth@cisco.com>
Thu, 12 May 2016 08:58:35 +0000 (10:58 +0200)
committerJakub Toth <jatoth@cisco.com>
Tue, 28 Jun 2016 12:23:06 +0000 (12:23 +0000)
  * repackeging
  * fixing changes

Change-Id: I2ece0416ed09c3fc3517957427e18673406013de
Signed-off-by: Jakub Toth <jatoth@cisco.com>
23 files changed:
restconf/sal-rest-connector/src/main/java/org/opendaylight/RestconfWrapperProviders.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaRetrievalService.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/api/RestconfService.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/RestConnectorProvider.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/RestConnectorProvider.java with 89% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/RestconfApplication.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/RestconfApplication.java with 93% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/common/handlers/api/SchemaContextHandler.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/api/schema/context/SchemaContextHandler.java with 92% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/common/handlers/impl/SchemaContextHandlerImpl.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/impl/schema/context/SchemaContextHandlerImpl.java with 85% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/common/references/SchemaContextRef.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/impl/services/SchemaContextRef.java with 96% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/Draft11ServicesWrapper.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/api/services/Draft11ServicesWrapper.java with 84% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfModulesService.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/api/services/RestconfModulesService.java with 98% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfOperationsService.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/api/services/RestconfOperationsService.java with 97% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfSchemaService.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/api/services/schema/RestconfSchemaService.java with 94% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/api/RestconfStreamsService.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/api/services/RestconfStreamsService.java with 96% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/impl/Draft11ServicesWrapperImpl.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/impl/services/Draft11ServicesWrapperImpl.java with 86% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/impl/RestconfModulesServiceImpl.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/impl/services/RestconfModulesServiceImpl.java with 97% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/impl/RestconfOperationsServiceImpl.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/impl/services/RestconfOperationsServiceImpl.java with 90% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/impl/RestconfSchemaServiceImpl.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/impl/services/RestconfSchemaServiceImpl.java with 87% similarity]
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/impl/RestconfStreamsServiceImpl.java [moved from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/impl/services/RestconfStreamsServiceImpl.java with 93% similarity]
restconf/sal-rest-connector/src/main/resources/WEB-INF/web.xml
restconf/sal-rest-connector/src/test/java/org/opendaylight/restconf/rest/RestConnectorProviderTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/restconf/rest/impl/schema/context/SchemaContextHandlerTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/restconf/rest/impl/services/RestconfSchemaServiceTest.java
restconf/sal-rest-connector/src/test/java/org/opendaylight/restconf/rest/impl/services/RestconfStreamsServiceTest.java

index 33b826b86e0f0c1b0ef442e9ab51599a51dbea90..df1ea9a1272ca0f1a9e7353633792e94ba132aee 100644 (file)
@@ -12,7 +12,7 @@ import org.opendaylight.controller.config.yang.md.sal.rest.connector.RestConnect
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.opendaylight.netconf.sal.rest.api.RestConnector;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfProviderImpl;
-import org.opendaylight.restconf.rest.RestConnectorProvider;
+import org.opendaylight.restconf.RestConnectorProvider;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
 
 /**
index 52999a5cd2019ed580d3a9dce9315b0b132cbaec..2dc16e209b1ab6b632db052644d20d34de403859 100644 (file)
@@ -12,7 +12,7 @@ import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import org.opendaylight.restconf.rest.api.services.schema.RestconfSchemaService;
+import org.opendaylight.restconf.rest.services.api.RestconfSchemaService;
 
 /**
  * @deprecated do not use this api. It is replaced by
index 1c99af58babc20d5f044dcc320111daa85e7d5bd..ade5a41d5878729fa9a238ec1989aeb0fed81de7 100644 (file)
@@ -26,9 +26,9 @@ import org.opendaylight.netconf.sal.rest.impl.PATCH;
 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
 import org.opendaylight.netconf.sal.restconf.impl.PATCHContext;
 import org.opendaylight.netconf.sal.restconf.impl.PATCHStatusContext;
-import org.opendaylight.restconf.rest.api.services.RestconfModulesService;
-import org.opendaylight.restconf.rest.api.services.RestconfOperationsService;
-import org.opendaylight.restconf.rest.api.services.RestconfStreamsService;
+import org.opendaylight.restconf.rest.services.api.RestconfModulesService;
+import org.opendaylight.restconf.rest.services.api.RestconfOperationsService;
+import org.opendaylight.restconf.rest.services.api.RestconfStreamsService;
 import org.opendaylight.restconf.restful.services.api.RestconfDataService;
 import org.opendaylight.restconf.restful.services.api.RestconfInvokeOperationsService;
 
similarity index 89%
rename from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/RestConnectorProvider.java
rename to restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/RestConnectorProvider.java
index 8dafecbf143f433461cc4c3546530eaf9331f213..ce6b2d2ecb5cf9155b0bf628ed8566127992ed5b 100644 (file)
@@ -5,7 +5,7 @@
  * 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.restconf.rest;
+package org.opendaylight.restconf;
 
 import com.google.common.base.Preconditions;
 import java.util.Collection;
@@ -15,11 +15,11 @@ import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
 import org.opendaylight.controller.sal.core.api.Provider;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.netconf.sal.rest.api.RestConnector;
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
+import org.opendaylight.restconf.common.handlers.impl.SchemaContextHandlerImpl;
 import org.opendaylight.restconf.rest.handlers.api.DOMMountPointServiceHandler;
 import org.opendaylight.restconf.rest.handlers.impl.DOMMountPointServiceHandlerImpl;
-import org.opendaylight.restconf.rest.impl.schema.context.SchemaContextHandlerImpl;
-import org.opendaylight.restconf.rest.impl.services.Draft11ServicesWrapperImpl;
+import org.opendaylight.restconf.rest.services.impl.Draft11ServicesWrapperImpl;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 
similarity index 93%
rename from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/RestconfApplication.java
rename to restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/RestconfApplication.java
index ae778993d5937c82301460b24f3d7cf5a21a5c93..44770388d4b2ba04fb104f8a3bad7c988ca21b4d 100644 (file)
@@ -5,7 +5,7 @@
  * 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.restconf.rest;
+package org.opendaylight.restconf;
 
 import com.google.common.collect.ImmutableSet;
 import java.util.HashSet;
@@ -15,7 +15,7 @@ import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContentYangBodyWr
 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContentYinBodyWriter;
 import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeJsonBodyWriter;
 import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeXmlBodyWriter;
-import org.opendaylight.restconf.rest.impl.services.Draft11ServicesWrapperImpl;
+import org.opendaylight.restconf.rest.services.impl.Draft11ServicesWrapperImpl;
 
 public class RestconfApplication extends Application {
 
@@ -5,7 +5,7 @@
  * 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.restconf.rest.api.schema.context;
+package org.opendaylight.restconf.common.handlers.api;
 
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
@@ -5,9 +5,9 @@
  * 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.restconf.rest.impl.schema.context;
+package org.opendaylight.restconf.common.handlers.impl;
 
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 /**
similarity index 96%
rename from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/impl/services/SchemaContextRef.java
rename to restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/common/references/SchemaContextRef.java
index a934a69a7df069b11d60530561834b7245c2b244..c15ffa3865e63d47b3a6e1adf7f6495002d519e2 100644 (file)
@@ -5,7 +5,7 @@
  * 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.restconf.rest.impl.services;
+package org.opendaylight.restconf.common.references;
 
 import java.lang.ref.SoftReference;
 import java.net.URI;
@@ -24,7 +24,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
  * {@link SchemaContext}.
  *
  */
-final class SchemaContextRef {
+public final class SchemaContextRef {
 
     private final SoftReference<SchemaContext> schemaContextRef;
 
@@ -73,7 +73,7 @@ final class SchemaContextRef {
 
     /**
      * Get {@link Module} by ietf-restconf qname from
-     * {@link Draft09.RestconfModule}
+     * {@link Draft11.RestconfModule}
      *
      * @return {@link Module}
      */
@@ -103,7 +103,7 @@ final class SchemaContextRef {
      *
      * @param mountPoint
      *            - mount point
-     * @param qname
+     * @param moduleQname
      *            - {@link QName} of module
      * @return {@link Module}
      */
@@ -5,10 +5,9 @@
  * 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.restconf.rest.api.services;
+package org.opendaylight.restconf.rest.services.api;
 
 import javax.ws.rs.Path;
-import org.opendaylight.restconf.rest.api.services.schema.RestconfSchemaService;
 
 /**
  * Wrapper for all services:
@@ -5,7 +5,7 @@
  * 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.restconf.rest.api.services;
+package org.opendaylight.restconf.rest.services.api;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -5,7 +5,7 @@
  * 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.restconf.rest.api.services;
+package org.opendaylight.restconf.rest.services.api;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -5,7 +5,7 @@
  * 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.restconf.rest.api.services.schema;
+package org.opendaylight.restconf.rest.services.api;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -5,7 +5,7 @@
  * 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.restconf.rest.api.services;
+package org.opendaylight.restconf.rest.services.api;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -5,18 +5,18 @@
  * 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.restconf.rest.impl.services;
+package org.opendaylight.restconf.rest.services.impl;
 
 import javax.ws.rs.core.UriInfo;
 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContext;
 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
-import org.opendaylight.restconf.rest.api.services.Draft11ServicesWrapper;
-import org.opendaylight.restconf.rest.api.services.RestconfModulesService;
-import org.opendaylight.restconf.rest.api.services.RestconfOperationsService;
-import org.opendaylight.restconf.rest.api.services.RestconfStreamsService;
-import org.opendaylight.restconf.rest.api.services.schema.RestconfSchemaService;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
 import org.opendaylight.restconf.rest.handlers.api.DOMMountPointServiceHandler;
+import org.opendaylight.restconf.rest.services.api.Draft11ServicesWrapper;
+import org.opendaylight.restconf.rest.services.api.RestconfModulesService;
+import org.opendaylight.restconf.rest.services.api.RestconfOperationsService;
+import org.opendaylight.restconf.rest.services.api.RestconfSchemaService;
+import org.opendaylight.restconf.rest.services.api.RestconfStreamsService;
 
 /**
  * Implementation of {@link Draft11ServicesWrapper}
@@ -5,7 +5,7 @@
  * 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.restconf.rest.impl.services;
+package org.opendaylight.restconf.rest.services.impl;
 
 import com.google.common.base.Preconditions;
 import java.util.Collections;
@@ -19,9 +19,10 @@ import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorTag;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorType;
 import org.opendaylight.restconf.Draft11;
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
-import org.opendaylight.restconf.rest.api.services.RestconfModulesService;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
+import org.opendaylight.restconf.common.references.SchemaContextRef;
 import org.opendaylight.restconf.rest.handlers.api.DOMMountPointServiceHandler;
+import org.opendaylight.restconf.rest.services.api.RestconfModulesService;
 import org.opendaylight.restconf.utils.RestconfConstants;
 import org.opendaylight.restconf.utils.mapping.RestconfMappingNodeUtil;
 import org.opendaylight.restconf.utils.parser.ParserIdentifier;
@@ -5,14 +5,14 @@
  * 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.restconf.rest.impl.services;
+package org.opendaylight.restconf.rest.services.impl;
 
 import javax.ws.rs.core.UriInfo;
 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
-import org.opendaylight.restconf.rest.api.services.RestconfOperationsService;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
 import org.opendaylight.restconf.rest.handlers.api.DOMMountPointServiceHandler;
+import org.opendaylight.restconf.rest.services.api.RestconfOperationsService;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 /**
@@ -5,12 +5,13 @@
  * 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.restconf.rest.impl.services;
+package org.opendaylight.restconf.rest.services.impl;
 
 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContext;
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
-import org.opendaylight.restconf.rest.api.services.schema.RestconfSchemaService;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
+import org.opendaylight.restconf.common.references.SchemaContextRef;
 import org.opendaylight.restconf.rest.handlers.api.DOMMountPointServiceHandler;
+import org.opendaylight.restconf.rest.services.api.RestconfSchemaService;
 import org.opendaylight.restconf.utils.parser.ParserIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -5,7 +5,7 @@
  * 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.restconf.rest.impl.services;
+package org.opendaylight.restconf.rest.services.impl;
 
 import com.google.common.base.Preconditions;
 import java.util.Set;
@@ -14,8 +14,9 @@ import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
 import org.opendaylight.netconf.sal.streams.listeners.Notificator;
 import org.opendaylight.restconf.Draft11;
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
-import org.opendaylight.restconf.rest.api.services.RestconfStreamsService;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
+import org.opendaylight.restconf.common.references.SchemaContextRef;
+import org.opendaylight.restconf.rest.services.api.RestconfStreamsService;
 import org.opendaylight.restconf.utils.mapping.RestconfMappingNodeUtil;
 import org.opendaylight.restconf.utils.schema.context.RestconfSchemaUtil;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
index aa28819565e60df95b8daef87996d5bbb7274674..bdb149f14f8074143533ec63033869b8c7880742 100644 (file)
@@ -4,21 +4,21 @@
     version="3.0">
 
     <servlet>
-        <servlet-name>Restconf</servlet-name>
+        <servlet-name>JAXRSRestconf</servlet-name>
         <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
         <init-param>
             <param-name>javax.ws.rs.Application</param-name>
-            <param-value>org.opendaylight.restconf.rest.RestconfApplication</param-value>
+            <param-value>org.opendaylight.netconf.sal.rest.impl.RestconfApplication</param-value>
         </init-param>
         <load-on-startup>0</load-on-startup>
     </servlet>
 
     <servlet>
-        <servlet-name>JAXRSRestconf</servlet-name>
+        <servlet-name>Restconf</servlet-name>
         <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
         <init-param>
             <param-name>javax.ws.rs.Application</param-name>
-            <param-value>org.opendaylight.netconf.sal.rest.impl.RestconfApplication</param-value>
+            <param-value>org.opendaylight.restconf.RestconfApplication</param-value>
         </init-param>
         <load-on-startup>1</load-on-startup>
     </servlet>
index b50450cd8418e52bff18f076dec90205580f32b4..d2ce0adefa489c170cdd06af56e44d94a6f794ed 100644 (file)
@@ -12,7 +12,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -23,7 +22,8 @@ import org.mockito.MockitoAnnotations;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
+import org.opendaylight.restconf.RestConnectorProvider;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 
@@ -45,7 +45,7 @@ public class RestConnectorProviderTest {
     @Before
     public void init() {
         MockitoAnnotations.initMocks(this);
-        connectorProvider = new RestConnectorProvider();
+        this.connectorProvider = new RestConnectorProvider();
     }
 
     /**
@@ -53,7 +53,7 @@ public class RestConnectorProviderTest {
      */
     @Test
     public void restConnectorProviderInitTest() {
-        assertNotNull("Connector provider should be initialized and not null", connectorProvider);
+        assertNotNull("Connector provider should be initialized and not null", this.connectorProvider);
     }
 
     /**
@@ -66,16 +66,16 @@ public class RestConnectorProviderTest {
     @Test
     public void successfulRegistrationTest() {
         // prepare conditions
-        when(mockSession.getService(SchemaService.class)).thenReturn(mockSchemaService);
-        when(mockSession.getService(DOMMountPointService.class)).thenReturn(mockMountPointService);
+        when(this.mockSession.getService(SchemaService.class)).thenReturn(this.mockSchemaService);
+        when(this.mockSession.getService(DOMMountPointService.class)).thenReturn(this.mockMountPointService);
 
         // test
-        connectorProvider.onSessionInitiated(mockSession);
+        this.connectorProvider.onSessionInitiated(this.mockSession);
 
         // verify interactions
-        verify(mockSession, times(1)).getService(SchemaService.class);
-        verify(mockSession, times(1)).getService(DOMMountPointService.class);
-        verify(mockSchemaService, times(1)).registerSchemaContextListener(Mockito.any(SchemaContextHandler.class));
+        verify(this.mockSession, times(1)).getService(SchemaService.class);
+        verify(this.mockSession, times(1)).getService(DOMMountPointService.class);
+        verify(this.mockSchemaService, times(1)).registerSchemaContextListener(Mockito.any(SchemaContextHandler.class));
     }
 
     /**
@@ -88,16 +88,16 @@ public class RestConnectorProviderTest {
     @Test
     public void successfulRegistrationWithoutMountPointTest() {
         // prepare conditions
-        when(mockSession.getService(SchemaService.class)).thenReturn(mockSchemaService);
-        when(mockSession.getService(DOMMountPointService.class)).thenReturn(null);
+        when(this.mockSession.getService(SchemaService.class)).thenReturn(this.mockSchemaService);
+        when(this.mockSession.getService(DOMMountPointService.class)).thenReturn(null);
 
         // test
-        connectorProvider.onSessionInitiated(mockSession);
+        this.connectorProvider.onSessionInitiated(this.mockSession);
 
         // verify interactions
-        verify(mockSession, times(1)).getService(SchemaService.class);
-        verify(mockSession, times(1)).getService(DOMMountPointService.class);
-        verify(mockSchemaService, times(1)).registerSchemaContextListener(Mockito.any(SchemaContextHandler.class));
+        verify(this.mockSession, times(1)).getService(SchemaService.class);
+        verify(this.mockSession, times(1)).getService(DOMMountPointService.class);
+        verify(this.mockSchemaService, times(1)).registerSchemaContextListener(Mockito.any(SchemaContextHandler.class));
     }
 
     /**
@@ -106,8 +106,8 @@ public class RestConnectorProviderTest {
      */
     @Test
     public void nullSessionRegistrationNegativeTest() {
-        thrown.expect(NullPointerException.class);
-        connectorProvider.onSessionInitiated(null);
+        this.thrown.expect(NullPointerException.class);
+        this.connectorProvider.onSessionInitiated(null);
     }
 
     /**
@@ -118,14 +118,14 @@ public class RestConnectorProviderTest {
     @Test
     public void withoutSchemaServiceRegistrationNegativeTest() {
         // prepare conditions
-        when(mockSession.getService(SchemaService.class)).thenReturn(null);
+        when(this.mockSession.getService(SchemaService.class)).thenReturn(null);
 
         // test
-        thrown.expect(NullPointerException.class);
-        connectorProvider.onSessionInitiated(mockSession);
+        this.thrown.expect(NullPointerException.class);
+        this.connectorProvider.onSessionInitiated(this.mockSession);
 
         // verify interaction
-        verify(mockSession, times(1)).getService(SchemaService.class);
+        verify(this.mockSession, times(1)).getService(SchemaService.class);
     }
 
     /**
@@ -133,7 +133,7 @@ public class RestConnectorProviderTest {
      */
     @Test
     public void closeNotOpenTest() throws Exception {
-        connectorProvider.close();
+        this.connectorProvider.close();
     }
 
     /**
@@ -142,18 +142,18 @@ public class RestConnectorProviderTest {
     @Test
     public void closeOpenTest() throws Exception {
         // prepare conditions
-        when(mockSession.getService(SchemaService.class)).thenReturn(mockSchemaService);
-        when(mockSession.getService(DOMMountPointService.class)).thenReturn(mockMountPointService);
-        when(mockSchemaService.registerSchemaContextListener(Mockito.any(SchemaContextHandler.class)))
-                .thenReturn(mockRegistration);
+        when(this.mockSession.getService(SchemaService.class)).thenReturn(this.mockSchemaService);
+        when(this.mockSession.getService(DOMMountPointService.class)).thenReturn(this.mockMountPointService);
+        when(this.mockSchemaService.registerSchemaContextListener(Mockito.any(SchemaContextHandler.class)))
+                .thenReturn(this.mockRegistration);
 
         // register
-        connectorProvider.onSessionInitiated(mockSession);
+        this.connectorProvider.onSessionInitiated(this.mockSession);
 
         // close registration
-        connectorProvider.close();
+        this.connectorProvider.close();
 
         // verify interaction
-        verify(mockRegistration, times(1)).close();
+        verify(this.mockRegistration, times(1)).close();
     }
 }
index d69305f7af9157fbfcba744555f66624ec1e327c..78d84abd8e0bf356bc2e4e75ac250f664dd037aa 100644 (file)
@@ -10,15 +10,12 @@ package org.opendaylight.restconf.rest.impl.schema.context;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
-
-import java.io.FileNotFoundException;
-import java.net.URISyntaxException;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
+import org.opendaylight.restconf.common.handlers.impl.SchemaContextHandlerImpl;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 /**
  * Tests for handling {@link SchemaContext}
@@ -33,10 +30,10 @@ public class SchemaContextHandlerTest {
 
     @Before
     public void setup() throws Exception {
-        schemaContextHandler = new SchemaContextHandlerImpl();
+        this.schemaContextHandler = new SchemaContextHandlerImpl();
 
-        schemaContext = TestRestconfUtils.loadSchemaContext(PATH_FOR_ACTUAL_SCHEMA_CONTEXT);
-        schemaContextHandler.onGlobalContextUpdated(schemaContext);
+        this.schemaContext = TestRestconfUtils.loadSchemaContext(PATH_FOR_ACTUAL_SCHEMA_CONTEXT);
+        this.schemaContextHandler.onGlobalContextUpdated(this.schemaContext);
     }
 
     /**
@@ -44,7 +41,7 @@ public class SchemaContextHandlerTest {
      */
     @Test
     public void schemaContextHandlerImplInitTest() {
-        assertNotNull("Handler should be created and not null", schemaContextHandler);
+        assertNotNull("Handler should be created and not null", this.schemaContextHandler);
     }
 
     /**
@@ -56,7 +53,7 @@ public class SchemaContextHandlerTest {
     @Test
     public void getSchemaContextTest() {
         assertEquals("SchemaContextHandler should has reference to actual SchemaContext",
-                schemaContext, schemaContextHandler.getSchemaContext());
+                this.schemaContext, this.schemaContextHandler.getSchemaContext());
     }
 
     /**
@@ -68,12 +65,12 @@ public class SchemaContextHandlerTest {
     @Test
     public void onGlobalContextUpdateTest() throws Exception {
         // create new SchemaContext and update SchemaContextHandler
-        SchemaContext newSchemaContext = TestRestconfUtils.loadSchemaContext(PATH_FOR_NEW_SCHEMA_CONTEXT);
-        schemaContextHandler.onGlobalContextUpdated(newSchemaContext);
+        final SchemaContext newSchemaContext = TestRestconfUtils.loadSchemaContext(PATH_FOR_NEW_SCHEMA_CONTEXT);
+        this.schemaContextHandler.onGlobalContextUpdated(newSchemaContext);
 
         assertNotEquals("SchemaContextHandler should not has reference to old SchemaContext",
-                schemaContext, schemaContextHandler.getSchemaContext());
+                this.schemaContext, this.schemaContextHandler.getSchemaContext());
         assertEquals("SchemaContextHandler should has reference to new SchemaContext",
-                newSchemaContext, schemaContextHandler.getSchemaContext());
+                newSchemaContext, this.schemaContextHandler.getSchemaContext());
     }
 }
index c3460ad298d8cf92937160c4133ded40c587f978..2ffb5a0ff41bb716959f7bebe5c712d6baeb67f4 100644 (file)
@@ -13,7 +13,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.when;
-
 import com.google.common.collect.ImmutableClassToInstanceMap;
 import java.util.HashMap;
 import org.junit.Before;
@@ -30,9 +29,10 @@ import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContext;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError;
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
-import org.opendaylight.restconf.rest.api.services.schema.RestconfSchemaService;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
 import org.opendaylight.restconf.rest.handlers.api.DOMMountPointServiceHandler;
+import org.opendaylight.restconf.rest.services.api.RestconfSchemaService;
+import org.opendaylight.restconf.rest.services.impl.RestconfSchemaServiceImpl;
 import org.opendaylight.restconf.utils.RestconfConstants;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
@@ -79,29 +79,29 @@ public class RestconfSchemaServiceTest {
     public void setup() throws Exception {
         MockitoAnnotations.initMocks(this);
 
-        schemaContext = TestRestconfUtils.loadSchemaContext("/modules");
-        schemaContextBehindMountPoint = TestRestconfUtils.loadSchemaContext("/modules/modules-behind-mount-point");
-        schemaContextWithMountPoints = TestRestconfUtils.loadSchemaContext("/modules/mount-points");
+        this.schemaContext = TestRestconfUtils.loadSchemaContext("/modules");
+        this.schemaContextBehindMountPoint = TestRestconfUtils.loadSchemaContext("/modules/modules-behind-mount-point");
+        this.schemaContextWithMountPoints = TestRestconfUtils.loadSchemaContext("/modules/mount-points");
 
         // create and register mount points
-        mountPoint = SimpleDOMMountPoint.create(
+        this.mountPoint = SimpleDOMMountPoint.create(
                 YangInstanceIdentifier.of(QName.create("mount:point:1", "2016-01-01", "cont")),
                 ImmutableClassToInstanceMap.copyOf(new HashMap<>()),
-                schemaContextBehindMountPoint
+                this.schemaContextBehindMountPoint
         );
 
-        mountPointWithNullSchemaContext = SimpleDOMMountPoint.create(
+        this.mountPointWithNullSchemaContext = SimpleDOMMountPoint.create(
                 YangInstanceIdentifier.of(QName.create("mount:point:2", "2016-01-01", "cont")),
                 ImmutableClassToInstanceMap.copyOf(new HashMap<>()),
                 null
         );
 
-        mountPointService = new DOMMountPointServiceImpl();
-        ((DOMMountPointServiceImpl) mountPointService).registerMountPoint(mountPoint);
-        ((DOMMountPointServiceImpl) mountPointService).registerMountPoint(mountPointWithNullSchemaContext);
-        when(mockMountPointHandler.getDOMMountPointService()).thenReturn(mountPointService);
+        this.mountPointService = new DOMMountPointServiceImpl();
+        ((DOMMountPointServiceImpl) this.mountPointService).registerMountPoint(this.mountPoint);
+        ((DOMMountPointServiceImpl) this.mountPointService).registerMountPoint(this.mountPointWithNullSchemaContext);
+        when(this.mockMountPointHandler.getDOMMountPointService()).thenReturn(this.mountPointService);
 
-        schemaService = new RestconfSchemaServiceImpl(mockContextHandler, mockMountPointHandler);
+        this.schemaService = new RestconfSchemaServiceImpl(this.mockContextHandler, this.mockMountPointHandler);
     }
 
     /**
@@ -109,7 +109,7 @@ public class RestconfSchemaServiceTest {
      */
     @Test
     public void schemaServiceImplInitTest() {
-        assertNotNull("Schema service should be initialized and not null", schemaService);
+        assertNotNull("Schema service should be initialized and not null", this.schemaService);
     }
 
     /**
@@ -118,10 +118,10 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaTest() {
         // prepare conditions - return not-mount point schema context
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContext);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContext);
 
         // make test
-        final SchemaExportContext exportContext = schemaService.getSchema(TEST_MODULE);
+        final SchemaExportContext exportContext = this.schemaService.getSchema(TEST_MODULE);
 
         // verify
         assertNotNull("Export context should not be null", exportContext);
@@ -142,10 +142,10 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaForNotExistingModuleTest() {
         // prepare conditions - return not-mount point schema context
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContext);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContext);
 
         // make test
-        final SchemaExportContext exportContext = schemaService.getSchema(NOT_EXISTING_MODULE);
+        final SchemaExportContext exportContext = this.schemaService.getSchema(NOT_EXISTING_MODULE);
 
         // verify
         assertNotNull("Export context should not be null", exportContext);
@@ -158,10 +158,10 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaMountPointTest() {
         // prepare conditions - return schema context with mount points
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContextWithMountPoints);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContextWithMountPoints);
 
         // make test
-        final SchemaExportContext exportContext = schemaService.getSchema(MOUNT_POINT + TEST_MODULE_BEHIND_MOUNT_POINT);
+        final SchemaExportContext exportContext = this.schemaService.getSchema(MOUNT_POINT + TEST_MODULE_BEHIND_MOUNT_POINT);
 
         // verify
         assertNotNull("Export context should not be null", exportContext);
@@ -182,10 +182,10 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaForNotExistingModuleMountPointTest() {
         // prepare conditions - return schema context with mount points
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContextWithMountPoints);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContextWithMountPoints);
 
         // make test
-        final SchemaExportContext exportContext = schemaService.getSchema(MOUNT_POINT + NOT_EXISTING_MODULE);
+        final SchemaExportContext exportContext = this.schemaService.getSchema(MOUNT_POINT + NOT_EXISTING_MODULE);
 
         // verify
         assertNotNull("Export context should not be null", exportContext);
@@ -198,11 +198,11 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWithNullSchemaContextTest() {
         // prepare conditions - returned schema context is null
-        when(mockContextHandler.getSchemaContext()).thenReturn(null);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(null);
 
         // make test
-        thrown.expect(NullPointerException.class);
-        schemaService.getSchema(TEST_MODULE);
+        this.thrown.expect(NullPointerException.class);
+        this.schemaService.getSchema(TEST_MODULE);
     }
 
     /**
@@ -212,11 +212,11 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWithNullSchemaContextMountPointTest() {
         // prepare conditions - returned schema context for mount points is null
-        when(mockContextHandler.getSchemaContext()).thenReturn(null);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(null);
 
         // make test
-        thrown.expect(NullPointerException.class);
-        schemaService.getSchema(MOUNT_POINT + TEST_MODULE_BEHIND_MOUNT_POINT);
+        this.thrown.expect(NullPointerException.class);
+        this.schemaService.getSchema(MOUNT_POINT + TEST_MODULE_BEHIND_MOUNT_POINT);
     }
 
     /**
@@ -226,12 +226,12 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaNullSchemaContextBehindMountPointTest() {
         // prepare conditions - return correct schema context for mount points (this is not null)
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContextWithMountPoints);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContextWithMountPoints);
 
         // make test - call service on mount point with null schema context
-        thrown.expect(NullPointerException.class);
+        this.thrown.expect(NullPointerException.class);
         // NULL_MOUNT_POINT contains null schema context
-        schemaService.getSchema(NULL_MOUNT_POINT + TEST_MODULE_BEHIND_MOUNT_POINT);
+        this.schemaService.getSchema(NULL_MOUNT_POINT + TEST_MODULE_BEHIND_MOUNT_POINT);
     }
 
     /**
@@ -241,11 +241,11 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWithNullIdentifierTest() {
         // prepare conditions - return correct schema context
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContext);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContext);
 
         // make test
-        thrown.expect(NullPointerException.class);
-        schemaService.getSchema(null);
+        this.thrown.expect(NullPointerException.class);
+        this.schemaService.getSchema(null);
     }
 
     /**
@@ -255,13 +255,13 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWithEmptyIdentifierTest() {
         // prepare conditions - return correct schema context
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContext);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContext);
 
         // make test and verify
         try {
-            schemaService.getSchema("");
+            this.schemaService.getSchema("");
             fail("Test should fail due to invalid identifier");
-        } catch (RestconfDocumentedException e) {
+        } catch (final RestconfDocumentedException e) {
             assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
             assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
             assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
@@ -276,13 +276,13 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWithEmptyIdentifierMountPointTest() {
         // prepare conditions - return correct schema context with mount points
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContextWithMountPoints);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContextWithMountPoints);
 
         // make test and verify
         try {
-            schemaService.getSchema(MOUNT_POINT + "");
+            this.schemaService.getSchema(MOUNT_POINT + "");
             fail("Test should fail due to invalid identifier");
-        } catch (RestconfDocumentedException e) {
+        } catch (final RestconfDocumentedException e) {
             assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
             assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
             assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
@@ -296,13 +296,13 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWithNotParsableIdentifierTest() {
         // prepare conditions - return correct schema context without mount points
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContext);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContext);
 
         // make test and verify
         try {
-            schemaService.getSchema("01_module/2016-01-01");
+            this.schemaService.getSchema("01_module/2016-01-01");
             fail("Test should fail due to invalid identifier");
-        } catch (RestconfDocumentedException e) {
+        } catch (final RestconfDocumentedException e) {
             assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
             assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
             assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
@@ -317,13 +317,13 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWithNotParsableIdentifierMountPointTest() {
         // prepare conditions - return correct schema context with mount points
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContextWithMountPoints);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContextWithMountPoints);
 
         // make test and verify
         try {
-            schemaService.getSchema(MOUNT_POINT + "01_module/2016-01-01");
+            this.schemaService.getSchema(MOUNT_POINT + "01_module/2016-01-01");
             fail("Test should fail due to invalid identifier");
-        } catch (RestconfDocumentedException e) {
+        } catch (final RestconfDocumentedException e) {
             assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
             assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
             assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
@@ -339,13 +339,13 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWrongIdentifierTest() {
         // prepare conditions - return correct schema context without mount points
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContext);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContext);
 
         // make test and verify
         try {
-            schemaService.getSchema("2014-01-01");
+            this.schemaService.getSchema("2014-01-01");
             fail("Test should fail due to invalid identifier");
-        } catch (RestconfDocumentedException e) {
+        } catch (final RestconfDocumentedException e) {
             assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
             assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
             assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
@@ -362,13 +362,13 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWrongIdentifierMountPointTest() {
         // prepare conditions - return correct schema context with mount points
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContextWithMountPoints);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContextWithMountPoints);
 
         // make test and verify
         try {
-            schemaService.getSchema(MOUNT_POINT + "2014-01-01");
+            this.schemaService.getSchema(MOUNT_POINT + "2014-01-01");
             fail("Test should fail due to invalid identifier");
-        } catch (RestconfDocumentedException e) {
+        } catch (final RestconfDocumentedException e) {
             assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
             assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
             assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
@@ -383,13 +383,13 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWithoutRevisionTest() {
         // prepare conditions - return correct schema context without mount points
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContext);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContext);
 
         // make test and verify
         try {
-            schemaService.getSchema("module");
+            this.schemaService.getSchema("module");
             fail("Test should fail due to invalid identifier");
-        } catch (RestconfDocumentedException e) {
+        } catch (final RestconfDocumentedException e) {
             assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
             assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
             assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
@@ -404,13 +404,13 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaWithoutRevisionMountPointTest() {
         // prepare conditions - return correct schema context with mount points
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContextWithMountPoints);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContextWithMountPoints);
 
         // make test and verify
         try {
-            schemaService.getSchema(MOUNT_POINT + "module");
+            this.schemaService.getSchema(MOUNT_POINT + "module");
             fail("Test should fail due to invalid identifier");
-        } catch (RestconfDocumentedException e) {
+        } catch (final RestconfDocumentedException e) {
             assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType());
             assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag());
             assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode());
@@ -424,10 +424,10 @@ public class RestconfSchemaServiceTest {
     @Test
     public void getSchemaContextWithNotExistingMountPointTest() {
         // prepare conditions - return schema context with mount points
-        when(mockContextHandler.getSchemaContext()).thenReturn(schemaContextWithMountPoints);
+        when(this.mockContextHandler.getSchemaContext()).thenReturn(this.schemaContextWithMountPoints);
 
         // make test
-        thrown.expect(IllegalArgumentException.class);
-        schemaService.getSchema(NOT_EXISTING_MOUNT_POINT + TEST_MODULE_BEHIND_MOUNT_POINT);
+        this.thrown.expect(IllegalArgumentException.class);
+        this.schemaService.getSchema(NOT_EXISTING_MOUNT_POINT + TEST_MODULE_BEHIND_MOUNT_POINT);
     }
 }
index b9dc6dafdb5004b7ed4b589ba1df757213180058..d4754e849d615b9d0f47078d63531f4b8c82a91d 100644 (file)
@@ -15,9 +15,6 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.when;
 import static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.EMPTY;
-import static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import java.util.AbstractMap;
@@ -41,10 +38,13 @@ import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError;
 import org.opendaylight.netconf.sal.streams.listeners.Notificator;
 import org.opendaylight.restconf.Draft11;
-import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
-import org.opendaylight.restconf.rest.api.services.RestconfStreamsService;
+import org.opendaylight.restconf.common.handlers.api.SchemaContextHandler;
+import org.opendaylight.restconf.rest.services.api.RestconfStreamsService;
+import org.opendaylight.restconf.rest.services.impl.RestconfStreamsServiceImpl;
 import org.opendaylight.restconf.utils.mapping.RestconfMappingNodeConstants;
 import org.opendaylight.restconf.utils.mapping.RestconfMappingStreamConstants;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
@@ -98,7 +98,7 @@ public class RestconfStreamsServiceTest {
      */
     @Test
     public void restconfStreamsServiceImplInitTest() {
-        assertNotNull("Streams service should be initialized and not null", streamsService);
+        assertNotNull("Streams service should be initialized and not null", this.streamsService);
     }
 
     /**
@@ -108,13 +108,13 @@ public class RestconfStreamsServiceTest {
     @Test
     public void getAvailableStreamsTest() throws Exception {
         // prepare conditions - get correct Restconf module
-        when(contextHandler.getSchemaContext()).thenReturn(mockSchemaContext);
-        when(mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
+        when(this.contextHandler.getSchemaContext()).thenReturn(this.mockSchemaContext);
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
                 .getNamespace(), Draft11.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("ietf-restconf"));
 
         // make test
-        final NormalizedNodeContext nodeContext = streamsService.getAvailableStreams(null);
+        final NormalizedNodeContext nodeContext = this.streamsService.getAvailableStreams(null);
 
         // verify loaded streams
         assertNotNull("Normalized node context should not be null", nodeContext);
@@ -128,11 +128,11 @@ public class RestconfStreamsServiceTest {
     @Test
     public void getAvailableStreamsNullSchemaContextNegativeTest() {
         // prepare conditions - returned SchemaContext is null
-        when(contextHandler.getSchemaContext()).thenReturn(null);
+        when(this.contextHandler.getSchemaContext()).thenReturn(null);
 
         // make test
-        thrown.expect(NullPointerException.class);
-        streamsService.getAvailableStreams(null);
+        this.thrown.expect(NullPointerException.class);
+        this.streamsService.getAvailableStreams(null);
     }
 
     /**
@@ -142,13 +142,13 @@ public class RestconfStreamsServiceTest {
     @Test
     public void getAvailableStreamsMissingRestconfModuleNegativeTest() {
         // prepare conditions - get null Restconf module
-        when(contextHandler.getSchemaContext()).thenReturn(mockSchemaContext);
-        when(mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
+        when(this.contextHandler.getSchemaContext()).thenReturn(this.mockSchemaContext);
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
                 .getNamespace(), Draft11.RestconfModule.IETF_RESTCONF_QNAME.getRevision())).thenReturn(null);
 
         // make test
-        thrown.expect(NullPointerException.class);
-        streamsService.getAvailableStreams(null);
+        this.thrown.expect(NullPointerException.class);
+        this.streamsService.getAvailableStreams(null);
     }
 
     /**
@@ -159,14 +159,14 @@ public class RestconfStreamsServiceTest {
     @Test
     public void getAvailableStreamsMissingListStreamNegativeTest() {
         // prepare conditions - get Restconf module with missing list stream
-        when(contextHandler.getSchemaContext()).thenReturn(mockSchemaContext);
-        when(mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
+        when(this.contextHandler.getSchemaContext()).thenReturn(this.mockSchemaContext);
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
                 .getNamespace(), Draft11.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("restconf-module-with-missing-list-stream"));
 
         // make test and verify
         try {
-            streamsService.getAvailableStreams(null);
+            this.streamsService.getAvailableStreams(null);
             fail("Test is expected to fail due to missing list stream");
         } catch (final RestconfDocumentedException e) {
             assertEquals("Error type is not correct",
@@ -186,14 +186,14 @@ public class RestconfStreamsServiceTest {
     @Test
     public void getAvailableStreamsMissingContainerStreamsNegativeTest() {
         // prepare conditions - get Restconf module with missing container streams
-        when(contextHandler.getSchemaContext()).thenReturn(mockSchemaContext);
-        when(mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
+        when(this.contextHandler.getSchemaContext()).thenReturn(this.mockSchemaContext);
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
                 .getNamespace(), Draft11.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("restconf-module-with-missing-container-streams"));
 
         // make test and verify
         try {
-            streamsService.getAvailableStreams(null);
+            this.streamsService.getAvailableStreams(null);
             fail("Test is expected to fail due to missing container streams");
         } catch (final RestconfDocumentedException e) {
             assertEquals("Error type is not correct",
@@ -212,14 +212,14 @@ public class RestconfStreamsServiceTest {
     @Test
     public void getAvailableStreamsIllegalListStreamNegativeTest() {
         // prepare conditions - get Restconf module with illegal list stream
-        when(contextHandler.getSchemaContext()).thenReturn(mockSchemaContext);
-        when(mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
+        when(this.contextHandler.getSchemaContext()).thenReturn(this.mockSchemaContext);
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
                 .getNamespace(), Draft11.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("restconf-module-with-illegal-list-stream"));
 
         // make test
-        thrown.expect(IllegalStateException.class);
-        streamsService.getAvailableStreams(null);
+        this.thrown.expect(IllegalStateException.class);
+        this.streamsService.getAvailableStreams(null);
     }
 
     /**
@@ -229,14 +229,14 @@ public class RestconfStreamsServiceTest {
     @Test
     public void getAvailableStreamsIllegalContainerStreamsNegativeTest() {
         // prepare conditions - get Restconf module with illegal container streams
-        when(contextHandler.getSchemaContext()).thenReturn(mockSchemaContext);
-        when(mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
+        when(this.contextHandler.getSchemaContext()).thenReturn(this.mockSchemaContext);
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
                 .getNamespace(), Draft11.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("restconf-module-with-illegal-container-streams"));
 
         // make test
-        thrown.expect(IllegalStateException.class);
-        streamsService.getAvailableStreams(null);
+        this.thrown.expect(IllegalStateException.class);
+        this.streamsService.getAvailableStreams(null);
     }
 
     /**
@@ -246,14 +246,14 @@ public class RestconfStreamsServiceTest {
     @Test
     public void getAvailableStreamsIllegalLeafDescriptionNegativeTest() {
         // prepare conditions - get Restconf module with illegal leaf description in list stream
-        when(contextHandler.getSchemaContext()).thenReturn(mockSchemaContext);
-        when(mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
+        when(this.contextHandler.getSchemaContext()).thenReturn(this.mockSchemaContext);
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft11.RestconfModule.IETF_RESTCONF_QNAME
                 .getNamespace(), Draft11.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("restconf-module-with-illegal-leaf-description"));
 
         // make test
-        thrown.expect(IllegalStateException.class);
-        streamsService.getAvailableStreams(null);
+        this.thrown.expect(IllegalStateException.class);
+        this.streamsService.getAvailableStreams(null);
     }
 
     /**
@@ -263,7 +263,7 @@ public class RestconfStreamsServiceTest {
      * @return Restconf module
      */
     private Module getTestingRestconfModule(final String s) {
-        return schemaContext.findModuleByName(s, Draft11.RestconfModule.IETF_RESTCONF_QNAME.getRevision());
+        return this.schemaContext.findModuleByName(s, Draft11.RestconfModule.IETF_RESTCONF_QNAME.getRevision());
     }
 
     /**