summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.aai
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-02-17 13:57:56 -0500
committerJim Hahn <jrh3@att.com>2020-02-17 20:41:09 -0500
commite44f1a1c58efed9fbe2efce78864aaee3b577003 (patch)
treee0a1903c107162dc2d9a3bcae2257862a99c6b48 /models-interactions/model-actors/actor.aai
parent85a2fee4074903012e77f78e26328b9a03a8bdfc (diff)
More changes to actor code
Use Coder.convert() from policy-common. Passed response to setOutcome(). Changed class names from XxxOperator to XxxOperation. Modified SDNC junits to invoke start() instead of startOperationAsync(). Changed context obtain() to re-run if the future was canceled. Added junit support class, BasicBidirectionalTopicOperation. Modified HttpOperation to allow subsequent requests to be issued. Some actors, like SO, send an initial HTTP request and then follow it with HTTP "are you done?" requests. Issue-ID: POLICY-2363-prop Change-Id: I12b5c2d4f07254e0cb79fabfe1ccf844b70a0654 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.aai')
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java5
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java6
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java (renamed from models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperatorTest.java)4
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java2
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java (renamed from models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperator.java)6
6 files changed, 15 insertions, 10 deletions
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
index bc2dde9d8..e32734b7d 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
@@ -121,9 +121,12 @@ public class AaiCustomQueryOperation extends HttpOperation<String> {
* Injects the response into the context.
*/
@Override
- protected void postProcessResponse(OperationOutcome outcome, String url, Response rawResponse, String response) {
+ protected CompletableFuture<OperationOutcome> postProcessResponse(OperationOutcome outcome, String url,
+ Response rawResponse, String response) {
logger.info("{}: caching response for {}", getFullName(), params.getRequestId());
params.getContext().setProperty(AaiCqResponse.CONTEXT_KEY, new AaiCqResponse(response));
+
+ return super.postProcessResponse(outcome, url, rawResponse, response);
}
}
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
index 60a28209b..ee1c4612d 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
@@ -116,13 +116,15 @@ public class AaiGetOperation extends HttpOperation<StandardCoderObject> {
* Injects the response into the context.
*/
@Override
- protected void postProcessResponse(OperationOutcome outcome, String url, Response rawResponse,
- StandardCoderObject response) {
+ protected CompletableFuture<OperationOutcome> postProcessResponse(OperationOutcome outcome, String url,
+ Response rawResponse, StandardCoderObject response) {
String entity = params.getTargetEntity();
logger.info("{}: caching response of {} for {}", getFullName(), entity, params.getRequestId());
params.getContext().setProperty(propertyPrefix + entity, response);
+
+ return super.postProcessResponse(outcome, url, rawResponse, response);
}
/**
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
index c95425e7a..a93508757 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
@@ -50,7 +50,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.onap.policy.controlloop.policy.PolicyResult;
-public class AaiCustomQueryOperationTest extends BasicAaiOperator<Map<String, String>> {
+public class AaiCustomQueryOperationTest extends BasicAaiOperation<Map<String, String>> {
private static final StandardCoder coder = new StandardCoder();
private static final String MY_LINK = "my-link";
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperatorTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java
index ebe953570..654864246 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperatorTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperationTest.java
@@ -38,14 +38,14 @@ import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.policy.PolicyResult;
-public class AaiGetOperatorTest extends BasicAaiOperator<Void> {
+public class AaiGetOperationTest extends BasicAaiOperation<Void> {
private static final String INPUT_FIELD = "input";
private static final String TEXT = "my-text";
private AaiGetOperation oper;
- public AaiGetOperatorTest() {
+ public AaiGetOperationTest() {
super(AaiConstants.ACTOR_NAME, AaiGetOperation.TENANT);
}
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java
index 39ed6fe88..ae38cca35 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiUtilTest.java
@@ -23,7 +23,7 @@ package org.onap.policy.controlloop.actor.aai;
import java.util.Map;
import org.junit.Test;
-public class AaiUtilTest extends BasicAaiOperator<Void> {
+public class AaiUtilTest extends BasicAaiOperation<Void> {
@Test
public void testMakeHeaders() {
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperator.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
index 50b562afb..00485c935 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperator.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
@@ -28,12 +28,12 @@ import org.onap.policy.controlloop.actor.test.BasicHttpOperation;
/**
* Superclass for various operator tests.
*/
-public abstract class BasicAaiOperator<Q> extends BasicHttpOperation<Q> {
+public abstract class BasicAaiOperation<Q> extends BasicHttpOperation<Q> {
/**
* Constructs the object using a default actor and operation name.
*/
- public BasicAaiOperator() {
+ public BasicAaiOperation() {
super();
}
@@ -43,7 +43,7 @@ public abstract class BasicAaiOperator<Q> extends BasicHttpOperation<Q> {
* @param actor actor name
* @param operation operation name
*/
- public BasicAaiOperator(String actor, String operation) {
+ public BasicAaiOperation(String actor, String operation) {
super(actor, operation);
}