diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2021-02-03 14:18:39 +0100 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2021-02-05 22:55:53 +0000 |
commit | 8bbecead253c30da60577ecd014d59983e4b6113 (patch) | |
tree | 870e2c2051598724cad30e0fa5e539378737e3c7 /sdnr/wt/helpserver/provider | |
parent | 2f9e781a7c3e22bf25df83dcc3ff44b885a80957 (diff) |
Migrate apigateway and helpserver
Migrate apigateway and helpserver to Aluminium
Issue-ID: CCSDK-3129
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: I6a669b7e0e5d805cab4a9e59e2b21a95fb6506f8
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/helpserver/provider')
-rw-r--r-- | sdnr/wt/helpserver/provider/pom.xml | 10 | ||||
-rw-r--r-- | sdnr/wt/helpserver/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/helpserver/test/TestMyServlet.java | 25 |
2 files changed, 12 insertions, 23 deletions
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 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.1.0</version> + <version>2.1.1-SNAPSHOT</version> <relativePath/> </parent> @@ -42,13 +42,17 @@ <properties> <maven.javadoc.skip>true</maven.javadoc.skip> - <checkstyle.skip>true</checkstyle.skip> </properties> <dependencies> <dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> + <artifactId>javax.servlet-api</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> 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()); } } |