diff options
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider/src')
14 files changed, 196 insertions, 23 deletions
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/Operation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/Operation.java index 39977fd41..dfa086595 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/Operation.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/Operation.java @@ -20,6 +20,7 @@ package org.onap.policy.controlloop.actorserviceprovider; +import java.util.List; import java.util.concurrent.CompletableFuture; /** @@ -43,6 +44,21 @@ public interface Operation { String getName(); /** + * Gets the names of the properties required by the operation. + * + * @return the names of the properties required by the operation + */ + List<String> getPropertyNames(); + + /** + * Sets a property. + * + * @param name property name + * @param value new value + */ + public void setProperty(String name, Object value); + + /** * Called by enforcement PDP engine to start the operation. As part of the operation, * it invokes the "start" and "complete" call-backs found within the parameters. * diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java new file mode 100644 index 000000000..42846460d --- /dev/null +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.controlloop.actorserviceprovider; + +/** + * Names of properties needed by the Actors defined within this repo. Note: this is not + * exhaustive, as additional property names may be returned by company-defined Actors. + */ +public class OperationProperties { + public static final String AAI_MODEL_CLOUD_REGION = "AAI/modelInvariantId/cloudRegion"; + public static final String AAI_MODEL_INVARIANT_GENERIC_VNF = "AAI/modelInvariantId/genericVnf"; + public static final String AAI_MODEL_SERVICE = "AAI/modelInvariantId/service"; + public static final String AAI_MODEL_TENANT = "AAI/modelInvariantId/tenant"; + public static final String AAI_MODEL_VNF = "AAI/modelInvariantId/vnf"; + public static final String AAI_RESOURCE_SERVICE_INSTANCE = "AAI/resourceId/serviceInstanceId"; + public static final String AAI_RESOURCE_VNF = "AAI/resourceId/modelInvariantId/vnf"; + public static final String AAI_PNF = "AAI/pnf"; + public static final String AAI_VSERVER_LINK = "AAI/vserver/link"; + + /* + * These are typically extracted from the event or from the event's enrichment data. + */ + public static final String ENRICHMENT_BANDWIDTH = "enrichment/bandwidth"; + public static final String ENRICHMENT_BANDWIDTH_CHANGE_TIME = "enrichment/bandwidth/changeTime"; + public static final String ENRICHMENT_GENERIC_VNF_ID = "enrichment/genericVnf/id"; + public static final String ENRICHMENT_NETWORK_ID = "enrichment/network/id"; + public static final String ENRICHMENT_SERVICE_ID = "enrichment/service/id"; + public static final String ENRICHMENT_SERVICE_INSTANCE_ID = "enrichment/serviceInstance/id"; + public static final String ENRICHMENT_VNF_ID = "enrichment/vnf/id"; + public static final String ENRICHMENT_VSERVER_ID = "enrichment/vserver/id"; + public static final String ENRICHMENT_VSERVER_NAME = "enrichment/vserver/name"; + + public static final String EVENT_ADDITIONAL_PARAMS = "event/additionalParams"; + public static final String EVENT_PAYLOAD = "event/payload"; + + /* + * These are data computed and/or tracked by the invoker. + */ + public static final String DATA_VF_COUNT = "data/vfCount"; + + + private OperationProperties() { + super(); + } +} diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java index 13231e6ad..a3f3a6905 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java @@ -76,10 +76,11 @@ public abstract class BidirectionalTopicOperation<Q, S> extends OperationPartial * @param params operation parameters * @param config configuration for this operation * @param clazz response class + * @param propertyNames names of properties required by this operation */ public BidirectionalTopicOperation(ControlLoopOperationParams params, BidirectionalTopicConfig config, - Class<S> clazz) { - super(params, config); + Class<S> clazz, List<String> propertyNames) { + super(params, config, propertyNames); this.config = config; this.responseClass = clazz; this.forwarder = config.getForwarder(); diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java index 4800b3a4b..09c876d41 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java @@ -21,6 +21,7 @@ package org.onap.policy.controlloop.actorserviceprovider.impl; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -90,9 +91,11 @@ public abstract class HttpOperation<T> extends OperationPartial { * @param params operation parameters * @param config configuration for this operation * @param clazz response class + * @param propertyNames names of properties required by this operation */ - public HttpOperation(ControlLoopOperationParams params, HttpConfig config, Class<T> clazz) { - super(params, config); + public HttpOperation(ControlLoopOperationParams params, HttpConfig config, Class<T> clazz, + List<String> propertyNames) { + super(params, config, propertyNames); this.config = config; this.responseClass = clazz; } 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 b28021607..060f7a64b 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 @@ -23,6 +23,7 @@ package org.onap.policy.controlloop.actorserviceprovider.impl; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -103,17 +104,27 @@ public abstract class OperationPartial implements Operation { @Setter(AccessLevel.PROTECTED) private String subRequestId; + @Getter + private final List<String> propertyNames; + + /** + * Values for the properties identified by {@link #getPropertyNames()}. + */ + private final Map<String, Object> properties = new HashMap<>(); + /** * Constructs the object. * * @param params operation parameters * @param config configuration for this operation + * @param propertyNames names of properties required by this operation */ - public OperationPartial(ControlLoopOperationParams params, OperatorConfig config) { + public OperationPartial(ControlLoopOperationParams params, OperatorConfig config, List<String> propertyNames) { this.params = params; this.config = config; this.fullName = params.getActor() + "." + params.getOperation(); + this.propertyNames = propertyNames; } public Executor getBlockingExecutor() { @@ -128,6 +139,27 @@ public abstract class OperationPartial implements Operation { return params.getOperation(); } + /** + * Sets a property. + * + * @param name property name + * @param value new value + */ + public void setProperty(String name, Object value) { + properties.put(name, value); + } + + /** + * Gets a property's value. + * + * @param name name of the property of interest + * @return the property's value, or {@code null} if it has no value + */ + @SuppressWarnings("unchecked") + public <T> T getProperty(String name) { + return (T) properties.get(name); + } + @Override public CompletableFuture<OperationOutcome> start() { // allocate a controller for the entire operation diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java index 7fc15c97b..f5dd49877 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java @@ -34,6 +34,7 @@ import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.common.parameters.BeanValidator; import org.onap.policy.common.parameters.annotations.NotNull; import org.onap.policy.controlloop.actorserviceprovider.ActorService; +import org.onap.policy.controlloop.actorserviceprovider.Operation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.Util; import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext; @@ -89,6 +90,12 @@ public class ControlLoopOperationParams { private Map<String, Object> payload; /** + * {@code True} if the preprocessing steps have already been executed, {@code false} + * otherwise. + */ + private boolean preprocessed; + + /** * Number of retries allowed, or {@code null} if no retries. */ private Integer retry; @@ -137,6 +144,16 @@ public class ControlLoopOperationParams { * @throws IllegalArgumentException if the parameters are invalid */ public CompletableFuture<OperationOutcome> start() { + return build().start(); + } + + /** + * Builds the specified operation. + * + * @return a new operation + * @throws IllegalArgumentException if the parameters are invalid + */ + public Operation build() { BeanValidationResult result = validate(); if (!result.isValid()) { logger.warn("parameter error in operation {}.{} for {}:\n{}", getActor(), getOperation(), getRequestId(), @@ -148,8 +165,7 @@ public class ControlLoopOperationParams { return actorService .getActor(getActor()) .getOperator(getOperation()) - .buildOperation(this) - .start(); + .buildOperation(this); // @formatter:on } diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineUtil.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineUtil.java index 3854fb29a..110f84ad8 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineUtil.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/pipeline/PipelineUtil.java @@ -20,6 +20,7 @@ package org.onap.policy.controlloop.actorserviceprovider.pipeline; +import java.util.Collections; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ForkJoinPool; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; @@ -38,7 +39,7 @@ public class PipelineUtil extends OperationPartial { * @param params utility parameters */ public PipelineUtil(ControlLoopOperationParams params) { - super(params, new OperatorConfig(ForkJoinPool.commonPool())); + super(params, new OperatorConfig(ForkJoinPool.commonPool()), Collections.emptyList()); } @Override diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java index b62eae8a6..e28ddeb09 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java @@ -35,6 +35,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.function.BiConsumer; @@ -363,7 +364,7 @@ public class BidirectionalTopicOperationTest { private class MyStringOperation extends BidirectionalTopicOperation<String, String> { public MyStringOperation() { - super(BidirectionalTopicOperationTest.this.params, config, String.class); + super(BidirectionalTopicOperationTest.this.params, config, String.class, Collections.emptyList()); } @Override @@ -385,7 +386,8 @@ public class BidirectionalTopicOperationTest { private class MyScoOperation extends BidirectionalTopicOperation<MyRequest, StandardCoderObject> { public MyScoOperation() { - super(BidirectionalTopicOperationTest.this.params, config, StandardCoderObject.class); + super(BidirectionalTopicOperationTest.this.params, config, StandardCoderObject.class, + Collections.emptyList()); } @Override @@ -407,7 +409,7 @@ public class BidirectionalTopicOperationTest { private class MyOperation extends BidirectionalTopicOperation<MyRequest, MyResponse> { public MyOperation() { - super(BidirectionalTopicOperationTest.this.params, config, MyResponse.class); + super(BidirectionalTopicOperationTest.this.params, config, MyResponse.class, Collections.emptyList()); } @Override diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java index 1b3485d5d..33e530334 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java @@ -502,7 +502,7 @@ public class HttpOperationTest { private class MyGetOperation<T> extends HttpOperation<T> { public MyGetOperation(Class<T> responseClass) { - super(HttpOperationTest.this.params, HttpOperationTest.this.config, responseClass); + super(HttpOperationTest.this.params, HttpOperationTest.this.config, responseClass, Collections.emptyList()); } @Override @@ -523,7 +523,8 @@ public class HttpOperationTest { private class MyPostOperation extends HttpOperation<MyResponse> { public MyPostOperation() { - super(HttpOperationTest.this.params, HttpOperationTest.this.config, MyResponse.class); + super(HttpOperationTest.this.params, HttpOperationTest.this.config, MyResponse.class, + Collections.emptyList()); } @Override @@ -550,7 +551,8 @@ public class HttpOperationTest { private class MyPutOperation extends HttpOperation<MyResponse> { public MyPutOperation() { - super(HttpOperationTest.this.params, HttpOperationTest.this.config, MyResponse.class); + super(HttpOperationTest.this.params, HttpOperationTest.this.config, MyResponse.class, + Collections.emptyList()); } @Override @@ -577,7 +579,7 @@ public class HttpOperationTest { private class MyDeleteOperation extends HttpOperation<String> { public MyDeleteOperation() { - super(HttpOperationTest.this.params, HttpOperationTest.this.config, String.class); + super(HttpOperationTest.this.params, HttpOperationTest.this.config, String.class, Collections.emptyList()); } @Override diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java index f85ef30b6..5ae804aea 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperatorTest.java @@ -28,6 +28,7 @@ import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.when; +import java.util.Collections; import java.util.Map; import java.util.concurrent.CompletableFuture; import org.junit.Before; @@ -157,7 +158,7 @@ public class HttpOperatorTest { private class MyOperation extends HttpOperation<String> { public MyOperation(ControlLoopOperationParams params, HttpConfig config) { - super(params, config, String.class); + super(params, config, String.class, Collections.emptyList()); } @Override diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java index ed5ba9b56..780964629 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperationTest.java @@ -31,6 +31,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.util.Collections; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.TimeUnit; @@ -196,7 +197,7 @@ public class HttpPollingOperationTest { @Test public void testDetmStatus() { // make an operation that does NOT override detmStatus() - oper = new HttpOperation<String>(params, config, String.class) {}; + oper = new HttpOperation<String>(params, config, String.class, Collections.emptyList()) {}; assertThatThrownBy(() -> oper.detmStatus(rawResponse, response)) .isInstanceOf(UnsupportedOperationException.class); @@ -230,7 +231,7 @@ public class HttpPollingOperationTest { private static class MyOper extends HttpOperation<String> { public MyOper(ControlLoopOperationParams params, HttpConfig config) { - super(params, config, String.class); + super(params, config, String.class, Collections.emptyList()); setUsePolling(); } diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java index 2a22b4b86..413667b20 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpPollingOperatorTest.java @@ -26,6 +26,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; +import java.util.Collections; import java.util.Map; import org.junit.Before; import org.junit.Test; @@ -111,7 +112,7 @@ public class HttpPollingOperatorTest { private static class MyOperation extends HttpOperation<String> { public MyOperation(ControlLoopOperationParams params, HttpConfig config) { - super(params, config, String.class); + super(params, config, String.class, Collections.emptyList()); } } } 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 e2ed2d98f..9bbc528ec 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 @@ -36,6 +36,7 @@ import ch.qos.logback.classic.Logger; import java.time.Instant; import java.util.ArrayDeque; import java.util.Arrays; +import java.util.Collections; import java.util.Deque; import java.util.LinkedList; import java.util.List; @@ -106,6 +107,8 @@ public class OperationPartialTest { private static final Logger logger = (Logger) LoggerFactory.getLogger(OperationPartial.class); private static final ExtractAppender appender = new ExtractAppender(); + private static final List<String> PROP_NAMES = List.of("hello", "world"); + @Mock private ActorService service; @Mock @@ -217,6 +220,22 @@ public class OperationPartialTest { } @Test + public void testGetPropertyNames() { + assertThat(oper.getPropertyNames()).isEqualTo(PROP_NAMES); + } + + @Test + public void testGetProperty_testSetProperty() { + oper.setProperty("propertyA", "valueA"); + oper.setProperty("propertyB", "valueB"); + oper.setProperty("propertyC", 20); + + assertEquals("valueA", oper.getProperty("propertyA")); + assertEquals("valueB", oper.getProperty("propertyB")); + assertEquals(Integer.valueOf(20), oper.getProperty("propertyC")); + } + + @Test public void testStart() { verifyRun("testStart", 1, 1, PolicyResult.SUCCESS); } @@ -406,7 +425,7 @@ public class OperationPartialTest { /* * Use an operation that doesn't override doOperation(). */ - OperationPartial oper2 = new OperationPartial(params, config) {}; + OperationPartial oper2 = new OperationPartial(params, config, Collections.emptyList()) {}; oper2.start(); assertTrue(executor.runAll(MAX_REQUESTS)); @@ -1118,7 +1137,7 @@ public class OperationPartialTest { @Test public void testGetRetryWait() { // need an operator that doesn't override the retry time - OperationPartial oper2 = new OperationPartial(params, config) {}; + OperationPartial oper2 = new OperationPartial(params, config, Collections.emptyList()) {}; assertEquals(OperationPartial.DEFAULT_RETRY_WAIT_MS, oper2.getRetryWaitMs()); } @@ -1290,7 +1309,7 @@ public class OperationPartialTest { public MyOper() { - super(OperationPartialTest.this.params, config); + super(OperationPartialTest.this.params, config, PROP_NAMES); } @Override diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java index e4c83049b..98ca6736d 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java @@ -126,7 +126,7 @@ public class ControlLoopOperationParamsTest { params = ControlLoopOperationParams.builder().actorService(actorService).completeCallback(completer) .context(context).executor(executor).actor(ACTOR).operation(OPERATION).payload(payload) .retry(RETRY).target(TARGET).targetEntity(TARGET_ENTITY).timeoutSec(TIMEOUT) - .startCallback(starter).build(); + .startCallback(starter).preprocessed(true).build(); outcome = params.makeOutcome(); } @@ -139,6 +139,13 @@ public class ControlLoopOperationParamsTest { } @Test + public void testBuild() { + assertSame(operation, params.build()); + + assertThatIllegalArgumentException().isThrownBy(() -> params.toBuilder().context(null).build().build()); + } + + @Test public void testGetRequestId() { assertSame(REQ_ID, params.getRequestId()); @@ -292,6 +299,14 @@ public class ControlLoopOperationParamsTest { } @Test + public void test() { + assertTrue(params.isPreprocessed()); + + // should be false when unspecified + assertFalse(ControlLoopOperationParams.builder().build().isPreprocessed()); + } + + @Test public void testGetRetry() { assertSame(RETRY, params.getRetry()); |