summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipTest.java)19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java57
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java11
18 files changed, 173 insertions, 123 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java
new file mode 100644
index 0000000000..c134f31b42
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java
@@ -0,0 +1,22 @@
+package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AbstractSDNCTask {
+
+ @Autowired
+ Environment env;
+
+
+ public URI buildCallbackURI(SDNCRequest sdncRequest) {
+ UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
+ .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
+ return builder.build();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
index e4dd35503e..b85e33144f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
@@ -22,8 +22,6 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
-import java.net.URI;
-import javax.ws.rs.core.UriBuilder;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
@@ -52,7 +50,7 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class SDNCActivateTasks {
+public class SDNCActivateTasks extends AbstractSDNCTask {
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
@@ -77,9 +75,9 @@ public class SDNCActivateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
Customer customer = gBBInput.getCustomer();
- GenericResourceApiVnfOperationInformation req =
- sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.activateVnf(vnf, serviceInstance, customer,
+ cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
@@ -127,11 +125,8 @@ public class SDNCActivateTasks {
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
SDNCRequest sdncRequest = new SDNCRequest();
- UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
- .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
- URI uri = builder.build();
GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf,
- serviceInstance, customer, cloudRegion, requestContext, uri);
+ serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
index c100cd6cee..ab2647a68d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
@@ -22,8 +22,6 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
-import java.net.URI;
-import javax.ws.rs.core.UriBuilder;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
@@ -55,7 +53,7 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class SDNCAssignTasks {
+public class SDNCAssignTasks extends AbstractSDNCTask {
private static final Logger logger = LoggerFactory.getLogger(SDNCAssignTasks.class);
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
@@ -100,9 +98,11 @@ public class SDNCAssignTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.assignVnf(vnf, serviceInstance, customer,
- cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming()));
SDNCRequest sdncRequest = new SDNCRequest();
+
+ GenericResourceApiVnfOperationInformation req =
+ sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext,
+ Boolean.TRUE.equals(vnf.isCallHoming()), buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
@@ -128,11 +128,9 @@ public class SDNCAssignTasks {
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
SDNCRequest sdncRequest = new SDNCRequest();
- UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
- .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
- URI uri = builder.build();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule,
- volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, uri);
+ GenericResourceApiVfModuleOperationInformation req =
+ sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
index acf48acdda..c5ebc5e447 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
@@ -20,8 +20,6 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
-import java.net.URI;
-import javax.ws.rs.core.UriBuilder;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
@@ -49,7 +47,7 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class SDNCChangeAssignTasks {
+public class SDNCChangeAssignTasks extends AbstractSDNCTask {
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCNetworkResources sdncNetworkResources;
@@ -88,9 +86,10 @@ public class SDNCChangeAssignTasks {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance,
- gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext());
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVnfOperationInformation req =
+ sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(),
+ gBBInput.getCloudRegion(), gBBInput.getRequestContext(), buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
@@ -127,11 +126,8 @@ public class SDNCChangeAssignTasks {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
Customer customer = gBBInput.getCustomer();
SDNCRequest sdncRequest = new SDNCRequest();
- UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
- .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
- URI uri = builder.build();
GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule,
- vnf, serviceInstance, customer, cloudRegion, requestContext, uri);
+ vnf, serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
index 3fc25196e1..3c42f76d73 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
@@ -22,8 +22,6 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
-import java.net.URI;
-import javax.ws.rs.core.UriBuilder;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
@@ -53,7 +51,7 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class SDNCDeactivateTasks {
+public class SDNCDeactivateTasks extends AbstractSDNCTask {
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
@@ -82,11 +80,8 @@ public class SDNCDeactivateTasks {
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
SDNCRequest sdncRequest = new SDNCRequest();
- UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
- .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
- URI uri = builder.build();
GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf,
- serviceInstance, customer, cloudRegion, requestContext, uri);
+ serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
@@ -111,9 +106,9 @@ public class SDNCDeactivateTasks {
vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
Customer customer = gBBInput.getCustomer();
- GenericResourceApiVnfOperationInformation req =
- sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.deactivateVnf(vnf, serviceInstance,
+ customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
index 4721bf56f1..e3c9785ab2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
@@ -22,8 +22,6 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
-import java.net.URI;
-import javax.ws.rs.core.UriBuilder;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
@@ -53,7 +51,7 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class SDNCUnassignTasks {
+public class SDNCUnassignTasks extends AbstractSDNCTask {
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
@@ -98,11 +96,8 @@ public class SDNCUnassignTasks {
RequestContext requestContext = gBBInput.getRequestContext();
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
SDNCRequest sdncRequest = new SDNCRequest();
- UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
- .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
- URI uri = builder.build();
- GenericResourceApiVfModuleOperationInformation req =
- sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, requestContext, uri);
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf,
+ serviceInstance, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
@@ -120,9 +115,9 @@ public class SDNCUnassignTasks {
RequestContext requestContext = gBBInput.getRequestContext();
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVnfOperationInformation req =
- sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer,
+ cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index a17556f091..073dead8b3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -28,6 +28,7 @@ import javax.persistence.EntityNotFoundException;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.aai.domain.yang.Vnfc;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
@@ -81,6 +82,8 @@ public class WorkflowActionBBTasks {
private CatalogDbClient catalogDbClient;
@Autowired
private FlowManipulatorListenerRunner flowManipulatorListenerRunner;
+ @Autowired
+ private RequestsDbListenerRunner requestsDbListener;
public void selectBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute =
@@ -225,6 +228,7 @@ public class WorkflowActionBBTasks {
request.setProgress(Long.valueOf(100));
request.setRequestStatus("COMPLETE");
request.setLastModifiedBy("CamundaBPMN");
+ requestsDbListener.post(request, new DelegateExecutionImpl(execution));
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception ex) {
workflowAction.buildAndThrowException(execution, "Error Updating Request Database", ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java
index fd0de086ad..376a27e830 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java
@@ -24,16 +24,18 @@ import java.util.Collections;
import java.util.List;
import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.db.PostCompletionRequestsDbListener;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
-public class MultiStageSkipListener implements FlowManipulator {
+public class MultiStageSkipListener implements FlowManipulator, PostCompletionRequestsDbListener {
@Autowired
protected BBInputSetupUtils bbInputSetupUtils;
@@ -41,12 +43,21 @@ public class MultiStageSkipListener implements FlowManipulator {
@Autowired
private CatalogDbClient catalogDbClient;
+ private static final String G_MULTI_STAGE_DESIGN = "multiStageDesign";
+
@Override
public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
return ((boolean) execution.getVariable(BBConstants.G_ALACARTE)) && "AssignVfModuleBB".equals(currentBBName)
&& isFirst;
}
+
+ @Override
+ public boolean shouldRunFor(BuildingBlockExecution execution) {
+
+ return (boolean) execution.getVariable(G_MULTI_STAGE_DESIGN);
+ }
+
@Override
public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
BuildingBlockExecution execution) {
@@ -61,10 +72,15 @@ public class MultiStageSkipListener implements FlowManipulator {
if (vnfCust != null && vnfCust.getMultiStageDesign() != null
&& vnfCust.getMultiStageDesign().equalsIgnoreCase("true")) {
flowsToExecute.retainAll(Collections.singletonList(currentBB));
+ execution.setVariable(G_MULTI_STAGE_DESIGN, Boolean.valueOf(vnfCust.getMultiStageDesign()));
}
}
}
}
+ @Override
+ public void run(InfraActiveRequests request, BuildingBlockExecution execution) {
+ request.setFlowStatus("Successfully completed Assign Building Block only due to multi-stage-design VNF");
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
index 0e32955eed..12aae1e6a6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
@@ -22,6 +22,7 @@
package org.onap.so.client.orchestration;
+import java.net.URI;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -50,47 +51,48 @@ public class SDNCVnfResources {
private SDNCClient sdncClient;
public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing,
+ URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, homing);
+ cloudRegion, requestContext, homing, callbackURI);
}
public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ cloudRegion, requestContext, false, callbackURI);
}
public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ cloudRegion, requestContext, false, callbackURI);
}
public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ cloudRegion, requestContext, false, callbackURI);
}
public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ cloudRegion, requestContext, false, callbackURI);
}
public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ cloudRegion, requestContext, false, callbackURI);
}
public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
index e39e202aa3..bef4ec3465 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
@@ -20,6 +20,7 @@
package org.onap.so.client.sdnc.mapper;
+import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -56,7 +57,8 @@ public class VnfTopologyOperationRequestMapper {
public GenericResourceApiVnfOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction,
GenericResourceApiRequestActionEnumeration requestAction, GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing,
+ URI callbackUrl) {
String sdncReqId = UUID.randomUUID().toString();
String msoRequestId = UUID.randomUUID().toString();
if (requestContext != null && requestContext.getMsoRequestId() != null) {
@@ -64,7 +66,7 @@ public class VnfTopologyOperationRequestMapper {
}
GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation();
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
- generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUrl.toString());
GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction);
GenericResourceApiServiceinformationServiceInformation serviceInformation =
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java
index ffd4f74b63..510dc47649 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java
@@ -94,11 +94,11 @@ public class SDNCActivateTaskTest extends BaseTaskTest {
@Test
public void activateVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).activateVnf(genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).activateVnf(eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncActivateTasks.activateVnf(execution);
- verify(sdncVnfResources, times(1)).activateVnf(genericVnf, serviceInstance, customer, cloudRegion,
- requestContext);
+ verify(sdncVnfResources, times(1)).activateVnf(eq(genericVnf), eq(serviceInstance), eq(customer),
+ eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
}
@@ -106,8 +106,8 @@ public class SDNCActivateTaskTest extends BaseTaskTest {
@Test
public void activateVnfTestException() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).activateVnf(genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVnfResources).activateVnf(eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncActivateTasks.activateVnf(execution);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java
index 982868dcbc..b72766c386 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java
@@ -113,12 +113,12 @@ public class SDNCAssignTasksTest extends BaseTaskTest {
@Test
public void assignVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).assignVnf(genericVnf,
- serviceInstance, customer, cloudRegion, requestContext, false);
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).assignVnf(eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), eq(false), any(URI.class));
execution.setVariable("generalBuildingBlock", gBBInput);
sdncAssignTasks.assignVnf(execution);
- verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext,
- false);
+ verify(sdncVnfResources, times(1)).assignVnf(eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion),
+ eq(requestContext), eq(false), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
}
@@ -126,8 +126,8 @@ public class SDNCAssignTasksTest extends BaseTaskTest {
@Test
public void assignVnfExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ doThrow(RuntimeException.class).when(sdncVnfResources).assignVnf(eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), eq(false), any(URI.class));
sdncAssignTasks.assignVnf(execution);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java
index 8c25bea801..96ff01f78b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java
@@ -80,11 +80,11 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest {
@Test
public void changeModelVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).changeModelVnf(genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).changeModelVnf(eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncChangeAssignTasks.changeModelVnf(execution);
- verify(sdncVnfResources, times(1)).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion,
- requestContext);
+ verify(sdncVnfResources, times(1)).changeModelVnf(eq(genericVnf), eq(serviceInstance), eq(customer),
+ eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
}
@@ -92,8 +92,8 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest {
@Test
public void changeModelVnfExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).changeModelVnf(genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVnfResources).changeModelVnf(eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncChangeAssignTasks.changeModelVnf(execution);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java
index d8a1b0182e..3714f9d9a9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java
@@ -107,19 +107,19 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest {
@Test
public void deactivateVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).deactivateVnf(genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).deactivateVnf(eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncDeactivateTasks.deactivateVnf(execution);
- verify(sdncVnfResources, times(1)).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion,
- requestContext);
+ verify(sdncVnfResources, times(1)).deactivateVnf(eq(genericVnf), eq(serviceInstance), eq(customer),
+ eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
}
@Test
public void deactivateVnfExceptionTest() throws Exception {
- doThrow(RuntimeException.class).when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVnfResources).deactivateVnf(eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
expectedException.expect(BpmnError.class);
sdncDeactivateTasks.deactivateVnf(execution);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java
index b29d15c830..98f6bfab9c 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java
@@ -125,11 +125,11 @@ public class SDNCUnassignTasksTest extends BaseTaskTest {
@Test
public void unassignVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).unassignVnf(genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).unassignVnf(eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncUnassignTasks.unassignVnf(execution);
- verify(sdncVnfResources, times(1)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion,
- requestContext);
+ verify(sdncVnfResources, times(1)).unassignVnf(eq(genericVnf), eq(serviceInstance), eq(customer),
+ eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
}
@@ -137,8 +137,8 @@ public class SDNCUnassignTasksTest extends BaseTaskTest {
@Test
public void unassignVnfExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVnfResources).unassignVnf(eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncUnassignTasks.unassignVnf(execution);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java
index b6f8aafa55..9e2eac416c 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java
@@ -36,16 +36,16 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
-import org.onap.so.bpmn.infrastructure.workflow.tasks.listeners.MultiStageSkipListener;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
@RunWith(MockitoJUnitRunner.class)
-public class MultiStageSkipTest {
+public class MultiStageSkipListenerTest {
@Mock
private CatalogDbClient catalogDbClient;
@@ -71,6 +71,12 @@ public class MultiStageSkipTest {
assertFalse("should not be triggered",
multiStageSkipListener.shouldRunFor("AssignVfModuleBB2", true, execution));
+ execution.setVariable("multiStageDesign", true);
+ assertTrue("should be triggered", multiStageSkipListener.shouldRunFor(execution));
+
+ execution.setVariable("multiStageDesign", false);
+ assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor(execution));
+
}
@@ -107,6 +113,15 @@ public class MultiStageSkipTest {
assertEquals("Flows should only have Assign", flowsToExecute.size(), 1);
assertEquals("Flows should only have Assign", flowsToExecute.get(0).getBuildingBlock().getBpmnFlowName(),
"AssignVfModuleBB");
+ }
+
+ @Test
+ public void postCompletionRequestsDbListenerTest() {
+ InfraActiveRequests request = new InfraActiveRequests();
+ BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
+ multiStageSkipListener.run(request, execution);
+ assertEquals("Successfully completed Assign Building Block only due to multi-stage-design VNF",
+ request.getFlowStatus());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
index 4c0e2b873f..0ccf056ddc 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
@@ -28,6 +28,8 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -66,6 +68,7 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
private CloudRegion cloudRegion;
private RequestContext requestContext;
private GenericResourceApiVnfOperationInformation sdncReq;
+ private URI testURI;
@Before
public void before() {
@@ -75,6 +78,11 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
cloudRegion = buildCloudRegion();
requestContext = buildRequestContext();
sdncReq = new GenericResourceApiVnfOperationInformation();
+ try {
+ testURI = new URI("http://localhost:9800");
+ } catch (URISyntaxException e) {
+
+ }
}
@Test
@@ -82,12 +90,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
- sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false, testURI);
verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
+ anyBoolean(), any(URI.class));
}
@Test
@@ -95,12 +103,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
- sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
+ anyBoolean(), any(URI.class));
}
@Test
@@ -108,12 +116,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
- sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
+ anyBoolean(), any(URI.class));
}
@Test
@@ -137,11 +145,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
- sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, genericVnf,
- serviceInstance, customer, cloudRegion, requestContext, false);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
+ verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION),
+ eq(SDNCSvcAction.CHANGE_ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE),
+ eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), eq(false),
+ any(URI.class));
}
@Test
@@ -150,12 +159,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),
isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),
any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class),
- anyBoolean());
- sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION),
eq(SDNCSvcAction.DEACTIVATE), isA(GenericResourceApiRequestActionEnumeration.class),
any(GenericVnf.class), any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),
- any(RequestContext.class), anyBoolean());
+ any(RequestContext.class), anyBoolean(), any(URI.class));
}
@@ -166,8 +175,8 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),
isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),
any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class),
- anyBoolean());
- sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
}
@Test
@@ -176,12 +185,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),
isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),
any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class),
- anyBoolean());
- sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION),
eq(SDNCSvcAction.UNASSIGN), isA(GenericResourceApiRequestActionEnumeration.class),
any(GenericVnf.class), any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),
- any(RequestContext.class), anyBoolean());
+ any(RequestContext.class), anyBoolean(), any(URI.class));
}
@Test
@@ -191,7 +200,7 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),
isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),
any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class),
- anyBoolean());
- sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
index cecf34ea10..00836176f0 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
@@ -23,15 +23,18 @@ package org.onap.so.client.sdnc.mapper;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Map;
import java.util.List;
+import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -45,8 +48,6 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
@RunWith(MockitoJUnitRunner.class)
public class VnfTopologyOperationRequestMapperTest {
@@ -127,11 +128,11 @@ public class VnfTopologyOperationRequestMapperTest {
GenericResourceApiVnfOperationInformation vnfOpInformation =
mapper.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, true);
+ cloudRegion, requestContext, true, new URI("http://localhost:8080"));
GenericResourceApiVnfOperationInformation vnfOpInformationNullReqContext =
mapper.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, null, true);
+ cloudRegion, null, true, new URI("http://localhost:8080"));
assertNull(vnfOpInformation.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid());
assertEquals("vnfModelCustomizationUUID",