From: daniel Date: Tue, 31 Oct 2017 12:37:41 +0000 (-0500) Subject: Fix Abatement Processing X-Git-Tag: v1.1.0~6^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=aa7d5c71a2bdd2b3a4241e0fd42d6c6872790537;p=policy%2Fdrools-applications.git Fix Abatement Processing The drools engine will now only fire the event rule if the event is an onset. This prevents abatements from being processed as onsets. Issue-Id: POLICY-407 Change-Id: Ic74efa74fbb1dc0e01d7c36a06fdaf48fc8a3238 Signed-off-by: Daniel Cruz --- diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl index 93b4e0a8a..acc980686 100644 --- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl @@ -203,6 +203,8 @@ rule "${policyName}.EVENT" // Retract it from memory // retract($event); + } else if ($event.closedLoopEventStatus != ControlLoopEventStatus.ONSET) { + throw new ControlLoopException($event.closedLoopEventStatus + " received with no prior onset"); } else { // // Create an EventManager @@ -261,7 +263,7 @@ rule "${policyName}.EVENT" VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event); notification.notification = ControlLoopNotificationType.REJECTED; - notification.message = "Exception occurred " + e.getMessage(); + notification.message = "Exception occurred: " + e.getMessage(); notification.policyName = drools.getRule().getName(); notification.policyScope = "${policyScope}"; notification.policyVersion = "${policyVersion}";