aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actorServiceProvider
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-08-04 09:09:14 -0400
committerJim Hahn <jrh3@att.com>2020-08-04 09:34:39 -0400
commit364ef26929f06637bca03dd7bfb5e8ac69b611f8 (patch)
treed1f3ccd22bb56f2acce8ea05244a6197d32c5fdd /models-interactions/model-actors/actorServiceProvider
parentacded8235dcbb0b06abaa98297fecef78b4eec41 (diff)
Skip preprocessor step in Actors
Modified Actors to skip the preprocessor step if the "preprocessed" flag is set to true in the parameters. Did not add any error checking code to ensure the data was actually available to the operation - will add that once the properties are being set by the application code. Extracted common code in GrpcOperationTest into the setup method. Issue-ID: POLICY-2746 Change-Id: Id70c31a2c96a7aaa9d73cc70cdf4f55f8a4e087f Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider')
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java5
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java9
2 files changed, 14 insertions, 0 deletions
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
index 060f7a64b..9ce53aa7a 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
@@ -268,6 +268,10 @@ public abstract class OperationPartial implements Operation {
* {@code null} if this operation has no guard
*/
protected CompletableFuture<OperationOutcome> startGuardAsync() {
+ if (params.isPreprocessed()) {
+ return null;
+ }
+
// get the guard payload
Map<String, Object> payload = makeGuardPayload();
@@ -285,6 +289,7 @@ public abstract class OperationPartial implements Operation {
* @return a new guard payload
*/
protected Map<String, Object> makeGuardPayload() {
+ // TODO delete this once preprocessing is done by the application
Map<String, Object> guard = new LinkedHashMap<>();
guard.put("actor", params.getActor());
guard.put("operation", params.getOperation());
diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
index 9bbc528ec..6d5435827 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java
@@ -346,6 +346,15 @@ public class OperationPartialTest {
assertEquals(oper.makeGuardPayload(), payload);
}
+ /**
+ * Tests startGuardAsync() when preprocessing is disabled.
+ */
+ @Test
+ public void testStartGuardAsyncDisabled() {
+ params = params.toBuilder().preprocessed(true).build();
+ assertNull(new MyOper().startGuardAsync());
+ }
+
@Test
public void testMakeGuardPayload() {
Map<String, Object> payload = oper.makeGuardPayload();