Use new Actor names in drools-apps 05/109805/1
authorJim Hahn <jrh3@att.com>
Wed, 1 Jul 2020 20:13:46 +0000 (16:13 -0400)
committerJim Hahn <jrh3@att.com>
Thu, 2 Jul 2020 13:59:44 +0000 (09:59 -0400)
Modified drools-apps to use XxxActor instead of XxxActorServiceProvider.
This is the second step of the rename.

Issue-ID: POLICY-2684
Change-Id: Iea60e92f914b7719ac765b086650479be9192d98
Signed-off-by: Jim Hahn <jrh3@att.com>
controlloop/common/controller-usecases/src/main/resources/usecases.drl
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/EventManagerServices.java
controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2Test.java

index dabc02f..95260fc 100644 (file)
@@ -40,9 +40,9 @@ import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager.NewEvent
 import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager;
 import org.onap.policy.controlloop.eventmanager.LockCallbackWorkingMemory;
 import org.onap.policy.controlloop.utils.ControlLoopUtils;
-import org.onap.policy.controlloop.actor.so.SoActorServiceProvider;
-import org.onap.policy.controlloop.actor.cds.CdsActorServiceProvider;
-import org.onap.policy.controlloop.actor.cds.CdsActorServiceProvider.CdsActorServiceManager;
+import org.onap.policy.controlloop.actor.so.SoActor;
+import org.onap.policy.controlloop.actor.cds.CdsActor;
+import org.onap.policy.controlloop.actor.cds.CdsActor.CdsActorServiceManager;
 import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants;
 import org.onap.policy.aai.AaiCqResponse;
 import org.onap.policy.appc.Request;
@@ -595,7 +595,7 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
                               drools.getWorkingMemory().insert(wrapper);
                           }
                       }
-                      SoActorServiceProvider.sendRequest($event.getRequestId().toString(),
+                      SoActor.sendRequest($event.getRequestId().toString(),
                           new mySoCallback(),
                           request,
                           PolicyEngineConstants.getManager().getEnvironmentProperty("so.url"),
@@ -649,8 +649,8 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
 
                       // Instantiate cds actor, service manager and grpc properties
 
-                      CdsActorServiceProvider cdsActor = new CdsActorServiceProvider();
-                      CdsActorServiceProvider.CdsActorServiceManager cdsActorServiceManager = cdsActor.new CdsActorServiceManager();
+                      CdsActor cdsActor = new CdsActor();
+                      CdsActor.CdsActorServiceManager cdsActorServiceManager = cdsActor.new CdsActorServiceManager();
 
                       CdsServerProperties props = new CdsServerProperties();
                       props.setHost(PolicyEngineConstants.getManager().getEnvironmentProperty("cds.grpcHost"));
index d3937c9..d16468d 100644 (file)
@@ -52,14 +52,14 @@ import org.onap.policy.controlloop.ControlLoopException;
 import org.onap.policy.controlloop.ControlLoopOperation;
 import org.onap.policy.controlloop.ControlLoopResponse;
 import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actor.appc.AppcActorServiceProvider;
-import org.onap.policy.controlloop.actor.appclcm.AppcLcmActorServiceProvider;
-import org.onap.policy.controlloop.actor.cds.CdsActorServiceProvider;
+import org.onap.policy.controlloop.actor.appc.AppcActor;
+import org.onap.policy.controlloop.actor.appclcm.AppcLcmActor;
+import org.onap.policy.controlloop.actor.cds.CdsActor;
 import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants;
-import org.onap.policy.controlloop.actor.sdnc.SdncActorServiceProvider;
-import org.onap.policy.controlloop.actor.sdnr.SdnrActorServiceProvider;
-import org.onap.policy.controlloop.actor.so.SoActorServiceProvider;
-import org.onap.policy.controlloop.actor.vfc.VfcActorServiceProvider;
+import org.onap.policy.controlloop.actor.sdnc.SdncActor;
+import org.onap.policy.controlloop.actor.sdnr.SdnrActor;
+import org.onap.policy.controlloop.actor.so.SoActor;
+import org.onap.policy.controlloop.actor.vfc.VfcActor;
 import org.onap.policy.controlloop.policy.Policy;
 import org.onap.policy.controlloop.policy.PolicyResult;
 import org.onap.policy.controlloop.policy.TargetType;
@@ -358,11 +358,11 @@ public class ControlLoopOperationManager implements Serializable {
         this.currentOperation = operation;
         if ("ModifyConfig".equalsIgnoreCase(policy.getRecipe())) {
             this.operationRequest =
-                AppcActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset,
+                AppcActor.constructRequest((VirtualControlLoopEvent) onset,
                     operation.clOperation, this.policy, this.targetEntity);
         } else {
             this.operationRequest =
-                AppcLcmActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset,
+                AppcLcmActor.constructRequest((VirtualControlLoopEvent) onset,
                     operation.clOperation, this.policy, this.targetEntity);
         }
         //
@@ -373,7 +373,7 @@ public class ControlLoopOperationManager implements Serializable {
     }
 
     private Object startSoOperation(ControlLoopEvent onset, Operation operation) {
-        SoActorServiceProvider soActorSp = new SoActorServiceProvider();
+        SoActor soActorSp = new SoActor();
         this.operationRequest = soActorSp.constructRequestCq((VirtualControlLoopEvent) onset,
             operation.clOperation, this.policy, this.aaiCqResponse);
 
@@ -389,7 +389,7 @@ public class ControlLoopOperationManager implements Serializable {
 
     private Object startVfcOperation(ControlLoopEvent onset, Operation operation) {
         this.operationRequest =
-            VfcActorServiceProvider.constructRequestCq((VirtualControlLoopEvent) onset,
+            VfcActor.constructRequestCq((VirtualControlLoopEvent) onset,
                 operation.clOperation, this.policy, this.aaiCqResponse);
         this.currentOperation = operation;
         if (this.operationRequest == null) {
@@ -403,7 +403,7 @@ public class ControlLoopOperationManager implements Serializable {
          * If the recipe is ModifyConfig or ModifyConfigANR, a SDNR request is constructed.
          */
         this.currentOperation = operation;
-        this.operationRequest = SdnrActorServiceProvider
+        this.operationRequest = SdnrActor
             .constructRequest((VirtualControlLoopEvent) onset, operation.clOperation, this.policy);
         //
         // Save the operation
@@ -416,7 +416,7 @@ public class ControlLoopOperationManager implements Serializable {
     }
 
     private Object startSdncOperation(ControlLoopEvent onset, Operation operation) {
-        SdncActorServiceProvider provider = new SdncActorServiceProvider();
+        SdncActor provider = new SdncActor();
         this.operationRequest = provider.constructRequest((VirtualControlLoopEvent) onset,
             operation.clOperation, this.policy);
         this.currentOperation = operation;
@@ -429,7 +429,7 @@ public class ControlLoopOperationManager implements Serializable {
     private Object startCdsOperation(ControlLoopEvent onset, Operation operation)
         throws AaiException {
 
-        CdsActorServiceProvider provider = new CdsActorServiceProvider();
+        CdsActor provider = new CdsActor();
         Optional<ExecutionServiceInput> optionalRequest =
             provider.constructRequest((VirtualControlLoopEvent) onset, operation.clOperation,
                 this.policy, this.buildAaiParams());
@@ -629,7 +629,7 @@ public class ControlLoopOperationManager implements Serializable {
         /*
          * Parse out the operation attempt using the subrequestid
          */
-        Integer operationAttempt = AppcLcmActorServiceProvider.parseOperationAttempt(
+        Integer operationAttempt = AppcLcmActor.parseOperationAttempt(
             dmaapResponse.getBody().getOutput().getCommonHeader().getSubRequestId());
         if (operationAttempt == null) {
             this.completeOperation(operationAttempt,
@@ -642,7 +642,7 @@ public class ControlLoopOperationManager implements Serializable {
          * Process the APPCLCM response to see what PolicyResult should be returned
          */
         AbstractMap.SimpleEntry<PolicyResult, String> result =
-            AppcLcmActorServiceProvider.processResponse(dmaapResponse);
+            AppcLcmActor.processResponse(dmaapResponse);
 
         if (result.getKey() != null) {
             this.completeOperation(operationAttempt, result.getValue(), result.getKey());
@@ -664,7 +664,7 @@ public class ControlLoopOperationManager implements Serializable {
         /*
          * Parse out the operation attempt using the subrequestid
          */
-        Integer operationAttempt = SdnrActorServiceProvider
+        Integer operationAttempt = SdnrActor
             .parseOperationAttempt(dmaapResponse.getBody().getCommonHeader().getSubRequestId());
         if (operationAttempt == null) {
             this.completeOperation(operationAttempt,
@@ -676,7 +676,7 @@ public class ControlLoopOperationManager implements Serializable {
          * Process the SDNR response to see what PolicyResult should be returned
          */
         Pair<PolicyResult, String> result =
-            SdnrActorServiceProvider.processResponse(dmaapResponse);
+            SdnrActor.processResponse(dmaapResponse);
 
         if (result.getLeft() != null) {
             this.completeOperation(operationAttempt, result.getRight(), result.getLeft());
@@ -1197,7 +1197,7 @@ public class ControlLoopOperationManager implements Serializable {
             //
             // Cast SDNR response and handle it
             //
-            return SdnrActorServiceProvider.getControlLoopResponse((PciResponseWrapper) response,
+            return SdnrActor.getControlLoopResponse((PciResponseWrapper) response,
                 event);
         } else {
             return null;
index 5141b71..7672622 100644 (file)
@@ -43,8 +43,8 @@ import org.onap.policy.aai.AaiCqResponse;
 import org.onap.policy.controlloop.ControlLoopOperation;
 import org.onap.policy.controlloop.ControlLoopResponse;
 import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actor.guard.GuardActorServiceProvider;
-import org.onap.policy.controlloop.actor.sdnr.SdnrActorServiceProvider;
+import org.onap.policy.controlloop.actor.guard.GuardActor;
+import org.onap.policy.controlloop.actor.sdnr.SdnrActor;
 import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
 import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
 import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
@@ -67,7 +67,7 @@ public class ControlLoopOperationManager2 implements Serializable {
     private static final String CL_TIMEOUT_ACTOR = "-CL-TIMEOUT-";
     public static final String LOCK_ACTOR = "LOCK";
     public static final String LOCK_OPERATION = "Lock";
-    private static final String GUARD_ACTOR = GuardActorServiceProvider.NAME;
+    private static final String GUARD_ACTOR = GuardActor.NAME;
     public static final String VSERVER_VSERVER_NAME = "vserver.vserver-name";
     public static final String GENERIC_VNF_VNF_NAME = "generic-vnf.vnf-name";
     public static final String GENERIC_VNF_VNF_ID = "generic-vnf.vnf-id";
@@ -574,7 +574,7 @@ public class ControlLoopOperationManager2 implements Serializable {
     protected ControlLoopResponse makeControlLoopResponse(OperationOutcome outcome) {
 
         // only generate response for certain actors.
-        if (outcome == null || !actor.equals(SdnrActorServiceProvider.NAME)) {
+        if (outcome == null || !actor.equals(SdnrActor.NAME)) {
             return null;
         }
 
index 66b9006..42bc3d1 100644 (file)
@@ -27,7 +27,7 @@ import org.onap.policy.common.parameters.ValidationResult;
 import org.onap.policy.common.utils.properties.PropertyObjectUtils;
 import org.onap.policy.controlloop.actor.guard.DecisionOperation;
 import org.onap.policy.controlloop.actor.guard.DecisionOperator;
-import org.onap.policy.controlloop.actor.guard.GuardActorServiceProvider;
+import org.onap.policy.controlloop.actor.guard.GuardActor;
 import org.onap.policy.controlloop.actor.guard.GuardConfig;
 import org.onap.policy.controlloop.actorserviceprovider.ActorService;
 import org.onap.policy.controlloop.actorserviceprovider.Util;
@@ -103,7 +103,7 @@ public class EventManagerServices {
      */
     public boolean isGuardEnabled() {
         try {
-            DecisionOperator guard = (DecisionOperator) getActorService().getActor(GuardActorServiceProvider.NAME)
+            DecisionOperator guard = (DecisionOperator) getActorService().getActor(GuardActor.NAME)
                             .getOperator(DecisionOperation.NAME);
             if (!guard.isConfigured()) {
                 logger.warn("cannot check 'disabled' property in GUARD actor - assuming disabled");
index a5179a9..add4c41 100644 (file)
@@ -57,7 +57,7 @@ import org.onap.policy.controlloop.ControlLoopOperation;
 import org.onap.policy.controlloop.ControlLoopResponse;
 import org.onap.policy.controlloop.VirtualControlLoopEvent;
 import org.onap.policy.controlloop.actor.guard.DecisionOperation;
-import org.onap.policy.controlloop.actor.guard.GuardActorServiceProvider;
+import org.onap.policy.controlloop.actor.guard.GuardActor;
 import org.onap.policy.controlloop.actorserviceprovider.ActorService;
 import org.onap.policy.controlloop.actorserviceprovider.Operation;
 import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
@@ -930,7 +930,7 @@ public class ControlLoopOperationManager2Test {
      */
     private OperationOutcome genGuardOutcome(boolean permit) {
         OperationOutcome outcome = mgr.getParams().makeOutcome();
-        outcome.setActor(GuardActorServiceProvider.NAME);
+        outcome.setActor(GuardActor.NAME);
         outcome.setOperation(DecisionOperation.NAME);
         outcome.setStart(Instant.now());
         mgr.getParams().callbackStarted(new OperationOutcome(outcome));