diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2018-03-22 12:25:48 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-22 12:25:48 +0000 |
commit | 9e4a0e9852f27e952c85272f0fdc4e2ae227a896 (patch) | |
tree | fa8d18d78085b167cd052416f204c9a88d00c132 /controlloop | |
parent | 512a8f5b4dc9afaf382dd76531dcbc0667551c58 (diff) | |
parent | 54150062fd38ba20bec6b68e4066538051c381f2 (diff) |
Merge "Fix Serialized Names for Legacy APPC"
Diffstat (limited to 'controlloop')
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) { |