aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2019-01-04 12:39:08 +0530
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2019-01-08 22:10:09 +0100
commit2e5bd7ed14d30437ccd662be63fe117c9702d75f (patch)
treeedd5543c8223d70dab7cfe45c42037f40dc2a384 /bpmn/MSOCoreBPMN
parent8a98627029dc451f3511182b5a56c5321f3b9b89 (diff)
Fix json parsing of resource input
Fix json parsing of resource input by adding escape character. Change-Id: Ic19bd5dae5eea25faaeae2df3eb0bcc29482ea7c Issue-ID: SO-1358 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'bpmn/MSOCoreBPMN')
-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/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
8 files changed, 89 insertions, 1 deletions
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/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);
+ }
+
}