From acded8235dcbb0b06abaa98297fecef78b4eec41 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 29 Jul 2020 13:50:40 -0400 Subject: 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 --- .../policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java | 6 ++++++ .../onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java | 6 ++++++ .../policy/controlloop/actor/aai/AaiGetTenantOperationTest.java | 6 ++++++ 3 files changed, 18 insertions(+) (limited to 'models-interactions/model-actors/actor.aai/src/test') 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; @@ -139,6 +140,11 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { .withMessage("missing " + AaiCustomQueryOperation.VSERVER_VSERVER_NAME + " in enrichment data"); } + @Test + public void testGetPropertyNames() { + assertThat(oper.getPropertyNames()).isEqualTo(List.of(OperationProperties.AAI_VSERVER_LINK)); + } + @Test public void testGenerateSubRequestId() { oper.generateSubRequestId(3); 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. */ -- cgit 1.2.3-korg