Refactor unit tests 82/122982/1
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>
Fri, 30 Jul 2021 04:57:03 +0000 (10:27 +0530)
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>
Fri, 30 Jul 2021 04:57:45 +0000 (10:27 +0530)
Refactor unit tests for apigateway

Issue-ID: CCSDK-3402
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: Ib5e5eb522a77d1df4a5a8feccc5c9e7d8a942b83
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
13 files changed:
sdnr/wt/apigateway/installer/pom.xml
sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/MyProperties.java
sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/SitedocServlet.java [new file with mode: 0644]
sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/TerrainServlet.java [moved from sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpTilesServlet.java with 51% similarity]
sdnr/wt/apigateway/provider/src/main/resources/org/opendaylight/blueprint/blueprint.xml
sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestAaiServlet.java
sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseServlet.java
sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestTilesServlet.java [deleted file]
sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestTopologyServlet.java [deleted file]
sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpAaiServlet.java
sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpEsServlet.java
sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServletBase.java
sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpTopologyServlet.java [deleted file]

index 0f206bf..3ee6e27 100755 (executable)
@@ -45,7 +45,7 @@
     <dependencies>
 
         <dependency>
-            <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+            <groupId>${project.groupId}</groupId>
             <artifactId>${application.name}-feature</artifactId>
             <version>${project.version}</version>
             <type>xml</type>
@@ -58,7 +58,7 @@
             </exclusions>
         </dependency>
         <dependency>
-            <groupId>org.onap.ccsdk.features.sdnr.wt</groupId>
+            <groupId>${project.groupId}</groupId>
             <artifactId>${application.name}-provider</artifactId>
             <version>${project.version}</version>
         </dependency>
