aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-actors')
-rw-r--r--models-interactions/model-actors/actor.aai/pom.xml2
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java4
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java1
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java1
-rw-r--r--models-interactions/model-actors/actor.appc/pom.xml2
-rw-r--r--models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java2
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java3
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.appclcm/pom.xml2
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java2
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java9
-rw-r--r--models-interactions/model-actors/actor.cds/pom.xml2
-rw-r--r--models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java2
-rw-r--r--models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java12
-rw-r--r--models-interactions/model-actors/actor.guard/pom.xml2
-rw-r--r--models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/GuardOperation.java2
-rw-r--r--models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/GuardOperationTest.java13
-rw-r--r--models-interactions/model-actors/actor.sdnc/pom.xml2
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java3
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java6
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java3
-rw-r--r--models-interactions/model-actors/actor.sdnr/pom.xml2
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java12
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.so/pom.xml2
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java2
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java4
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java6
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java5
-rw-r--r--models-interactions/model-actors/actor.test/pom.xml2
-rw-r--r--models-interactions/model-actors/actor.vfc/pom.xml2
-rw-r--r--models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java2
-rw-r--r--models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java3
-rw-r--r--models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java18
-rw-r--r--models-interactions/model-actors/actorServiceProvider/pom.xml2
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.java7
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java1
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java1
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcomeTest.java3
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java14
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java8
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java4
-rw-r--r--models-interactions/model-actors/pom.xml2
43 files changed, 143 insertions, 38 deletions
diff --git a/models-interactions/model-actors/actor.aai/pom.xml b/models-interactions/model-actors/actor.aai/pom.xml
index 07407f7ea..940b4bd80 100644
--- a/models-interactions/model-actors/actor.aai/pom.xml
+++ b/models-interactions/model-actors/actor.aai/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actor.aai</artifactId>
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
index 243a0c696..ca6cfb2f8 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.aai;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.Assert.assertEquals;
@@ -123,6 +124,9 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation<Map<String, S
outcome = oper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+
+ String resp = outcome.getResponse();
+ assertThat(resp).isNotNull().contains("relationship-list");
}
@Test
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
index 22702404b..d197789ca 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
@@ -92,6 +92,7 @@ public class AaiGetPnfOperationTest extends BasicAaiOperation<Void> {
outcome = oper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof StandardCoderObject);
}
/**
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
index 496d2ea68..1e9a1d987 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
@@ -92,6 +92,7 @@ public class AaiGetTenantOperationTest extends BasicAaiOperation<Void> {
outcome = oper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof StandardCoderObject);
}
/**
diff --git a/models-interactions/model-actors/actor.appc/pom.xml b/models-interactions/model-actors/actor.appc/pom.xml
index 43f360bdd..30e6cbc5e 100644
--- a/models-interactions/model-actors/actor.appc/pom.xml
+++ b/models-interactions/model-actors/actor.appc/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actor.appc</artifactId>
diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java
index 75a4c9f58..14ab355bf 100644
--- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java
+++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java
@@ -171,6 +171,8 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request,
*/
@Override
public OperationOutcome setOutcome(OperationOutcome outcome, PolicyResult result, Response response) {
+ outcome.setResponse(response);
+
if (response.getStatus() == null || response.getStatus().getDescription() == null) {
return setOutcome(outcome, result);
}
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java
index 4c6477d93..b2d012a9f 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java
@@ -212,6 +212,7 @@ public class AppcOperationTest extends BasicAppcOperation {
assertSame(outcome, oper.setOutcome(outcome, PolicyResult.SUCCESS, response));
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
assertNotNull(outcome.getMessage());
+ assertSame(response, outcome.getResponse());
response.setStatus(status);
// null description
@@ -219,12 +220,14 @@ public class AppcOperationTest extends BasicAppcOperation {
assertSame(outcome, oper.setOutcome(outcome, PolicyResult.FAILURE, response));
assertEquals(PolicyResult.FAILURE, outcome.getResult());
assertNotNull(outcome.getMessage());
+ assertSame(response, outcome.getResponse());
status.setDescription(MY_DESCRIPTION);
for (PolicyResult result : PolicyResult.values()) {
assertSame(outcome, oper.setOutcome(outcome, result, response));
assertEquals(result, outcome.getResult());
assertEquals(MY_DESCRIPTION, outcome.getMessage());
+ assertSame(response, outcome.getResponse());
}
}
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java
index 4f4f506ce..0e29dd208 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java
@@ -42,6 +42,7 @@ import org.junit.Test;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.appc.Request;
+import org.onap.policy.appc.Response;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
@@ -108,6 +109,7 @@ public class ModifyConfigOperationTest extends BasicAppcOperation {
outcome = oper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof Response);
}
@Test
diff --git a/models-interactions/model-actors/actor.appclcm/pom.xml b/models-interactions/model-actors/actor.appclcm/pom.xml
index 448e70793..de91da4e1 100644
--- a/models-interactions/model-actors/actor.appclcm/pom.xml
+++ b/models-interactions/model-actors/actor.appclcm/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actor.appclcm</artifactId>
diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
index e34d3c586..3e5ed2c27 100644
--- a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
+++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java
@@ -182,6 +182,8 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
*/
@Override
public OperationOutcome setOutcome(OperationOutcome outcome, PolicyResult result, AppcLcmDmaapWrapper response) {
+ outcome.setResponse(response);
+
AppcLcmResponseStatus status = getStatus(response);
if (status == null) {
return setOutcome(outcome, result);
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
index b2a44af53..c5ec58acd 100644
--- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
+++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -127,6 +128,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation {
outcome = oper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof AppcLcmDmaapWrapper);
}
@Test
@@ -163,7 +165,8 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation {
assertTrue(executor.runAll(100));
assertTrue(future2.isDone());
- assertEquals(PolicyResult.SUCCESS, future2.get().getResult());
+ outcome = future2.get();
+ assertEquals(PolicyResult.SUCCESS, outcome.getResult());
}
@Test
@@ -258,21 +261,25 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation {
oper.setOutcome(outcome, PolicyResult.SUCCESS, response);
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
assertEquals(MY_MESSAGE, outcome.getMessage());
+ assertSame(response, outcome.getResponse());
// failure
oper.setOutcome(outcome, PolicyResult.FAILURE, response);
assertEquals(PolicyResult.FAILURE, outcome.getResult());
assertEquals(MY_MESSAGE, outcome.getMessage());
+ assertSame(response, outcome.getResponse());
// null message
response.getBody().getOutput().getStatus().setMessage(null);
oper.setOutcome(outcome, PolicyResult.SUCCESS, response);
assertEquals(ControlLoopOperation.SUCCESS_MSG, outcome.getMessage());
+ assertSame(response, outcome.getResponse());
// null status
response.getBody().getOutput().setStatus(null);
oper.setOutcome(outcome, PolicyResult.SUCCESS, response);
assertEquals(ControlLoopOperation.SUCCESS_MSG, outcome.getMessage());
+ assertSame(response, outcome.getResponse());
}
@Test
diff --git a/models-interactions/model-actors/actor.cds/pom.xml b/models-interactions/model-actors/actor.cds/pom.xml
index b07a177f8..fff0dd712 100644
--- a/models-interactions/model-actors/actor.cds/pom.xml
+++ b/models-interactions/model-actors/actor.cds/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actor.cds</artifactId>
<dependencies>
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
index 2afa9fa2e..d0f5bd2b4 100644
--- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
+++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
@@ -62,10 +62,12 @@ public class CdsActorServiceManager implements CdsProcessorListener {
break;
case EVENT_COMPONENT_EXECUTED:
outcome.setResult(PolicyResult.SUCCESS);
+ outcome.setResponse(message);
future.complete(outcome);
break;
default:
outcome.setResult(PolicyResult.FAILURE);
+ outcome.setResponse(message);
future.complete(outcome);
break;
}
diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java
index 83473a89a..908b05c08 100644
--- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java
+++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.controlloop.actor.cds;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.util.concurrent.CompletableFuture;
@@ -59,8 +60,9 @@ public class GrpcActorServiceManagerTest {
Status status = Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_EXECUTED).build();
output = ExecutionServiceOutput.newBuilder().setStatus(status).build();
manager.onMessage(output);
- assertEquals(PolicyResult.SUCCESS, future.get(2, TimeUnit.SECONDS).getResult());
- assertTrue(future.isDone());
+ OperationOutcome outcome = future.get(2, TimeUnit.SECONDS);
+ assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertSame(output, outcome.getResponse());
}
@Test
@@ -79,8 +81,9 @@ public class GrpcActorServiceManagerTest {
Status status = Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_FAILURE).build();
output = ExecutionServiceOutput.newBuilder().setStatus(status).build();
manager.onMessage(output);
- assertEquals(PolicyResult.FAILURE, future.get(2, TimeUnit.SECONDS).getResult());
- assertTrue(future.isDone());
+ OperationOutcome outcome = future.get(2, TimeUnit.SECONDS);
+ assertEquals(PolicyResult.FAILURE, outcome.getResult());
+ assertSame(output, outcome.getResponse());
}
@Test
@@ -89,6 +92,5 @@ public class GrpcActorServiceManagerTest {
Exception exception = new Exception("something failed");
manager.onError(exception);
assertTrue(future.isCompletedExceptionally());
- assertTrue(future.isDone());
}
}
diff --git a/models-interactions/model-actors/actor.guard/pom.xml b/models-interactions/model-actors/actor.guard/pom.xml
index 9b1927563..d4e056ce6 100644
--- a/models-interactions/model-actors/actor.guard/pom.xml
+++ b/models-interactions/model-actors/actor.guard/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actor.guard</artifactId>
diff --git a/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/GuardOperation.java b/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/GuardOperation.java
index 3a7821ec2..da1f95603 100644
--- a/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/GuardOperation.java
+++ b/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/GuardOperation.java
@@ -142,6 +142,8 @@ public class GuardOperation extends HttpOperation<DecisionResponse> {
protected CompletableFuture<OperationOutcome> postProcessResponse(OperationOutcome outcome, String url,
Response rawResponse, DecisionResponse response) {
+ outcome.setResponse(response);
+
// determine the result
String status = response.getStatus();
if (status == null) {
diff --git a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/GuardOperationTest.java b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/GuardOperationTest.java
index 58d54a5ed..daf4dff6e 100644
--- a/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/GuardOperationTest.java
+++ b/models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/GuardOperationTest.java
@@ -24,6 +24,8 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
@@ -119,6 +121,7 @@ public class GuardOperationTest extends BasicHttpOperation<DecisionRequest> {
outcome = oper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof DecisionResponse);
}
/**
@@ -135,6 +138,7 @@ public class GuardOperationTest extends BasicHttpOperation<DecisionRequest> {
outcome = oper.start().get();
assertEquals(PolicyResult.FAILURE, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof DecisionResponse);
}
@Test
@@ -159,7 +163,9 @@ public class GuardOperationTest extends BasicHttpOperation<DecisionRequest> {
executor.runAll(100);
assertTrue(future2.isDone());
- assertEquals(PolicyResult.SUCCESS, future2.get().getResult());
+ outcome = future2.get();
+ assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(resp, outcome.getResponse());
assertNotNull(oper.getSubRequestId());
assertEquals(oper.getSubRequestId(), future2.get().getSubRequestId());
@@ -181,7 +187,9 @@ public class GuardOperationTest extends BasicHttpOperation<DecisionRequest> {
// should already be done
assertTrue(future2.isDone());
- assertEquals(PolicyResult.SUCCESS, future2.get().getResult());
+ outcome = future2.get();
+ assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertNull(outcome.getResponse());
// ensure callbacks were invoked
verify(started).accept(any());
@@ -246,6 +254,7 @@ public class GuardOperationTest extends BasicHttpOperation<DecisionRequest> {
oper.postProcessResponse(outcome, BASE_URI, rawResponse, response);
assertEquals(expectedResult, outcome.getResult());
assertEquals(expectedMessage, outcome.getMessage());
+ assertSame(response, outcome.getResponse());
}
@Override
diff --git a/models-interactions/model-actors/actor.sdnc/pom.xml b/models-interactions/model-actors/actor.sdnc/pom.xml
index 700d13a02..7a657c0e3 100644
--- a/models-interactions/model-actors/actor.sdnc/pom.xml
+++ b/models-interactions/model-actors/actor.sdnc/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actor.sdnc</artifactId>
diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java
index 2b856707e..95b4bd739 100644
--- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java
+++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.controlloop.actor.sdnc;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.Map;
import org.junit.AfterClass;
@@ -32,6 +33,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.sdnc.SdncRequest;
+import org.onap.policy.sdnc.SdncResponse;
public class BandwidthOnDemandOperationTest extends BasicSdncOperation {
@@ -80,6 +82,7 @@ public class BandwidthOnDemandOperationTest extends BasicSdncOperation {
outcome = oper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof SdncResponse);
}
@Test
diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java
index bb1285ea3..921694269 100644
--- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java
+++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java
@@ -126,9 +126,11 @@ public abstract class BasicSdncOperation extends BasicHttpOperation<SdncRequest>
executor.runAll(100);
assertTrue(future2.isDone());
- assertEquals(PolicyResult.SUCCESS, future2.get().getResult());
+ outcome = future2.get();
+ assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof SdncResponse);
- assertNotNull(future2.get().getSubRequestId());
+ assertNotNull(outcome.getSubRequestId());
return requestCaptor.getValue().getEntity();
}
diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java
index 678648db3..142f10743 100644
--- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java
+++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.controlloop.actor.sdnc;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.Map;
import org.junit.AfterClass;
@@ -32,6 +33,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.sdnc.SdncRequest;
+import org.onap.policy.sdnc.SdncResponse;
public class RerouteOperationTest extends BasicSdncOperation {
@@ -74,6 +76,7 @@ public class RerouteOperationTest extends BasicSdncOperation {
outcome = oper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof SdncResponse);
}
@Test
diff --git a/models-interactions/model-actors/actor.sdnr/pom.xml b/models-interactions/model-actors/actor.sdnr/pom.xml
index 21adbb7ef..63d961d3d 100644
--- a/models-interactions/model-actors/actor.sdnr/pom.xml
+++ b/models-interactions/model-actors/actor.sdnr/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actor.sdnr</artifactId>
diff --git a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
index 40face7fa..d0bb38e43 100644
--- a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
+++ b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
@@ -118,20 +118,22 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
*/
@Override
public OperationOutcome setOutcome(OperationOutcome outcome, PolicyResult result, PciMessage responseWrapper) {
+ outcome.setResponse(responseWrapper);
+
if (responseWrapper.getBody() == null || responseWrapper.getBody().getOutput() == null) {
outcome.setControlLoopResponse(makeControlLoopResponse(null));
return setOutcome(outcome, result);
}
- PciResponse response = responseWrapper.getBody().getOutput();
- if (response.getStatus() == null || response.getStatus().getValue() == null) {
- outcome.setControlLoopResponse(makeControlLoopResponse(response.getPayload()));
+ PciResponse pciResponse = responseWrapper.getBody().getOutput();
+ if (pciResponse.getStatus() == null || pciResponse.getStatus().getValue() == null) {
+ outcome.setControlLoopResponse(makeControlLoopResponse(pciResponse.getPayload()));
return setOutcome(outcome, result);
}
outcome.setResult(result);
- outcome.setMessage(response.getStatus().getValue());
- outcome.setControlLoopResponse(makeControlLoopResponse(response.getPayload()));
+ outcome.setMessage(pciResponse.getStatus().getValue());
+ outcome.setControlLoopResponse(makeControlLoopResponse(pciResponse.getPayload()));
return outcome;
}
diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java
index 2bb0d9469..370d6768e 100644
--- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java
+++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java
@@ -135,6 +135,7 @@ public class SdnrOperationTest extends BasicSdnrOperation {
outcome = operation.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof PciMessage);
ControlLoopResponse clresp = outcome.getControlLoopResponse();
assertNotNull(clresp);
@@ -243,5 +244,6 @@ public class SdnrOperationTest extends BasicSdnrOperation {
assertSame(outcome, operation.setOutcome(outcome, PolicyResult.SUCCESS, response));
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
assertNotNull(outcome.getMessage());
+ assertSame(response, outcome.getResponse());
}
}
diff --git a/models-interactions/model-actors/actor.so/pom.xml b/models-interactions/model-actors/actor.so/pom.xml
index 46ff04fe1..52d3a1426 100644
--- a/models-interactions/model-actors/actor.so/pom.xml
+++ b/models-interactions/model-actors/actor.so/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actor.so</artifactId>
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
index a26f6a77f..7f8a5c5c4 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoOperation.java
@@ -229,6 +229,7 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
if (getCount++ >= getMaxGets()) {
logger.warn("{}: execeeded 'get' limit {} for {}", getFullName(), getMaxGets(), params.getRequestId());
setOutcome(outcome, PolicyResult.FAILURE_TIMEOUT);
+ outcome.setResponse(response);
outcome.setMessage(SO_RESPONSE_CODE + " " + outcome.getMessage());
return CompletableFuture.completedFuture(outcome);
}
@@ -316,6 +317,7 @@ public abstract class SoOperation extends HttpOperation<SoResponse> {
// set default result and message
setOutcome(outcome, result);
+ outcome.setResponse(response);
outcome.setMessage(rawResponse.getStatus() + " " + outcome.getMessage());
return outcome;
}
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
index 644521869..9e72c8aaf 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
@@ -176,6 +176,7 @@ public class SoOperationTest extends BasicSoOperation {
assertSame(outcome, future2.get());
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
assertNotNull(oper.getSubRequestId());
+ assertSame(response, outcome.getResponse());
// failed
oper.generateSubRequestId(2);
@@ -186,6 +187,7 @@ public class SoOperationTest extends BasicSoOperation {
assertSame(outcome, future2.get());
assertEquals(PolicyResult.FAILURE, outcome.getResult());
assertNotNull(oper.getSubRequestId());
+ assertSame(response, outcome.getResponse());
// no request id in the response
oper.generateSubRequestId(2);
@@ -291,6 +293,7 @@ public class SoOperationTest extends BasicSoOperation {
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
assertEquals("200 " + ControlLoopOperation.SUCCESS_MSG, outcome.getMessage());
+ assertSame(response, outcome.getResponse());
// failure case
when(rawResponse.getStatus()).thenReturn(500);
@@ -298,6 +301,7 @@ public class SoOperationTest extends BasicSoOperation {
assertEquals(PolicyResult.FAILURE, outcome.getResult());
assertEquals("500 " + ControlLoopOperation.FAILED_MSG, outcome.getMessage());
+ assertSame(response, outcome.getResponse());
}
@Test
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
index def107441..2b3e1163b 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
@@ -53,6 +53,7 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.so.SoRequest;
+import org.onap.policy.so.SoResponse;
public class VfModuleCreateTest extends BasicSoOperation {
private static final String MODEL_NAME2 = "my-model-name-B";
@@ -96,6 +97,7 @@ public class VfModuleCreateTest extends BasicSoOperation {
outcome = oper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof SoResponse);
}
@Test
@@ -187,6 +189,10 @@ public class VfModuleCreateTest extends BasicSoOperation {
outcome = future2.get(5, TimeUnit.SECONDS);
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ SoResponse resp = outcome.getResponse();
+ assertNotNull(resp);
+ assertEquals(REQ_ID.toString(), resp.getRequestReferences().getRequestId());
+
assertEquals(origCount + 1, oper.getVfCount());
}
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
index 0ec1a1df0..86242f042 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
@@ -130,6 +130,7 @@ public class VfModuleDeleteTest extends BasicSoOperation {
outcome = oper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof SoResponse);
}
@Test
@@ -219,6 +220,10 @@ public class VfModuleDeleteTest extends BasicSoOperation {
outcome = future2.get(5, TimeUnit.SECONDS);
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ SoResponse resp = outcome.getResponse();
+ assertNotNull(resp);
+ assertEquals(REQ_ID.toString(), resp.getRequestReferences().getRequestId());
+
assertEquals(origCount - 1, oper.getVfCount());
}
diff --git a/models-interactions/model-actors/actor.test/pom.xml b/models-interactions/model-actors/actor.test/pom.xml
index 55cf8702b..bf925638c 100644
--- a/models-interactions/model-actors/actor.test/pom.xml
+++ b/models-interactions/model-actors/actor.test/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actor.test</artifactId>
diff --git a/models-interactions/model-actors/actor.vfc/pom.xml b/models-interactions/model-actors/actor.vfc/pom.xml
index 9542051e9..35a1026b0 100644
--- a/models-interactions/model-actors/actor.vfc/pom.xml
+++ b/models-interactions/model-actors/actor.vfc/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actor.vfc</artifactId>
diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java
index 827109d10..573ee2698 100644
--- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java
+++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcOperation.java
@@ -119,6 +119,7 @@ public abstract class VfcOperation extends HttpOperation<VfcResponse> {
if (getCount++ >= getMaxGets()) {
logger.warn("{}: execeeded 'get' limit {} for {}", getFullName(), getMaxGets(), params.getRequestId());
setOutcome(outcome, PolicyResult.FAILURE_TIMEOUT);
+ outcome.setResponse(response);
outcome.setMessage(VFC_RESPONSE_CODE + " " + outcome.getMessage());
return CompletableFuture.completedFuture(outcome);
}
@@ -179,6 +180,7 @@ public abstract class VfcOperation extends HttpOperation<VfcResponse> {
// set default result and message
setOutcome(outcome, result);
+ outcome.setResponse(response);
outcome.setMessage(rawResponse.getStatus() + " " + outcome.getMessage());
return outcome;
}
diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java
index 5fe4973ce..d8ba7e4e8 100644
--- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java
+++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.controlloop.actor.vfc;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.util.concurrent.CompletableFuture;
import org.apache.commons.lang3.tuple.Pair;
@@ -33,6 +34,7 @@ import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.vfc.VfcRequest;
+import org.onap.policy.vfc.VfcResponse;
public class RestartTest extends BasicVfcOperation {
private Restart restartOper;
@@ -72,6 +74,7 @@ public class RestartTest extends BasicVfcOperation {
outcome = restartOper.start().get();
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof VfcResponse);
}
@Test
diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java
index 4d98b97c9..0b58fd4a3 100644
--- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java
+++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcOperationTest.java
@@ -82,30 +82,30 @@ public class VfcOperationTest extends BasicVfcOperation {
response.setResponseDescriptor(new VfcResponseDescriptor());
response.setJobId("sampleJobId");
+
+ // null status
CompletableFuture<OperationOutcome> future2 = oper.postProcessResponse(outcome, PATH, rawResponse, response);
assertFalse(future2.isDone());
- // assertSame(outcome, future2.get()); TODO Hanging
- assertEquals(PolicyResult.SUCCESS, outcome.getResult());
response.getResponseDescriptor().setStatus("FinisHeD");
future2 = oper.postProcessResponse(outcome, PATH, rawResponse, response);
assertTrue(future2.isDone());
assertSame(outcome, future2.get());
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertSame(response, outcome.getResponse());
+ // failed
response.getResponseDescriptor().setStatus("eRRor");
future2 = oper.postProcessResponse(outcome, PATH, rawResponse, response);
assertTrue(future2.isDone());
assertSame(outcome, future2.get());
assertEquals(PolicyResult.FAILURE, outcome.getResult());
+ assertSame(response, outcome.getResponse());
- // failed
- /*
- * response.getResponseDescriptor().setStatus("anything but finished"); future2 =
- * oper.postProcessResponse(outcome, PATH, rawResponse, response);
- * assertTrue(future2.isDone()); assertSame(outcome, future2.get());
- * assertEquals(PolicyResult.FAILURE, outcome.getResult());
- */
+ // unfinished
+ response.getResponseDescriptor().setStatus("anything but finished");
+ future2 = oper.postProcessResponse(outcome, PATH, rawResponse, response);
+ assertFalse(future2.isDone());
}
@Test
diff --git a/models-interactions/model-actors/actorServiceProvider/pom.xml b/models-interactions/model-actors/actorServiceProvider/pom.xml
index 67ef2760e..08940c8b6 100644
--- a/models-interactions/model-actors/actorServiceProvider/pom.xml
+++ b/models-interactions/model-actors/actorServiceProvider/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
<artifactId>model-actors</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<artifactId>actorServiceProvider</artifactId>
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.java
index e2d94b3b3..0fd2c0bfd 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.java
@@ -43,6 +43,7 @@ public class OperationOutcome {
private PolicyResult result = PolicyResult.SUCCESS;
private String message;
private boolean finalOutcome;
+ private Object response;
private ControlLoopResponse controlLoopResponse;
/**
@@ -60,6 +61,7 @@ public class OperationOutcome {
this.result = source.result;
this.message = source.message;
this.finalOutcome = source.finalOutcome;
+ this.response = source.response;
this.controlLoopResponse = source.controlLoopResponse;
}
@@ -85,6 +87,11 @@ public class OperationOutcome {
return clo;
}
+ @SuppressWarnings("unchecked")
+ public <T> T getResponse() {
+ return (T) response;
+ }
+
/**
* Determines if this outcome is for the given actor and operation.
*
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java
index 9decd8a61..8285a5635 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java
@@ -250,6 +250,7 @@ public abstract class BidirectionalTopicOperation<Q, S> extends OperationPartial
* @return the updated operation
*/
public OperationOutcome setOutcome(OperationOutcome outcome, PolicyResult result, S response) {
+ outcome.setResponse(response);
return setOutcome(outcome, result);
}
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 e83fe8c94..1acc1ff65 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
@@ -217,6 +217,7 @@ public abstract class HttpOperation<T> extends OperationPartial {
public OperationOutcome setOutcome(OperationOutcome outcome, PolicyResult result, Response rawResponse,
T response) {
+ outcome.setResponse(response);
return setOutcome(outcome, result);
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcomeTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcomeTest.java
index 77d2253e1..c60a0f00c 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcomeTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcomeTest.java
@@ -42,6 +42,7 @@ public class OperationOutcomeTest {
private static final String SUB_REQ_ID = "my-sub-request-id";
private static final PolicyResult RESULT = PolicyResult.FAILURE_GUARD;
private static final String MESSAGE = "my-message";
+ private static final String RESPONSE = "my-response";
private ControlLoopResponse response;
private OperationOutcome outcome;
@@ -70,6 +71,7 @@ public class OperationOutcomeTest {
assertEquals(SUB_REQ_ID, outcome2.getSubRequestId());
assertEquals(RESULT, outcome2.getResult());
assertEquals(MESSAGE, outcome2.getMessage());
+ assertSame(RESPONSE, outcome2.getResponse());
assertSame(response, outcome2.getControlLoopResponse());
}
@@ -142,6 +144,7 @@ public class OperationOutcomeTest {
outcome.setStart(START);
outcome.setSubRequestId(SUB_REQ_ID);
outcome.setTarget(TARGET);
+ outcome.setResponse(RESPONSE);
outcome.setControlLoopResponse(response);
}
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
index 55782a34d..84a4d5d29 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
@@ -38,6 +38,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;
+import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.junit.Before;
@@ -85,6 +86,7 @@ public class BidirectionalTopicOperationTest {
private ControlLoopOperationParams params;
private OperationOutcome outcome;
private StandardCoderObject stdResponse;
+ private MyResponse response;
private String responseText;
private PseudoExecutor executor;
private int ntimes;
@@ -109,7 +111,9 @@ public class BidirectionalTopicOperationTest {
params = ControlLoopOperationParams.builder().actor(ACTOR).operation(OPERATION).executor(executor).build();
outcome = params.makeOutcome();
- responseText = coder.encode(new MyResponse());
+ response = new MyResponse();
+ response.setRequestId(REQ_ID);
+ responseText = coder.encode(response);
stdResponse = coder.decode(responseText, StandardCoderObject.class);
ntimes = 1;
@@ -159,6 +163,7 @@ public class BidirectionalTopicOperationTest {
assertSame(outcome, future.get());
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(response, outcome.getResponse());
verify(forwarder).unregister(eq(Arrays.asList(REQ_ID)), eq(listenerCaptor.getValue()));
}
@@ -258,6 +263,7 @@ public class BidirectionalTopicOperationTest {
assertSame(outcome, oper2.processResponse(outcome, TEXT, null));
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(TEXT, outcome.getResponse());
}
/**
@@ -270,6 +276,7 @@ public class BidirectionalTopicOperationTest {
assertSame(outcome, oper2.processResponse(outcome, responseText, stdResponse));
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(stdResponse, outcome.getResponse());
}
/**
@@ -286,6 +293,7 @@ public class BidirectionalTopicOperationTest {
assertSame(outcome, oper.processResponse(outcome, responseText, stdResponse));
assertEquals(PolicyResult.FAILURE, outcome.getResult());
+ assertEquals(resp, outcome.getResponse());
}
/**
@@ -295,6 +303,7 @@ public class BidirectionalTopicOperationTest {
public void testProcessResponseDecodeOk() throws CoderException {
assertSame(outcome, oper.processResponse(outcome, responseText, stdResponse));
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(response, outcome.getResponse());
}
/**
@@ -344,8 +353,9 @@ public class BidirectionalTopicOperationTest {
@Getter
@Setter
+ @EqualsAndHashCode
public static class MyResponse {
- private String requestId = REQ_ID;
+ private String requestId;
private String output;
}
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java
index 81238defa..eb1aa880f 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java
@@ -256,6 +256,7 @@ public class HttpOperationTest {
callback.get().completed(response);
assertSame(outcome, future2.get(5, TimeUnit.SECONDS));
+ assertSame(TEXT, outcome.getResponse());
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
}
@@ -290,6 +291,7 @@ public class HttpOperationTest {
assertTrue(result.isDone());
assertSame(outcome, result.get());
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertSame(TEXT, outcome.getResponse());
}
/**
@@ -302,6 +304,7 @@ public class HttpOperationTest {
assertTrue(result.isDone());
assertSame(outcome, result.get());
assertEquals(PolicyResult.FAILURE, outcome.getResult());
+ assertSame(TEXT, outcome.getResponse());
}
/**
@@ -317,6 +320,7 @@ public class HttpOperationTest {
assertTrue(result.isDone());
assertSame(outcome, result.get());
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(Integer.valueOf(10), outcome.getResponse());
}
/**
@@ -357,6 +361,7 @@ public class HttpOperationTest {
assertNotNull(outcome);
assertEquals(1, nget);
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof MyResponse);
}
/**
@@ -373,6 +378,7 @@ public class HttpOperationTest {
assertNotNull(outcome);
assertEquals(1, ndelete);
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof String);
}
/**
@@ -388,6 +394,7 @@ public class HttpOperationTest {
assertNotNull(outcome);
assertEquals(1, npost);
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof MyResponse);
}
/**
@@ -404,6 +411,7 @@ public class HttpOperationTest {
assertNotNull(outcome);
assertEquals(1, nput);
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertTrue(outcome.getResponse() instanceof MyResponse);
}
@Test
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
index 75463b9d7..f5fd9fb75 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
@@ -1027,6 +1027,10 @@ public class OperationPartialTest {
assertEquals(ControlLoopOperation.SUCCESS_MSG, outcome.getMessage());
assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ oper.setOutcome(outcome, PolicyResult.SUCCESS);
+ assertEquals(ControlLoopOperation.SUCCESS_MSG, outcome.getMessage());
+ assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+
for (PolicyResult result : FAILURE_RESULTS) {
outcome = new OperationOutcome();
oper.setOutcome(outcome, result);
diff --git a/models-interactions/model-actors/pom.xml b/models-interactions/model-actors/pom.xml
index c5fcdf0d3..b2c737930 100644
--- a/models-interactions/model-actors/pom.xml
+++ b/models-interactions/model-actors/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models-interactions</artifactId>
- <version>2.2.7-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>