summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.appclcm/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-05-27 10:49:39 -0400
committerJim Hahn <jrh3@att.com>2020-05-27 16:31:35 -0400
commit770e374bc2e4ba814bb0e59eadf0f9fe2d5291e5 (patch)
treed9ad1100fbb13b468865474a3450700b1b5c9f52 /models-interactions/model-actors/actor.appclcm/src
parentddd400dc81f6bdabc76924cf904af540aa912ca2 (diff)
Include response in OperationOutcome
Added the response field and modified the actors to populate it. Issue-ID: POLICY-2592 Change-Id: I24487b6fbc23b69bde4a95acd470864d8231c49d Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.appclcm/src')
-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
2 files changed, 10 insertions, 1 deletions
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