aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCoreBPMN/src/test')
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java14
-rw-r--r--bpmn/MSOCoreBPMN/src/test/resources/json-examples/OofExample.json110
2 files changed, 123 insertions, 1 deletions
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java
index 6748128f05..067ae9806d 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/json/JsonUtilsTest.java
@@ -81,7 +81,19 @@ public class JsonUtilsTest {
JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo");
Map<String, String> map = utils.entryArrayToMap(assignmentInfo.toString(), "variableName", "variableValue");
assertEquals(map.get("cloudOwner"), "CloudOwner");
- }
+ }
+ @Test
+ public void entryArrayToMapStringTestOof() throws IOException {
+ JsonUtils utils = new JsonUtils();
+ String response = this.getJson("OofExample.json");
+ String entry = JsonUtils.getJsonValue(response, "solutions.placementSolutions");
+ JSONArray arr = new JSONArray(entry);
+ JSONArray arr2 = arr.getJSONArray(0);
+ JSONObject homingDataJson = arr2.getJSONObject(0);
+ JSONArray assignmentInfo = homingDataJson.getJSONArray("assignmentInfo");
+ Map<String, String> map = utils.entryArrayToMap(assignmentInfo.toString(), "key", "value");
+ assertEquals(map.get("cloudOwner"), "HPA-cloud");
+ }
@Test
public void getJsonRootPropertyTest() throws IOException {
String response = this.getJson("SDNCServiceResponseExample.json");
diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/OofExample.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/OofExample.json
new file mode 100644
index 0000000000..127748a5e8
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/OofExample.json
@@ -0,0 +1,110 @@
+{
+ "requestStatus":"completed",
+ "statusMessage":"",
+ "solutions":{
+ "placementSolutions":[
+ [
+ {
+ "serviceResourceId":"78976677-bca7-446a-8b31-52b83e9aa925",
+ "resourceModuleName":"7400fd06C75f4a44A68f",
+ "solution":{
+ "identifierType":"cloudRegionId",
+ "cloudOwner":"HPA-cloud",
+ "identifiers":[
+ "Cloud-region3"
+ ]
+ },
+ "assignmentInfo":[
+ {
+ "value":"false",
+ "key":"isRehome"
+ },
+ {
+ "value":"att_aic",
+ "key":"locationType"
+ },
+ {
+ "value":"Cloud-region3",
+ "key":"locationId"
+ },
+ {
+ "value":{
+ "directives":[
+ {
+ "directives":[
+ {
+ "attributes":[
+ {
+ "attribute_value":"Flavor31",
+ "attribute_name":"label_1"
+ }
+ ],
+ "type":"flavor_directives"
+ },
+ {
+ "attributes":[
+ {
+ "attribute_value":"direct",
+ "attribute_name":"oof_returned_vnic_type_for_firewall_protected"
+ }
+ ],
+ "type":"sriovNICNetwork_directives"
+ }
+ ],
+ "type":"vnfc",
+ "id":"vfw_1"
+ },
+ {
+ "directives":[
+ {
+ "attributes":[
+ {
+ "attribute_value":"Flavor32",
+ "attribute_name":"label_2"
+ }
+ ],
+ "type":"flavor_directives"
+ }
+ ],
+ "type":"vnfc",
+ "id":"vfw_2"
+ },
+ {
+ "directives":[
+ {
+ "attributes":[
+ {
+ "attribute_value":"Flavor32",
+ "attribute_name":"label_3"
+ }
+ ],
+ "type":"flavor_directives"
+ }
+ ],
+ "type":"vnfc",
+ "id":"vfw_3"
+ }
+ ]
+ },
+ "key":"oof_directives"
+ },
+ {
+ "value":"DLLSTX233",
+ "key":"cloudClli"
+ },
+ {
+ "value":"75919",
+ "key":"aic_version"
+ },
+ {
+ "value":"HPA-cloud",
+ "key":"cloudOwner"
+ }
+ ]
+ }
+ ]
+ ]
+ },
+ "transactionId":"",
+ "requestId":"05da4f90-15f7-4128-8ac4-e06dc3cc06f9"
+} \ No newline at end of file