summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actorServiceProvider/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-03-20 18:29:21 -0400
committerJim Hahn <jrh3@att.com>2020-03-20 18:29:21 -0400
commitfd172714bd75184366a4c6e2f92cd8cfd84a56d7 (patch)
tree49bd6589e1dcc20be3d4754602415989453e77cb /models-interactions/model-actors/actorServiceProvider/src/test
parentf1eb76a0f0773780c9179f6098ed9847ecb9f9fa (diff)
Exception not propagated by processResponse
If the topic processResponse() method throws an exception, then the actor/operation is left in an incomplete state. Issue-ID: POLICY-2434 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I6c5d149d4046fbfb970c8dd831fc3938516d1115
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider/src/test')
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
index 587564a2e..48669f799 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java
@@ -168,10 +168,40 @@ public class BidirectionalTopicOperationTest {
}
/**
+ * Tests startOperationAsync() when processResponse() throws an exception.
+ */
+ @Test
+ public void testStartOperationAsyncProcException() throws Exception {
+ oper = new MyOperation() {
+ @Override
+ protected OperationOutcome processResponse(OperationOutcome outcome, String rawResponse,
+ StandardCoderObject scoResponse) {
+ throw EXPECTED_EXCEPTION;
+ }
+ };
+
+ CompletableFuture<OperationOutcome> future = oper.startOperationAsync(1, outcome);
+ assertFalse(future.isDone());
+
+ assertEquals(SUB_REQID, outcome.getSubRequestId());
+
+ verify(forwarder).register(eq(Arrays.asList(REQ_ID)), listenerCaptor.capture());
+
+ verify(forwarder, never()).unregister(any(), any());
+
+ // provide a response
+ listenerCaptor.getValue().accept(responseText, stdResponse);
+ assertTrue(executor.runAll(MAX_REQUESTS));
+ assertTrue(future.isCompletedExceptionally());
+
+ verify(forwarder).unregister(eq(Arrays.asList(REQ_ID)), eq(listenerCaptor.getValue()));
+ }
+
+ /**
* Tests startOperationAsync() when the publisher throws an exception.
*/
@Test
- public void testStartOperationAsyncException() throws Exception {
+ public void testStartOperationAsyncPubException() throws Exception {
// indicate that nothing was published
when(handler.send(any())).thenReturn(false);