summaryrefslogtreecommitdiffstats
path: root/appc-adapters
diff options
context:
space:
mode:
authorGanesh Chandrasekaran <ganesh.c@samsung.com>2018-08-30 17:59:06 +0900
committerTakamune Cho <tc012c@att.com>2018-09-05 18:59:43 +0000
commitf5035002126910aeba60cdcd070290696c3f2942 (patch)
tree8073bccbeeff75e647c3b0826eb28953902e9835 /appc-adapters
parent2de7bd87825a2d743c0756d6ed44d744a757cdff (diff)
increase coverage for restAdaptor HTTP_GET
Issue-ID: APPC-1181 Change-Id: Iac9a6be49bc3e4ed2461a337e9b892b821a8d518 Signed-off-by: Ganesh Chandrasekaran <ganesh.c@samsung.com>
Diffstat (limited to 'appc-adapters')
-rw-r--r--appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/test/java/org/onap/appc/adapter/rest/impl/TestRestAdapterImpl.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/test/java/org/onap/appc/adapter/rest/impl/TestRestAdapterImpl.java b/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/test/java/org/onap/appc/adapter/rest/impl/TestRestAdapterImpl.java
index 387b6a5f9..6ddfe8817 100644
--- a/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/test/java/org/onap/appc/adapter/rest/impl/TestRestAdapterImpl.java
+++ b/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/test/java/org/onap/appc/adapter/rest/impl/TestRestAdapterImpl.java
@@ -80,6 +80,39 @@ public class TestRestAdapterImpl {
assertEquals("GET", httpGet.getMethod());
assertEquals("http://example.com:8080/about/health", httpGet.getURI().toURL().toString());
}
+
+ @Test
+ public void testCreateRequestNoParamGet() throws IOException, IllegalStateException, IllegalArgumentException,
+ ZoneException, APPCException {
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> params = new HashMap<>();
+
+ adapter.commonGet(params, ctx);
+
+ assertEquals("failure", ctx.getStatus());
+ assertEquals("500", ctx.getAttribute("org.openecomp.rest.result.code"));
+ assertEquals("java.lang.IllegalArgumentException: HTTP request may not be null",
+ ctx.getAttribute("org.openecomp.rest.result.message"));
+ }
+
+ @Test
+ public void testCreateRequestInvalidParamGet() throws IOException, IllegalStateException, IllegalArgumentException,
+ ZoneException, APPCException {
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> params = new HashMap<>();
+ params.put("org.onap.appc.instance.URI", "boo");
+ params.put("org.onap.appc.instance.haveHeader","false");
+ params.put("org.onap.appc.instance.requestBody", "{\"name\":\"MyNode2\", \"width\":300, \"height\":300}");
+
+ adapter.commonGet(params, ctx);
+
+ assertEquals("failure", ctx.getStatus());
+ assertEquals("500", ctx.getAttribute("org.openecomp.rest.result.code"));
+ assertEquals("org.apache.http.client.ClientProtocolException",
+ ctx.getAttribute("org.openecomp.rest.result.message"));
+ }
@Test
public void testCreateHttpRequestPost() throws IOException, IllegalStateException, IllegalArgumentException,