diff options
author | 2019-08-13 15:52:22 -0400 | |
---|---|---|
committer | 2019-08-15 09:21:28 -0400 | |
commit | fdaae76549bafb2e482c02fb26de719c69431b48 (patch) | |
tree | a3f477da55f80fe7e4bed3d959d8089cf1971438 /controlloop/templates/archetype-cl-usecases | |
parent | 9e8023a455633c7daf0dd291c6268986e39352d7 (diff) |
Modify to work with new drools-pdp
Due to sonar fixes, drools-pdp changed in a way that requires changes
to drools-applications. In the case of template.demo, lots of test cases
had to be modified, so they were refactored to extract common setup and
tear down code.
Fixed checkstyle issues.
Fixed license date.
Change-Id: Ie9e0239b95916ae7ef8c1b669987f7bb07d841b9
Issue-ID: POLICY-1968
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/templates/archetype-cl-usecases')
-rw-r--r-- | controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl index a9e17c3c4..37d7b6936 100644 --- a/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl @@ -77,7 +77,7 @@ import java.time.Instant; import java.util.LinkedList; import java.util.Iterator; -import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.drools.system.PolicyEngineConstants; /* * This object is to provide support for timeouts @@ -180,7 +180,7 @@ rule "EVENT" // // Let interested parties know // - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); // // Retract it from memory @@ -213,7 +213,7 @@ rule "EVENT" // // Let interested parties know // - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); // // Setup the Overall Control Loop timer // @@ -230,7 +230,7 @@ rule "EVENT" // // Let interested parties know // - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); // // Retract it from memory // @@ -255,7 +255,7 @@ rule "EVENT" // // // - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); // // Retract the event // @@ -348,7 +348,7 @@ rule "EVENT.MANAGER" // // In this case, we are done // - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); // // Unlock the target // @@ -393,7 +393,7 @@ rule "EVENT.MANAGER" // // In this case, we are done // - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); // // Unlock the target // @@ -461,7 +461,7 @@ rule "EVENT.MANAGER" notification.setPolicyScope($params.getPolicyScope()); notification.setPolicyVersion($params.getPolicyVersion()); - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); retract($event); @@ -495,7 +495,7 @@ rule "EVENT.MANAGER" notification.setPolicyScope($params.getPolicyScope()); notification.setPolicyVersion($params.getPolicyVersion()); - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); retract($event); @@ -549,17 +549,17 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" notification.setPolicyScope($params.getPolicyScope()); notification.setPolicyVersion($params.getPolicyVersion()); - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); switch ($operation.policy.getActor()){ case "APPC": if (request instanceof Request) { - PolicyEngine.manager.deliver("APPC-CL", request); + PolicyEngineConstants.getManager().deliver("APPC-CL", request); } else if (request instanceof LcmRequestWrapper) { - PolicyEngine.manager.deliver("APPC-LCM-READ", request); + PolicyEngineConstants.getManager().deliver("APPC-LCM-READ", request); } break; case "SO": @@ -576,9 +576,9 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" SoActorServiceProvider.sendRequest($event.getRequestId().toString(), new mySoCallback(), request, - PolicyEngine.manager.getEnvironmentProperty("so.url"), - PolicyEngine.manager.getEnvironmentProperty("so.username"), - PolicyEngine.manager.getEnvironmentProperty("so.password")); + PolicyEngineConstants.getManager().getEnvironmentProperty("so.url"), + PolicyEngineConstants.getManager().getEnvironmentProperty("so.username"), + PolicyEngineConstants.getManager().getEnvironmentProperty("so.password")); } break; case "VFC": @@ -592,15 +592,15 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" // Start VFC thread Thread t = new Thread(new VfcManager(new myVfcCallback(), (VfcRequest)request, - PolicyEngine.manager.getEnvironmentProperty("vfc.url"), - PolicyEngine.manager.getEnvironmentProperty("vfc.username"), - PolicyEngine.manager.getEnvironmentProperty("vfc.password"))); + PolicyEngineConstants.getManager().getEnvironmentProperty("vfc.url"), + PolicyEngineConstants.getManager().getEnvironmentProperty("vfc.username"), + PolicyEngineConstants.getManager().getEnvironmentProperty("vfc.password"))); t.start(); } break; case "SDNR": if (request instanceof PciRequestWrapper) { - PolicyEngine.manager.deliver("SDNR-CL", request); + PolicyEngineConstants.getManager().deliver("SDNR-CL", request); } break; @@ -614,9 +614,9 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" // Start SDNC thread Thread t = new Thread(new SdncManager(new mySdncCallback(), (SdncRequest)request, - PolicyEngine.manager.getEnvironmentProperty("sdnc.url"), - PolicyEngine.manager.getEnvironmentProperty("sdnc.username"), - PolicyEngine.manager.getEnvironmentProperty("sdnc.password"))); + PolicyEngineConstants.getManager().getEnvironmentProperty("sdnc.url"), + PolicyEngineConstants.getManager().getEnvironmentProperty("sdnc.username"), + PolicyEngineConstants.getManager().getEnvironmentProperty("sdnc.password"))); t.start(); } break; @@ -666,7 +666,7 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" notification.setMessage($operation.getOperationHistory()); notification.setHistory($operation.getHistory()); - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); } retract($opTimer); @@ -716,7 +716,7 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED" notification.setPolicyScope($params.getPolicyScope()); notification.setPolicyVersion($params.getPolicyVersion()); - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); // // Now send Guard Request to XACML Guard. In order to bypass the call to Guard, @@ -728,7 +728,7 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED" // // NOTE: The environment properties uses "guard.disabled" but the boolean is guardEnabled - boolean guardEnabled = "false".equalsIgnoreCase(PolicyEngine.manager.getEnvironmentProperty("guard.disabled")); + boolean guardEnabled = "false".equalsIgnoreCase(PolicyEngineConstants.getManager().getEnvironmentProperty("guard.disabled")); if(guardEnabled){ @@ -794,7 +794,7 @@ rule "GUARD.RESPONSE" notification.setPolicyScope($params.getPolicyScope()); notification.setPolicyVersion($params.getPolicyVersion()); - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); if("Permit".equalsIgnoreCase($guardResponse.getResult())){ @@ -867,13 +867,13 @@ rule "APPC.RESPONSE" // // Let interested parties know // - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); } else { notification.setNotification(ControlLoopNotificationType.OPERATION_FAILURE); // // Let interested parties know // - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); } // // Ensure the operation is complete @@ -987,7 +987,7 @@ rule "APPC.LCM.RESPONSE" } else { notification.setNotification(ControlLoopNotificationType.OPERATION_FAILURE); } - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); // // Ensure the operation is complete // @@ -1096,7 +1096,7 @@ rule "SO.RESPONSE" notification.setNotification(ControlLoopNotificationType.OPERATION_FAILURE); } - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); // // Ensure the operation is complete // @@ -1341,7 +1341,7 @@ rule "EVENT.MANAGER.OPERATION.TIMEOUT" // // Let interested parties know // - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); // // Get rid of the timer // @@ -1399,7 +1399,7 @@ rule "EVENT.MANAGER.TIMEOUT" // // Let interested parties know // - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); } // // Retract the event @@ -1525,10 +1525,10 @@ rule "SDNR.RESPONSE" } else { notification.setNotification(ControlLoopNotificationType.OPERATION_FAILURE); } - PolicyEngine.manager.deliver("POLICY-CL-MGT", notification); + PolicyEngineConstants.getManager().deliver("POLICY-CL-MGT", notification); ControlLoopResponse clResponse = $operation.getControlLoopResponse($response, $event); - PolicyEngine.manager.deliver("DCAE_CL_RSP", clResponse); + PolicyEngineConstants.getManager().deliver("DCAE_CL_RSP", clResponse); // // Ensure the operation is complete // |