aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actorServiceProvider/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-02-18 08:13:45 -0500
committerJim Hahn <jrh3@att.com>2020-02-18 12:51:37 -0500
commitef562e809d00aea6fbdaf845b7dd1ada26f40e22 (patch)
treecf853dad82697813ed4ef639af918109f61b6095 /models-interactions/model-actors/actorServiceProvider/src
parent1bb549251599ce7866e1143158a68b5f259d22b1 (diff)
Actor updates to support SO
Used SuperBuilder in operation Params classes. Added rawResponse to http setOutcome(). Made HttpOperation.operator private. Issue-ID: POLICY-2371 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Ie894f2e6ae4a31b69a700e425f9e94c5e8a15daa
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider/src')
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java13
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/BidirectionalTopicParams.java4
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpParams.java4
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/BidirectionalTopicParamsTest.java5
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpParamsTest.java2
5 files changed, 17 insertions, 11 deletions
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java
index c3c0f6dc2..da4887e15 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java
@@ -54,7 +54,7 @@ public abstract class HttpOperation<T> extends OperationPartial {
/**
* Operator that created this operation.
*/
- protected final HttpOperator operator;
+ private final HttpOperator operator;
/**
* Response class.
@@ -188,11 +188,11 @@ public abstract class HttpOperation<T> extends OperationPartial {
if (!isSuccess(rawResponse, response)) {
logger.info("{}.{} request failed with http error code {} for {}", params.getActor(), params.getOperation(),
rawResponse.getStatus(), params.getRequestId());
- return CompletableFuture.completedFuture(setOutcome(outcome, PolicyResult.FAILURE, response));
+ return CompletableFuture.completedFuture(setOutcome(outcome, PolicyResult.FAILURE, rawResponse, response));
}
logger.info("{}.{} request succeeded for {}", params.getActor(), params.getOperation(), params.getRequestId());
- setOutcome(outcome, PolicyResult.SUCCESS, response);
+ setOutcome(outcome, PolicyResult.SUCCESS, rawResponse, response);
return postProcessResponse(outcome, url, rawResponse, response);
}
@@ -201,10 +201,13 @@ public abstract class HttpOperation<T> extends OperationPartial {
*
* @param outcome operation to be updated
* @param result result of the operation
- * @param response response used to populate the outcome
+ * @param rawResponse raw response
+ * @param response decoded response
* @return the updated operation
*/
- public OperationOutcome setOutcome(OperationOutcome outcome, PolicyResult result, T response) {
+ public OperationOutcome setOutcome(OperationOutcome outcome, PolicyResult result, Response rawResponse,
+ T response) {
+
return setOutcome(outcome, result);
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/BidirectionalTopicParams.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/BidirectionalTopicParams.java
index cafca1fa6..d1d3faf1a 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/BidirectionalTopicParams.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/BidirectionalTopicParams.java
@@ -20,8 +20,8 @@
package org.onap.policy.controlloop.actorserviceprovider.parameters;
-import lombok.Builder;
import lombok.Data;
+import lombok.experimental.SuperBuilder;
import org.onap.policy.common.parameters.BeanValidator;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.common.parameters.annotations.Min;
@@ -34,7 +34,7 @@ import org.onap.policy.common.parameters.annotations.NotNull;
@NotNull
@NotBlank
@Data
-@Builder(toBuilder = true)
+@SuperBuilder(toBuilder = true)
public class BidirectionalTopicParams {
/**
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpParams.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpParams.java
index 2d3ab8b54..57270ac65 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpParams.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpParams.java
@@ -20,8 +20,8 @@
package org.onap.policy.controlloop.actorserviceprovider.parameters;
-import lombok.Builder;
import lombok.Data;
+import lombok.experimental.SuperBuilder;
import org.onap.policy.common.parameters.BeanValidator;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.common.parameters.annotations.Min;
@@ -34,7 +34,7 @@ import org.onap.policy.common.parameters.annotations.NotNull;
@NotNull
@NotBlank
@Data
-@Builder(toBuilder = true)
+@SuperBuilder(toBuilder = true)
public class HttpParams {
/**
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/BidirectionalTopicParamsTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/BidirectionalTopicParamsTest.java
index 7e44fa2e1..0ec0bb57c 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/BidirectionalTopicParamsTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/BidirectionalTopicParamsTest.java
@@ -67,8 +67,11 @@ public class BidirectionalTopicParamsTest {
assertEquals(params, params.toBuilder().build());
}
+ // @formatter:off
private void testValidateField(String fieldName, String expected,
- Function<BidirectionalTopicParamsBuilder, BidirectionalTopicParamsBuilder> makeInvalid) {
+ @SuppressWarnings("rawtypes") Function<BidirectionalTopicParamsBuilder, BidirectionalTopicParamsBuilder>
+ makeInvalid) {
+ // @formatter:on
// original params should be valid
ValidationResult result = params.validate(CONTAINER);
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpParamsTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpParamsTest.java
index fdfb4b495..8d4d44685 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpParamsTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/HttpParamsTest.java
@@ -68,7 +68,7 @@ public class HttpParamsTest {
}
private void testValidateField(String fieldName, String expected,
- Function<HttpParamsBuilder, HttpParamsBuilder> makeInvalid) {
+ @SuppressWarnings("rawtypes") Function<HttpParamsBuilder, HttpParamsBuilder> makeInvalid) {
// original params should be valid
ValidationResult result = params.validate(CONTAINER);