From 8bbecead253c30da60577ecd014d59983e4b6113 Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Wed, 3 Feb 2021 14:18:39 +0100 Subject: Migrate apigateway and helpserver Migrate apigateway and helpserver to Aluminium Issue-ID: CCSDK-3129 Signed-off-by: Ravi Pendurty Change-Id: I6a669b7e0e5d805cab4a9e59e2b21a95fb6506f8 Signed-off-by: Ravi Pendurty --- sdnr/wt/helpserver/feature/pom.xml | 4 +++- sdnr/wt/helpserver/installer/pom.xml | 2 +- sdnr/wt/helpserver/pom.xml | 2 +- sdnr/wt/helpserver/provider/pom.xml | 10 ++++++--- .../sdnr/wt/helpserver/test/TestMyServlet.java | 25 +++++----------------- 5 files changed, 17 insertions(+), 26 deletions(-) (limited to 'sdnr/wt/helpserver') diff --git a/sdnr/wt/helpserver/feature/pom.xml b/sdnr/wt/helpserver/feature/pom.xml index b5e7dafd8..08f0c63dc 100644 --- a/sdnr/wt/helpserver/feature/pom.xml +++ b/sdnr/wt/helpserver/feature/pom.xml @@ -29,7 +29,7 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0 + 2.1.1-SNAPSHOT @@ -41,10 +41,12 @@ ccsdk-features :: ${project.artifactId} + ${project.groupId} sdnr-wt-helpserver-provider ${project.version} + diff --git a/sdnr/wt/helpserver/installer/pom.xml b/sdnr/wt/helpserver/installer/pom.xml index 802079c15..654d7406a 100755 --- a/sdnr/wt/helpserver/installer/pom.xml +++ b/sdnr/wt/helpserver/installer/pom.xml @@ -29,7 +29,7 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0 + 2.1.1-SNAPSHOT diff --git a/sdnr/wt/helpserver/pom.xml b/sdnr/wt/helpserver/pom.xml index 3c5d471d6..0fa2c3f7f 100755 --- a/sdnr/wt/helpserver/pom.xml +++ b/sdnr/wt/helpserver/pom.xml @@ -29,7 +29,7 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0 + 2.1.1-SNAPSHOT diff --git a/sdnr/wt/helpserver/provider/pom.xml b/sdnr/wt/helpserver/provider/pom.xml index 5db0853ce..6cf2d03fd 100644 --- a/sdnr/wt/helpserver/provider/pom.xml +++ b/sdnr/wt/helpserver/provider/pom.xml @@ -29,7 +29,7 @@ org.onap.ccsdk.parent binding-parent - 2.1.0 + 2.1.1-SNAPSHOT @@ -42,13 +42,17 @@ true - true + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-common + ${project.version} + javax.servlet - servlet-api + javax.servlet-api org.slf4j diff --git a/sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestMyServlet.java b/sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestMyServlet.java index cd40e122b..c65002307 100644 --- a/sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestMyServlet.java +++ b/sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestMyServlet.java @@ -25,17 +25,16 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; -import java.io.StringWriter; import java.nio.file.Files; import java.nio.file.OpenOption; import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; +import org.onap.ccsdk.features.sdnr.wt.common.test.ServletOutputStreamToStringWriter; import org.onap.ccsdk.features.sdnr.wt.helpserver.HelpServlet; import org.onap.ccsdk.features.sdnr.wt.helpserver.data.ExtactBundleResource; import org.onap.ccsdk.features.sdnr.wt.helpserver.data.HelpInfrastructureObject; @@ -87,14 +86,7 @@ public class TestMyServlet extends Mockito { when(request.getRequestURI()).thenReturn("help/"); when(request.getQueryString()).thenReturn("?meta"); - StringWriter stringWriter = new StringWriter(); - ServletOutputStream out = new ServletOutputStream() { - - @Override - public void write(int arg0) throws IOException { - stringWriter.write(arg0); - } - }; + ServletOutputStreamToStringWriter out = new ServletOutputStreamToStringWriter(); when(response.getOutputStream()).thenReturn(out); HelpServlet helpServlet = null; @@ -114,7 +106,7 @@ public class TestMyServlet extends Mockito { helpServlet.close(); } - String result = stringWriter.toString().trim(); + String result = out.getStringWriter().toString().trim(); System.out.println("Result: '" + result + "'"); assertEquals(CONTENT, result); } @@ -134,14 +126,7 @@ public class TestMyServlet extends Mockito { HttpServletResponse response = mock(HttpServletResponse.class); when(request.getRequestURI()).thenReturn("help/" + fn); - StringWriter sw = new StringWriter(); - ServletOutputStream out = new ServletOutputStream() { - - @Override - public void write(int arg0) throws IOException { - sw.write(arg0); - } - }; + ServletOutputStreamToStringWriter out = new ServletOutputStreamToStringWriter(); try { when(response.getOutputStream()).thenReturn(out); helpServlet.doGet(request, response); @@ -157,6 +142,6 @@ public class TestMyServlet extends Mockito { } catch (Exception e) { } - assertEquals("compare content for " + fn, CONTENT, sw.toString().trim()); + assertEquals("compare content for " + fn, CONTENT, out.getStringWriter().toString().trim()); } } -- cgit 1.2.3-korg