aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.guard/src/test
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.guard/src/test
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.guard/src/test')
-rw-r--r--models-interactions/model-actors/actor.guard/src/test/java/org/onap/policy/controlloop/actor/guard/GuardOperationTest.java13
1 files changed, 11 insertions, 2 deletions
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