aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.appclcm/src
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-08-27 08:44:12 -0400
committerPamela Dragosh <pdragosh@research.att.com>2020-08-27 14:29:09 -0400
commitf456cc5c8e1efd15edb6da718e1428d8fd7c66c5 (patch)
treeb7b4ba3fc6255b056e00f6e203d7ec8fd6a7c194 /models-interactions/model-actors/actor.appclcm/src
parent68a60a45f27287a4a523c82ef466cbeec655f641 (diff)
Remove Target and TargetType
The dependency should have been removed in the last review to remove SDC and policy-yaml legacy code. It was revealed that usage of TargetType and Type were spread out over the actor code. Those fields are represented differently in the new TOSCA Operational Policy Type, so fields were created to capture those values to be used by actor code. Issue-ID: POLICY-2428 Change-Id: Ib783526a518ca7942ae9e38019bd343639f4dd98 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.appclcm/src')
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperation.java4
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java28
2 files changed, 17 insertions, 15 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 dc74825f7..1d687cded 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
@@ -33,11 +33,11 @@ import org.onap.policy.appclcm.AppcLcmResponseStatus;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
+import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperation;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.topic.SelectorKey;
-import org.onap.policy.controlloop.policy.PolicyResult;
public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWrapper, AppcLcmDmaapWrapper> {
@@ -177,7 +177,7 @@ public class AppcLcmOperation extends BidirectionalTopicOperation<AppcLcmDmaapWr
* Sets the message to the status description, if available.
*/
@Override
- public OperationOutcome setOutcome(OperationOutcome outcome, PolicyResult result, AppcLcmDmaapWrapper response) {
+ public OperationOutcome setOutcome(OperationOutcome outcome, OperationResult result, AppcLcmDmaapWrapper response) {
outcome.setResponse(response);
AppcLcmResponseStatus status = getStatus(response);
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 f3b3cc2f3..e707ea942 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
@@ -32,6 +32,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -57,12 +58,12 @@ import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
+import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperation.Status;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicParams;
-import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.controlloop.policy.Target;
+import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.simulators.AppcLcmTopicServer;
import org.onap.policy.simulators.TopicServer;
@@ -106,6 +107,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
super.tearDownBasic();
}
+ @Override
protected TopicServer<AppcLcmDmaapWrapper> makeServer(TopicSink sink, TopicSource source) {
return new AppcLcmTopicServer(sink, source);
}
@@ -129,7 +131,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
};
outcome = oper.start().get();
- assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(OperationResult.SUCCESS, outcome.getResult());
assertTrue(outcome.getResponse() instanceof AppcLcmDmaapWrapper);
}
@@ -168,7 +170,7 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
assertTrue(executor.runAll(100));
assertTrue(future2.isDone());
outcome = future2.get();
- assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ assertEquals(OperationResult.SUCCESS, outcome.getResult());
}
@Test
@@ -260,26 +262,26 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
@Test
public void testSetOutcome() {
- oper.setOutcome(outcome, PolicyResult.SUCCESS, response);
- assertEquals(PolicyResult.SUCCESS, outcome.getResult());
+ oper.setOutcome(outcome, OperationResult.SUCCESS, response);
+ assertEquals(OperationResult.SUCCESS, outcome.getResult());
assertEquals(MY_MESSAGE, outcome.getMessage());
assertSame(response, outcome.getResponse());
// failure
- oper.setOutcome(outcome, PolicyResult.FAILURE, response);
- assertEquals(PolicyResult.FAILURE, outcome.getResult());
+ oper.setOutcome(outcome, OperationResult.FAILURE, response);
+ assertEquals(OperationResult.FAILURE, outcome.getResult());
assertEquals(MY_MESSAGE, outcome.getMessage());
assertSame(response, outcome.getResponse());
// null message
response.getBody().getOutput().getStatus().setMessage(null);
- oper.setOutcome(outcome, PolicyResult.SUCCESS, response);
+ oper.setOutcome(outcome, OperationResult.SUCCESS, response);
assertEquals(ControlLoopOperation.SUCCESS_MSG, outcome.getMessage());
assertSame(response, outcome.getResponse());
// null status
response.getBody().getOutput().setStatus(null);
- oper.setOutcome(outcome, PolicyResult.SUCCESS, response);
+ oper.setOutcome(outcome, OperationResult.SUCCESS, response);
assertEquals(ControlLoopOperation.SUCCESS_MSG, outcome.getMessage());
assertSame(response, outcome.getResponse());
}
@@ -348,10 +350,10 @@ public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcL
protected void makeContext() {
super.makeContext();
- Target target = new Target();
- target.setResourceID(RESOURCE_ID);
+ Map<String, String> targetEntities = new HashMap<>();
+ targetEntities.put(ControlLoopOperationParams.PARAMS_ENTITY_RESOURCEID, RESOURCE_ID);
- params = params.toBuilder().target(target).build();
+ params = params.toBuilder().targetEntityIds(targetEntities).build();
}
@Override