diff options
author | 2020-02-12 13:01:57 -0500 | |
---|---|---|
committer | 2020-02-12 14:29:21 -0500 | |
commit | 3b4884e5688a71116b3935e3a4ad243ab6287c80 (patch) | |
tree | dfd320bef72050eabfb43e449cf644d4b3824b54 /models-interactions/model-actors/actor.test/src/main | |
parent | 35867f2e63c26d47417bfefc9a0912f17c4a873a (diff) |
Add A&AI actor and some operators
Added A&AI Actor, as well as operators for the "custom query" and
the "tenant" query (on which the custom query depends).
Issue-ID: POLICY-1625
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: Ic9dadc07a6057cb1abb9698da86eb9431fc9ed3e
Diffstat (limited to 'models-interactions/model-actors/actor.test/src/main')
-rw-r--r-- | models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java | 15 |
1 files changed, 15 insertions, 0 deletions
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 15e4848c6..cd9681c8e 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 @@ -33,6 +33,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; 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.controlloop.VirtualControlLoopEvent; @@ -166,4 +167,18 @@ public class BasicHttpOperation<Q> { protected Map<String, String> makeEnrichment() { return new TreeMap<>(); } + + /** + * Provides a response to an asynchronous HttpClient call. + * + * @param response response to be provided to the call + * @return a function that provides the response to the call + */ + protected Answer<CompletableFuture<Response>> provideResponse(Response response) { + return args -> { + InvocationCallback<Response> cb = args.getArgument(0); + cb.completed(response); + return CompletableFuture.completedFuture(response); + }; + } } |