From 28ca4d196bb0e8c50ad64b5bfde117a93ace3e04 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 14 Feb 2020 14:22:48 -0500 Subject: Use BidirectionalTopicClient from policy-common Also modified "target" to sink in various places, and renamed various uses of "pair" to "bidirectional" (e.g., TopicPairParams => BidirectionalTopicParams). Also replaced MyExec with PseudoExecutor, from policy-common. As part of this, extracted the logRequest and logResponse methods from the Http and Topic classes, moving them into the common OperationPartial class. Modified A&AI, SDNC junit tests to use PseudoExecutor. Added support for incomplete responses on Topics, where multiple responses may be received for one request Fixed a duplicate entry in actor.aai pom. As the changes were already big enough, went ahead and also did the following to support the APPC Actor: - Reorganized parameter classes and content. - Modified anyOf, allOf to take functions instead of futures and handle exceptions thrown by any of the functions. Also added sequence() method. - Deleted doTask. - Modified ActorService.config to take a map of maps, not just a map. - Decided NOT to move anyOf, allOf, and sequence from OperationPartial to a utility class, because they depend on "params". Issue-ID: POLICY-2363 Signed-off-by: Jim Hahn Change-Id: I5a8bae05dfef22fe71c57c58f265b9dac20df5c5 --- .../onap/policy/controlloop/actor/test/BasicHttpOperation.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'models-interactions/model-actors/actor.test/src/main') diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java index cd9681c8e..e160479b3 100644 --- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java +++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java @@ -36,6 +36,7 @@ import org.mockito.MockitoAnnotations; import org.mockito.stubbing.Answer; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactory; +import org.onap.policy.common.utils.time.PseudoExecutor; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.ActorService; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; @@ -90,6 +91,7 @@ public class BasicHttpOperation { protected VirtualControlLoopEvent event; protected ControlLoopEventContext context; protected OperationOutcome outcome; + protected PseudoExecutor executor; /** * Constructs the object using a default actor and operation name. @@ -123,6 +125,8 @@ public class BasicHttpOperation { future = new CompletableFuture<>(); when(client.getBaseUrl()).thenReturn(BASE_URI); + executor = new PseudoExecutor(); + makeContext(); outcome = params.makeOutcome(); @@ -133,6 +137,8 @@ public class BasicHttpOperation { /** * Reinitializes {@link #enrichment}, {@link #event}, {@link #context}, and * {@link #params}. + *

+ * Note: {@link #params} is configured to use {@link #executor}. */ protected void makeContext() { enrichment = new TreeMap<>(makeEnrichment()); @@ -143,8 +149,8 @@ public class BasicHttpOperation { context = new ControlLoopEventContext(event); - params = ControlLoopOperationParams.builder().context(context).actorService(service).actor(actorName) - .operation(operationName).targetEntity(TARGET_ENTITY).build(); + params = ControlLoopOperationParams.builder().executor(executor).context(context).actorService(service) + .actor(actorName).operation(operationName).targetEntity(TARGET_ENTITY).build(); } /** -- cgit 1.2.3-korg