aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-11-18 10:44:41 -0500
committerJim Hahn <jrh3@att.com>2020-11-20 11:49:01 -0500
commit1dd41890f83702d47c5a957493046433989ef36c (patch)
tree4271931cf6ca6e7c43141cc600bd8351015be294 /models-interactions
parentca468c57a4d09842f2608e32da74b30eba52d015 (diff)
Delete preprocessed flag from actors
Removed the "preprocessed" flag from the Actor parameter class, now that the actors no longer have a startPreprocess() method. Also removed targetEntity from Actor parameter class. Created a makeOutcome method within OperationPartial, which is used to create an initial outcome whose target field is pre-populated with the target-entity extracted from the properties. As the meaning of "target" may be specific to an operation, the makeOutcome method may be overridden by an operation subclass. Issue-ID: POLICY-2804 Change-Id: Ifb66de63301d644e69340009593513773ee5672d Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions')
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java4
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java5
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java1
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java1
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/ModifyConfigOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java3
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java7
-rw-r--r--models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java9
-rw-r--r--models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java2
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java2
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java2
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java2
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java2
-rw-r--r--models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java1
-rw-r--r--models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java2
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java26
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParams.java16
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java18
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/parameters/ControlLoopOperationParamsTest.java34
21 files changed, 64 insertions, 79 deletions
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
index a4b30652d..c1582c51a 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
@@ -30,6 +30,7 @@ import org.onap.policy.aai.AaiConstants;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
@@ -71,7 +72,8 @@ public class AaiGetPnfOperation extends AaiGetOperation {
StringBuilder str = new StringBuilder(getClient().getBaseUrl());
- String path = getPath() + URI_SEP + URLEncoder.encode(getTargetEntity(), StandardCharsets.UTF_8);
+ String target = getProperty(OperationProperties.AAI_TARGET_ENTITY);
+ String path = getPath() + URI_SEP + URLEncoder.encode(target, StandardCharsets.UTF_8);
WebTarget web = getClient().getWebTarget().path(path);
str.append(path);
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
index add9c647a..b3bf4ce12 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
@@ -28,6 +28,7 @@ import org.onap.policy.aai.AaiConstants;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
@@ -72,8 +73,10 @@ public class AaiGetTenantOperation extends AaiGetOperation {
WebTarget web = getClient().getWebTarget().path(path);
str.append(path);
+ String target = getProperty(OperationProperties.AAI_TARGET_ENTITY);
+
web = addQuery(web, str, "?", "search-node-type", "vserver");
- web = addQuery(web, str, "&", "filter", "vserver-name:EQUALS:" + getTargetEntity());
+ web = addQuery(web, str, "&", "filter", "vserver-name:EQUALS:" + target);
Builder webldr = web.request();
addHeaders(webldr, headers);
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 61155ce07..b5ba5d2ab 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
@@ -91,7 +91,7 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation {
HttpParams opParams = HttpParams.builder().clientName(MY_CLIENT).path("v16/query").build();
config = new HttpConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new AaiCustomQueryOperation(params, config);
oper.setProperty(OperationProperties.AAI_VSERVER_LINK, MY_LINK);
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
index fb2b770db..9e72fe2e8 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperationTest.java
@@ -72,6 +72,7 @@ public class AaiGetPnfOperationTest extends BasicAaiOperation {
public void setUp() throws Exception {
super.setUpBasic();
oper = new AaiGetPnfOperation(params, config);
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
}
@Test
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
index 27495d8fc..a79a8f79a 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperationTest.java
@@ -72,6 +72,7 @@ public class AaiGetTenantOperationTest extends BasicAaiOperation {
public void setUp() throws Exception {
super.setUpBasic();
oper = new AaiGetTenantOperation(params, config);
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
}
@Test
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 ee3ac0242..ab15fdd56 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
@@ -82,7 +82,7 @@ public class ModifyConfigOperationTest extends BasicAppcOperation {
BidirectionalTopicParams.builder().sinkTopic(MY_SINK).sourceTopic(MY_SINK).build();
config = new BidirectionalTopicConfig(blockingExecutor, opParams, topicMgr, AppcOperation.SELECTOR_KEYS);
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new ModifyConfigOperation(params, config);
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 303067dde..bf204781a 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
@@ -84,7 +84,8 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
* Action Identifiers are required for APPC LCM requests. For R1, the recipes
* supported by Policy only require a vnf-id.
*/
- inputRequest.setActionIdentifiers(Map.of(VNF_ID_KEY, getTargetEntity()));
+ String target = getProperty(OperationProperties.AAI_TARGET_ENTITY);
+ inputRequest.setActionIdentifiers(Map.of(VNF_ID_KEY, target));
/*
* For R1, the payloads will not be required for the Restart, Rebuild, or Migrate
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 650c5da99..b9999f4a1 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
@@ -22,6 +22,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.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -94,6 +95,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
response = makeResponse();
oper = new AppcLcmOperation(params, config);
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
}
@After
@@ -118,6 +120,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new AppcLcmOperation(params, config);
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
outcome = oper.start().get();
assertEquals(OperationResult.SUCCESS, outcome.getResult());
@@ -161,6 +164,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
// only builds a payload for ConfigModify
params = params.toBuilder().operation(AppcLcmConstants.OPERATION_CONFIG_MODIFY).build();
oper = new AppcLcmOperation(params, config);
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
oper.generateSubRequestId(2);
AppcLcmDmaapWrapper req = oper.makeRequest(2);
@@ -181,8 +185,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
oper.generateSubRequestId(2);
- assertThatIllegalArgumentException().isThrownBy(() -> oper.makeRequest(2))
- .withMessage("Cannot convert payload");
+ assertThatThrownBy(() -> oper.makeRequest(2)).isInstanceOf(NullPointerException.class);
}
@Test
diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java
index da069d83e..f83f782d9 100644
--- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java
+++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/GrpcOperationTest.java
@@ -64,7 +64,6 @@ import org.onap.policy.simulators.CdsSimulator;
import org.onap.policy.simulators.Util;
public class GrpcOperationTest {
- private static final String TARGET_ENTITY = "entity";
private static final String MY_VNF = "my-vnf";
private static final String MY_SVC_ID = "my-service-instance-id";
private static final String RESOURCE_ID = "my-resource-id";
@@ -125,7 +124,7 @@ public class GrpcOperationTest {
targetEntityIds.put(ControlLoopOperationParams.PARAMS_ENTITY_RESOURCEID, RESOURCE_ID);
params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR).operation(GrpcOperation.NAME)
- .requestId(REQUEST_ID).actorService(new ActorService()).targetEntity(TARGET_ENTITY)
+ .requestId(REQUEST_ID).actorService(new ActorService())
.build();
}
@@ -137,9 +136,9 @@ public class GrpcOperationTest {
Map<String, Object> payload = Map.of("artifact_name", "my_artifact", "artifact_version", "1.0");
params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR).operation("subscribe")
- .requestId(REQUEST_ID).actorService(new ActorService()).targetEntity(TARGET_ENTITY)
+ .requestId(REQUEST_ID).actorService(new ActorService())
.retry(0).timeoutSec(5).executor(blockingExecutor).payload(payload)
- .preprocessed(true).build();
+ .build();
cdsProps.setHost("localhost");
cdsProps.setPort(sim.getPort());
@@ -231,7 +230,7 @@ public class GrpcOperationTest {
ControlLoopOperationParams params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR)
.operation(GrpcOperation.NAME).requestId(REQUEST_ID).actorService(new ActorService())
- .targetType(targetType).targetEntity(TARGET_ENTITY).payload(payloadMap).build();
+ .targetType(targetType).payload(payloadMap).build();
GrpcConfig config = new GrpcConfig(executor, cdsProps);
operation = new GrpcOperation(params, config);
diff --git a/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java b/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
index d9ec3ab2c..f18a04fd1 100644
--- a/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
+++ b/models-interactions/model-actors/actor.guard/src/main/java/org/onap/policy/controlloop/actor/guard/DecisionOperation.java
@@ -99,7 +99,7 @@ public class DecisionOperation extends HttpOperation<DecisionResponse> {
final Executor executor = params.getExecutor();
final CallbackManager callbacks = new CallbackManager();
- return CompletableFuture.completedFuture(params.makeOutcome(getTargetEntity()))
+ return CompletableFuture.completedFuture(makeOutcome())
.whenCompleteAsync(callbackStarted(callbacks), executor)
.whenCompleteAsync(callbackCompleted(callbacks), executor);
}
diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java
index ba68534c4..8c12be8f9 100644
--- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java
+++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BandwidthOnDemandOperationTest.java
@@ -96,7 +96,7 @@ public class BandwidthOnDemandOperationTest extends BasicSdncOperation {
.path("GENERIC-RESOURCE-API:vf-module-topology-operation").build();
config = new HttpConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new BandwidthOnDemandOperation(params, config);
oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE);
diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java
index 3f087844b..effbb6e02 100644
--- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java
+++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/RerouteOperationTest.java
@@ -75,7 +75,7 @@ public class RerouteOperationTest extends BasicSdncOperation {
.path("GENERIC-RESOURCE-API:network-topology-operation").build();
config = new HttpConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new RerouteOperation(params, config);
oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE);
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
index 8dca7c844..dfd5c92f6 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java
@@ -98,7 +98,7 @@ public class VfModuleCreateTest extends BasicSoOperation {
.maxPolls(2).build();
config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new VfModuleCreate(params, config);
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
index 3bce9b0f8..ce762011a 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java
@@ -125,7 +125,7 @@ public class VfModuleDeleteTest extends BasicSoOperation {
.pollPath("orchestrationRequests/v5/").maxPolls(2).build();
config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new VfModuleDelete(params, config);
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
index bb7f34b61..4bfbe40f2 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
@@ -112,7 +112,7 @@ public class BasicOperation {
*/
protected void makeContext() {
params = ControlLoopOperationParams.builder().executor(executor).requestId(REQ_ID).actorService(service)
- .actor(actorName).operation(operationName).targetEntity(TARGET_ENTITY).payload(makePayload())
+ .actor(actorName).operation(operationName).payload(makePayload())
.build();
}
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java
index fe06ad52f..758acf75e 100644
--- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java
+++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java
@@ -74,7 +74,6 @@ public class BasicOperationTest {
assertEquals(ACTOR, oper.params.getActor());
assertEquals(OPERATION, oper.params.getOperation());
assertSame(BasicHttpOperation.REQ_ID, oper.params.getRequestId());
- assertEquals(BasicHttpOperation.TARGET_ENTITY, oper.params.getTargetEntity());
}
@Test
diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java
index fab7636ba..75ed8b29b 100644
--- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java
+++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/RestartTest.java
@@ -81,7 +81,7 @@ public class RestartTest extends BasicVfcOperation {
.maxPolls(1).build();
config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
restartOper = new Restart(params, config);
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 e9f6b024c..c3d3f6663 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
@@ -226,7 +226,7 @@ public abstract class OperationPartial implements Operation {
logger.info("{}: start operation attempt {} for {}", getFullName(), attempt, params.getRequestId());
final Executor executor = params.getExecutor();
- final OperationOutcome outcome = params.makeOutcome(getTargetEntity());
+ final OperationOutcome outcome = makeOutcome();
final CallbackManager callbacks = new CallbackManager();
// this operation attempt gets its own controller
@@ -357,7 +357,7 @@ public abstract class OperationPartial implements Operation {
outcome = origOutcome;
} else {
logger.warn("{}: null outcome; treating as a failure for {}", getFullName(), params.getRequestId());
- outcome = this.setOutcome(params.makeOutcome(getTargetEntity()), OperationResult.FAILURE);
+ outcome = this.setOutcome(makeOutcome(), OperationResult.FAILURE);
}
// ensure correct actor/operation
@@ -456,7 +456,7 @@ public abstract class OperationPartial implements Operation {
private Function<Throwable, OperationOutcome> fromException(String type) {
return thrown -> {
- OperationOutcome outcome = params.makeOutcome(getTargetEntity());
+ OperationOutcome outcome = makeOutcome();
if (thrown instanceof CancellationException || thrown.getCause() instanceof CancellationException) {
// do not include exception in the message, as it just clutters the log
@@ -893,6 +893,16 @@ public abstract class OperationPartial implements Operation {
}
/**
+ * Makes an outcome, populating the "target" field with the contents of the target
+ * entity property.
+ *
+ * @return a new operation outcome
+ */
+ protected OperationOutcome makeOutcome() {
+ return params.makeOutcome(getProperty(OperationProperties.AAI_TARGET_ENTITY));
+ }
+
+ /**
* Determines if a throwable is due to a timeout.
*
* @param thrown throwable of interest
@@ -976,16 +986,6 @@ public abstract class OperationPartial implements Operation {
}
/**
- * Gets the target entity, first trying the properties and then the parameters.
- *
- * @return the target entity
- */
- protected String getTargetEntity() {
- String targetEntity = getProperty(OperationProperties.AAI_TARGET_ENTITY);
- return (targetEntity != null ? targetEntity : params.getTargetEntity());
- }
-
- /**
* Gets the operation timeout.
*
* @param timeoutSec timeout, in seconds, extracted from the parameters, or
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 67f68036b..2769697cf 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
@@ -97,13 +97,6 @@ public class ControlLoopOperationParams {
private Map<String, Object> payload;
/**
- * {@code True} if the preprocessing steps have already been executed, {@code false}
- * otherwise.
- */
- // TODO remove this once the rules no longer reference it
- private boolean preprocessed;
-
- /**
* Number of retries allowed, or {@code null} if no retries.
*/
private Integer retry;
@@ -121,12 +114,6 @@ public class ControlLoopOperationParams {
private Map<String, String> targetEntityIds;
/**
- * Target entity.
- */
- // TODO to be removed
- private String targetEntity;
-
- /**
* Timeout, in seconds, or {@code null} if no timeout. Zero and negative values also
* imply no timeout.
*/
@@ -197,9 +184,8 @@ public class ControlLoopOperationParams {
*
* @return a new operation outcome
*/
- // TODO to be removed
public OperationOutcome makeOutcome() {
- return makeOutcome(getTargetEntity());
+ return makeOutcome(null);
}
/**
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 b7a6a1d3b..72a7338d5 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
@@ -165,7 +165,7 @@ public class OperationPartialTest {
params = ControlLoopOperationParams.builder().completeCallback(this::completer).requestId(REQ_ID)
.executor(executor).actorService(service).actor(ACTOR).operation(OPERATION).timeoutSec(TIMEOUT)
- .startCallback(this::starter).targetEntity(MY_TARGET_ENTITY).build();
+ .startCallback(this::starter).build();
when(service.getActor(OperationPartial.GUARD_ACTOR_NAME)).thenReturn(guardActor);
when(guardActor.getOperator(OperationPartial.GUARD_OPERATION_NAME)).thenReturn(guardOperator);
@@ -924,6 +924,12 @@ public class OperationPartialTest {
}
@Test
+ public void testMakeOutcome() {
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, MY_TARGET_ENTITY);
+ assertEquals(MY_TARGET_ENTITY, oper.makeOutcome().getTarget());
+ }
+
+ @Test
public void testIsTimeout() {
final TimeoutException timex = new TimeoutException(EXPECTED_EXCEPTION);
@@ -1007,16 +1013,6 @@ public class OperationPartialTest {
}
@Test
- public void testGetTargetEntity() {
- // get it from the params
- assertEquals(MY_TARGET_ENTITY, oper.getTargetEntity());
-
- // now get it from the properties
- oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, "entityX");
- assertEquals("entityX", oper.getTargetEntity());
- }
-
- @Test
public void testGetTimeOutMs() {
assertEquals(TIMEOUT * 1000, oper.getTimeoutMs(params.getTimeoutSec()));
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 b6bd50c7e..fc36c12ba 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
@@ -112,8 +112,8 @@ public class ControlLoopOperationParamsTest {
params = ControlLoopOperationParams.builder().actorService(actorService).completeCallback(completer)
.requestId(REQ_ID).executor(executor).actor(ACTOR).operation(OPERATION).payload(payload)
- .retry(RETRY).targetEntity(TARGET_ENTITY).timeoutSec(TIMEOUT)
- .startCallback(starter).preprocessed(true).build();
+ .retry(RETRY).timeoutSec(TIMEOUT)
+ .startCallback(starter).build();
outcome = params.makeOutcome(TARGET_ENTITY);
}
@@ -139,13 +139,20 @@ public class ControlLoopOperationParamsTest {
@Test
public void testMakeOutcome() {
- assertEquals(ACTOR, outcome.getActor());
- assertEquals(OPERATION, outcome.getOperation());
+ outcome = params.makeOutcome();
+ assertNull(outcome.getTarget());
+ checkRemainingFields("with actor");
+ }
+
+ @Test
+ public void testMakeOutcomeString() {
+ assertEquals(TARGET_ENTITY, outcome.getTarget());
checkRemainingFields("with actor");
}
protected void checkRemainingFields(String testName) {
- assertEquals(testName, TARGET_ENTITY, outcome.getTarget());
+ assertEquals(ACTOR, outcome.getActor());
+ assertEquals(OPERATION, outcome.getOperation());
assertNull(testName, outcome.getStart());
assertNull(testName, outcome.getEnd());
assertNull(testName, outcome.getSubRequestId());
@@ -212,7 +219,7 @@ public class ControlLoopOperationParamsTest {
testValidate("requestId", NULL_MSG, bldr -> bldr.requestId(null));
// has no target entity
- BeanValidationResult result = params.toBuilder().targetEntity(null).build().validate();
+ BeanValidationResult result = params.toBuilder().build().validate();
assertTrue(result.isValid());
// check edge cases
@@ -224,7 +231,7 @@ public class ControlLoopOperationParamsTest {
// test with minimal fields
assertTrue(ControlLoopOperationParams.builder().actorService(actorService).requestId(REQ_ID).actor(ACTOR)
- .operation(OPERATION).targetEntity(TARGET_ENTITY).build().validate().isValid());
+ .operation(OPERATION).build().validate().isValid());
}
private void testValidate(String fieldName, String expected,
@@ -277,14 +284,6 @@ 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());
@@ -312,9 +311,4 @@ public class ControlLoopOperationParamsTest {
public void testGetCompleteCallback() {
assertSame(completer, params.getCompleteCallback());
}
-
- @Test
- public void testGetTargetEntity() {
- assertEquals(TARGET_ENTITY, params.getTargetEntity());
- }
}