summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN
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
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')
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java25
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java14
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java15
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java3
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java13
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java4
-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
12 files changed, 227 insertions, 16 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java
index 9c80548490..52207f2156 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/RollbackData.java
@@ -25,24 +25,26 @@ import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
/**
- * An object that stores data for rollbacks. Data is organized by type. A
- * type is simply a string identifier. Multiple types of data may be stored
- * in the same object for separate rollback operations.
+ * An object that stores data for rollbacks. Data is organized by type. A type is simply a string
+ * identifier. Multiple types of data may be stored in the same object for separate rollback
+ * operations.
*/
public class RollbackData implements Serializable {
private static final long serialVersionUID = 1L;
- private Map<String, Map<String, Serializable>> dictionary =
- new HashMap<>();
+ @JsonProperty
+ private final Map<String, Map<String, Serializable>> dictionary = new HashMap<>();
/**
* Returns true if the specified type is stored in this object.
*
* @param type the data type
*/
- public boolean hasType(String type) {
+ public boolean hasType(final String type) {
return dictionary.containsKey(type);
}
@@ -53,9 +55,8 @@ public class RollbackData implements Serializable {
* @param key the key
* @param value the value
*/
- public void put(String type, String key, String value) {
- Map<String, Serializable> mapForType = dictionary
- .computeIfAbsent(type, k -> new HashMap<>());
+ public void put(final String type, final String key, final String value) {
+ final Map<String, Serializable> mapForType = dictionary.computeIfAbsent(type, k -> new HashMap<>());
mapForType.put(key, value);
}
@@ -67,8 +68,8 @@ public class RollbackData implements Serializable {
* @param key the key
* @return the item or null if there is no item for the specified type and key
*/
- public Serializable get(String type, String key) {
- Map<String, Serializable> mapForType = dictionary.get(type);
+ public Serializable get(final String type, final String key) {
+ final Map<String, Serializable> mapForType = dictionary.get(type);
if (mapForType == null) {
return null;
@@ -83,7 +84,7 @@ public class RollbackData implements Serializable {
* @param type the data type
* @return a map, or null if there are no items associated with the specified data type
*/
- public Map<String, Serializable> get(String type) {
+ public Map<String, Serializable> get(final String type) {
return dictionary.get(type);
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java
index f143346cae..c7c7bba20c 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java
@@ -22,6 +22,8 @@ package org.onap.so.bpmn.core.domain;
import java.util.UUID;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
@@ -55,6 +57,9 @@ public class AllottedResource extends Resource {
private String nfNamingCode;
private String orchestrationStatus;
+ @JsonIgnore
+ private String resourceInput;
+
/*
* GET and SET
*/
@@ -119,4 +124,13 @@ public class AllottedResource extends Resource {
public void setOrchestrationStatus(String orchestrationStatus) {
this.orchestrationStatus = orchestrationStatus;
}
+
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java
index 20ab3ecc84..f0e97f15ef 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java
@@ -22,6 +22,8 @@ package org.onap.so.bpmn.core.domain;
import java.util.UUID;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -47,7 +49,10 @@ public class NetworkResource extends Resource {
private String networkRole;
private String networkTechnology;
private String networkScope;
-
+
+ @JsonIgnore
+ private String resourceInput;
+
/*
* GET and SET
*/
@@ -75,4 +80,12 @@ public class NetworkResource extends Resource {
public void setNetworkScope(String networkScope) {
this.networkScope = networkScope;
}
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
index 4295f50a3c..5cdbbcb7c9 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
@@ -23,6 +23,8 @@ package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
@@ -32,6 +34,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
* @author cb645j
*
*/
+@JsonIgnoreProperties(ignoreUnknown = true)
public class ServiceInstance extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
index dc76ab0bc7..a7e5389583 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
@@ -25,6 +25,7 @@ import java.util.List;
import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -59,6 +60,9 @@ public class VnfResource extends Resource {
private String multiStageDesign;
private String orchestrationStatus;
+ @JsonIgnore
+ private String resourceInput;
+
/*
* GET and SET
*/
@@ -123,6 +127,15 @@ public class VnfResource extends Resource {
public void setOrchestrationStatus(String orchestrationStatus){
this.orchestrationStatus = orchestrationStatus;
}
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
+
/**
* Returns a list of all VfModule objects.
* Base module is first entry in the list
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
index ee53148e44..35f76908e3 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
@@ -927,7 +927,7 @@ public class JsonUtils {
for (int i = 0; i < arr.length(); i++){
JSONObject jo = arr.getJSONObject(i);
String key = jo.getString(keyNode);
- String value = jo.getString(valueNode);
+ String value = jo.get(valueNode).toString();
map.put(key, value);
}
msoLogger.debug("Completed Entry Array To Map Util Method");
@@ -954,7 +954,7 @@ public class JsonUtils {
for(int i = 0; i < arr.length(); i++){
JSONObject jo = arr.getJSONObject(i);
String key = jo.getString(keyNode);
- String value = jo.getString(valueNode);
+ String value = jo.get(valueNode).toString();
map.put(key, value);
}
msoLogger.debug("Completed Entry Array To Map Util Method");
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