summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.aai/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-07-29 13:50:40 -0400
committerJim Hahn <jrh3@att.com>2020-07-31 14:08:17 -0400
commitacded8235dcbb0b06abaa98297fecef78b4eec41 (patch)
tree8b400d09875cd2c6f7844fbbe0c4d9e1e1a16230 /models-interactions/model-actors/actor.aai/src
parent1da24b28d9df7c8ad5154d7788dab0ab9da589f8 (diff)
Add property lists to Actors
Modified the Actor code to provide a list of properties needed by the actor to perform a given operation. Added a build() method to the parameter class so invokers can build an operation and set its properties prior to starting it. Added a "preprocessed" field to the parameter class so invokers can indicate that the Actor need not perform any preprocessing steps. Will modify the actors, in a subsequent review, to observe the flag. Added "properties" to Operation so invokers can set the properties. Will modify the actors, in a subsequent review, to use the property values instead of the event context. Tweaked a few Actors to get values using the "params" object instead of reaching inside to the event object that it contains. Addressed review comment(s): - add prefix to other property names Issue-ID: POLICY-2746 Change-Id: I65996aef5cec5afe25e8287c0b2f5f322c532ca5 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.aai/src')
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java6
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java3
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java6
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java6
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java6
5 files changed, 25 insertions, 2 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 718047cfc..caa8b9e1f 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
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.aai;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.CompletableFuture;
@@ -36,6 +37,7 @@ import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
@@ -57,6 +59,8 @@ public class AaiCustomQueryOperation extends HttpOperation<String> {
public static final String RESOURCE_LINK = "resource-link";
public static final String RESULT_DATA = "result-data";
+ private static final List<String> PROPERTY_NAMES = List.of(OperationProperties.AAI_VSERVER_LINK);
+
// TODO make this configurable
private static final String PREFIX = "/aai/v16";
@@ -70,7 +74,7 @@ public class AaiCustomQueryOperation extends HttpOperation<String> {
* @param config configuration for this operation
*/
public AaiCustomQueryOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, String.class);
+ super(params, config, String.class, PROPERTY_NAMES);
this.vserver = params.getContext().getEnrichment().get(VSERVER_VSERVER_NAME);
if (StringUtils.isBlank(this.vserver)) {
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 07738b084..c18d06c95 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
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.aai;
+import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.CompletableFuture;
@@ -58,7 +59,7 @@ public class AaiGetOperation extends HttpOperation<StandardCoderObject> {
* @param config configuration for this operation
*/
public AaiGetOperation(ControlLoopOperationParams params, HttpConfig config) {
- super(params, config, StandardCoderObject.class);
+ super(params, config, StandardCoderObject.class, Collections.emptyList());
this.propertyPrefix = getFullName() + ".";
}
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 173eb2908..400096507 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
@@ -51,6 +51,7 @@ import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.Util;
import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation;
import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperator;
@@ -140,6 +141,11 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation {
}
@Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEqualTo(List.of(OperationProperties.AAI_VSERVER_LINK));
+ }
+
+ @Test
public void testGenerateSubRequestId() {
oper.generateSubRequestId(3);
assertEquals("3", oper.getSubRequestId());
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
index 042b64f60..b211db261 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.aai;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -79,6 +80,11 @@ public class AaiGetPnfOperationTest extends BasicAaiOperation {
assertEquals(AaiGetPnfOperation.NAME, oper.getName());
}
+ @Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEmpty();
+ }
+
/**
* Tests "success" case with simulator.
*/
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
index be8a26416..fe0327c10 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.controlloop.actor.aai;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -79,6 +80,11 @@ public class AaiGetTenantOperationTest extends BasicAaiOperation {
assertEquals(AaiGetTenantOperation.NAME, oper.getName());
}
+ @Test
+ public void testGetPropertyNames() {
+ assertThat(oper.getPropertyNames()).isEmpty();
+ }
+
/**
* Tests "success" case with simulator.
*/