summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.sdnr/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.sdnr/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.sdnr/src')
-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
2 files changed, 9 insertions, 5 deletions
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());
}
}