summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.appc/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.appc/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.appc/src')
-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
3 files changed, 7 insertions, 0 deletions
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