summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/common/src/test/java
diff options
context:
space:
mode:
authorMichael DÜrre <michael.duerre@highstreet-technologies.com>2020-11-19 15:40:16 +0100
committerMichael DÜrre <michael.duerre@highstreet-technologies.com>2020-11-19 15:40:31 +0100
commitf88794b887842911b30a75afc53f87f660d1c1e7 (patch)
tree5fb23c62c851a031824366ffc2ad37e068be0096 /sdnr/wt/common/src/test/java
parent799548ca5bc35ef26ab6a6498cb10fb22fcb1d8e (diff)
adapt ES version to 7.9.x
add new ES mapping for honolulu Issue-ID: SDNC-1411 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com> Change-Id: I477f87cd5b6da564663b6677e3cd94afef4dd1a6
Diffstat (limited to 'sdnr/wt/common/src/test/java')
-rw-r--r--sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/helper/HelpServletBase.java37
1 files changed, 9 insertions, 28 deletions
diff --git a/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/helper/HelpServletBase.java b/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/helper/HelpServletBase.java
index dbdaace34..a3d2c9be9 100644
--- a/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/helper/HelpServletBase.java
+++ b/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/helper/HelpServletBase.java
@@ -27,29 +27,23 @@ import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
-import java.io.ByteArrayInputStream;
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.StringWriter;
import java.net.InetSocketAddress;
import java.util.Enumeration;
import java.util.Map;
import java.util.Vector;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import org.junit.After;
import org.junit.Before;
-
-import com.sun.net.httpserver.HttpExchange;
-import com.sun.net.httpserver.HttpHandler;
-import com.sun.net.httpserver.HttpServer;
+import org.onap.ccsdk.features.sdnr.wt.common.test.ServletInputStreamFromByteArrayInputStream;
+import org.onap.ccsdk.features.sdnr.wt.common.test.ServletOutputStreamToStringWriter;
@SuppressWarnings("restriction")
public class HelpServletBase {
@@ -97,21 +91,8 @@ public class HelpServletBase {
HttpServletRequest mockRequest = mock(HttpServletRequest.class);
HttpServletResponse mockResponse = mock(HttpServletResponse.class);
- StringWriter out = new StringWriter();
- ServletOutputStream printOut = new ServletOutputStream() {
-
- @Override
- public void write(int arg0) throws IOException {
- out.write(arg0);
- }
- };
- ByteArrayInputStream bis = new ByteArrayInputStream(data.getBytes());
- ServletInputStream inputStream = new ServletInputStream() {
- @Override
- public int read() throws IOException {
- return bis.read();
- }
- };
+ ServletOutputStreamToStringWriter printOut = new ServletOutputStreamToStringWriter();
+ ServletInputStreamFromByteArrayInputStream inputStream = new ServletInputStreamFromByteArrayInputStream(data.getBytes());
Vector<String> headers = new Vector<String>();
headers.addElement("Accept");
headers.add("User-Agent");
@@ -142,9 +123,9 @@ public class HelpServletBase {
verify(mockResponse).setStatus(200);
if (exact)
- assertEquals(expectedResponse, out.toString());
+ assertEquals(expectedResponse, printOut.getStringWriter().toString());
else
- assertTrue("response not for method " + method + "correct", out.toString().contains(expectedResponse));
+ assertTrue("response not for method " + method + "correct", printOut.getStringWriter().toString().contains(expectedResponse));
// currently unable to check extra headers
if (headersToCheck != null) {