summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl/appc
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-06-17 17:35:26 -0400
committerJim Hahn <jrh3@att.com>2021-06-17 17:52:40 -0400
commitcad8b87bffb3b10c67f8b68ce8fcee5e5a3dcc35 (patch)
tree22748439c4a9c81bfb10e82577448e397f6c3996 /models-interactions/model-impl/appc
parent27ac6bce15318a074d4fb53606571eb30e46bf07 (diff)
Use lombok annotations for aai, appc, appclcm, cds
Issue-ID: POLICY-3396 Change-Id: I81b6b0c7929809ffaeadadd6144e9b9f394bfdc8 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-impl/appc')
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java17
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java17
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java15
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java52
-rw-r--r--models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java7
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java3
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java3
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java5
-rw-r--r--models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java5
9 files changed, 32 insertions, 92 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 d48d7250c..e2b6be268 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,11 +30,15 @@ import java.util.Map;
import java.util.UUID;
import lombok.EqualsAndHashCode;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
+import lombok.ToString;
@Getter
@Setter
@EqualsAndHashCode
+@NoArgsConstructor
+@ToString
public class CommonHeader implements Serializable {
private static final long serialVersionUID = -3581658269910980336L;
@@ -59,10 +63,6 @@ public class CommonHeader implements Serializable {
@SerializedName("Flags")
private Collection<Map<String, String>> flags = new ArrayList<>();
- public CommonHeader() {
- // Default constructor
- }
-
/**
* Construct an instance from an existing instance.
*
@@ -81,11 +81,4 @@ public class CommonHeader implements Serializable {
this.flags.addAll(commonHeader.flags);
}
}
-
- @Override
- public String toString() {
- return "CommonHeader [TimeStamp=" + timeStamp + ", APIver=" + apiVer + ", OriginatorId=" + originatorId
- + ", RequestId=" + requestId + ", SubrequestId=" + subRequestId + ", RequestTrack=" + requestTrack
- + ", Flags=" + flags + "]";
- }
}
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 c26566fe1..20b75d23a 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,11 +27,15 @@ import java.util.HashMap;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
+import lombok.ToString;
@Getter
@Setter
@EqualsAndHashCode
+@NoArgsConstructor
+@ToString
public class Request implements Serializable {
private static final long serialVersionUID = -3912323643990646431L;
@@ -49,15 +53,4 @@ public class Request implements Serializable {
@SerializedName("Payload")
private Map<String, Object> payload = new HashMap<>();
-
- public Request() {
- // Initiate an empty Request instance
- }
-
- @Override
- public String toString() {
- return "Request [CommonHeader=" + commonHeader + ", Action=" + action + ", TargetId=" + targetId + ", ObjectId="
- + objectId + ", Payload=" + payload + "]";
- }
-
}
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 3afbd53c7..2576e3806 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,11 +27,15 @@ import java.util.HashMap;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
+import lombok.ToString;
@Getter
@Setter
@EqualsAndHashCode
+@NoArgsConstructor
+@ToString
public class Response implements Serializable {
private static final long serialVersionUID = 434953706339865151L;
@@ -50,10 +54,6 @@ public class Response implements Serializable {
@SerializedName("Payload")
private Map<String, Object> payload = new HashMap<>();
- public Response() {
-
- }
-
/**
* Construct an instance from an existing instance.
*
@@ -67,9 +67,4 @@ public class Response implements Serializable {
this.payload.putAll(request.getPayload());
}
}
-
- @Override
- public String toString() {
- return "Response [CommonHeader=" + commonHeader + ", Status=" + status + ", Payload=" + payload + "]";
- }
}
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 6a0e19a42..6e8a72de7 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
@@ -23,11 +23,15 @@ package org.onap.policy.appc;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
+import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
+import lombok.ToString;
@Getter
@Setter
+@EqualsAndHashCode
+@ToString
public class ResponseStatus implements Serializable {
private static final long serialVersionUID = 2421770469587860452L;
@@ -39,52 +43,4 @@ public class ResponseStatus implements Serializable {
@SerializedName("Description")
private String description;
-
- @Override
- public String toString() {
- return "ResponseStatus [Code=" + code + ", Value=" + value + ", Description=" + description + "]";
- }
-
- @Override
- public int hashCode() {
- final var prime = 31;
- var result = 1;
- result = prime * result + code;
- result = prime * result + ((description == null) ? 0 : description.hashCode());
- result = prime * result + ((value == null) ? 0 : value.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ResponseStatus other = (ResponseStatus) obj;
- if (code != other.code) {
- return false;
- }
- if (description == null) {
- if (other.description != null) {
- return false;
- }
- } else if (!description.equals(other.description)) {
- return false;
- }
- if (value == null) {
- if (other.value != null) {
- return false;
- }
- } else if (!value.equals(other.value)) {
- return false;
- }
- return true;
- }
-
}
diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java
index 9fa503131..faf3fc49c 100644
--- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java
+++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java
@@ -26,9 +26,12 @@ import com.google.gson.GsonBuilder;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.onap.policy.common.gson.InstantAsMillisTypeAdapter;
import org.onap.policy.common.gson.ZonedDateTimeTypeAdapter;
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class Serialization {
public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx");
@@ -38,8 +41,4 @@ public final class Serialization {
// .registerTypeAdapter(CommonHeader1607.class, new gsonCommonHeaderInstance())
// .registerTypeAdapter(ResponseStatus1607.class, new gsonResponseStatus())
.create();
-
- private Serialization() {
- // Private constructor to prevent subclassing
- }
}
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java
index 686e6a416..8c00fd5de 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.appc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
@@ -73,7 +74,7 @@ public class CommonHeaderTest {
assertNotEquals(0, commonHeader.hashCode());
- assertEquals("CommonHeader [TimeStamp=", commonHeader.toString().substring(0, 24));
+ assertThat(commonHeader.toString()).startsWith("CommonHeader(timeStamp=");
CommonHeader copiedCommonHeader = new CommonHeader();
copiedCommonHeader.setApiVer(commonHeader.getApiVer());
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 5bff56b78..52b974c54 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
@@ -21,6 +21,7 @@
package org.onap.policy.appc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
@@ -64,7 +65,7 @@ public class RequestTest {
assertNotEquals(0, request.hashCode());
- assertEquals("Request [CommonHeader=CommonHeader [TimeStamp=", request.toString().substring(0, 46));
+ assertThat(request.toString()).startsWith("Request(commonHeader=CommonHeader(timeStamp=");
Request copiedRequest = new Request();
copiedRequest.setCommonHeader(request.getCommonHeader());
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java
index c79062594..cd4e2a697 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,7 @@
package org.onap.policy.appc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
@@ -48,7 +49,7 @@ public class ResponseStatusTest {
assertEquals(THERE_S_NO_PLACE_LIKE_HOME, status.getValue());
assertNotEquals(0, status.hashCode());
- assertEquals("ResponseStatus [Code=1234, Value=There's no pla", status.toString().substring(0, 47));
+ assertThat(status.toString()).startsWith("ResponseStatus(code=1234, value=There's no pla");
ResponseStatus copiedStatus = new ResponseStatus();
copiedStatus.setCode(status.getCode());
diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java
index 9e20331f9..42e5a6d85 100644
--- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java
+++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,7 @@
package org.onap.policy.appc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
@@ -60,7 +61,7 @@ public class ResponseTest {
assertNotEquals(0, response.hashCode());
- assertEquals("Response [CommonHeader=CommonHeader [TimeStamp=", response.toString().substring(0, 47));
+ assertThat(response.toString()).startsWith("Response(commonHeader=CommonHeader(timeStamp=");
Response copiedResponse = new Response();
copiedResponse.setCommonHeader(response.getCommonHeader());