summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2019-07-05 10:23:16 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-07-05 10:23:22 -0400
commit0e2cda138f35ee6a7a8a54c29a6c4edf07d51745 (patch)
treebed0d4cdf6ad783a5a58a3f00f594d43e41902f7 /bpmn
parent294a68f814de3820ae3d5fdcf976615ad233c11a (diff)
update bpmn to save extsystemerrorsource
Added ext error source to workflow exception Updated all lines that create this exception with source Added unit tests and updated existing ones Change-Id: Id9b3b1e6e24368224214a6370ea2d450ae667bfb Issue-ID: SO-2092 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy43
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java42
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java91
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java129
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java98
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java27
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn134
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn1
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java73
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java3
19 files changed, 626 insertions, 113 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
index d95dbe2184..c23150384e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
@@ -34,6 +34,7 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
+import org.onap.so.utils.TargetEntities
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -283,6 +284,16 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
execution.setVariable("WorkflowException", exception);
logger.debug("Outgoing WorkflowException is " + exception)
}
+
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, TargetEntities extSystemErrorSource) {
+ MsoUtils utils = new MsoUtils()
+ String processKey = getProcessKey(execution);
+ logger.debug("Building a WorkflowException for " + processKey)
+
+ WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage, extSystemErrorSource);
+ execution.setVariable("WorkflowException", exception);
+ logger.debug("Outgoing WorkflowException is " + exception)
+ }
/**
* This error handling method builds a WorkflowException Object and throws a
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
index a769eca3a1..866229f6b8 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
@@ -40,7 +40,6 @@ import java.util.UUID
-
class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger( VnfAdapterRestV1.class);
@@ -81,7 +80,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no messageId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
execution.setVariable('VNFAResponse_CORRELATOR', messageId)
@@ -95,7 +94,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
execution.setVariable(prefix + 'notificationUrl', notificationUrl)
@@ -109,7 +108,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
while (vnfAdapterEndpoint.endsWith('/')) {
@@ -127,7 +126,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'POST'
@@ -140,7 +139,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
String vfModuleId = getChildText(root, 'vfModuleId')
@@ -149,7 +148,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'PUT'
@@ -163,7 +162,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
String vfModuleId = getChildText(root, 'vfModuleId')
@@ -172,7 +171,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -186,7 +185,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
@@ -195,7 +194,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
@@ -204,7 +203,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -225,7 +224,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'PUT'
@@ -241,7 +240,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -257,7 +256,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -270,7 +269,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
@@ -307,7 +306,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
}
@@ -358,7 +357,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus())
@@ -371,7 +370,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
}
@@ -400,7 +399,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
}
} catch (Exception e) {
logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", TargetEntity.SO)
}
}
@@ -419,10 +418,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String rolledBack = getChildText(root, "rolledBack")
rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
- " from VnfAdapter:" + category + message + rolledBack);
+ " from VnfAdapter:" + category + message + rolledBack, TargetEntity.OPENSTACK);
} catch (Exception e) {
response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
- exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response)
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, TargetEntity.OPENSTACK)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index 122e71851f..ed31e1d079 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -34,6 +34,8 @@ import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.utils.TargetEntities;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -185,4 +187,44 @@ public class ExecuteBuildingBlockRainyDay {
public void setHandlingStatusSuccess(DelegateExecution execution) {
execution.setVariable(HANDLING_CODE, "Success");
}
+
+ public void updateExtSystemErrorSource(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable("mso-request-id");
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ TargetEntities extSystemErrorSource = exception.getExtSystemErrorSource();
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
+ if (isRollbackFailure == null) {
+ isRollbackFailure = false;
+ }
+
+ if (extSystemErrorSource != null) {
+ String extSystemErrorSourceString = extSystemErrorSource.toString();
+ if (isRollbackFailure) {
+ logger.debug("Updating extSystemErrorSource for isRollbackFailure to {} for request: {}",
+ extSystemErrorSourceString, requestId);
+ request.setRollbackExtSystemErrorSource(extSystemErrorSourceString);
+ } else {
+ logger.debug("Updating extSystemErrorSource to {} for request: {}", extSystemErrorSourceString,
+ requestId);
+ request.setExtSystemErrorSource(extSystemErrorSourceString);
+ }
+ } else if (isRollbackFailure) {
+ logger.debug(
+ "rollbackExtSystemErrorSource is null for isRollbackFailure. Setting rollbackExtSystemErrorSource to UNKNOWN");
+ request.setRollbackExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ } else {
+ logger.debug("extSystemErrorSource is null. Setting extSystemErrorSource to UNKNOWN");
+ request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ }
+
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error("Failed to update Request db with extSystemErrorSource or rollbackExtSystemErrorSource: "
+ + e.getMessage());
+ }
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
index d656314fd1..100887dbbc 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
@@ -43,6 +43,8 @@ import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvide
import org.onap.so.logger.MessageEnum;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.onap.so.utils.TargetEntities;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -89,6 +91,39 @@ public class ExceptionBuilder {
buildAndThrowWorkflowException(execution, errorCode, msg);
}
+ public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception,
+ TargetEntities extSystemErrorSource) {
+ String msg = "Exception in %s.%s ";
+ try {
+ logger.error("Exception occurred", exception);
+
+ String errorVariable = "Error%s%s";
+
+ StackTraceElement[] trace = Thread.currentThread().getStackTrace();
+ for (StackTraceElement traceElement : trace) {
+ if (!traceElement.getClassName().equals(this.getClass().getName())
+ && !traceElement.getClassName().equals(Thread.class.getName())) {
+ msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName());
+ String shortClassName =
+ traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1);
+ errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName());
+ break;
+ }
+ }
+
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), msg.toString());
+ execution.setVariable(errorVariable, exception.getMessage());
+ } catch (Exception ex) {
+ // log trace, allow process to complete gracefully
+ logger.error("Exception occurred", ex);
+ }
+
+ if (exception.getMessage() != null)
+ msg = msg.concat(exception.getMessage());
+ buildAndThrowWorkflowException(execution, errorCode, msg, extSystemErrorSource);
+ }
+
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) {
String msg = "Exception in %s.%s ";
try {
@@ -120,6 +155,38 @@ public class ExceptionBuilder {
buildAndThrowWorkflowException(execution, errorCode, msg);
}
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception,
+ TargetEntities extSystemErrorSource) {
+ String msg = "Exception in %s.%s ";
+ try {
+ logger.error("Exception occurred", exception);
+
+ String errorVariable = "Error%s%s";
+
+ StackTraceElement[] trace = Thread.currentThread().getStackTrace();
+ for (StackTraceElement traceElement : trace) {
+ if (!traceElement.getClassName().equals(this.getClass().getName())
+ && !traceElement.getClassName().equals(Thread.class.getName())) {
+ msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName());
+ String shortClassName =
+ traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1);
+ errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName());
+ break;
+ }
+ }
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), msg.toString());
+ execution.setVariable(errorVariable, exception.getMessage());
+ } catch (Exception ex) {
+ // log trace, allow process to complete gracefully
+ logger.error("Exception occurred", ex);
+ }
+
+ if (exception.getMessage() != null)
+ msg = msg.concat(exception.getMessage());
+ buildAndThrowWorkflowException(execution, errorCode, msg, extSystemErrorSource);
+ }
+
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage) {
if (execution instanceof DelegateExecutionImpl) {
buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode,
@@ -127,6 +194,14 @@ public class ExceptionBuilder {
}
}
+ public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage,
+ TargetEntities extSystemErrorSource) {
+ if (execution instanceof DelegateExecutionImpl) {
+ buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode,
+ errorMessage, extSystemErrorSource);
+ }
+ }
+
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
String processKey = getProcessKey(execution);
logger.info("Building a WorkflowException for Subflow");
@@ -139,6 +214,19 @@ public class ExceptionBuilder {
throw new BpmnError("MSOWorkflowException");
}
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
+ TargetEntities extSystemErrorSource) {
+ String processKey = getProcessKey(execution);
+ logger.info("Building a WorkflowException for Subflow");
+
+ WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage, extSystemErrorSource);
+ execution.setVariable("WorkflowException", exception);
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("MSOWorkflowException");
+ }
+
public void buildAndThrowWorkflowException(DelegateExecution execution, String errorCode, String errorMessage) {
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
throw new BpmnError(errorCode, errorMessage);
@@ -204,7 +292,8 @@ public class ExceptionBuilder {
if (flowShouldContinue) {
execution.setVariable("StatusMessage", errorMessage.toString());
} else {
- WorkflowException exception = new WorkflowException(processKey, 400, errorMessage.toString());
+ WorkflowException exception =
+ new WorkflowException(processKey, 400, errorMessage.toString(), TargetEntity.SO);
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString());
logger.info("Outgoing WorkflowException is {}", exception);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
new file mode 100644
index 0000000000..6a48558d11
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.servicedecomposition.tasks;
+
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.utils.TargetEntity;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ExecuteBuildingBlockRainyDayUnitTest {
+
+ @Mock
+ private RequestsDbClient requestsDbClient;
+
+ @InjectMocks
+ @Spy
+ private ExecuteBuildingBlockRainyDay executeBuildingBlockRainyDay;
+
+ private DelegateExecution execution;
+ private DelegateExecution executionNullisRollback;
+ private String msoRequestId = "ef7c004b-829f-4773-a7d8-4de29feef5b1";
+ private InfraActiveRequests request = new InfraActiveRequests();
+ private WorkflowException exception;
+ private WorkflowException noExtSystemErrorSourceException;
+
+ @Before
+ public void setup() {
+ exception = new WorkflowException("Test exception", 7000, "", "", TargetEntity.SDNC);
+ noExtSystemErrorSourceException =
+ new WorkflowException("Test exception without extsystemErrorSource", 7000, "", "");
+
+ execution = new DelegateExecutionFake();
+ execution.setVariable("mso-request-id", "ef7c004b-829f-4773-a7d8-4de29feef5b1");
+
+ executionNullisRollback = new DelegateExecutionFake();
+ executionNullisRollback.setVariable("mso-request-id", "ef7c004b-829f-4773-a7d8-4de29feef5b1");
+ }
+
+ @Test
+ public void updateExtSystemErrorSourceTest() {
+ doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
+ execution.setVariable("isRollback", false);
+ execution.setVariable("WorkflowException", exception);
+ executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
+ request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+
+ verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
+ }
+
+ @Test
+ public void updateExtSystemErrorSourceisRollbackTest() {
+ doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
+ execution.setVariable("isRollback", true);
+ execution.setVariable("WorkflowException", exception);
+ executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
+ request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+
+ verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
+ }
+
+ @Test
+ public void updateExtSystemErrorSourceisRollbackTargetEntityNullTest() {
+ doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
+ execution.setVariable("isRollback", true);
+ execution.setVariable("WorkflowException", noExtSystemErrorSourceException);
+ executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
+ request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+
+ verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
+ }
+
+ @Test
+ public void updateExtSystemErrorSourceTargetEntityNullTest() {
+ doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
+ execution.setVariable("isRollback", false);
+ execution.setVariable("WorkflowException", noExtSystemErrorSourceException);
+ executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
+ request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+
+ verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
+ }
+
+ @Test
+ public void updateExtSystemErrorSourceTargetEntityisRollbackNullTest() {
+ doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
+ executionNullisRollback.setVariable("WorkflowException", exception);
+ executeBuildingBlockRainyDay.updateExtSystemErrorSource(executionNullisRollback);
+ request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+
+ verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java
index 5f9aef67e6..aae62445de 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java
@@ -55,6 +55,7 @@ public class ExceptionBuilderTest extends BaseTest {
@Mock
protected ExtractPojosForBB extractPojosForBB;
+
@Spy
@InjectMocks
private ExceptionBuilder exceptionBuilder = new ExceptionBuilder();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
new file mode 100644
index 0000000000..b109ae258d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.exception;
+
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.utils.TargetEntity;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ExceptionBuilderUnitTest {
+ @Mock
+ private BuildingBlockExecution buildingBlockExecution;
+
+ @InjectMocks
+ @Spy
+ private ExceptionBuilder exceptionBuilder;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private Exception e = new Exception("failure message");
+ private DelegateExecution execution;
+
+ @Before
+ public void setup() {
+ execution = new DelegateExecutionFake();
+ }
+
+
+ @Test
+ public void buildAndThrowWorkflowExceptionTest() {
+ String expectedErrorMessage =
+ "Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message";
+ doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage,
+ TargetEntity.SDNC);
+
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, TargetEntity.SDNC);
+
+ verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage,
+ TargetEntity.SDNC);
+ }
+
+ @Test
+ public void buildAndThrowWorkflowExceptionBuildingBlockExecutionTest() {
+ String expectedErrorMessage =
+ "Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message";
+ doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(buildingBlockExecution, 7000,
+ expectedErrorMessage, TargetEntity.SDNC);
+
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, TargetEntity.SDNC);
+
+ verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(buildingBlockExecution, 7000,
+ expectedErrorMessage, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void buildAndThrowWorkflowExceptionWithErrorMessageTest() {
+ doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
+
+ thrown.expect(BpmnError.class);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
index 1692045d33..7d5bb0dcf1 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.core;
import java.io.Serializable;
+import org.onap.so.utils.TargetEntities;
/**
* An object that represents a workflow exception.
@@ -32,6 +33,7 @@ public class WorkflowException implements Serializable {
private final int errorCode;
private final String errorMessage;
private final String workStep;
+ private TargetEntities extSystemErrorSource;
/**
* Constructor
@@ -47,6 +49,15 @@ public class WorkflowException implements Serializable {
workStep = "*";
}
+ public WorkflowException(String processKey, int errorCode, String errorMessage,
+ TargetEntities extSystemErrorSource) {
+ this.processKey = processKey;
+ this.errorCode = errorCode;
+ this.errorMessage = errorMessage;
+ workStep = "*";
+ this.extSystemErrorSource = extSystemErrorSource;
+ }
+
public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep) {
this.processKey = processKey;
this.errorCode = errorCode;
@@ -54,6 +65,15 @@ public class WorkflowException implements Serializable {
this.workStep = workStep;
}
+ public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep,
+ TargetEntities extSystemErrorSource) {
+ this.processKey = processKey;
+ this.errorCode = errorCode;
+ this.errorMessage = errorMessage;
+ this.workStep = workStep;
+ this.extSystemErrorSource = extSystemErrorSource;
+ }
+
/**
* Returns the process key.
*/
@@ -82,12 +102,17 @@ public class WorkflowException implements Serializable {
return workStep;
}
+ public TargetEntities getExtSystemErrorSource() {
+ return extSystemErrorSource;
+ }
+
/**
* Returns a string representation of this object.
*/
@Override
public String toString() {
return getClass().getSimpleName() + "[processKey=" + getProcessKey() + ",errorCode=" + getErrorCode()
- + ",errorMessage=" + getErrorMessage() + ",workStep=" + getWorkStep() + "]";
+ + ",errorMessage=" + getErrorMessage() + ",workStep=" + getWorkStep() + ",extSystemErrorSource="
+ + extSystemErrorSource + "]";
}
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
index 0a6a7731ce..e64c44eb94 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
@@ -11,6 +11,7 @@
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" />
<camunda:out source="StatusMessage" target="StatusMessage" />
+ <camunda:in source="isRollback" target="isRollback" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_19wuics</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_01h9qmz</bpmn:outgoing>
@@ -37,13 +38,8 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0je0y25" sourceRef="StatusPolicy" targetRef="CheckOrchestrationStatusValidationResults" />
<bpmn:subProcess id="SubProcess_0tv8zda" name="Error Handling&#10;&#10;" triggeredByEvent="true">
- <bpmn:startEvent id="StartEvent_0tmcs9g">
- <bpmn:outgoing>SequenceFlow_09synl9</bpmn:outgoing>
- <bpmn:errorEventDefinition camunda:errorCodeVariable="WorkflowExceptionCode" camunda:errorMessageVariable="WorkflowExceptionMessage" />
- </bpmn:startEvent>
- <bpmn:sequenceFlow id="SequenceFlow_09synl9" sourceRef="StartEvent_0tmcs9g" targetRef="Task_QueryRainyDayTable" />
<bpmn:serviceTask id="Task_QueryRainyDayTable" name="QueryRainyDayTable" camunda:expression="${ExecuteBuildingBlockRainyDay.queryRainyDayTable(execution,true)}">
- <bpmn:incoming>SequenceFlow_09synl9</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0vdeqxv</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0a62t4c</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:exclusiveGateway id="ExclusiveGateway_1aonzik" name="Check HandlingCode" default="SequenceFlow_0h8v45y">
@@ -93,6 +89,16 @@
<bpmn:incoming>SequenceFlow_0541bid</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_12ps9at</bpmn:outgoing>
</bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0vdeqxv" sourceRef="Task_UpdateExtErrorSource" targetRef="Task_QueryRainyDayTable" />
+ <bpmn:sequenceFlow id="SequenceFlow_09synl9" sourceRef="StartEvent_0tmcs9g" targetRef="Task_UpdateExtErrorSource" />
+ <bpmn:startEvent id="StartEvent_0tmcs9g">
+ <bpmn:outgoing>SequenceFlow_09synl9</bpmn:outgoing>
+ <bpmn:errorEventDefinition camunda:errorCodeVariable="WorkflowExceptionCode" camunda:errorMessageVariable="WorkflowExceptionMessage" />
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="Task_UpdateExtErrorSource" name="Update ExtErrorSource" camunda:expression="${ExecuteBuildingBlockRainyDay.updateExtSystemErrorSource(execution)}">
+ <bpmn:incoming>SequenceFlow_09synl9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0vdeqxv</bpmn:outgoing>
+ </bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_16lmcxp" sourceRef="Task_setHandlingCodeSuccess" targetRef="End_ExecuteBuildingBlock" />
<bpmn:sequenceFlow id="SequenceFlow_1j0vskt" name="Silent Success" sourceRef="CheckOrchestrationStatusValidationResults" targetRef="Task_setHandlingCodeSuccess">
@@ -163,63 +169,63 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0ey4zpt_di" bpmnElement="ExclusiveGateway_0ey4zpt" isMarkerVisible="true">
- <dc:Bounds x="721" y="385" width="50" height="50" />
+ <dc:Bounds x="692" y="389" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="716" y="360" width="63" height="13" />
+ <dc:Bounds x="686" y="364" width="65" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_0qjyidb_di" bpmnElement="IntermediateCatchEvent_RetryTimer">
- <dc:Bounds x="965" y="392" width="36" height="36" />
+ <dc:Bounds x="936" y="396" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="956" y="367" width="55" height="13" />
+ <dc:Bounds x="927" y="371" width="56" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1aonzik_di" bpmnElement="ExclusiveGateway_1aonzik" isMarkerVisible="true">
- <dc:Bounds x="568" y="385" width="50" height="50" />
+ <dc:Bounds x="539" y="389" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="558" y="347" width="70" height="25" />
+ <dc:Bounds x="528" y="351" width="72" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1wbevp0_di" bpmnElement="SequenceFlow_1wbevp0">
- <di:waypoint xsi:type="dc:Point" x="771" y="410" />
- <di:waypoint xsi:type="dc:Point" x="836" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="742" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="807" y="414" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="788" y="385" width="18" height="13" />
+ <dc:Bounds x="759" y="389" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0fwsjva_di" bpmnElement="SequenceFlow_0fwsjva">
- <di:waypoint xsi:type="dc:Point" x="618" y="410" />
- <di:waypoint xsi:type="dc:Point" x="721" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="589" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="692" y="414" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="656" y="418" width="27" height="13" />
+ <dc:Bounds x="627" y="422" width="28" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0h8v45y_di" bpmnElement="SequenceFlow_0h8v45y">
- <di:waypoint xsi:type="dc:Point" x="593" y="435" />
- <di:waypoint xsi:type="dc:Point" x="593" y="491" />
+ <di:waypoint xsi:type="dc:Point" x="564" y="439" />
+ <di:waypoint xsi:type="dc:Point" x="564" y="495" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="600" y="456" width="85" height="13" />
+ <dc:Bounds x="570" y="460" width="88" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1tifgqh_di" bpmnElement="Task_QueryRainyDayTable">
- <dc:Bounds x="425" y="370" width="100" height="80" />
+ <dc:Bounds x="396" y="374" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0ndt8ft_di" bpmnElement="SequenceFlow_0ndt8ft">
- <di:waypoint xsi:type="dc:Point" x="936" y="410" />
- <di:waypoint xsi:type="dc:Point" x="965" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="907" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="414" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="906" y="389" width="90" height="12" />
+ <dc:Bounds x="877" y="393" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_07a1ytc_di" bpmnElement="SequenceFlow_07a1ytc">
- <di:waypoint xsi:type="dc:Point" x="1001" y="410" />
- <di:waypoint xsi:type="dc:Point" x="1039" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="972" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="1010" y="414" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="975" y="389" width="90" height="12" />
+ <dc:Bounds x="946" y="393" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1obvxht_di" bpmnElement="Task_SetRetryTimer">
- <dc:Bounds x="836" y="370" width="100" height="80" />
+ <dc:Bounds x="807" y="374" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0kdjsnx_di" bpmnElement="Continue">
<di:waypoint xsi:type="dc:Point" x="508" y="180" />
@@ -245,38 +251,25 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0a62t4c_di" bpmnElement="SequenceFlow_0a62t4c">
- <di:waypoint xsi:type="dc:Point" x="525" y="410" />
- <di:waypoint xsi:type="dc:Point" x="568" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="496" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="539" y="414" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="502" y="389" width="90" height="13" />
+ <dc:Bounds x="473" y="393" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_0tv8zda_di" bpmnElement="SubProcess_0tv8zda" isExpanded="true">
- <dc:Bounds x="320" y="294" width="802" height="290" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="StartEvent_0tmcs9g_di" bpmnElement="StartEvent_0tmcs9g">
- <dc:Bounds x="340" y="392" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="223" y="428" width="90" height="12" />
- </bpmndi:BPMNLabel>
+ <dc:Bounds x="171" y="298" width="922" height="295" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_09synl9_di" bpmnElement="SequenceFlow_09synl9">
- <di:waypoint xsi:type="dc:Point" x="376" y="410" />
- <di:waypoint xsi:type="dc:Point" x="425" y="410" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="356" y="389" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0mvmk3i_di" bpmnElement="EndEvent_0mvmk3i">
- <dc:Bounds x="575" y="491" width="36" height="36" />
+ <dc:Bounds x="546" y="495" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="548" y="531" width="90" height="12" />
+ <dc:Bounds x="519" y="535" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1aww7yx_di" bpmnElement="EndEvent_1sez2lh">
- <dc:Bounds x="1039" y="392" width="36" height="36" />
+ <dc:Bounds x="1010" y="396" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1049" y="432" width="19" height="13" />
+ <dc:Bounds x="1020" y="436" width="20" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_16lmcxp_di" bpmnElement="SequenceFlow_16lmcxp">
@@ -319,27 +312,50 @@
<dc:Bounds x="906" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0541bid_di" bpmnElement="SequenceFlow_0541bid">
- <di:waypoint xsi:type="dc:Point" x="746" y="435" />
- <di:waypoint xsi:type="dc:Point" x="746" y="459" />
+ <di:waypoint xsi:type="dc:Point" x="717" y="439" />
+ <di:waypoint xsi:type="dc:Point" x="717" y="463" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="757" y="436" width="13" height="13" />
+ <dc:Bounds x="728" y="440" width="13" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_12ps9at_di" bpmnElement="SequenceFlow_12ps9at">
- <di:waypoint xsi:type="dc:Point" x="796" y="499" />
- <di:waypoint xsi:type="dc:Point" x="868" y="499" />
+ <di:waypoint xsi:type="dc:Point" x="767" y="503" />
+ <di:waypoint xsi:type="dc:Point" x="839" y="503" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="787" y="478" width="90" height="12" />
+ <dc:Bounds x="758" y="482" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_05vw85n_di" bpmnElement="EndEvent_0ex9298">
- <dc:Bounds x="868" y="481" width="36" height="36" />
+ <dc:Bounds x="839" y="485" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="877" y="521" width="19" height="13" />
+ <dc:Bounds x="848" y="525" width="20" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_11f2c91_di" bpmnElement="Task_QuerySecondaryPolicy">
- <dc:Bounds x="696" y="459" width="100" height="80" />
+ <dc:Bounds x="667" y="463" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0vdeqxv_di" bpmnElement="SequenceFlow_0vdeqxv">
+ <di:waypoint xsi:type="dc:Point" x="361" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="396" y="414" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="378.5" y="393" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_0tmcs9g_di" bpmnElement="StartEvent_0tmcs9g">
+ <dc:Bounds x="196" y="396" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="79" y="432" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_09synl9_di" bpmnElement="SequenceFlow_09synl9">
+ <di:waypoint xsi:type="dc:Point" x="232" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="261" y="414" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="201.5" y="393" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_10v49qn_di" bpmnElement="Task_UpdateExtErrorSource">
+ <dc:Bounds x="261" y="374" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn
index b66ecfa329..11227ede4d 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn
@@ -50,6 +50,7 @@ ex.processJavaException(execution)]]></bpmn2:script>
<camunda:in source="asyncCorrelator" target="RCVWFMSG_correlator" />
<camunda:in source="asyncTimeout" target="RCVWFMSG_timeout" />
<camunda:out source="WorkflowResponse" target="asyncResponse" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0qrwjzu</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_03cy5y5</bpmn2:outgoing>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index 35b77d9189..47b9efeb6d 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -23,6 +23,7 @@
<camunda:out source="RetryDuration" target="RetryDuration" />
<camunda:in source="suppressRollback" target="suppressRollback" />
<camunda:out source="StatusMessage" target="StatusMessage" />
+ <camunda:in source="isRollback" target="isRollback" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1hsqed1</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index e5df3d3f35..f1fd23fe82 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -65,6 +65,7 @@ import org.onap.so.client.sniro.beans.ServiceInfo;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import org.onap.so.client.sniro.beans.SubscriberInfo;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -160,14 +161,15 @@ public class SniroHomingV2 {
logger.trace("Completed Sniro Homing Call Sniro");
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
+ TargetEntity.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
- "Internal Error - occurred while preparing sniro request: " + e.getMessage());
+ "Internal Error - occurred while preparing sniro request: " + e.getMessage(), TargetEntity.SO);
}
}
@@ -211,14 +213,16 @@ public class SniroHomingV2 {
logger.trace("Completed Sniro Homing Process Solution");
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
+ TargetEntity.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
- "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage());
+ "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage(),
+ TargetEntity.SO);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index 859db11037..e9d33f46ab 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -38,6 +38,7 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.NetworkAdapterResources;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -93,7 +94,7 @@ public class NetworkAdapterRestV1 {
throw new Exception("No Network Request was created. networkAdapterRequest was null.");
}
} catch (Exception ex) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
@@ -138,7 +139,7 @@ public class NetworkAdapterRestV1 {
}
} catch (Exception e) {
logger.error("Error in Openstack Adapter callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.OPENSTACK);
}
}
@@ -151,7 +152,7 @@ public class NetworkAdapterRestV1 {
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on Openstack Async-Response");
+ "Error timed out waiting on Openstack Async-Response", TargetEntity.SO);
}
public void handleSyncError(DelegateExecution execution) {
@@ -159,6 +160,6 @@ public class NetworkAdapterRestV1 {
String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = "
+ responseString;
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, TargetEntity.OPENSTACK);
}
}
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 fcc67d0ef7..9bbe94a077 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
@@ -29,8 +29,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.utils.TargetEntity;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +41,8 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCQueryTasks {
-
+ private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class);
+ private static final String NO_RESPONSE_FROM_SDNC = "Error did not receive a response from SDNC.";
public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_";
@Autowired
private SDNCVnfResources sdncVnfResources;
@@ -63,8 +66,14 @@ public class SDNCQueryTasks {
}
String response = sdncVnfResources.queryVnf(genericVnf);
execution.setVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId(), response);
+ } catch (BadResponseException ex) {
+ if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ }
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
@@ -88,6 +97,12 @@ public class SDNCQueryTasks {
throw new Exception("Vf Module " + vfModule.getVfModuleId()
+ " exists in gBuildingBlock but does not have a selflink value");
}
+ } catch (BadResponseException ex) {
+ if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ }
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -109,10 +124,16 @@ public class SDNCQueryTasks {
// If we see a bb object not found exception for something that is not a vf module id, then we should throw
// the error as normal
if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO);
+ }
+ } catch (BadResponseException ex) {
+ if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
}
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 cb761f4110..03714db943 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
@@ -37,6 +37,7 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -79,17 +80,19 @@ public class SDNCRequestTasks {
} catch (PathNotFoundException e) {
logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Recieved invalid response from SDNC, unable to read message content.");
+ "Recieved invalid response from SDNC, unable to read message content.", TargetEntity.SO);
} catch (MapperException e) {
logger.error("Failed to map SDNC object to JSON prior to POST.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Failed to map SDNC object to JSON prior to POST.");
+ "Failed to map SDNC object to JSON prior to POST.", TargetEntity.SO);
} catch (BadResponseException e) {
logger.error("Did not receive a successful response from SDNC.", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage(),
+ TargetEntity.SDNC);
} catch (HttpClientErrorException e) {
logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.");
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.",
+ TargetEntity.SO);
}
}
@@ -120,16 +123,17 @@ public class SDNCRequestTasks {
}
} catch (SDNCErrorResponseException e) {
logger.error("SDNC error response - " + e.getMessage());
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
} catch (Exception e) {
- logger.error("Error procesing SDNC callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error procesing SDNC callback");
+ logger.error("Error processing SDNC callback", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error processing SDNC callback",
+ TargetEntity.SO);
}
}
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on SDNC Async-Response");
+ "Error timed out waiting on SDNC Async-Response", TargetEntity.SO);
}
protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
@@ -149,5 +153,4 @@ public class SDNCRequestTasks {
}
return result;
}
-
}
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 44152fcaf4..a17556f091 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
@@ -312,7 +312,6 @@ public class WorkflowActionBBTasks {
}
workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
-
if (rollbackFlows.isEmpty())
execution.setVariable("isRollbackNeeded", false);
else
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index d0cee42178..8aea2d2650 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -39,12 +39,14 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
+import org.onap.so.utils.TargetEntity;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -110,8 +112,9 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
delegateExecution.setVariable("networkAdapterRequest", updateNetworkRequest);
delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
- doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder)
- .buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(), any(String.class));
+ doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException(
+ any(DelegateExecution.class), anyInt(), any(String.class), any(TargetEntity.class));
+
try {
networkAdapterRestV1Tasks.processCallback(delegateExecution);
} catch (BpmnError be) {
@@ -119,6 +122,6 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
}
assertNull(delegateExecution.getVariable("updateNetworkResponse"));
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000),
- eq("test error message"));
+ eq("test error message"), eq(TargetEntity.OPENSTACK));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
index 3ea8474b24..0ba9237aaf 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
@@ -43,6 +43,9 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.utils.TargetEntities;
+import org.onap.so.utils.TargetEntity;
public class SDNCQueryTasksTest extends BaseTaskTest {
@InjectMocks
@@ -61,8 +64,8 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
genericVnf = setGenericVnf();
vfModule = setVfModule();
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
- .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(
+ any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(TargetEntities.class));
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
@@ -88,6 +91,28 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
}
@Test
+ public void queryVfModuleBadResponseExceptionTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error received from SDNC");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModule(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void queryVfModuleResponseExceptionNoResponseTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error did not receive a response from SDNC.");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModule(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ }
+
+ @Test
public void queryVnfTest() throws Exception {
String sdncQueryResponse = "response";
@@ -101,6 +126,28 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
}
@Test
+ public void queryVnfBadResponseExceptionTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error received from SDNC");
+ doThrow(exception).when(sdncVnfResources).queryVnf(genericVnf);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVnf(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void queryVnfBadResponseExceptionNoResponseTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error did not receive a response from SDNC.");
+ doThrow(exception).when(sdncVnfResources).queryVnf(genericVnf);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVnf(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ }
+
+ @Test
public void queryVfModuleForVolumeGroupTest() throws Exception {
String sdncQueryResponse = "response";
vfModule.setSelflink("vfModuleSelfLink");
@@ -115,6 +162,28 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
}
@Test
+ public void queryVfModuleForVolumeGroupBadResponseExceptionTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error received from SDNC");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void queryVfModuleForVolumeGroupBadResponseExceptionNoResponseTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error did not receive a response from SDNC.");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ }
+
+ @Test
public void queryVfModuleForVolumeGroupNoSelfLinkExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
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 6a94b357e0..0fc33fe5ce 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
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import java.io.IOException;
@@ -48,6 +49,7 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.utils.TargetEntity;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import com.fasterxml.jackson.core.JsonParseException;
@@ -66,7 +68,6 @@ public class SDNCRequestTasksTest extends SDNCRequestTasks {
@Mock
SDNCClient sdncClient;
-
@Spy
private ExceptionBuilder exceptionBuilder;