aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/controller-usecases
diff options
context:
space:
mode:
authorStraubs, Ralph (rs8887) <rs8887@att.com>2020-07-17 10:38:02 -0400
committerTaka Cho <takamune.cho@att.com>2020-08-28 17:03:19 -0400
commita6d4077e3639a0f3478f0cbf51e06ef46517a10d (patch)
tree1d34398ef3488d97c1dc6475372a1b8755373a8b /controlloop/common/controller-usecases
parentc75e28d1c1221c37ea4fd1feed9d38c75334f4db (diff)
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) <rs8887@att.com> Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Signed-off-by: Taka Cho <takamune.cho@att.com> Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/controller-usecases')
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java21
1 files changed, 11 insertions, 10 deletions
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<String, String> 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<String, String> 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();
}