From a6d4077e3639a0f3478f0cbf51e06ef46517a10d Mon Sep 17 00:00:00 2001 From: "Straubs, Ralph (rs8887)" Date: Fri, 17 Jul 2020 10:38:02 -0400 Subject: Add tdjam-controller the details is on wiki: https://wiki.onap.org/display/DW/tdjam+Feature+for+Tosca-Driven+Control+Loops Fixed some eclipse warnings. Revised the interaction between a manager and its SerialWorkQueue to address some threading issues. The original code started processing the event as soon as the manager was created, WHILE it was still being added to the map. During junit tests, the event responses came back, within the same thread, which then attempted to remove the manager from the map. This resulted in a ConcurrentHashMap exception. Issue-ID: POLICY-2415 Change-Id: I94a4152637be76e5b2aea2d869afd84dfb413a0e Signed-off-by: Straubs, Ralph (rs8887) Signed-off-by: jhh Signed-off-by: Taka Cho Signed-off-by: Jim Hahn --- .../usecases/UsecasesEventManagerTest.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'controlloop/common/controller-usecases') diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java index 6681c3ef3..b87e56da6 100644 --- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java +++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java @@ -77,6 +77,7 @@ import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; import org.onap.policy.controlloop.drl.legacy.ControlLoopParams; import org.onap.policy.controlloop.eventmanager.ActorConstants; import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2; +import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager2Drools; import org.onap.policy.controlloop.ophistory.OperationHistoryDataManager; import org.onap.policy.drools.apps.controller.usecases.UsecasesEventManager.NewEventStatus; import org.onap.policy.drools.apps.controller.usecases.step.AaiCqStep2; @@ -917,15 +918,15 @@ public class UsecasesEventManagerTest { Map orig = event.getAai(); event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "true")); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem)) .isInstanceOf(IllegalStateException.class); event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_IS_CLOSED_LOOP_DISABLED, "true")); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem)) .isInstanceOf(IllegalStateException.class); event.setAai(addAai(orig, ControlLoopEventManager2.PNF_IS_IN_MAINT, "true")); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem)) .isInstanceOf(IllegalStateException.class); } @@ -934,17 +935,17 @@ public class UsecasesEventManagerTest { Map orig = event.getAai(); event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "ACTIVE")); - assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException(); + assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException(); event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "inactive")); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem)) .isInstanceOf(IllegalStateException.class); event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "ACTIVE")); - assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException(); + assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException(); event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "inactive")); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem)) .isInstanceOf(IllegalStateException.class); } @@ -954,15 +955,15 @@ public class UsecasesEventManagerTest { for (String value : Arrays.asList("yes", "y", "true", "t", "yEs", "trUe")) { event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, value)); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem)) .isInstanceOf(IllegalStateException.class); } event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "false")); - assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException(); + assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException(); event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "no")); - assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException(); + assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException(); } -- cgit 1.2.3-korg