aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN/src/test
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-25 17:08:41 -0500
committerSmokowski, Steve (ss835w) <ss835w@us.att.com>2019-01-28 14:39:43 -0500
commitfe91155454a27401e8c23780fa247c0ede196747 (patch)
tree26d0f2e56d9b31283c5f2173c5e765d035187137 /bpmn/MSOCoreBPMN/src/test
parentd62389df8c10d46609c5770b45697f7ac401dc82 (diff)
parentfe76d074a452e58d4122cc234d17e7aa407a1b44 (diff)
Merge 'origin/casablanca' into master
Issue-ID: SO-1435 Change-Id: If065ef5c91e769452fd6701fa6c28a23b4bdf2b2 Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'bpmn/MSOCoreBPMN/src/test')
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java12
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java12
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java10
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java11
-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
6 files changed, 168 insertions, 1 deletions
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java
index b1dd8659cd..cca28d411f 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/AllottedResourceTest.java
@@ -21,8 +21,11 @@ package org.onap.so.bpmn.core.domain;
import static org.junit.Assert.*;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
+import java.io.IOException;
+
public class AllottedResourceTest {
private AllottedResource ar = new AllottedResource();
@@ -51,4 +54,13 @@ public class AllottedResourceTest {
}
+ @Test
+ public void allottedResourceMapperTest() throws IOException {
+ String jsonStr = "{\"allottedResourceType\": \"code123\", \"resourceInput\": \"sample\"}";
+ ObjectMapper objectMapper = new ObjectMapper();
+ AllottedResource vnfResource = objectMapper.readValue(jsonStr, AllottedResource.class);
+
+ assertTrue(vnfResource != null);
+ }
+
}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java
index 6ca9cef8d2..ee23ebd438 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/NetworkResourceTest.java
@@ -21,8 +21,11 @@ package org.onap.so.bpmn.core.domain;
import static org.junit.Assert.*;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
+import java.io.IOException;
+
public class NetworkResourceTest {
private NetworkResource nr = new NetworkResource();
@@ -39,4 +42,13 @@ public class NetworkResourceTest {
}
+ @Test
+ public void networkResourceMapperTest() throws IOException {
+ String jsonStr = "{\"networkScope\": \"code123\", \"resourceInput\": \"sample\"}";
+ ObjectMapper objectMapper = new ObjectMapper();
+ NetworkResource networkResource = objectMapper.readValue(jsonStr, NetworkResource.class);
+
+ assertTrue(networkResource != null);
+ }
+
}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java
index 7cacc9da88..c04dc9d601 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceInstanceTest.java
@@ -21,8 +21,10 @@ package org.onap.so.bpmn.core.domain;
import static org.junit.Assert.*;
+import java.io.IOException;
import java.util.Map;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
public class ServiceInstanceTest {
@@ -58,4 +60,12 @@ public class ServiceInstanceTest {
}
+ @Test
+ public void serviceInstanceMapperTest() throws IOException {
+ String jsonStr = "{\"workloadContext\": \"code123\", \"resourceOrder\": \"sample\"}";
+ ObjectMapper objectMapper = new ObjectMapper();
+ ServiceInstance serviceInstance = objectMapper.readValue(jsonStr, ServiceInstance.class);
+ assertTrue(serviceInstance != null);
+ }
+
}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
index 24947e9a8d..a83337fc5b 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
@@ -21,8 +21,10 @@ package org.onap.so.bpmn.core.domain;
import static org.junit.Assert.*;
+import java.io.IOException;
import java.util.List;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
public class VnfResourceTest {
@@ -52,4 +54,13 @@ public class VnfResourceTest {
}
+ @Test
+ public void vnfResourceMapperTest() throws IOException {
+ String jsonStr = "{\"vnfHostname\": \"home\", \"resourceInput\": \"sample\"}";
+ ObjectMapper objectMapper = new ObjectMapper();
+ VnfResource vnfResource = objectMapper.readValue(jsonStr, VnfResource.class);
+
+ assertTrue(vnfResource != null);
+ }
+
}
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