diff options
Diffstat (limited to 'restapi-call-node')
9 files changed, 386 insertions, 94 deletions
diff --git a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java index e4ec9147c..21b66b221 100644 --- a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java +++ b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java @@ -21,39 +21,41 @@ package org.onap.ccsdk.sli.plugins.restapicall; -import java.io.BufferedReader; +import static org.junit.Assert.assertEquals; import java.io.IOException; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.Map; - import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.plugins.restapicall.JsonParser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class TestJsonParser { - private static final Logger log = LoggerFactory.getLogger(TestJsonParser.class); - @Test public void test() throws SvcLogicException, IOException { - BufferedReader in = new BufferedReader( - new InputStreamReader(ClassLoader.getSystemResourceAsStream("test.json")) - ); - StringBuilder b = new StringBuilder(); - String line; - while ((line = in.readLine()) != null) - b.append(line).append('\n'); - - Map<String, String> mm = JsonParser.convertToProperties(b.toString()); - - logProperties(mm); - - in.close(); + String path = "src/test/resources/test.json"; + String content = new String(Files.readAllBytes(Paths.get(path))); + Map<String, String> mm = JsonParser.convertToProperties(content); + assertEquals("Server1", mm.get("equipment-data[0].equipment-id")); + assertEquals("1600000", mm.get("equipment-data[0].max-server-speed")); + assertEquals("2", mm.get("equipment-data[0].number-primary-servers")); + assertEquals("4", mm.get("equipment-data[0].server-count")); + assertEquals("Server1", mm.get("equipment-data[0].server-id")); + assertEquals("Unknown", mm.get("equipment-data[0].server-model")); + assertEquals("Test-Value", mm.get("equipment-data[0].test-node.test-inner-node")); + assertEquals("1", mm.get("equipment-data_length")); + assertEquals("The provisioned access bandwidth is at or exceeds 50% of the total server capacity.", + mm.get("message")); + assertEquals("VCE-Cust", mm.get("resource-rule.endpoint-position")); + assertEquals("Server", mm.get("resource-rule.equipment-level")); + assertEquals("max-server-speed * number-primary-servers", mm.get("resource-rule.hard-limit-expression")); + assertEquals("Bandwidth", mm.get("resource-rule.resource-name")); + assertEquals("DUMMY", mm.get("resource-rule.service-model")); + assertEquals("0.6 * max-server-speed * number-primary-servers", mm.get("resource-rule.soft-limit-expression")); + assertEquals("1605000", mm.get("resource-state.last-added")); + assertEquals("1920000", mm.get("resource-state.limit-value")); + assertEquals("1600000", mm.get("resource-state.threshold-value")); + assertEquals("1605000", mm.get("resource-state.used")); } @Test(expected = NullPointerException.class) @@ -61,13 +63,167 @@ public class TestJsonParser { JsonParser.convertToProperties(null); } - private void logProperties(Map<String, String> mm) { - List<String> ll = new ArrayList<>(); - for (Object o : mm.keySet()) - ll.add((String) o); - Collections.sort(ll); - log.info("Properties:"); - for (String name : ll) - log.info("--- {}: {}", name, mm.get(name)); + @Test + public void testJsonStringToCtxToplevelArray() throws Exception { + String path = "src/test/resources/ArrayMenu.json"; + String content = new String(Files.readAllBytes(Paths.get(path))); + Map<String, String> mm = JsonParser.convertToProperties(content); + assertEquals("plain", mm.get("name")); + assertEquals("true", mm.get("vegetarian")); + assertEquals("1", mm.get("id")); + assertEquals("1000", mm.get("calories")); + assertEquals("pizza", mm.get("type")); + + // The below statements are how I expected it to work, but it does not work this way +/* + assertEquals("1000", mm.get("[0].calories")); + assertEquals("1", mm.get("[0].id")); + assertEquals("plain", mm.get("[0].name")); + assertEquals("pizza", mm.get("[0].type")); + assertEquals("true", mm.get("[0].vegetarian")); + assertEquals("2000", mm.get("[1].calories")); + assertEquals("2", mm.get("[1].id")); + assertEquals("Tuesday Special", mm.get("[1].name")); + assertEquals("1", mm.get("[1].topping[0].id")); + assertEquals("onion", mm.get("[1].topping[0].name")); + assertEquals("2", mm.get("[1].topping[1].id")); + assertEquals("pepperoni", mm.get("[1].topping[1].name")); + assertEquals("2", mm.get("[1].topping_length")); + assertEquals("pizza", mm.get("[1].type")); + assertEquals("false", mm.get("[1].vegetarian")); + assertEquals("1500", mm.get("[2].calories")); + assertEquals("3", mm.get("[2].id")); + assertEquals("House Special", mm.get("[2].name")); + assertEquals("3", mm.get("[2].topping[0].id")); + assertEquals("basil", mm.get("[2].topping[0].name")); + assertEquals("4", mm.get("[2].topping[1].id")); + assertEquals("fresh mozzarella", mm.get("[2].topping[1].name")); + assertEquals("5", mm.get("[2].topping[2].id")); + assertEquals("tomato", mm.get("[2].topping[2].name")); + assertEquals("3", mm.get("[2].topping_length")); + assertEquals("pizza", mm.get("[2].type")); + assertEquals("true", mm.get("[2].vegetarian")); + assertEquals("3", mm.get("_length")); +*/ + } + + @Test + public void testJsonStringToCtx() throws Exception { + String path = "src/test/resources/ObjectMenu.json"; + String content = new String(Files.readAllBytes(Paths.get(path))); + Map<String, String> mm = JsonParser.convertToProperties(content); + assertEquals("1000", mm.get("menu[0].calories")); + assertEquals("1", mm.get("menu[0].id")); + assertEquals("plain", mm.get("menu[0].name")); + assertEquals("pizza", mm.get("menu[0].type")); + assertEquals("true", mm.get("menu[0].vegetarian")); + assertEquals("2000", mm.get("menu[1].calories")); + assertEquals("2", mm.get("menu[1].id")); + assertEquals("Tuesday Special", mm.get("menu[1].name")); + assertEquals("1", mm.get("menu[1].topping[0].id")); + assertEquals("onion", mm.get("menu[1].topping[0].name")); + assertEquals("2", mm.get("menu[1].topping[1].id")); + assertEquals("pepperoni", mm.get("menu[1].topping[1].name")); + assertEquals("2", mm.get("menu[1].topping_length")); + assertEquals("pizza", mm.get("menu[1].type")); + assertEquals("false", mm.get("menu[1].vegetarian")); + assertEquals("1500", mm.get("menu[2].calories")); + assertEquals("3", mm.get("menu[2].id")); + assertEquals("House Special", mm.get("menu[2].name")); + assertEquals("3", mm.get("menu[2].topping[0].id")); + assertEquals("basil", mm.get("menu[2].topping[0].name")); + assertEquals("4", mm.get("menu[2].topping[1].id")); + assertEquals("fresh mozzarella", mm.get("menu[2].topping[1].name")); + assertEquals("5", mm.get("menu[2].topping[2].id")); + assertEquals("tomato", mm.get("menu[2].topping[2].name")); + assertEquals("3", mm.get("menu[2].topping_length")); + assertEquals("pizza", mm.get("menu[2].type")); + assertEquals("true", mm.get("menu[2].vegetarian")); + assertEquals("3", mm.get("menu_length")); + } + + @Test(expected = SvcLogicException.class) // current behavior is multidimensional arrays are not supported + public void test2dJsonStringToCtx() throws Exception { + String path = "src/test/resources/2dArray.json"; + String content = new String(Files.readAllBytes(Paths.get(path))); + Map<String, String> mm = JsonParser.convertToProperties(content); + + // code will crash before these tests + assertEquals("apple", mm.get("[0][0]")); + assertEquals("orange", mm.get("[0][1]")); + assertEquals("banana", mm.get("[0][2]")); + assertEquals("3", mm.get("[0]_length")); + assertEquals("squash", mm.get("[1][0]")); + assertEquals("broccoli", mm.get("[1][1]")); + assertEquals("cauliflower", mm.get("[1][2]")); + assertEquals("3", mm.get("[1]_length")); + assertEquals("2", mm.get("_length")); + } + + @Test(expected = SvcLogicException.class) // current behavior is multidimensional arrays are not supported + public void test3dJsonStringToCtx() throws Exception { + String path = "src/test/resources/3dArray.json"; + String content = new String(Files.readAllBytes(Paths.get(path))); + Map<String, String> mm = JsonParser.convertToProperties(content); + + // code will crash before these tests + assertEquals("a", mm.get("[0][0][0]")); + assertEquals("b", mm.get("[0][0][1]")); + assertEquals("c", mm.get("[0][0][2]")); + assertEquals("3", mm.get("[0][0]_length")); + assertEquals("d", mm.get("[0][1][0]")); + assertEquals("e", mm.get("[0][1][1]")); + assertEquals("f", mm.get("[0][1][2]")); + assertEquals("3", mm.get("[0][1]_length")); + assertEquals("2", mm.get("[0]_length")); + assertEquals("x", mm.get("[1][0][0]")); + assertEquals("y", mm.get("[1][0][1]")); + assertEquals("z", mm.get("[1][0][2]")); + assertEquals("3", mm.get("[1][0]_length")); + assertEquals("1", mm.get("[1]_length")); + assertEquals("2", mm.get("_length")); + } + + @Test + public void testJsonWidgetStringToCtx() throws Exception { + String path = "src/test/resources/Widget.json"; + String content = new String(Files.readAllBytes(Paths.get(path))); + Map<String, String> mm = JsonParser.convertToProperties(content); + assertEquals("false", mm.get("widget.debug")); + assertEquals("center", mm.get("widget.image.alignment")); + assertEquals("150", mm.get("widget.image.hOffset")); + assertEquals("moon", mm.get("widget.image.name")); + assertEquals("images/moon.png", mm.get("widget.image.src")); + assertEquals("150", mm.get("widget.image.vOffset")); + assertEquals("center", mm.get("widget.text.alignment")); + assertEquals("Click Me", mm.get("widget.text.data")); + assertEquals("350", mm.get("widget.text.hOffset")); + assertEquals("text1", mm.get("widget.text.name")); + assertEquals("21", mm.get("widget.text.size")); + assertEquals("bold", mm.get("widget.text.style")); + assertEquals("200", mm.get("widget.text.vOffset")); + assertEquals("300", mm.get("widget.window.height")); + assertEquals("main_window", mm.get("widget.window.name")); + assertEquals("ONAP Widget", mm.get("widget.window.title")); + assertEquals("200", mm.get("widget.window.width")); + } + + @Test + public void testEmbeddedEscapedJsonJsonStringToCtx() throws Exception { + String path = "src/test/resources/EmbeddedEscapedJson.json"; + String content = new String(Files.readAllBytes(Paths.get(path))); + Map<String, String> mm = JsonParser.convertToProperties(content); + assertEquals("escapedJsonObject", mm.get("input.parameters[0].name")); + assertEquals("[{\"id\":\"0.2.0.0/16\"},{\"id\":\"ge04::/64\"}]", mm.get("input.parameters[0].value")); + assertEquals("Hello/World", mm.get("input.parameters[1].value")); + assertEquals("resourceName", mm.get("input.parameters[2].name")); + assertEquals("The\t\"Best\"\tName", mm.get("input.parameters[2].value")); + assertEquals("3", mm.get("input.parameters_length")); + + // Break the embedded json object into properties + mm = JsonParser.convertToProperties(mm.get("input.parameters[0].value")); + assertEquals("0.2.0.0/16", mm.get("id")); + // assertEquals("ge04::/64", mm.get("id")); this second value gets lost } + } diff --git a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestXmlParser.java b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestXmlParser.java index 326c9ca89..76f86abc0 100644 --- a/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestXmlParser.java +++ b/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestXmlParser.java @@ -21,38 +21,21 @@ package org.onap.ccsdk.sli.plugins.restapicall; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Collections; +import static org.junit.Assert.assertEquals; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Set; - import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.plugins.restapicall.XmlParser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class TestXmlParser { - private static final Logger log = LoggerFactory.getLogger(TestXmlParser.class); - @Test public void test() throws Exception { - BufferedReader in = new BufferedReader( - new InputStreamReader(ClassLoader.getSystemResourceAsStream("test3.xml")) - ); - StringBuilder b = new StringBuilder(); - String line; - while ((line = in.readLine()) != null) - b.append(line).append('\n'); - + String path = "src/test/resources/test3.xml"; + String content = new String(Files.readAllBytes(Paths.get(path))); Set<String> listNameList = new HashSet<String>(); listNameList.add("project.dependencies.dependency"); listNameList.add("project.build.plugins.plugin"); @@ -61,61 +44,78 @@ public class TestXmlParser { listNameList.add("project.build.pluginManagement." + "plugins.plugin.configuration.lifecycleMappingMetadata.pluginExecutions.pluginExecution"); - Map<String, String> mm = XmlParser.convertToProperties(b.toString(), listNameList); - logProperties(mm); - in.close(); + Map<String, String> mm = XmlParser.convertToProperties(content, listNameList); + assertEquals("811182", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VpnId")); + assertEquals("v6", mm.get("ApplyGroupResponse.ApplyGroupResponseData.RoutingApplyGroups.Family")); + assertEquals("SET6_BVOIP_IN", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfImport")); + assertEquals("AG_MAX_MCASTROUTES", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.ApplyGroup.ApplyGroup")); + assertEquals("ICOREPVC-81114561", mm.get("ApplyGroupResponse.ApplyGroupResponseData.ServiceInstanceId")); + assertEquals("SET_RESET_LP", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport")); + assertEquals("21302:811182", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfName")); + assertEquals("BGP4_PROTOCOL", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.RoutingApplyGroups.RoutingProtocol")); + assertEquals("AG6_MAX_PREFIX", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.RoutingApplyGroups.ApplyGroupPeer.ApplyGroup")); + assertEquals("VPNL811182", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.End2EndVpnKey")); + assertEquals("AG6_BFD_BGP_3000", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.RoutingApplyGroups.ApplyGroupNeighbour.ApplyGroup")); + assertEquals("200", mm.get("ApplyGroupResponse.response-code")); + assertEquals("gp6_21302:811182", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.RoutingApplyGroups.PeerGroupName")); + assertEquals("Y", mm.get("ApplyGroupResponse.ack-final-indicator")); + assertEquals("Success", mm.get("ApplyGroupResponse.response-message")); } @Test public void testValidLength() throws Exception { - BufferedReader in = new BufferedReader( - new InputStreamReader(ClassLoader.getSystemResourceAsStream("test3.xml")) - ); - StringBuilder b = new StringBuilder(); - String line; - while ((line = in.readLine()) != null) - b.append(line).append('\n'); - + String path = "src/test/resources/test3.xml"; + String content = new String(Files.readAllBytes(Paths.get(path))); Set<String> listNameList = new HashSet<String>(); listNameList.add("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfImport"); listNameList.add("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport"); - Map<String, String> mm = XmlParser.convertToProperties(b.toString(), listNameList); - - assertThat(mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport[5]"), is("SET_RESET_LP")); - assertThat(mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfImport[0]"), is("SET_BVOIP_IN")); - - logProperties(mm); - in.close(); + Map<String, String> mm = XmlParser.convertToProperties(content, listNameList); + assertEquals("AG6_BFD_BGP_3000", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.RoutingApplyGroups.ApplyGroupNeighbour.ApplyGroup")); + assertEquals("AG6_MAX_PREFIX", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.RoutingApplyGroups.ApplyGroupPeer.ApplyGroup")); + assertEquals("v6", mm.get("ApplyGroupResponse.ApplyGroupResponseData.RoutingApplyGroups.Family")); + assertEquals("gp6_21302:811182", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.RoutingApplyGroups.PeerGroupName")); + assertEquals("BGP4_PROTOCOL", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.RoutingApplyGroups.RoutingProtocol")); + assertEquals("ICOREPVC-81114561", mm.get("ApplyGroupResponse.ApplyGroupResponseData.ServiceInstanceId")); + assertEquals("AG_MAX_MCASTROUTES", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.ApplyGroup.ApplyGroup")); + assertEquals("VPNL811182", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.End2EndVpnKey")); + assertEquals("811182", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VpnId")); + assertEquals("SET6_DSU", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport[0]")); + assertEquals("SET_DSU", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport[1]")); + assertEquals("SET6_MANAGED", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport[2]")); + assertEquals("SET_MANAGED", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport[3]")); + assertEquals("SET_LOVRF_COMMUNITY", + mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport[4]")); + assertEquals("SET_RESET_LP", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport[5]")); + assertEquals("6", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport_length")); + assertEquals("SET_BVOIP_IN", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfImport[0]")); + assertEquals("SET6_BVOIP_IN", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfImport[1]")); + assertEquals("2", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfImport_length")); + assertEquals("21302:811182", mm.get("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfName")); + assertEquals("Y", mm.get("ApplyGroupResponse.ack-final-indicator")); + assertEquals("200", mm.get("ApplyGroupResponse.response-code")); + assertEquals("Success", mm.get("ApplyGroupResponse.response-message")); } @Test(expected = SvcLogicException.class) public void testInvalidLength() throws Exception { - BufferedReader in = new BufferedReader( - new InputStreamReader(ClassLoader.getSystemResourceAsStream("invalidlength.xml")) - ); - StringBuilder b = new StringBuilder(); - String line; - while ((line = in.readLine()) != null) - b.append(line).append('\n'); - + String path = "src/test/resources/invalidlength.xml"; + String content = new String(Files.readAllBytes(Paths.get(path))); Set<String> listNameList = new HashSet<String>(); listNameList.add("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfImport"); listNameList.add("ApplyGroupResponse.ApplyGroupResponseData.VrfDetails.VrfExport"); - - Map<String, String> mm = XmlParser.convertToProperties(b.toString(), listNameList); - logProperties(mm); - in.close(); + XmlParser.convertToProperties(content, listNameList); // throws an exception because the length in the xml is + // not a valid number } - private void logProperties(Map<String, String> mm) { - List<String> ll = new ArrayList<>(); - for (Object o : mm.keySet()) - ll.add((String) o); - Collections.sort(ll); - - log.info("Properties:"); - for (String name : ll) - log.info("--- " + name + ": " + mm.get(name)); - } } diff --git a/restapi-call-node/provider/src/test/resources/2dArray.json b/restapi-call-node/provider/src/test/resources/2dArray.json new file mode 100644 index 000000000..b473864d8 --- /dev/null +++ b/restapi-call-node/provider/src/test/resources/2dArray.json @@ -0,0 +1,4 @@ +[
+ ["apple", "orange", "banana"],
+ ["squash", "broccoli", "cauliflower"]
+]
\ No newline at end of file diff --git a/restapi-call-node/provider/src/test/resources/3dArray.json b/restapi-call-node/provider/src/test/resources/3dArray.json new file mode 100644 index 000000000..149955596 --- /dev/null +++ b/restapi-call-node/provider/src/test/resources/3dArray.json @@ -0,0 +1,4 @@ +[
+ [["a","b","c"], ["d","e","f"]],
+ [["x","y","z"]]
+]
\ No newline at end of file diff --git a/restapi-call-node/provider/src/test/resources/ArrayMenu.json b/restapi-call-node/provider/src/test/resources/ArrayMenu.json new file mode 100644 index 000000000..b12f16315 --- /dev/null +++ b/restapi-call-node/provider/src/test/resources/ArrayMenu.json @@ -0,0 +1,41 @@ +[{
+ "id": "1",
+ "type": "pizza",
+ "name": "plain",
+ "calories": 1000,
+ "vegetarian": true
+ }, {
+ "id": "2",
+ "type": "pizza",
+ "name": "Tuesday Special",
+ "calories": 2000,
+ "vegetarian": false,
+ "topping":
+ [{
+ "id": "1",
+ "name": "onion"
+ }, {
+ "id": "2",
+ "name": "pepperoni"
+ }
+ ]
+ }, {
+ "id": "3",
+ "type": "pizza",
+ "name": "House Special",
+ "calories": 1500,
+ "vegetarian": true,
+ "topping":
+ [{
+ "id": "3",
+ "name": "basil"
+ }, {
+ "id": "4",
+ "name": "fresh mozzarella"
+ }, {
+ "id": "5",
+ "name": "tomato"
+ }
+ ]
+ }
+]
diff --git a/restapi-call-node/provider/src/test/resources/EmbeddedEscapedJson.json b/restapi-call-node/provider/src/test/resources/EmbeddedEscapedJson.json new file mode 100644 index 000000000..dbb6d8d3a --- /dev/null +++ b/restapi-call-node/provider/src/test/resources/EmbeddedEscapedJson.json @@ -0,0 +1,16 @@ +{
+ "input": {
+ "parameters":
+ [{
+ "name": "escapedJsonObject",
+ "value": "[{\"id\":\"0.2.0.0\/16\"},{\"id\":\"ge04::\/64\"}]"
+ }, {
+ "name": "password",
+ "value": "Hello\/World"
+ }, {
+ "name": "resourceName",
+ "value": "The\t\"Best\"\tName"
+ }
+ ]
+ }
+}
\ No newline at end of file diff --git a/restapi-call-node/provider/src/test/resources/EscapedJson.json b/restapi-call-node/provider/src/test/resources/EscapedJson.json new file mode 100644 index 000000000..a7719e819 --- /dev/null +++ b/restapi-call-node/provider/src/test/resources/EscapedJson.json @@ -0,0 +1 @@ +{\"widget\":{\"debug\":false,\"window\":{\"title\":\"ONAP Widget\",\"name\":\"main_window\",\"width\":200,\"height\":300},\"image\":{\"src\":\"images\/moon.png\",\"name\":\"moon\",\"hOffset\":150,\"vOffset\":150,\"alignment\":\"center\"},\"text\":{\"data\":\"Click Me\",\"size\":21,\"style\":\"bold\",\"name\":\"text1\",\"hOffset\":350,\"vOffset\":200,\"alignment\":\"center\"}}}
\ No newline at end of file diff --git a/restapi-call-node/provider/src/test/resources/ObjectMenu.json b/restapi-call-node/provider/src/test/resources/ObjectMenu.json new file mode 100644 index 000000000..56f842d48 --- /dev/null +++ b/restapi-call-node/provider/src/test/resources/ObjectMenu.json @@ -0,0 +1,43 @@ +{
+ "menu": [{
+ "id": "1",
+ "type": "pizza",
+ "name": "plain",
+ "calories": 1000,
+ "vegetarian": true
+ }, {
+ "id": "2",
+ "type": "pizza",
+ "name": "Tuesday Special",
+ "calories": 2000,
+ "vegetarian": false,
+ "topping":
+ [{
+ "id": "1",
+ "name": "onion"
+ }, {
+ "id": "2",
+ "name": "pepperoni"
+ }
+ ]
+ }, {
+ "id": "3",
+ "type": "pizza",
+ "name": "House Special",
+ "calories": 1500,
+ "vegetarian": true,
+ "topping":
+ [{
+ "id": "3",
+ "name": "basil"
+ }, {
+ "id": "4",
+ "name": "fresh mozzarella"
+ }, {
+ "id": "5",
+ "name": "tomato"
+ }
+ ]
+ }
+ ]
+}
diff --git a/restapi-call-node/provider/src/test/resources/Widget.json b/restapi-call-node/provider/src/test/resources/Widget.json new file mode 100644 index 000000000..1e25282c2 --- /dev/null +++ b/restapi-call-node/provider/src/test/resources/Widget.json @@ -0,0 +1,27 @@ +{
+ "widget": {
+ "debug": false,
+ "window": {
+ "title": "ONAP Widget",
+ "name": "main_window",
+ "width": 200,
+ "height": 300
+ },
+ "image": {
+ "src": "images/moon.png",
+ "name": "moon",
+ "hOffset": 150,
+ "vOffset": 150,
+ "alignment": "center"
+ },
+ "text": {
+ "data": "Click Me",
+ "size": 21,
+ "style": "bold",
+ "name": "text1",
+ "hOffset": 350,
+ "vOffset": 200,
+ "alignment": "center"
+ }
+ }
+}
\ No newline at end of file |