summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java18
2 files changed, 28 insertions, 8 deletions
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 b69ab151c4..dabfc81e1f 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
@@ -152,7 +152,7 @@ public class ExceptionBuilder {
.getProcessDefinition(execution.getProcessDefinitionId()).getKey();
}
- public void processAuditException(DelegateExecutionImpl execution) {
+ public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) {
logger.info("Building a WorkflowException for Subflow");
StringBuilder errorMessage = new StringBuilder();
@@ -203,11 +203,15 @@ public class ExceptionBuilder {
errorMessage.append(
"Recommendation - Wait for nightly RO Audit to run and fix the data issue and resume vf-module creation in VID. If problem persists then report problem to AIC/RO Ops.");
- WorkflowException exception = new WorkflowException(processKey, 400, errorMessage.toString());
- execution.setVariable("WorkflowException", exception);
- execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
- logger.info("Outgoing WorkflowException is {}", exception);
- logger.info("Throwing MSOWorkflowException");
- throw new BpmnError("AAIInventoryFailure");
+ if (flowShouldContinue) {
+ execution.setVariable("StatusMessage", errorMessage.toString());
+ } else {
+ WorkflowException exception = new WorkflowException(processKey, 400, errorMessage.toString());
+ execution.setVariable("WorkflowException", exception);
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString());
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("AAIInventoryFailure");
+ }
}
}
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 4ade9dbe32..549f16b6f6 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
@@ -22,6 +22,7 @@ package org.onap.so.client.exception;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import org.camunda.bpm.engine.delegate.BpmnError;
@@ -131,7 +132,7 @@ public class ExceptionBuilderTest extends BaseTest {
public void processAuditExceptionTest() {
try {
Mockito.doReturn(extractPojosForBB).when(exceptionBuilder).getExtractPojosForBB();
- exceptionBuilder.processAuditException((DelegateExecutionImpl) execution);
+ exceptionBuilder.processAuditException((DelegateExecutionImpl) execution, false);
} catch (BpmnError bpmnException) {
assertEquals("AAIInventoryFailure", bpmnException.getErrorCode());
WorkflowException we = execution.getVariable("WorkflowException");
@@ -142,4 +143,19 @@ public class ExceptionBuilderTest extends BaseTest {
}
}
+ @Test
+ public void processAuditExceptionContinueTest() {
+ try {
+ Mockito.doReturn(extractPojosForBB).when(exceptionBuilder).getExtractPojosForBB();
+ exceptionBuilder.processAuditException((DelegateExecutionImpl) execution, true);
+ String sm = execution.getVariable("StatusMessage");
+ assertNotNull(sm);
+ assertEquals(
+ "create VF-Module testVfModuleId1 failed due to incomplete A&AI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that AIC RO did not create vserver testVServerId in AAI. Recommendation - Wait for nightly RO Audit to run and fix the data issue and resume vf-module creation in VID. If problem persists then report problem to AIC/RO Ops.",
+ sm);
+ } catch (BpmnError bpmnException) {
+ fail();
+ }
+ }
+
}