summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCRUZ <dc443y@att.com>2018-03-21 19:49:32 -0500
committerdc443y <dc443y@att.com>2018-03-21 20:17:29 -0500
commit54150062fd38ba20bec6b68e4066538051c381f2 (patch)
treeebf8067807adbab1769f491f952d5417324389d6
parent6718f2da899b21b4adc7d004a4e592039645d75a (diff)
Fix Serialized Names for Legacy APPC
The legacy APPC request and response messages must be upper camel case. Issue-ID: POLICY-681 Change-Id: I439fa22b76dd2cb35a054bf93260705b8cf1af51 Signed-off-by: dc443y <dc443y@att.com>
-rw-r--r--controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java6
-rw-r--r--controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java15
-rw-r--r--controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java11
-rw-r--r--controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java7
-rw-r--r--controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java3
-rw-r--r--controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java7
-rw-r--r--controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java3
7 files changed, 49 insertions, 3 deletions
diff --git a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
index 58510ba8c..eb0eef927 100644
--- a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
+++ b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
@@ -142,10 +142,10 @@ public class AppcServiceProviderTest {
logger.debug("JSON Output: \n" + jsonRequest);
/* The JSON string must contain the following fields */
- assertTrue(jsonRequest.contains("commonHeader"));
- assertTrue(jsonRequest.contains("action"));
+ assertTrue(jsonRequest.contains("CommonHeader"));
+ assertTrue(jsonRequest.contains("Action"));
assertTrue(jsonRequest.contains("ModifyConfig"));
- assertTrue(jsonRequest.contains("payload"));
+ assertTrue(jsonRequest.contains("Payload"));
assertTrue(jsonRequest.contains("generic-vnf.vnf-id"));
assertTrue(jsonRequest.contains("pg-streams"));
diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java
index 8ae029b76..506303fc2 100644
--- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java
+++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java
@@ -27,15 +27,30 @@ import java.util.Collection;
import java.util.Map;
import java.util.UUID;
+import com.google.gson.annotations.SerializedName;
+
public class CommonHeader implements Serializable {
private static final long serialVersionUID = -3581658269910980336L;
+ @SerializedName("TimeStamp")
private Instant timeStamp = Instant.now();
+
+ @SerializedName("APIver")
private String apiVer = "1.01";
+
+ @SerializedName("OriginatorID")
private String originatorID;
+
+ @SerializedName("RequestID")
private UUID requestID;
+
+ @SerializedName("SubRequestID")
private String subRequestID;
+
+ @SerializedName("RequestTrack")
private Collection<String> requestTrack = new ArrayList<>();
+
+ @SerializedName("Flags")
private Collection<Map<String, String>> flags = new ArrayList<>();
public CommonHeader() {
diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java
index a74626000..fd37d31b2 100644
--- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java
+++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java
@@ -24,13 +24,24 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
+import com.google.gson.annotations.SerializedName;
+
public class Request implements Serializable{
private static final long serialVersionUID = -3912323643990646431L;
+ @SerializedName("CommonHeader")
private CommonHeader commonHeader;
+
+ @SerializedName("Action")
private String action;
+
+ @SerializedName("TargetID")
private String targetID;
+
+ @SerializedName("ObjectID")
private String objectID;
+
+ @SerializedName("Payload")
private HashMap<String, Object> payload = new HashMap<>();
public Request() {
diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java
index e00205998..b117350ae 100644
--- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java
+++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java
@@ -24,11 +24,18 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
+import com.google.gson.annotations.SerializedName;
+
public class Response implements Serializable {
private static final long serialVersionUID = 434953706339865151L;
+ @SerializedName("CommonHeader")
private CommonHeader commonHeader;
+
+ @SerializedName("Status")
private ResponseStatus status = new ResponseStatus();
+
+ @SerializedName("Payload")
private HashMap<String, Object> payload = new HashMap<>();
public Response() {
diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java
index fa96067c4..3b0d445aa 100644
--- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java
+++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java
@@ -20,6 +20,8 @@
package org.onap.policy.appc;
+import com.google.gson.annotations.SerializedName;
+
public enum ResponseCode {
ACCEPT(100),
ERROR(200),
@@ -28,6 +30,7 @@ public enum ResponseCode {
FAILURE(500)
;
+ @SerializedName("Code")
private Integer code;
private ResponseCode(int code) {
diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java
index 7cef50127..7f85ac7a7 100644
--- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java
+++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java
@@ -22,11 +22,18 @@ package org.onap.policy.appc;
import java.io.Serializable;
+import com.google.gson.annotations.SerializedName;
+
public class ResponseStatus implements Serializable {
private static final long serialVersionUID = 2421770469587860452L;
+ @SerializedName("Code")
private int code;
+
+ @SerializedName("Value")
private String value;
+
+ @SerializedName("Description")
private String description;
@Override
diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java
index e750b60a6..8d9bede23 100644
--- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java
+++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java
@@ -20,6 +20,8 @@
package org.onap.policy.appc;
+import com.google.gson.annotations.SerializedName;
+
public enum ResponseValue {
ACCEPT("ACCEPT"),
ERROR("ERROR"),
@@ -28,6 +30,7 @@ public enum ResponseValue {
FAILURE("FAILURE")
;
+ @SerializedName("Value")
private String value;
private ResponseValue(String value) {