RestapiCallNode unit tests 84/99784/2
authorSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Wed, 18 Dec 2019 21:29:24 +0000 (21:29 +0000)
committerSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Wed, 18 Dec 2019 21:46:54 +0000 (21:46 +0000)
Validate JsonParser in RestapiCallNode

Issue-ID: CCSDK-2008
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Change-Id: Idd062d9614b89b1c0142591af600ea8ff61c019a

restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestJsonParser.java
restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestXmlParser.java
restapi-call-node/provider/src/test/resources/2dArray.json [new file with mode: 0644]
restapi-call-node/provider/src/test/resources/3dArray.json [new file with mode: 0644]
restapi-call-node/provider/src/test/resources/ArrayMenu.json [new file with mode: 0644]
restapi-call-node/provider/src/test/resources/EmbeddedEscapedJson.json [new file with mode: 0644]
restapi-call-node/provider/src/test/resources/EscapedJson.json [new file with mode: 0644]
restapi-call-node/provider/src/test/resources/ObjectMenu.json [new file with mode: 0644]
restapi-call-node/provider/src/test/resources/Widget.json [new file with mode: 0644]

index e4ec914..21b66b2 100644 (file)
 
 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
     }
+
 }
index 326c9ca..76f86ab 100644 (file)
 
 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 (file)
index 0000000..b473864
--- /dev/null
@@ -0,0 +1,4 @@
+[\r
+       ["apple", "orange", "banana"],\r
+       ["squash", "broccoli", "cauliflower"]\r
+]
\ 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 (file)
index 0000000..1499555
--- /dev/null
@@ -0,0 +1,4 @@
+[\r
+       [["a","b","c"], ["d","e","f"]],\r
+       [["x","y","z"]]\r
+]
\ 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 (file)
index 0000000..b12f163
--- /dev/null
@@ -0,0 +1,41 @@
+[{\r
+               "id": "1",\r
+               "type": "pizza",\r
+               "name": "plain",\r
+               "calories": 1000,\r
+               "vegetarian": true\r
+       }, {\r
+               "id": "2",\r
+               "type": "pizza",\r
+               "name": "Tuesday Special",\r
+               "calories": 2000,\r
+               "vegetarian": false,\r
+               "topping":\r
+               [{\r
+                               "id": "1",\r
+                               "name": "onion"\r
+                       }, {\r
+                               "id": "2",\r
+                               "name": "pepperoni"\r
+                       }\r
+               ]\r
+       }, {\r
+               "id": "3",\r
+               "type": "pizza",\r
+               "name": "House Special",\r
+               "calories": 1500,\r
+               "vegetarian": true,\r
+               "topping":\r
+               [{\r
+                               "id": "3",\r
+                               "name": "basil"\r
+                       }, {\r
+                               "id": "4",\r
+                               "name": "fresh mozzarella"\r
+                       }, {\r
+                               "id": "5",\r
+                               "name": "tomato"\r
+                       }\r
+               ]\r
+       }\r
+]\r
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 (file)
index 0000000..dbb6d8d
--- /dev/null
@@ -0,0 +1,16 @@
+{\r
+       "input": {\r
+               "parameters":\r
+               [{\r
+                               "name": "escapedJsonObject",\r
+                               "value": "[{\"id\":\"0.2.0.0\/16\"},{\"id\":\"ge04::\/64\"}]"\r
+                       }, {\r
+                               "name": "password",\r
+                               "value": "Hello\/World"\r
+                       }, {\r
+                               "name": "resourceName",\r
+                               "value": "The\t\"Best\"\tName"\r
+                       }\r
+               ]\r
+       }\r
+}
\ 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 (file)
index 0000000..a7719e8
--- /dev/null
@@ -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 (file)
index 0000000..56f842d
--- /dev/null
@@ -0,0 +1,43 @@
+{\r
+       "menu": [{\r
+                       "id": "1",\r
+                       "type": "pizza",\r
+                       "name": "plain",\r
+                       "calories": 1000,\r
+                       "vegetarian": true\r
+               }, {\r
+                       "id": "2",\r
+                       "type": "pizza",\r
+                       "name": "Tuesday Special",\r
+                       "calories": 2000,\r
+                       "vegetarian": false,\r
+                       "topping":\r
+                       [{\r
+                                       "id": "1",\r
+                                       "name": "onion"\r
+                               }, {\r
+                                       "id": "2",\r
+                                       "name": "pepperoni"\r
+                               }\r
+                       ]\r
+               }, {\r
+                       "id": "3",\r
+                       "type": "pizza",\r
+                       "name": "House Special",\r
+                       "calories": 1500,\r
+                       "vegetarian": true,\r
+                       "topping":\r
+                       [{\r
+                                       "id": "3",\r
+                                       "name": "basil"\r
+                               }, {\r
+                                       "id": "4",\r
+                                       "name": "fresh mozzarella"\r
+                               }, {\r
+                                       "id": "5",\r
+                                       "name": "tomato"\r
+                               }\r
+                       ]\r
+               }\r
+       ]\r
+}\r
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 (file)
index 0000000..1e25282
--- /dev/null
@@ -0,0 +1,27 @@
+{\r
+       "widget": {\r
+               "debug": false,\r
+               "window": {\r
+                       "title": "ONAP Widget",\r
+                       "name": "main_window",\r
+                       "width": 200,\r
+                       "height": 300\r
+               },\r
+               "image": {\r
+                       "src": "images/moon.png",\r
+                       "name": "moon",\r
+                       "hOffset": 150,\r
+                       "vOffset": 150,\r
+                       "alignment": "center"\r
+               },\r
+               "text": {\r
+                       "data": "Click Me",\r
+                       "size": 21,\r
+                       "style": "bold",\r
+                       "name": "text1",\r
+                       "hOffset": 350,\r
+                       "vOffset": 200,\r
+                       "alignment": "center"\r
+               }\r
+       }\r
+}
\ No newline at end of file