Merge "Fix restapi-call-node install"
authorDan Timoney <dt5972@att.com>
Fri, 16 Mar 2018 18:10:22 +0000 (18:10 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 16 Mar 2018 18:10:22 +0000 (18:10 +0000)
restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/Parameters.java
restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java
restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java

index c4ad4c5..e5c1859 100644 (file)
@@ -131,6 +131,8 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
             if (p.templateFileName != null) {
                 String reqTemplate = readFile(p.templateFileName);
                 req = buildXmlJsonRequest(ctx, reqTemplate, p.format);
+            } else if (p.requestBody != null) {
+                req = p.requestBody;
             }
             r = sendHttpRequest(req, p);
             setResponseStatus(ctx, p.responsePrefix, r);
@@ -209,6 +211,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
     protected Parameters getParameters(Map<String, String> paramMap) throws SvcLogicException {
         Parameters p = new Parameters();
         p.templateFileName = parseParam(paramMap, "templateFileName", false, null);
+        p.requestBody = parseParam(paramMap, "requestBody", false, null);
         p.restapiUrl = parseParam(paramMap, "restapiUrl", true, null);
         validateUrl(p.restapiUrl);
         p.restapiUser = parseParam(paramMap, "restapiUser", false, null);
@@ -382,8 +385,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin {
             try {
                 n = Integer.parseInt(value1);
             } catch (NumberFormatException e) {
-                throw new SvcLogicException("Invalid input of repeat interval, should be an integer value " +
-                    e.getLocalizedMessage(), e);
+                log.info("value1 not set or not a number, n will remain set at zero");
             }
 
             newTemplate.append(template.substring(k, i1));
index 2da5b2c..09fa835 100644 (file)
@@ -91,7 +91,7 @@ public class TestRestapiCallNode {
         rcn.sendRequest(p, ctx);
     }
 
-    @Test(expected = SvcLogicException.class)
+    @Test
     public void testInvalidRepeatTimes() throws SvcLogicException {
         SvcLogicContext ctx = new SvcLogicContext();
         ctx.setAttribute("tmp.sdn-circuit-req-row_length", "a");