diff options
author | Jim Hahn <jrh3@att.com> | 2020-07-29 13:50:40 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-07-31 14:08:17 -0400 |
commit | acded8235dcbb0b06abaa98297fecef78b4eec41 (patch) | |
tree | 8b400d09875cd2c6f7844fbbe0c4d9e1e1a16230 /models-interactions/model-actors/actor.appclcm | |
parent | 1da24b28d9df7c8ad5154d7788dab0ab9da589f8 (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.appclcm')
2 files changed, 11 insertions, 6 deletions
diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java index 0be723c7c..590bf1968 100644 --- a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java +++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java @@ -20,6 +20,7 @@ package org.onap.policy.controlloop.actor.appclcm; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -32,7 +33,6 @@ import org.onap.policy.appclcm.AppcLcmOutput; import org.onap.policy.appclcm.AppcLcmResponseCode; import org.onap.policy.appclcm.AppcLcmResponseStatus; import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperation; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig; @@ -62,7 +62,7 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr * @param config configuration for this operation */ public AppcLcmOperation(ControlLoopOperationParams params, BidirectionalTopicConfig config) { - super(params, config, AppcLcmDmaapWrapper.class); + super(params, config, AppcLcmDmaapWrapper.class, Collections.emptyList()); if (StringUtils.isBlank(params.getTargetEntity())) { throw new IllegalArgumentException("missing targetEntity"); @@ -80,12 +80,11 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr @Override protected AppcLcmDmaapWrapper makeRequest(int attempt) { - VirtualControlLoopEvent onset = params.getContext().getEvent(); String subRequestId = getSubRequestId(); AppcLcmCommonHeader header = new AppcLcmCommonHeader(); - header.setOriginatorId(onset.getRequestId().toString()); - header.setRequestId(onset.getRequestId()); + header.setOriginatorId(params.getRequestId().toString()); + header.setRequestId(params.getRequestId()); header.setSubRequestId(subRequestId); AppcLcmInput inputRequest = new AppcLcmInput(); @@ -118,7 +117,7 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr AppcLcmDmaapWrapper dmaapRequest = new AppcLcmDmaapWrapper(); dmaapRequest.setBody(body); dmaapRequest.setVersion("2.0"); - dmaapRequest.setCorrelationId(onset.getRequestId() + "-" + subRequestId); + dmaapRequest.setCorrelationId(params.getRequestId() + "-" + subRequestId); dmaapRequest.setRpcName(recipeFormatter.getUrlRecipe()); dmaapRequest.setType("request"); diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java index 6059cb5ed..705fd105f 100644 --- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java +++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java @@ -20,6 +20,7 @@ package org.onap.policy.controlloop.actor.appclcm; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -142,6 +143,11 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL } @Test + public void testGetPropertyNames() { + assertThat(oper.getPropertyNames()).isEmpty(); + } + + @Test public void testStartPreprocessorAsync() throws Exception { context = mock(ControlLoopEventContext.class); when(context.getEvent()).thenReturn(event); |