summaryrefslogtreecommitdiffstats
path: root/sdnr/wt
diff options
context:
space:
mode:
authorm.miernik <m.miernik@samsung.com>2021-06-28 10:45:06 +0200
committerm.miernik <m.miernik@samsung.com>2021-06-28 10:46:50 +0200
commit6360ba16069370151019865c504e1bec1d896e8c (patch)
treee66f31eaa05a3c8158c27696733d324c3fd1ab79 /sdnr/wt
parenteb3e6911fa6b9a70b59eef520e071c0ad041aaa5 (diff)
Fix apigateway tests
Move constant variables to one common place - HelpServletBase.java Issue-ID: SDNC-1579 Change-Id: I770378358712869a423d11f22d3df3f6dad92f8b Signed-off-by: m.miernik <m.miernik@samsung.com>
Diffstat (limited to 'sdnr/wt')
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestAaiServlet.java8
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseServlet.java12
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestTilesServlet.java8
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestTopologyServlet.java8
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpAaiServlet.java5
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpEsServlet.java6
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServletBase.java23
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpTilesServlet.java4
-rw-r--r--sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpTopologyServlet.java4
9 files changed, 30 insertions, 48 deletions
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestAaiServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestAaiServlet.java
index 35b33d879..200949ec2 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestAaiServlet.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestAaiServlet.java
@@ -63,10 +63,10 @@ public class TestAaiServlet extends HelpServletBase {
// initEsTestWebserver(port);
properties.load(new ByteArrayInputStream(tmpconfigcontent2.getBytes()));
- testrequest(HTTPMETHOD_GET, query, HelpAaiServlet.RESPONSE_GET, true);
- testrequest(HTTPMETHOD_POST, query, HelpAaiServlet.RESPONSE_POST, true);
- testrequest(HTTPMETHOD_PUT, query, HelpAaiServlet.RESPONSE_PUT, true);
- testrequest(HTTPMETHOD_DELETE, query, HelpAaiServlet.RESPONSE_DELETE, true);
+ 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())
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseServlet.java
index 45eac88cd..7067bbeef 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseServlet.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/TestDatabaseServlet.java
@@ -37,12 +37,8 @@ public class TestDatabaseServlet extends HelpServletBase {
super("/database", PORT);
}
-
-
final String LR = "\n";
-
-
@Test
public void test() throws ServletException, IOException {
@@ -67,10 +63,10 @@ public class TestDatabaseServlet extends HelpServletBase {
// initEsTestWebserver(port);
properties.load(new ByteArrayInputStream(tmpconfigcontent2.getBytes()));
- 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_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();
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
index d7adf2fbb..30ec53d4d 100644
--- 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
@@ -63,10 +63,10 @@ public class TestTilesServlet extends HelpServletBase {
// initEsTestWebserver(port);
properties.load(new ByteArrayInputStream(tmpconfigcontent2.getBytes()));
- testrequest(HTTPMETHOD_GET, query, HelpTilesServlet.RESPONSE_GET, true);
- testrequest(HTTPMETHOD_POST, query, HelpTilesServlet.RESPONSE_POST, true);
- testrequest(HTTPMETHOD_PUT, query, HelpTilesServlet.RESPONSE_PUT, true);
- testrequest(HTTPMETHOD_DELETE, query, HelpTilesServlet.RESPONSE_DELETE, true);
+ 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())
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
index 08d19b4ee..9b9692388 100644
--- 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
@@ -62,10 +62,10 @@ public class TestTopologyServlet extends HelpServletBase {
// initEsTestWebserver(port);
properties.load(new ByteArrayInputStream(tmpconfigcontent2.getBytes()));
- testrequest(HTTPMETHOD_GET, query, HelpTopologyServlet.RESPONSE_GET, true);
- testrequest(HTTPMETHOD_POST, query, HelpTopologyServlet.RESPONSE_POST, true);
- testrequest(HTTPMETHOD_PUT, query, HelpTopologyServlet.RESPONSE_PUT, true);
- testrequest(HTTPMETHOD_DELETE, query, HelpTopologyServlet.RESPONSE_DELETE, true);
+ 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())
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpAaiServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpAaiServlet.java
index 5d4c8f507..513fe0e57 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpAaiServlet.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpAaiServlet.java
@@ -29,11 +29,6 @@ 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 {
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpEsServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpEsServlet.java
index fe89c9fc4..8e031e9a9 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpEsServlet.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpEsServlet.java
@@ -30,12 +30,6 @@ 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);
diff --git a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServletBase.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServletBase.java
index 4048012bb..f0247c031 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServletBase.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpServletBase.java
@@ -52,6 +52,11 @@ 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;
@@ -170,23 +175,23 @@ public class HelpServletBase {
OutputStream os = null;
try {
if (method.equals(HTTPMETHOD_GET)) {
- t.sendResponseHeaders(200, HelpEsServlet.RESPONSE_GET.length());
+ t.sendResponseHeaders(200, RESPONSE_GET.length());
os = t.getResponseBody();
- os.write(HelpEsServlet.RESPONSE_GET.getBytes());
+ os.write(RESPONSE_GET.getBytes());
} else if (method.equals(HTTPMETHOD_POST)) {
- t.sendResponseHeaders(200, HelpEsServlet.RESPONSE_POST.length());
+ t.sendResponseHeaders(200, RESPONSE_POST.length());
os = t.getResponseBody();
- os.write(HelpEsServlet.RESPONSE_POST.getBytes());
+ os.write(RESPONSE_POST.getBytes());
} else if (method.equals(HTTPMETHOD_PUT)) {
- t.sendResponseHeaders(200, HelpEsServlet.RESPONSE_PUT.length());
+ t.sendResponseHeaders(200, RESPONSE_PUT.length());
os = t.getResponseBody();
- os.write(HelpEsServlet.RESPONSE_PUT.getBytes());
+ os.write(RESPONSE_PUT.getBytes());
} else if (method.equals(HTTPMETHOD_DELETE)) {
- t.sendResponseHeaders(200, HelpEsServlet.RESPONSE_DELETE.length());
+ t.sendResponseHeaders(200, RESPONSE_DELETE.length());
os = t.getResponseBody();
- os.write(HelpEsServlet.RESPONSE_DELETE.getBytes());
+ os.write(RESPONSE_DELETE.getBytes());
} else if (method.equals(HTTPMETHOD_OPTIONS)) {
- t.sendResponseHeaders(200, HelpEsServlet.RESPONSE_OPTIONS.length());
+ t.sendResponseHeaders(200, 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/HelpTilesServlet.java b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpTilesServlet.java
index e847b289e..cae5d93b9 100644
--- a/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpTilesServlet.java
+++ b/sdnr/wt/apigateway/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/apigateway/test/helper/HelpTilesServlet.java
@@ -29,10 +29,6 @@ import org.onap.ccsdk.features.sdnr.wt.apigateway.TilesServlet;
public class HelpTilesServlet extends TilesServlet 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";
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
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
index 2532fe0bc..18c6d9ffe 100644
--- 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
@@ -29,10 +29,6 @@ import org.onap.ccsdk.features.sdnr.wt.apigateway.TopologyServlet;
public class HelpTopologyServlet extends TopologyServlet 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";
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {