aboutsummaryrefslogtreecommitdiffstats
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/aai/tasks/AAIUpdateTasks.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java146
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java2
11 files changed, 204 insertions, 49 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 38261c0f1a..ed6379a6a4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -156,7 +156,9 @@ public class AAIUpdateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
String heatStackId = execution.getVariable("heatStackId");
-
+ if (heatStackId == null) {
+ heatStackId = "";
+ }
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
CloudRegion cloudRegion = gBBInput.getCloudRegion();
volumeGroup.setHeatStackId(heatStackId);
@@ -320,6 +322,9 @@ public class AAIUpdateTasks {
public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
try {
String heatStackId = execution.getVariable("heatStackId");
+ if (heatStackId == null) {
+ heatStackId = "";
+ }
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
vfModule.setHeatStackId(heatStackId);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 4506699ce8..81ebfb1f41 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -75,7 +75,9 @@ public class SDNCQueryTasks {
+ genericVnf.getVnfId() + "/vnf-data/vf-modules/vf-module/"
+ vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology/";
try {
- vfModule.setSelflink(selfLink);
+ if(vfModule.getSelflink() == null || (vfModule.getSelflink() != null && vfModule.getSelflink().isEmpty())) {
+ vfModule.setSelflink(selfLink);
+ }
if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
String response = sdncVfModuleResources.queryVfModule(vfModule);
execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index 58c6db109c..173d5f7e73 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
@@ -90,11 +91,6 @@ public class SDNCRequestTasks {
public void handleTimeOutException (DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error timed out waiting on SDNC Async-Response");
}
-
- public void handleSyncError (DelegateExecution execution) {
- String msg = (String) execution.getVariable("SDNCSyncError");
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
- }
protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
return "Y".equals(finalMessageIndicator);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index e04043a352..10ee13ebed 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -166,6 +166,13 @@ public class WorkflowAction {
} catch (Exception ex) {
cloudOwner = environment.getProperty(defaultCloudOwner);
}
+ boolean suppressRollback = false;
+ try{
+ suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
+ } catch (Exception ex) {
+ suppressRollback = false;
+ }
+ execution.setVariable("suppressRollback", suppressRollback);
Resource resource = extractResourceIdAndTypeFromUri(uri);
WorkflowType resourceType = resource.getResourceType();
execution.setVariable("resourceName", resourceType.toString());
@@ -401,6 +408,7 @@ public class WorkflowAction {
if(virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink()
&& virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
workflowResourceIds.setNetworkId(resourceId);
ebb.setWorkflowResourceIds(workflowResourceIds);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
index 7e6eb2a23d..ac06818e66 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -100,7 +100,7 @@ public class WorkflowActionBBFailure {
} catch (Exception ex) {
logger.error("Failed to extract workflow exception from execution.",ex);
}
- return Optional.of(errorMsg);
+ return Optional.empty();
}
public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) {
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 d9125e4104..917039b17b 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
@@ -20,7 +20,9 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
+import java.sql.Timestamp;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import java.util.Optional;
@@ -181,27 +183,30 @@ public class WorkflowActionBBTasks {
}
}
- public void setupCompleteMsoProcess(DelegateExecution execution) {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
- final String action = (String) execution.getVariable(G_ACTION);
- final String resourceId = (String) execution.getVariable("resourceId");
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
- final String resourceName = (String) execution.getVariable("resourceName");
- final String source = (String) execution.getVariable("source");
- String macroAction = "";
- if (aLaCarte) {
- macroAction = "ALaCarte-" + resourceName + "-" + action;
- } else {
- macroAction = "Macro-" + resourceName + "-" + action;
+ public void updateRequestStatusToComplete(DelegateExecution execution) {
+ try{
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ final String action = (String) execution.getVariable(G_ACTION);
+ final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ final String resourceName = (String) execution.getVariable("resourceName");
+ String macroAction = "";
+ if (aLaCarte) {
+ macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
+ } else {
+ macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly.";
+ }
+ execution.setVariable("finalStatusMessage", macroAction);
+ Timestamp endTime = new Timestamp(System.currentTimeMillis());
+ request.setEndTime(endTime);
+ request.setStatusMessage(macroAction);
+ request.setProgress(Long.valueOf(100));
+ request.setRequestStatus("COMPLETE");
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ }catch (Exception ex) {
+ workflowAction.buildAndThrowException(execution, "Error Updating Request Database", ex);
}
- String msoCompletionRequest = "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>"
- + requestId + "</request-id><action>" + action + "</action><source>" + source
- + "</source></request-info><status-message>" + macroAction
- + " request was executed correctly.</status-message><serviceInstanceId>" + resourceId
- + "</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>";
- execution.setVariable("CompleteMsoProcessRequest", msoCompletionRequest);
- execution.setVariable("mso-request-id", requestId);
- execution.setVariable("mso-service-instance-id", resourceId);
}
public void checkRetryStatus(DelegateExecution execution) {
@@ -209,11 +214,12 @@ public class WorkflowActionBBTasks {
String requestId = (String) execution.getVariable(G_REQUEST_ID);
String retryDuration = (String) execution.getVariable("RetryDuration");
int retryCount = (int) execution.getVariable(RETRY_COUNT);
+ int nextCount = retryCount +1;
if (handlingCode.equals("Retry")){
workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
try{
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- request.setRetryStatusMessage("Retry " + retryCount+1 + "/5 will be started in " + retryDuration);
+ request.setRetryStatusMessage("Retry " + nextCount + "/5 will be started in " + retryDuration);
requestDbclient.updateInfraActiveRequests(request);
} catch(Exception ex){
logger.warn("Failed to update Request Db Infra Active Requests with Retry Status",ex);
@@ -221,7 +227,7 @@ public class WorkflowActionBBTasks {
if(retryCount<5){
int currSequence = (int) execution.getVariable("gCurrentSequence");
execution.setVariable("gCurrentSequence", currSequence-1);
- execution.setVariable(RETRY_COUNT, retryCount + 1);
+ execution.setVariable(RETRY_COUNT, nextCount);
}else{
workflowAction.buildAndThrowException(execution, "Exceeded maximum retries. Ending flow with status Abort");
}
@@ -285,4 +291,100 @@ public class WorkflowActionBBTasks {
workflowAction.buildAndThrowException(execution, "Rollback has already been called. Cannot rollback a request that is currently in the rollback state.");
}
}
+
+ protected void updateRequestErrorStatusMessage(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ String errorMsg = retrieveErrorMessage(execution);
+ if(errorMsg == null || errorMsg.equals("")){
+ errorMsg = "Failed to determine error message";
+ }
+ request.setStatusMessage(errorMsg);
+ logger.debug("Updating RequestDB to failed: errorMsg = " + errorMsg);
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error("Failed to update Request db with the status message after retry or rollback has been initialized.",e);
+ }
+ }
+
+ public void abortCallErrorHandling(DelegateExecution execution) {
+ String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
+ logger.error(msg);
+ throw new BpmnError(msg);
+ }
+
+ public void updateRequestStatusToFailed(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ String errorMsg = null;
+ String rollbackErrorMsg = null;
+ boolean rollbackCompleted = (boolean) execution.getVariable("isRollbackComplete");
+ boolean isRollbackFailure = (boolean) execution.getVariable("isRollback");
+ ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
+
+ if(rollbackCompleted){
+ rollbackErrorMsg = "Rollback has been completed successfully.";
+ request.setRollbackStatusMessage(rollbackErrorMsg);
+ logger.debug("Updating RequestDB to failed: Rollback has been completed successfully");
+ }else{
+ if(isRollbackFailure){
+ rollbackErrorMsg = retrieveErrorMessage(execution);
+ if(rollbackErrorMsg == null || rollbackErrorMsg.equals("")){
+ rollbackErrorMsg = "Failed to determine rollback error message.";
+ }
+ request.setRollbackStatusMessage(rollbackErrorMsg);
+ logger.debug("Updating RequestDB to failed: rollbackErrorMsg = " + rollbackErrorMsg);
+ }else{
+ errorMsg = retrieveErrorMessage(execution);
+ if(errorMsg == null || errorMsg.equals("")){
+ errorMsg = "Failed to determine error message";
+ }
+ request.setStatusMessage(errorMsg);
+ logger.debug("Updating RequestDB to failed: errorMsg = " + errorMsg);
+ }
+ }
+ if(ebb!=null && ebb.getBuildingBlock()!=null){
+ String flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed.";
+ request.setFlowStatus(flowStatus);
+ execution.setVariable("flowStatus", flowStatus);
+ }
+
+ request.setProgress(Long.valueOf(100));
+ request.setRequestStatus("FAILED");
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e);
+ }
+ }
+
+ private String retrieveErrorMessage (DelegateExecution execution){
+ String errorMsg = "";
+ try {
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ if(exception != null && (exception.getErrorMessage()!=null || !exception.getErrorMessage().equals(""))){
+ errorMsg = exception.getErrorMessage();
+ }
+ } catch (Exception ex) {
+ //log error and attempt to extact WorkflowExceptionMessage
+ logger.error("Failed to extract workflow exception from execution.",ex);
+ }
+
+ if (errorMsg == null || errorMsg.equals("")){
+ try {
+ errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
+ } catch (Exception ex) {
+ logger.error("Failed to extract workflow exception message from WorkflowException",ex);
+ errorMsg = "Unexpected Error in BPMN.";
+ }
+ }
+ return errorMsg;
+ }
+
+ public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) {
+ execution.setVariable("isRollbackComplete", true);
+ updateRequestStatusToFailed(execution);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
index 57c760b01f..4abb0a1b2c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
@@ -49,9 +49,12 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.beans.Subnet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriUtils;
@@ -59,6 +62,7 @@ import org.springframework.web.util.UriUtils;
public class NetworkAdapterObjectMapper {
private static final ModelMapper modelMapper = new ModelMapper();
private static String FORWARD_SLASH = "/";
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterObjectMapper.class);
public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, Customer customer) throws UnsupportedEncodingException {
CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
@@ -82,8 +86,12 @@ public class NetworkAdapterObjectMapper {
//build and set provider Vlan Network
ProviderVlanNetwork providerVlanNetwork = buildProviderVlanNetwork(l3Network);
createNetworkRequest.setProviderVlanNetwork(providerVlanNetwork);
-
- createNetworkRequest.setNetworkTechnology(setNetworkTechnology(l3Network.getModelInfoNetwork().getNetworkTechnology()));
+ String networkTechnology = l3Network.getModelInfoNetwork().getNetworkTechnology();
+ if(networkTechnology == null) {
+ networkTechnology = l3Network.getNetworkTechnology();
+ logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology);
+ }
+ createNetworkRequest.setNetworkTechnology(setNetworkTechnology(networkTechnology));
//build and set Contrail Network
ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index 6c20938780..f97b137fb3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.aai.tasks;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
@@ -292,6 +293,17 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
}
@Test
+ public void updateHeatStackIdVfModuleToNullTest() throws Exception {
+ execution.setVariable("heatStackId", null);
+ doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
+
+ aaiUpdateTasks.updateHeatStackIdVfModule(execution);
+
+ verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
+ assertEquals(vfModule.getHeatStackId(), "");
+ }
+
+ @Test
public void updateHeatStackIdVfModuleExceptionTest() throws Exception {
doThrow(RuntimeException.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
@@ -358,6 +370,16 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
assertEquals("newHeatStackId", volumeGroup.getHeatStackId());
}
+ @Test
+ public void updateHeatStackIdVolumeGroupToNullTest() throws Exception {
+ execution.setVariable("heatStackId", null);
+ doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ assertEquals(volumeGroup.getHeatStackId(), "");
+ }
@Test
public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
index a6efbd5989..f1779cf119 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
@@ -129,15 +129,6 @@ public class SDNCRequestTasksTest extends SDNCRequestTasks{
sndcRequestTasks.handleTimeOutException(delegateExecution);
}
-
- @Test
- public void HandleSyncError_Test() throws MapperException, BadResponseException{
- delegateExecution.setVariable("SDNCSyncError", "Error in SDNC Request");
- doReturn("processKey").when(exceptionBuilder).getProcessKey(delegateExecution);
- expectedException.expect(BpmnError.class);
- sndcRequestTasks.handleSyncError(delegateExecution);
- }
-
@Test
public void processCallBack_Final_Test() throws MapperException, BadResponseException, IOException{
final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_ASYNC_Request.json")));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index 189ecb96c7..5c1485979e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -114,16 +114,37 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
- public void msoCompleteProcessTest() throws Exception{
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ public void updateRequestStatusToCompleteTest() throws Exception{
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
execution.setVariable("requestAction", "createInstance");
- execution.setVariable("resourceId", "123");
- execution.setVariable("source","MSO");
execution.setVariable("resourceName", "Service");
execution.setVariable("aLaCarte", true);
- workflowActionBBTasks.setupCompleteMsoProcess(execution);
- String response = (String) execution.getVariable("CompleteMsoProcessRequest");
- assertEquals(response,"<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>00f704ca-c5e5-4f95-a72c-6889db7b0688</request-id><action>createInstance</action><source>MSO</source></request-info><status-message>ALaCarte-Service-createInstance request was executed correctly.</status-message><serviceInstanceId>123</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>");
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBTasks.updateRequestStatusToComplete(execution);
+ assertEquals("ALaCarte-Service-createInstance request was executed correctly.",execution.getVariable("finalStatusMessage"));
+ }
+
+ @Test
+ public void updateRequestStatusToFailedFlowStatusTest() {
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ execution.setVariable("isRollbackComplete", false);
+ execution.setVariable("isRollback", false);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName("CreateNetworkBB");
+ ebb.setBuildingBlock(buildingBlock);
+ execution.setVariable("buildingBlock", ebb);
+ WorkflowException wfe = new WorkflowException("failure", 1, "failure");
+ execution.setVariable("WorkflowException", wfe);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBTasks.updateRequestStatusToFailed(execution);
+ assertEquals("CreateNetworkBB has failed.",execution.getVariable("flowStatus"));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
index 8f0d00ff86..6f353fa622 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
@@ -144,7 +144,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{
List<Subnet> subnetList = new ArrayList<Subnet>();
subnetList.add(openstackSubnet);
l3Network.getSubnets().add(openstackSubnet);
- l3Network.getModelInfoNetwork().setNetworkTechnology("Contrail");
+ l3Network.setNetworkTechnology("Contrail");
CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);