diff options
author | Jim Hahn <jrh3@att.com> | 2020-08-04 09:09:14 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-08-04 09:34:39 -0400 |
commit | 364ef26929f06637bca03dd7bfb5e8ac69b611f8 (patch) | |
tree | d1f3ccd22bb56f2acce8ea05244a6197d32c5fdd /models-interactions/model-actors/actor.aai | |
parent | acded8235dcbb0b06abaa98297fecef78b4eec41 (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/actor.aai')
2 files changed, 14 insertions, 0 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 caa8b9e1f..151f7a214 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 @@ -87,6 +87,10 @@ public class AaiCustomQueryOperation extends HttpOperation<String> { */ @Override protected CompletableFuture<OperationOutcome> startPreprocessorAsync() { + if (params.isPreprocessed()) { + return null; + } + ControlLoopOperationParams tenantParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME).operation(AaiGetTenantOperation.NAME) .targetEntity(vserver).payload(null).retry(null).timeoutSec(null).build(); 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 400096507..476e6432d 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 @@ -25,6 +25,7 @@ import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; @@ -151,6 +152,15 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation { assertEquals("3", oper.getSubRequestId()); } + /** + * Tests startPreprocessorAsync(), when preprocessing is disabled. + */ + @Test + public void testStartPreprocessorAsyncDisabled() { + params = params.toBuilder().preprocessed(true).build(); + assertNull(new AaiCustomQueryOperation(params, config).startPreprocessorAsync()); + } + @Test @SuppressWarnings("unchecked") public void testStartOperationAsync_testStartPreprocessorAsync_testMakeRequest_testPostProcess() throws Exception { |