aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.appc/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-02-20 09:40:14 -0500
committerJim Hahn <jrh3@att.com>2020-02-20 16:29:08 -0500
commit467247c7970f9ae83464d78929ed970bbf03c593 (patch)
tree54b78e6505b664c3a61e532bf6f7c276307d6591 /models-interactions/model-actors/actor.appc/src/test
parentf6da7772d9dc01ce4ddd21a55b0f1c5fb7ad814f (diff)
More actor clean-up
Currently, Operator classes refer to Operation classes, and vice versa, creating a dependency cycle. In addition, there is a slight problem in that if an operator is reconfigured, any running operation may get inconsistent configuration data. Modified the code to create Config objects that are passed to the operation, instead of passing the Operator to the operations. This solved both issues. Replaceed makeOperator() with constructors. Added parameter type to HttpActors. Modified guard to get "ONAP" properties from its configuration, as a default. Changed setUp() to setUpBasic(), so "throws Exception" could be removed, thus resolving a sonar issue. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I21eb8798acfbc636ff1bd8741b21c7278365b6e4
Diffstat (limited to 'models-interactions/model-actors/actor.appc/src/test')
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java6
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java11
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java4
3 files changed, 10 insertions, 11 deletions
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java
index 8a86b346c..218a4e532 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcOperationTest.java
@@ -48,7 +48,7 @@ public class AppcOperationTest extends BasicAppcOperation {
public void setUp() throws Exception {
super.setUp();
- oper = new AppcOperation(params, operator) {
+ oper = new AppcOperation(params, config) {
@Override
protected Request makeRequest(int attempt) {
return oper.makeRequest(attempt, MY_VNF);
@@ -81,7 +81,7 @@ public class AppcOperationTest extends BasicAppcOperation {
// repeat using a null payload
params = params.toBuilder().payload(null).build();
- oper = new AppcOperation(params, operator) {
+ oper = new AppcOperation(params, config) {
@Override
protected Request makeRequest(int attempt) {
return oper.makeRequest(attempt, MY_VNF);
@@ -111,7 +111,7 @@ public class AppcOperationTest extends BasicAppcOperation {
params = params.toBuilder().payload(payload).build();
- oper = new AppcOperation(params, operator) {
+ oper = new AppcOperation(params, config) {
@Override
protected Request makeRequest(int attempt) {
return oper.makeRequest(attempt, MY_VNF);
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java
index 3d4a04612..ed3e7a7ee 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java
@@ -32,7 +32,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import java.util.function.BiConsumer;
-import java.util.function.BiFunction;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
import org.onap.policy.appc.ResponseStatus;
@@ -40,8 +39,8 @@ import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.Util;
-import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperator;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
+import org.onap.policy.controlloop.actorserviceprovider.impl.OperationMaker;
+import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.controlloop.policy.Target;
import org.powermock.reflect.Whitebox;
@@ -82,7 +81,7 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio
* Initializes mocks and sets up.
*/
public void setUp() throws Exception {
- super.setUp();
+ super.setUpBasic();
response = new Response();
@@ -123,12 +122,12 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio
* @param expectedText text expected in the exception message
*/
protected void verifyMissing(String fieldName, String expectedText,
- BiFunction<ControlLoopOperationParams, BidirectionalTopicOperator, AppcOperation> maker) {
+ OperationMaker<BidirectionalTopicConfig, AppcOperation> maker) {
makeContext();
enrichment.remove(fieldName);
- AppcOperation oper = maker.apply(params, operator);
+ AppcOperation oper = maker.apply(params, config);
assertThatIllegalArgumentException().isThrownBy(() -> Whitebox.invokeMethod(oper, "makeRequest", 1))
.withMessageContaining("missing").withMessageContaining(expectedText);
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java
index 34bbec32f..5ff789715 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java
@@ -54,7 +54,7 @@ public class ModifyConfigOperationTest extends BasicAppcOperation {
@Before
public void setUp() throws Exception {
super.setUp();
- oper = new ModifyConfigOperation(params, operator);
+ oper = new ModifyConfigOperation(params, config);
}
@Test
@@ -72,7 +72,7 @@ public class ModifyConfigOperationTest extends BasicAppcOperation {
AtomicBoolean guardStarted = new AtomicBoolean();
- oper = new ModifyConfigOperation(params, operator) {
+ oper = new ModifyConfigOperation(params, config) {
@Override
protected CompletableFuture<OperationOutcome> startGuardAsync() {
guardStarted.set(true);