index c518cff..66cbd02 100644 (file)
@@ -46,6 +46,9 @@ public class MyProperties {
     private static final String DEFAULT_URL_OFF = "off";
     private static final String DEFAULT_TILES = "${TILEURL}";
     private static final String DEFAULT_TOPOLOGY = "${TOPOURL}";
+    private static final String DEFAULT_SITEDOC = "${SITEDOCURL}";
+    private static final String DEFAULT_TERRAIN = "${TERRAINURL}";
+
     private static MyProperties mObj;
     private static final String ENVVARIABLE = "${";
     private static final String REGEXENVVARIABLE = "(\\$\\{[A-Z0-9_-]+\\})";
@@ -57,9 +60,10 @@ public class MyProperties {
     private String esBase;
     private String tilesBase;
     private String topologyBase;
+    private String sitedocBase;
+    private String terrainBase;
 
     private boolean trustInsecure;
-
     private boolean corsEnabled;
 
     public boolean isAAIOff() {
@@ -93,6 +97,13 @@ public class MyProperties {
     public String getTopologyBaseUrl() {
         return this.topologyBase;
     }
+    public String getSitedocBaseUrl() {
+        return this.sitedocBase;
+    }
+
+    public String getTerrainBaseUrl() {
+        return this.terrainBase;
+    }
 
     public Map<String, String> getAAIHeaders() {
         return this.aaiHeaders;
@@ -143,6 +154,8 @@ public class MyProperties {
         this.esBase = getProperty(defaultProps,"database", DEFAULT_ESDATABASE);
         this.tilesBase = getProperty(defaultProps,"tiles", DEFAULT_TILES, DEFAULT_URL_OFF);
         this.topologyBase = getProperty(defaultProps,"topology", DEFAULT_TOPOLOGY, DEFAULT_URL_OFF);
+        this.sitedocBase = getProperty(defaultProps,"sitedoc", DEFAULT_SITEDOC, DEFAULT_URL_OFF);
+        this.terrainBase = getProperty(defaultProps,"terrain", DEFAULT_TERRAIN, DEFAULT_URL_OFF);
         this.trustInsecure = Integer.parseInt(getProperty(defaultProps,"insecure", DEFAULT_TRUSTINSECURE)) == 1;
         this.corsEnabled = Integer.parseInt(getProperty(defaultProps,"cors", DEFAULT_CORSENABLED)) == 1;
     }
@@ -207,6 +220,7 @@ public class MyProperties {
         sb.append("database=" + DEFAULT_ESDATABASE + LR);
         sb.append("tiles=" + DEFAULT_TILES + LR);
         sb.append("topology=" + DEFAULT_TOPOLOGY + LR);
+        sb.append("terrain=" + DEFAULT_TERRAIN + LR);
         sb.append("insecure=" + DEFAULT_TRUSTINSECURE + LR);
         sb.append("cors=" + DEFAULT_CORSENABLED);
         try {
@@ -229,4 +243,5 @@ public class MyProperties {
                 + ", trustInsecure=" + trustInsecure + ", corsEnabled=" + corsEnabled + "]";
     }
 
+
 }
diff --git a/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/SitedocServlet.java b/sdnr/wt/apigateway/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/apigateway/SitedocServlet.java
new file mode 100644 (file)
index 0000000..347dbb0
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps.sdnr.wt.apigateway
+ * ================================================================================
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.ccsdk.features.sdnr.wt.apigateway;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class SitedocServlet extends BaseServlet {
+
+    private static final long serialVersionUID = 5946205120796162644L;
+    private static final String OFFLINE_RESPONSE_MESSAGE = "Topology interface is offline";
+    private static final String BASEURL = "/sitedoc";
+    private static final String SITEDOC_SUBPATH = "/topology/stadok";
+    private static boolean trustAll = false;
+
+    public SitedocServlet() {
+        super();
+    }
+
+    @Override
+    protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        resp.setStatus(200);
+    }
+
+    @Override
+    protected String getOfflineResponse() {
+        return OFFLINE_RESPONSE_MESSAGE;
+    }
+
+    @Override
+    protected boolean isOff() {
+        return MyProperties.getInstance().isTopologyOff();
+    }
+
+    @Override
+    protected String getRemoteUrl(String uri) {
+
+        if (uri != null && uri.length() > 0) {
+            uri = uri.substring(BASEURL.length());
+        }
+        return MyProperties.getInstance().getSitedocBaseUrl() + SITEDOC_SUBPATH + uri;
+    }
+
+    @Override
+    protected boolean doTrustAll() {
+        return trustAll;
+    }
+
+    @Override
+    protected void trustAll(boolean trust) {
+        trustAll = trust;
+    }
+}
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP : CCSDK.apps.sdnr.wt.apigateway
  * ================================================================================
- * Copyright (C) 2018 highstreet technologies GmbH Intellectual Property.
+ * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
  * All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-package org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper;
+package org.onap.ccsdk.features.sdnr.wt.apigateway;
 
 import java.io.IOException;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import org.onap.ccsdk.features.sdnr.wt.apigateway.TilesServlet;
 
-public class HelpTilesServlet extends TilesServlet implements IPublicServlet {
+public class TerrainServlet extends BaseServlet {
 
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 5946205120796162644L;
+    private static final String OFFLINE_RESPONSE_MESSAGE = "Terrain interface is offline";
+    private static final String BASEURL = "/terrain";
+    private static boolean trustAll = false;
+
+    public TerrainServlet() {
+        super();
+    }
+
+    @Override
+    protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        resp.setStatus(200);
+    }
 
     @Override
-    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        super.doGet(req, resp);
+    protected String getOfflineResponse() {
+        return OFFLINE_RESPONSE_MESSAGE;
     }
 
     @Override
-    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        super.doPost(req, resp);
+    protected boolean isOff() {
+        return MyProperties.getInstance().isTopologyOff();
     }
 
     @Override
-    public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        super.doPut(req, resp);
+    protected String getRemoteUrl(String uri) {
+
+        if (uri != null && uri.length() > 0) {
+            uri = uri.substring(BASEURL.length());
+        }
+        return MyProperties.getInstance().getTerrainBaseUrl() + uri;
     }
 
     @Override
-    public void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        super.doOptions(req, resp);
+    protected boolean doTrustAll() {
+        return trustAll;
     }
 
     @Override
-    public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        super.doDelete(req, resp);
+    protected void trustAll(boolean trust) {
+        trustAll = trust;
     }
 }
index cd325e4..37fa4ee 100644 (file)
         </service-properties>
     </service>
 
+    <bean id="sitedocServlet"
+          class="org.onap.ccsdk.features.sdnr.wt.apigateway.SitedocServlet">
+    </bean>
+
+    <service interface="javax.servlet.http.HttpServlet" ref="sitedocServlet">
+        <service-properties>
+            <entry key="alias" value="/sitedoc"/>
+        </service-properties>
+    </service>
+
+    <bean id="terrainServlet"
+          class="org.onap.ccsdk.features.sdnr.wt.apigateway.TerrainServlet">
+    </bean>
+
+    <service interface="javax.servlet.http.HttpServlet" ref="terrainServlet">
+        <service-properties>
+            <entry key="alias" value="/terrain"/>
+        </service-properties>
+    </service>
 </blueprint>
index 200949e..3436c36 100644 (file)
@@ -29,6 +29,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.onap.ccsdk.features.sdnr.wt.apigateway.MyProperties;
 import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpAaiServlet;
+import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpEsServlet;
 import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpServletBase;
 
 public class TestAaiServlet extends HelpServletBase {
@@ -63,10 +64,10 @@ public class TestAaiServlet extends HelpServletBase {
 
         // initEsTestWebserver(port);
         properties.load(new ByteArrayInputStream(tmpconfigcontent2.getBytes()));
-        testrequest(HTTPMETHOD_GET, query, RESPONSE_GET, true);
-        testrequest(HTTPMETHOD_POST, query, RESPONSE_POST, true);
-        testrequest(HTTPMETHOD_PUT, query, RESPONSE_PUT, true);
-        testrequest(HTTPMETHOD_DELETE, query, RESPONSE_DELETE, true);
+        testrequest(HTTPMETHOD_GET, query, HelpEsServlet.RESPONSE_GET, true);
+        testrequest(HTTPMETHOD_POST, query, HelpEsServlet.RESPONSE_POST, true);
+        testrequest(HTTPMETHOD_PUT, query, HelpEsServlet.RESPONSE_PUT, true);
+        testrequest(HTTPMETHOD_DELETE, query, HelpEsServlet.RESPONSE_DELETE, true);
         testrequest(HTTPMETHOD_OPTIONS, query, "", false);
         // stopTestWebserver();
         if (tmpFile.exists())
index 7067bbe..45eac88 100644 (file)
@@ -37,8 +37,12 @@ public class TestDatabaseServlet extends HelpServletBase {
         super("/database", PORT);
     }
 
+
+
     final String LR = "\n";
 
+
+
     @Test
     public void test() throws ServletException, IOException {
 
@@ -63,10 +67,10 @@ public class TestDatabaseServlet extends HelpServletBase {
 
         // initEsTestWebserver(port);
         properties.load(new ByteArrayInputStream(tmpconfigcontent2.getBytes()));
-        testrequest(HTTPMETHOD_GET, query, RESPONSE_GET, true);
-        testrequest(HTTPMETHOD_POST, query, RESPONSE_POST, true);
-        testrequest(HTTPMETHOD_PUT, query, RESPONSE_PUT, true);
-        testrequest(HTTPMETHOD_DELETE, query, RESPONSE_DELETE, true);
+        testrequest(HTTPMETHOD_GET, query, HelpEsServlet.RESPONSE_GET, true);
+        testrequest(HTTPMETHOD_POST, query, HelpEsServlet.RESPONSE_POST, true);
+        testrequest(HTTPMETHOD_PUT, query, HelpEsServlet.RESPONSE_PUT, true);
+        testrequest(HTTPMETHOD_DELETE, query, HelpEsServlet.RESPONSE_DELETE, true);
         testrequest(HTTPMETHOD_OPTIONS, query, "", false);
         // stopTestWebserver();
 
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestTilesServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestTilesServlet.java
deleted file mode 100644 (file)
index 30ec53d..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : CCSDK.apps.sdnr.wt.apigateway
- * ================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.apigateway.test;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import javax.servlet.ServletException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.ccsdk.features.sdnr.wt.apigateway.MyProperties;
-import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpServletBase;
-import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpTilesServlet;
-
-public class TestTilesServlet extends HelpServletBase {
-
-    private static final int PORT = 40001;
-
-    public TestTilesServlet() {
-        super("/tiles", PORT);
-    }
-
-
-    @Test
-    public void test() throws ServletException, IOException {
-        String tmpFilename = "tmp.cfg";
-        File tmpFile = new File(tmpFilename);
-        if (tmpFile.exists())
-            tmpFile.delete();
-        MyProperties properties = MyProperties.Instantiate(tmpFile, true);
-        String query = "{\"query\":{\"match_all\":{}}}";
-        String tmpconfigcontent = "aai=off" + LR + "aaiHeaders=[]" + LR + "database=off" + LR + "tiles=off" + LR
-            + "insecure=0" + LR + "cors=0";
-        String tmpconfigcontent2 = "aai=off" + LR + "aaiHeaders=[]" + LR + "database=off" + LR
-            + "tiles=http://" + HOST + ":" + PORT + LR + "insecure=1" + LR + "cors=1";
-        this.setServlet(new HelpTilesServlet());
-        // test disabled message
-        properties.load(new ByteArrayInputStream(tmpconfigcontent.getBytes()));
-        String expectedResponse = "offline";
-        testrequest(HTTPMETHOD_GET, query, expectedResponse, false);
-        testrequest(HTTPMETHOD_POST, query, expectedResponse, false);
-        testrequest(HTTPMETHOD_PUT, query, expectedResponse, false);
-        testrequest(HTTPMETHOD_DELETE, query, expectedResponse, false);
-
-        // initEsTestWebserver(port);
-        properties.load(new ByteArrayInputStream(tmpconfigcontent2.getBytes()));
-        testrequest(HTTPMETHOD_GET, query, RESPONSE_GET, true);
-        testrequest(HTTPMETHOD_POST, query, RESPONSE_POST, true);
-        testrequest(HTTPMETHOD_PUT, query, RESPONSE_PUT, true);
-        testrequest(HTTPMETHOD_DELETE, query, RESPONSE_DELETE, true);
-        testrequest(HTTPMETHOD_OPTIONS, query, "", false);
-        // stopTestWebserver();
-        if (tmpFile.exists())
-            tmpFile.delete();
-    }
-
-    @Before
-    public void init() throws IOException {
-        HelpServletBase.initEsTestWebserver(PORT);
-    }
-
-    @After
-    public void deinit() {
-        HelpServletBase.stopTestWebserver();
-    }
-}
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestTopologyServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestTopologyServlet.java
deleted file mode 100644 (file)
index 9b96923..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : CCSDK.apps.sdnr.wt.apigateway
- * ================================================================================
- * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.apigateway.test;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import javax.servlet.ServletException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.ccsdk.features.sdnr.wt.apigateway.MyProperties;
-import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpServletBase;
-import org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper.HelpTopologyServlet;
-
-public class TestTopologyServlet extends HelpServletBase {
-
-    private static final int PORT = 40001;
-
-    public TestTopologyServlet() {
-        super("/topology", PORT);
-    }
-
-    @Test
-    public void test() throws ServletException, IOException {
-        String tmpFilename = "tmp.cfg";
-        File tmpFile = new File(tmpFilename);
-        if (tmpFile.exists())
-            tmpFile.delete();
-        MyProperties properties = MyProperties.Instantiate(tmpFile, true);
-        String query = "{\"query\":{\"match_all\":{}}}";
-        String tmpconfigcontent = "aai=off" + LR + "aaiHeaders=[]" + LR + "database=off" + LR + "tiles=off" + LR
-            + "topology=off" + LR + "insecure=0" + LR + "cors=0";
-        String tmpconfigcontent2 = "aai=off" + LR + "aaiHeaders=[]" + LR + "database=off" + LR + "tiles=off" + LR
-            + "topology=http://" + HOST + ":" + PORT + LR + "insecure=1" + LR + "cors=1";
-        this.setServlet(new HelpTopologyServlet());
-        // test disabled message
-        properties.load(new ByteArrayInputStream(tmpconfigcontent.getBytes()));
-        String expectedResponse = "offline";
-        testrequest(HTTPMETHOD_GET, query, expectedResponse, false);
-        testrequest(HTTPMETHOD_POST, query, expectedResponse, false);
-        testrequest(HTTPMETHOD_PUT, query, expectedResponse, false);
-        testrequest(HTTPMETHOD_DELETE, query, expectedResponse, false);
-
-        // initEsTestWebserver(port);
-        properties.load(new ByteArrayInputStream(tmpconfigcontent2.getBytes()));
-        testrequest(HTTPMETHOD_GET, query, RESPONSE_GET, true);
-        testrequest(HTTPMETHOD_POST, query, RESPONSE_POST, true);
-        testrequest(HTTPMETHOD_PUT, query, RESPONSE_PUT, true);
-        testrequest(HTTPMETHOD_DELETE, query, RESPONSE_DELETE, true);
-        testrequest(HTTPMETHOD_OPTIONS, query, "", false);
-        // stopTestWebserver();
-        if (tmpFile.exists())
-            tmpFile.delete();
-    }
-
-    @Before
-    public void init() throws IOException {
-        HelpServletBase.initEsTestWebserver(PORT);
-    }
-
-    @After
-    public void deinit() {
-        HelpServletBase.stopTestWebserver();
-    }
-}
index 513fe0e..5d4c8f5 100644 (file)
@@ -29,6 +29,11 @@ import org.onap.ccsdk.features.sdnr.wt.apigateway.AaiServlet;
 public class HelpAaiServlet extends AaiServlet implements IPublicServlet {
 
     private static final long serialVersionUID = 1L;
+    public static final String RESPONSE_GET = "This is the response get";
+    public static final String RESPONSE_POST = "This is the response post";
+    public static final String RESPONSE_PUT = "This is the response put";
+    public static final String RESPONSE_DELETE = "This is the response delete";
+    public static final String RESPONSE_OPTIONS = "This is the response options";
 
     @Override
     public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
index 8e031e9..fe89c9f 100644 (file)
@@ -30,6 +30,12 @@ public class HelpEsServlet extends EsServlet implements IPublicServlet {
 
     private static final long serialVersionUID = 6502905928958752573L;
 
+    public static final String RESPONSE_GET = "This is the response get";
+    public static final String RESPONSE_POST = "This is the response post";
+    public static final String RESPONSE_PUT = "This is the response put";
+    public static final String RESPONSE_DELETE = "This is the response delete";
+    public static final String RESPONSE_OPTIONS = "This is the response options";
+
     @Override
     public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         super.doGet(req, resp);
index f0247c0..4048012 100644 (file)
@@ -52,11 +52,6 @@ public class HelpServletBase {
     public static final String HTTPMETHOD_PUT = "PUT";
     public static final String HTTPMETHOD_DELETE = "DELETE";
     public static final String HTTPMETHOD_OPTIONS = "OPTIONS";
-    public static final String RESPONSE_GET = "This is the response get";
-    public static final String RESPONSE_POST = "This is the response post";
-    public static final String RESPONSE_PUT = "This is the response put";
-    public static final String RESPONSE_DELETE = "This is the response delete";
-    public static final String RESPONSE_OPTIONS = "This is the response options";
     private IPublicServlet servlet;
     private static HttpServer server;
     private static ExecutorService httpThreadPool;
@@ -175,23 +170,23 @@ public class HelpServletBase {
             OutputStream os = null;
             try {
                 if (method.equals(HTTPMETHOD_GET)) {
-                    t.sendResponseHeaders(200, RESPONSE_GET.length());
+                    t.sendResponseHeaders(200, HelpEsServlet.RESPONSE_GET.length());
                     os = t.getResponseBody();
-                    os.write(RESPONSE_GET.getBytes());
+                    os.write(HelpEsServlet.RESPONSE_GET.getBytes());
                 } else if (method.equals(HTTPMETHOD_POST)) {
-                    t.sendResponseHeaders(200, RESPONSE_POST.length());
+                    t.sendResponseHeaders(200, HelpEsServlet.RESPONSE_POST.length());
                     os = t.getResponseBody();
-                    os.write(RESPONSE_POST.getBytes());
+                    os.write(HelpEsServlet.RESPONSE_POST.getBytes());
                 } else if (method.equals(HTTPMETHOD_PUT)) {
-                    t.sendResponseHeaders(200, RESPONSE_PUT.length());
+                    t.sendResponseHeaders(200, HelpEsServlet.RESPONSE_PUT.length());
                     os = t.getResponseBody();
-                    os.write(RESPONSE_PUT.getBytes());
+                    os.write(HelpEsServlet.RESPONSE_PUT.getBytes());
                 } else if (method.equals(HTTPMETHOD_DELETE)) {
-                    t.sendResponseHeaders(200, RESPONSE_DELETE.length());
+                    t.sendResponseHeaders(200, HelpEsServlet.RESPONSE_DELETE.length());
                     os = t.getResponseBody();
-                    os.write(RESPONSE_DELETE.getBytes());
+                    os.write(HelpEsServlet.RESPONSE_DELETE.getBytes());
                 } else if (method.equals(HTTPMETHOD_OPTIONS)) {
-                    t.sendResponseHeaders(200, RESPONSE_OPTIONS.length());
+                    t.sendResponseHeaders(200, HelpEsServlet.RESPONSE_OPTIONS.length());
                     //os = t.getResponseBody();
                     //os.write(RESPONSE_OPTIONS.getBytes());
                 } else {
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpTopologyServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpTopologyServlet.java
deleted file mode 100644 (file)
index 18c6d9f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : CCSDK.apps.sdnr.wt.apigateway
- * ================================================================================
- * Copyright (C) 2018 highstreet technologies GmbH Intellectual Property.
- * All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.ccsdk.features.sdnr.wt.apigateway.test.helper;
-
-import java.io.IOException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.onap.ccsdk.features.sdnr.wt.apigateway.TopologyServlet;
-
-public class HelpTopologyServlet extends TopologyServlet implements IPublicServlet {
-
-    private static final long serialVersionUID = 1L;
-
-    @Override
-    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        super.doGet(req, resp);
-    }
-
-    @Override
-    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        super.doPost(req, resp);
-    }
-
-    @Override
-    public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        super.doPut(req, resp);
-    }
-
-    @Override
-    public void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        super.doOptions(req, resp);
-    }
-
-    @Override
-    public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        super.doDelete(req, resp);
-    }
-}