From ef562e809d00aea6fbdaf845b7dd1ada26f40e22 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 18 Feb 2020 08:13:45 -0500 Subject: 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 Change-Id: Ie894f2e6ae4a31b69a700e425f9e94c5e8a15daa --- .../actorserviceprovider/impl/HttpOperation.java | 13 ++++++++----- .../parameters/BidirectionalTopicParams.java | 4 ++-- .../actorserviceprovider/parameters/HttpParams.java | 4 ++-- .../parameters/BidirectionalTopicParamsTest.java | 5 ++++- .../actorserviceprovider/parameters/HttpParamsTest.java | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-) (limited to 'models-interactions/model-actors/actorServiceProvider/src') 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 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 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 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 makeInvalid) { + @SuppressWarnings("rawtypes") Function + 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 makeInvalid) { + @SuppressWarnings("rawtypes") Function makeInvalid) { // original params should be valid ValidationResult result = params.validate(CONTAINER); -- cgit 1.2.3-korg