X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=restapi-call-node%2Fprovider%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fccsdk%2Fsli%2Fplugins%2Frestapicall%2FTestRestapiCallNode.java;fp=restapi-call-node%2Fprovider%2Fsrc%2Ftest%2Fjava%2Fjtest%2Forg%2Fonap%2Fccsdk%2Fsli%2Fplugins%2Frestapicall%2FTestRestapiCallNode.java;h=bdf67dc45a16ece3e3e9b04bd5f76a9d2e9bb557;hb=c75880b15cebc206d43721b35299453f49406f20;hp=3752a9c3fc49aeca65ccc5a42eb9e12ae63ae38f;hpb=06c30ec3fa1dbdf26b7e1abce89c68e3efc632c7;p=ccsdk%2Fsli%2Fplugins.git 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/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java similarity index 97% rename from restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java rename to restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java index 3752a9c3..bdf67dc4 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/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java @@ -19,13 +19,14 @@ * ============LICENSE_END========================================================= */ -package jtest.org.onap.ccsdk.sli.plugins.restapicall; +package org.onap.ccsdk.sli.plugins.restapicall; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import java.net.URI; import java.util.HashMap; import java.util.Map; +import org.codehaus.jettison.json.JSONObject; import org.glassfish.grizzly.http.server.HttpServer; import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; import org.glassfish.jersey.media.multipart.MultiPartFeature; @@ -721,4 +722,20 @@ public class TestRestapiCallNode { assertThat(ctx.getAttribute("header.Set-Cookie"), is("cookieResponse=cookieValueInReturn;Version=1")); server.shutdownNow(); } + + @Test + public void testEmbeddedJsonTemplate() throws Exception { + SvcLogicContext ctx = new SvcLogicContext(); + String complexObj = "{\"image_name\":\"Ubuntu 14.04\",\"service-instance-id\":\"1\",\"vnf-model-customization-uuid\":\"2f\",\"vnf-id\":\"3b\"}"; + ctx.setAttribute("reqId", "1235"); + ctx.setAttribute("subReqId", "054243"); + ctx.setAttribute("actionName", "CREATE"); + ctx.setAttribute("myPrefix", "2016-09-09 16:30:35.0"); + ctx.setAttribute("complexObj", complexObj); + RestapiCallNode rcn = new RestapiCallNode(); + String request = rcn.buildXmlJsonRequest(ctx, rcn.readFile("src/test/resources/testEmbeddedTemplate.json"), Format.JSON); + //This will throw a JSONException and fail the test case if rest api call node doesn't form valid JSON + JSONObject requestObj = new JSONObject(request); + } + }