diff options
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider')
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(); |