summaryrefslogtreecommitdiffstats
path: root/controlloop/common/controller-usecases
diff options
context:
space:
mode:
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.java56
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.java7
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java11
3 files changed, 30 insertions, 44 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 d4979fb79..cce720974 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
@@ -76,8 +76,6 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
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;
@@ -888,7 +886,7 @@ public class UsecasesEventManagerTest {
// VM case
event.setTargetType(ControlLoopTargetType.VM);
- event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
+ event.setAai(Map.of(UsecasesConstants.GENERIC_VNF_VNF_ID, MY_TARGET));
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
event.setAai(Map.of());
@@ -896,7 +894,7 @@ public class UsecasesEventManagerTest {
// VNF case
event.setTargetType(ControlLoopTargetType.VNF);
- event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
+ event.setAai(Map.of(UsecasesConstants.GENERIC_VNF_VNF_ID, MY_TARGET));
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
event.setAai(Map.of());
@@ -904,7 +902,7 @@ public class UsecasesEventManagerTest {
// PNF case
event.setTargetType(ControlLoopTargetType.PNF);
- event.setAai(Map.of(ControlLoopEventManager2.PNF_NAME, MY_TARGET));
+ event.setAai(Map.of(UsecasesConstants.PNF_NAME, MY_TARGET));
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
event.setAai(Map.of());
@@ -914,13 +912,13 @@ public class UsecasesEventManagerTest {
@Test
public void testValidateAaiVmVnfData() {
event.setTargetType(ControlLoopTargetType.VM);
- event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_ID, MY_TARGET));
+ event.setAai(Map.of(UsecasesConstants.GENERIC_VNF_VNF_ID, MY_TARGET));
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
- event.setAai(Map.of(ControlLoopEventManager2.VSERVER_VSERVER_NAME, MY_TARGET));
+ event.setAai(Map.of(UsecasesConstants.VSERVER_VSERVER_NAME, MY_TARGET));
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
- event.setAai(Map.of(ControlLoopEventManager2.GENERIC_VNF_VNF_NAME, MY_TARGET));
+ event.setAai(Map.of(UsecasesConstants.GENERIC_VNF_VNF_NAME, MY_TARGET));
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
event.setAai(Map.of());
@@ -931,7 +929,7 @@ public class UsecasesEventManagerTest {
@Test
public void testValidateAaiPnfData() {
event.setTargetType(ControlLoopTargetType.PNF);
- event.setAai(Map.of(ControlLoopEventManager2.PNF_NAME, MY_TARGET));
+ event.setAai(Map.of(UsecasesConstants.PNF_NAME, MY_TARGET));
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
event.setAai(Map.of());
@@ -943,16 +941,16 @@ public class UsecasesEventManagerTest {
public void testIsClosedLoopDisabled() {
Map<String, String> orig = event.getAai();
- event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "true"));
- assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+ event.setAai(addAai(orig, UsecasesConstants.VSERVER_IS_CLOSED_LOOP_DISABLED, "true"));
+ assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
.isInstanceOf(IllegalStateException.class);
- event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_IS_CLOSED_LOOP_DISABLED, "true"));
- assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+ event.setAai(addAai(orig, UsecasesConstants.GENERIC_VNF_IS_CLOSED_LOOP_DISABLED, "true"));
+ assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
.isInstanceOf(IllegalStateException.class);
- event.setAai(addAai(orig, ControlLoopEventManager2.PNF_IS_IN_MAINT, "true"));
- assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+ event.setAai(addAai(orig, UsecasesConstants.PNF_IS_IN_MAINT, "true"));
+ assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
.isInstanceOf(IllegalStateException.class);
}
@@ -960,18 +958,18 @@ public class UsecasesEventManagerTest {
public void testIsProvStatusInactive() {
Map<String, String> orig = event.getAai();
- event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "ACTIVE"));
- assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+ event.setAai(addAai(orig, UsecasesConstants.VSERVER_PROV_STATUS, "ACTIVE"));
+ assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
- event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "inactive"));
- assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+ event.setAai(addAai(orig, UsecasesConstants.VSERVER_PROV_STATUS, "inactive"));
+ assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
.isInstanceOf(IllegalStateException.class);
- event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "ACTIVE"));
- assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+ event.setAai(addAai(orig, UsecasesConstants.GENERIC_VNF_PROV_STATUS, "ACTIVE"));
+ assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
- event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "inactive"));
- assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+ event.setAai(addAai(orig, UsecasesConstants.GENERIC_VNF_PROV_STATUS, "inactive"));
+ assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
.isInstanceOf(IllegalStateException.class);
}
@@ -980,16 +978,16 @@ public class UsecasesEventManagerTest {
Map<String, String> orig = event.getAai();
for (String value : Arrays.asList("yes", "y", "true", "t", "yEs", "trUe")) {
- event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, value));
- assertThatThrownBy(() -> new ControlLoopEventManager2Drools(params, event, workMem))
+ event.setAai(addAai(orig, UsecasesConstants.VSERVER_IS_CLOSED_LOOP_DISABLED, value));
+ assertThatThrownBy(() -> new UsecasesEventManager(params, event, workMem))
.isInstanceOf(IllegalStateException.class);
}
- event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "false"));
- assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+ event.setAai(addAai(orig, UsecasesConstants.VSERVER_IS_CLOSED_LOOP_DISABLED, "false"));
+ assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
- event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "no"));
- assertThatCode(() -> new ControlLoopEventManager2Drools(params, event, workMem)).doesNotThrowAnyException();
+ event.setAai(addAai(orig, UsecasesConstants.VSERVER_IS_CLOSED_LOOP_DISABLED, "no"));
+ assertThatCode(() -> new UsecasesEventManager(params, event, workMem)).doesNotThrowAnyException();
}
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.java
index 131e5d3c8..ab9507221 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.java
@@ -50,7 +50,6 @@ import org.onap.policy.controlloop.actor.so.VfModuleCreate;
import org.onap.policy.controlloop.actorserviceprovider.Operation;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.TargetType;
-import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.eventmanager.StepContext;
import org.onap.policy.drools.apps.controller.usecases.UsecasesConstants;
@@ -73,8 +72,6 @@ public class GuardStep2Test {
private static final int VF_COUNT = 10;
@Mock
- private ControlLoopEventContext context;
- @Mock
private StepContext stepContext;
@Mock
private VirtualControlLoopEvent event;
@@ -106,8 +103,6 @@ public class GuardStep2Test {
when(event.getRequestId()).thenReturn(REQ_ID);
when(event.getAai()).thenReturn(aai);
- when(context.getEvent()).thenReturn(event);
-
when(genericVnf.getVnfId()).thenReturn(MY_TARGET);
when(genericVnf.getVnfName()).thenReturn(MY_NAME);
when(genericVnf.getVnfType()).thenReturn(MY_TYPE);
@@ -174,7 +169,7 @@ public class GuardStep2Test {
.actor(MASTER_ACTOR)
.operation(MASTER_OPERATION)
.targetEntity(MY_TARGET)
- .context(context)
+ .requestId(REQ_ID)
.targetType(target)
.build();
// @formatter:on
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java
index d01e2b5a0..7695d5b20 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java
@@ -64,10 +64,8 @@ import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.Operator;
import org.onap.policy.controlloop.actorserviceprovider.TargetType;
-import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
-import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager2;
import org.onap.policy.controlloop.eventmanager.StepContext;
import org.onap.policy.drools.apps.controller.usecases.UsecasesConstants;
@@ -97,7 +95,6 @@ public class Step2Test {
private CompletableFuture<OperationOutcome> future;
private Map<String, String> payload;
private VirtualControlLoopEvent event;
- private ControlLoopEventContext context;
private BlockingQueue<OperationOutcome> starts;
private BlockingQueue<OperationOutcome> completions;
private ControlLoopOperationParams params;
@@ -126,10 +123,6 @@ public class Step2Test {
event = new VirtualControlLoopEvent();
event.setRequestId(REQ_ID);
- event.setTarget(ControlLoopOperationManager2.VSERVER_VSERVER_NAME);
- event.setAai(new TreeMap<>(Map.of(ControlLoopOperationManager2.VSERVER_VSERVER_NAME, MY_TARGET)));
-
- context = new ControlLoopEventContext(event);
starts = new LinkedBlockingQueue<>();
completions = new LinkedBlockingQueue<>();
@@ -137,10 +130,10 @@ public class Step2Test {
Map<String, String> entityIds = new HashMap<>();
params = ControlLoopOperationParams.builder().actor(POLICY_ACTOR).actorService(actors)
- .completeCallback(completions::add).context(context).executor(ForkJoinPool.commonPool())
+ .completeCallback(completions::add).executor(ForkJoinPool.commonPool())
.operation(POLICY_OPERATION).payload(new TreeMap<>(payload)).startCallback(starts::add)
.targetType(TargetType.VM).targetEntityIds(entityIds).targetEntity(MY_TARGET)
- .build();
+ .requestId(REQ_ID).build();
step = new Step2(stepContext, params, event);
step.init();