summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.cds/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.cds/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.cds/src')
-rw-r--r--models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java2
-rw-r--r--models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java12
2 files changed, 9 insertions, 5 deletions
diff --git a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
index 2afa9fa2e..d0f5bd2b4 100644
--- a/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
+++ b/models-interactions/model-actors/actor.cds/src/main/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceManager.java
@@ -62,10 +62,12 @@ public class CdsActorServiceManager implements CdsProcessorListener {
break;
case EVENT_COMPONENT_EXECUTED:
outcome.setResult(PolicyResult.SUCCESS);
+ outcome.setResponse(message);
future.complete(outcome);
break;
default:
outcome.setResult(PolicyResult.FAILURE);
+ outcome.setResponse(message);
future.complete(outcome);
break;
}
diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java
index 83473a89a..908b05c08 100644
--- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java
+++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcActorServiceManagerTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.controlloop.actor.cds;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.util.concurrent.CompletableFuture;
@@ -59,8 +60,9 @@ public class GrpcActorServiceManagerTest {
Status status = Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_EXECUTED).build();
output = ExecutionServiceOutput.newBuilder().setStatus(status).build();
manager.onMessage(output);
- assertEquals(PolicyResult.SUCCESS, future.get(2, TimeUnit.SECONDS).getResult());
- assertTrue(future.isDone());
+ OperationOutcome outcome = future.get(2, TimeUnit.SECONDS);
+ assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertSame(output, outcome.getResponse());
}
@Test
@@ -79,8 +81,9 @@ public class GrpcActorServiceManagerTest {
Status status = Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_FAILURE).build();
output = ExecutionServiceOutput.newBuilder().setStatus(status).build();
manager.onMessage(output);
- assertEquals(PolicyResult.FAILURE, future.get(2, TimeUnit.SECONDS).getResult());
- assertTrue(future.isDone());
+ OperationOutcome outcome = future.get(2, TimeUnit.SECONDS);
+ assertEquals(PolicyResult.FAILURE, outcome.getResult());
+ assertSame(output, outcome.getResponse());
}
@Test
@@ -89,6 +92,5 @@ public class GrpcActorServiceManagerTest {
Exception exception = new Exception("something failed");
manager.onError(exception);
assertTrue(future.isCompletedExceptionally());
- assertTrue(future.isDone());
}
}