summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.guard
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-actors/actor.guard')
-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
2 files changed, 13 insertions, 2 deletions
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