From f456cc5c8e1efd15edb6da718e1428d8fd7c66c5 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Thu, 27 Aug 2020 08:44:12 -0400 Subject: 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 --- .../onap/policy/controlloop/actor/appc/AppcOperation.java | 4 ++-- .../policy/controlloop/actor/appc/ModifyConfigOperation.java | 3 ++- .../policy/controlloop/actor/appc/AppcOperationTest.java | 12 ++++++------ .../policy/controlloop/actor/appc/BasicAppcOperation.java | 12 ++++++------ .../controlloop/actor/appc/ModifyConfigOperationTest.java | 6 +++--- 5 files changed, 19 insertions(+), 18 deletions(-) (limited to 'models-interactions/model-actors/actor.appc/src') diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java index e07093ae6..70c70823c 100644 --- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java +++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java @@ -33,11 +33,11 @@ import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.coder.StandardCoderInstantAsMillis; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; +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; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -172,7 +172,7 @@ public abstract class AppcOperation extends BidirectionalTopicOperation makeServer(TopicSink sink, TopicSource source) { return new AppcLegacyTopicServer(sink, source); } @@ -126,7 +127,7 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio assertTrue(future2.isDone()); outcome = future2.get(); - assertEquals(PolicyResult.SUCCESS, outcome.getResult()); + assertEquals(OperationResult.SUCCESS, outcome.getResult()); assertEquals(MY_DESCRIPTION, outcome.getMessage()); } @@ -153,10 +154,9 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio protected void makeContext() { super.makeContext(); - Target target = new Target(); - target.setResourceID(RESOURCE_ID); + Map entities = Map.of(ControlLoopOperationParams.PARAMS_ENTITY_RESOURCEID, RESOURCE_ID); - params = params.toBuilder().target(target).build(); + params = params.toBuilder().targetEntityIds(entities).build(); } /** 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 2177dfa41..749b6c86c 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 @@ -51,10 +51,10 @@ import org.onap.policy.appc.Response; 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.controlloop.ControlLoopEventContext; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicParams; -import org.onap.policy.controlloop.policy.PolicyResult; public class ModifyConfigOperationTest extends BasicAppcOperation { @@ -120,7 +120,7 @@ public class ModifyConfigOperationTest extends BasicAppcOperation { oper.setProperty(OperationProperties.AAI_RESOURCE_VNF, genvnf); outcome = oper.start().get(); - assertEquals(PolicyResult.SUCCESS, outcome.getResult()); + assertEquals(OperationResult.SUCCESS, outcome.getResult()); assertTrue(outcome.getResponse() instanceof Response); } @@ -162,7 +162,7 @@ public class ModifyConfigOperationTest extends BasicAppcOperation { future2.complete(params.makeOutcome(null)); assertTrue(executor.runAll(100)); assertTrue(future3.isDone()); - assertEquals(PolicyResult.SUCCESS, future3.get().getResult()); + assertEquals(OperationResult.SUCCESS, future3.get().getResult()); } /** -- cgit 1.2.3-korg