summaryrefslogtreecommitdiffstats
path: root/restapi-call-node/provider/src/test
diff options
context:
space:
mode:
authorGaurav Agrawal <gaurav.agrawal@huawei.com>2017-09-20 11:48:54 +0530
committerGaurav Agrawal <gaurav.agrawal@huawei.com>2017-09-20 11:51:02 +0530
commit33bfbaf4a7c2c33fc0b0b5ab18a5553dd8884cf7 (patch)
tree5f49e36433f959088de494946a9848a1254fb0f1 /restapi-call-node/provider/src/test
parentba209b4de55c56e5c427e3389518966f2c896661 (diff)
Changes to RestApiCall plugin
Changes includes 1. Perform validation of URL syntax during parameter parsing phase. 2. StringBuilder to replace string concatenation within loop. 3. Testcase addition. 4. Sonar critical issue fix for XmlJsonUtil 5) Use logger built-in string formatting rather then string concatenation https://sonar.onap.org/component_issues/index?id=org.onap.ccsdk.sli.plugins%3Accsdk-sli-plugins#resolved=false|severities=CRITICAL Change-Id: I884af51023bbd4983c43707aca97c398d24fc9de Issue-Id: CCSDK-67 Signed-off-by: Gaurav Agrawal <gaurav.agrawal@huawei.com>
Diffstat (limited to 'restapi-call-node/provider/src/test')
-rw-r--r--restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
index 51c39478..118d97d3 100644
--- a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
+++ b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
@@ -168,4 +168,31 @@ public class TestRestapiCallNode {
RestapiCallNode rcn = new RestapiCallNode();
rcn.sendRequest(p, ctx);
}
+
+
+ @Test(expected = SvcLogicException.class)
+ public void testWithInvalidURI() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
+ ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
+
+ Map<String, String> p = new HashMap<String, String>();
+ p.put("templateFileName", "src/test/resources/test-template.json");
+ p.put("restapiUrl", "http://echo. getpostman.com");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "abc123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "response");
+ p.put("skipSending", "false");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
}