aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl/appc/src
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-impl/appc/src')
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java72
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java46
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java41
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java28
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java52
5 files changed, 52 insertions, 187 deletions
diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java
index a3859b4ae..05507e60e 100644
--- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java
+++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java
@@ -29,7 +29,11 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.UUID;
+import lombok.Getter;
+import lombok.Setter;
+@Getter
+@Setter
public class CommonHeader implements Serializable {
private static final long serialVersionUID = -3581658269910980336L;
@@ -65,6 +69,8 @@ public class CommonHeader implements Serializable {
this.originatorId = commonHeader.originatorId;
this.requestId = commonHeader.requestId;
this.subRequestId = commonHeader.subRequestId;
+ this.timeStamp = commonHeader.getTimeStamp();
+ this.apiVer = commonHeader.getApiVer();
if (commonHeader.requestTrack != null) {
this.requestTrack.addAll(commonHeader.requestTrack);
}
@@ -73,62 +79,6 @@ public class CommonHeader implements Serializable {
}
}
- public Instant getTimeStamp() {
- return timeStamp;
- }
-
- public void setTimeStamp(Instant timeStamp) {
- this.timeStamp = timeStamp;
- }
-
- public String getApiVer() {
- return apiVer;
- }
-
- public void setApiVer(String apiVer) {
- this.apiVer = apiVer;
- }
-
- public String getOriginatorId() {
- return originatorId;
- }
-
- public void setOriginatorId(String originatorId) {
- this.originatorId = originatorId;
- }
-
- public UUID getRequestId() {
- return requestId;
- }
-
- public void setRequestId(UUID requestId) {
- this.requestId = requestId;
- }
-
- public String getSubRequestId() {
- return subRequestId;
- }
-
- public void setSubRequestId(String subRequestId) {
- this.subRequestId = subRequestId;
- }
-
- public Collection<String> getRequestTrack() {
- return requestTrack;
- }
-
- public void setRequestTrack(Collection<String> requestTrack) {
- this.requestTrack = requestTrack;
- }
-
- public Collection<Map<String, String>> getFlags() {
- return flags;
- }
-
- public void setFlags(Collection<Map<String, String>> flags) {
- this.flags = flags;
- }
-
@Override
public String toString() {
return "CommonHeader [TimeStamp=" + timeStamp + ", APIver=" + apiVer + ", OriginatorId=" + originatorId
@@ -205,13 +155,9 @@ public class CommonHeader implements Serializable {
return false;
}
if (timeStamp == null) {
- if (other.timeStamp != null) {
- return false;
- }
- } else if (!timeStamp.equals(other.timeStamp)) {
- return false;
+ return other.timeStamp == null;
+ } else {
+ return timeStamp.equals(other.timeStamp);
}
- return true;
}
-
}
diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java
index a9ad6d8da..e340360af 100644
--- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java
+++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java
@@ -26,7 +26,11 @@ import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
+@Getter
+@Setter
public class Request implements Serializable {
private static final long serialVersionUID = -3912323643990646431L;
@@ -43,52 +47,12 @@ public class Request implements Serializable {
private String objectId;
@SerializedName("Payload")
- private HashMap<String, Object> payload = new HashMap<>();
+ private Map<String, Object> payload = new HashMap<>();
public Request() {
// Initiate an empty Request instance
}
- public CommonHeader getCommonHeader() {
- return commonHeader;
- }
-
- public Map<String, Object> getPayload() {
- return payload;
- }
-
- public String getAction() {
- return action;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- public String getTargetId() {
- return targetId;
- }
-
- public void setTargetId(String targetId) {
- this.targetId = targetId;
- }
-
- public String getObjectId() {
- return objectId;
- }
-
- public void setObjectId(String objectId) {
- this.objectId = objectId;
- }
-
- public void setCommonHeader(CommonHeader commonHeader) {
- this.commonHeader = commonHeader;
- }
-
- public void setPayload(Map<String, Object> payload) {
- this.payload = new HashMap<>(payload);
- }
-
@Override
public int hashCode() {
final int prime = 31;
diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java
index d5fc66e5d..ae8b76423 100644
--- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java
+++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java
@@ -26,7 +26,11 @@ import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
+@Getter
+@Setter
public class Response implements Serializable {
private static final long serialVersionUID = 434953706339865151L;
@@ -38,7 +42,7 @@ public class Response implements Serializable {
private ResponseStatus status = new ResponseStatus();
@SerializedName("Payload")
- private HashMap<String, Object> payload = new HashMap<>();
+ private Map<String, Object> payload = new HashMap<>();
public Response() {
@@ -58,30 +62,6 @@ public class Response implements Serializable {
}
}
- public CommonHeader getCommonHeader() {
- return commonHeader;
- }
-
- public void setCommonHeader(CommonHeader commonHeader) {
- this.commonHeader = commonHeader;
- }
-
- public ResponseStatus getStatus() {
- return status;
- }
-
- public void setStatus(ResponseStatus status) {
- this.status = status;
- }
-
- public Map<String, Object> getPayload() {
- return payload;
- }
-
- public void setPayload(Map<String, Object> payload) {
- this.payload = new HashMap<>(payload);
- }
-
@Override
public String toString() {
return "Response [CommonHeader=" + commonHeader + ", Status=" + status + ", Payload=" + payload + "]";
@@ -124,14 +104,9 @@ public class Response implements Serializable {
return false;
}
if (status == null) {
- if (other.status != null) {
- return false;
- }
- } else if (!status.equals(other.status)) {
- return false;
+ return other.status == null;
+ } else {
+ return status.equals(other.status);
}
- return true;
}
-
-
}
diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java
index 68c059ca8..54589830f 100644
--- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java
+++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java
@@ -24,7 +24,11 @@ package org.onap.policy.appc;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
+import lombok.Getter;
+import lombok.Setter;
+@Getter
+@Setter
public class ResponseStatus implements Serializable {
private static final long serialVersionUID = 2421770469587860452L;
@@ -42,30 +46,6 @@ public class ResponseStatus implements Serializable {
return "ResponseStatus [Code=" + code + ", Value=" + value + ", Description=" + description + "]";
}
- public int getCode() {
- return code;
- }
-
- public void setCode(int code) {
- this.code = code;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
@Override
public int hashCode() {
final int prime = 31;
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java
index 560a7d8d5..00ac99de5 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java
@@ -75,54 +75,54 @@ public class RequestTest {
copiedRequest.setPayload(request.getPayload());
copiedRequest.setTargetId(request.getTargetId());
- assertTrue(request.equals(request));
- assertTrue(request.equals(copiedRequest));
- assertFalse(request.equals(null));
- assertFalse(request.equals("Hello"));
+ assertEquals(request, request);
+ assertEquals(request, copiedRequest);
+ assertNotEquals(null, request);
+ assertNotEquals("Hello", request);
request.setCommonHeader(null);
- assertFalse(request.equals(copiedRequest));
+ assertNotEquals(request, copiedRequest);
copiedRequest.setCommonHeader(null);
- assertTrue(request.equals(copiedRequest));
+ assertEquals(request, copiedRequest);
request.setCommonHeader(commonHeader);
- assertFalse(request.equals(copiedRequest));
+ assertNotEquals(request, copiedRequest);
copiedRequest.setCommonHeader(commonHeader);
- assertTrue(request.equals(copiedRequest));
+ assertEquals(request, copiedRequest);
request.setAction(null);
- assertFalse(request.equals(copiedRequest));
+ assertNotEquals(request, copiedRequest);
copiedRequest.setAction(null);
- assertTrue(request.equals(copiedRequest));
+ assertEquals(request, copiedRequest);
request.setAction(GO_TO_OZ);
- assertFalse(request.equals(copiedRequest));
+ assertNotEquals(request, copiedRequest);
copiedRequest.setAction(GO_TO_OZ);
- assertTrue(request.equals(copiedRequest));
+ assertEquals(request, copiedRequest);
request.setObjectId(null);
- assertFalse(request.equals(copiedRequest));
+ assertNotEquals(request, copiedRequest);
copiedRequest.setObjectId(null);
- assertTrue(request.equals(copiedRequest));
+ assertEquals(request, copiedRequest);
request.setObjectId(WIZARD);
- assertFalse(request.equals(copiedRequest));
+ assertNotEquals(request, copiedRequest);
copiedRequest.setObjectId(WIZARD);
- assertTrue(request.equals(copiedRequest));
+ assertEquals(request, copiedRequest);
request.setTargetId(null);
- assertFalse(request.equals(copiedRequest));
+ assertNotEquals(request, copiedRequest);
copiedRequest.setTargetId(null);
- assertTrue(request.equals(copiedRequest));
+ assertEquals(request, copiedRequest);
request.setTargetId("Oz");
- assertFalse(request.equals(copiedRequest));
+ assertNotEquals(request, copiedRequest);
copiedRequest.setTargetId("Oz");
- assertTrue(request.equals(copiedRequest));
+ assertEquals(request, copiedRequest);
- request.setPayload(new HashMap<String, Object>());
- assertFalse(request.equals(copiedRequest));
- copiedRequest.setPayload(new HashMap<String, Object>());
- assertTrue(request.equals(copiedRequest));
+ request.setPayload(new HashMap<>());
+ assertNotEquals(request, copiedRequest);
+ copiedRequest.setPayload(new HashMap<>());
+ assertEquals(request, copiedRequest);
request.setPayload(payload);
- assertFalse(request.equals(copiedRequest));
+ assertNotEquals(request, copiedRequest);
copiedRequest.setPayload(payload);
- assertTrue(request.equals(copiedRequest));
+ assertEquals(request, copiedRequest);
}
}