summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-09-27 14:18:14 +0000
committerGerrit Code Review <gerrit@onap.org>2019-09-27 14:18:14 +0000
commitd6a26f001eb691c6e8b7269e9045980ca3a57e9b (patch)
tree1a17aeadaaf5f456d2b58cab486d45ad7f2bd242
parent0f5d4b5e7df6d80684d612e27ce32f0cae6f6b6c (diff)
parent07c30c3f010df4c5a66d060eda4eb0866b078bf6 (diff)
Merge "Set WorkflowException on BPMN WF error"
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java13
2 files changed, 16 insertions, 1 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index d9c6857ef1..0c31dfa16f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -138,7 +138,9 @@ public class ExecuteActivity implements JavaDelegate {
execution.setVariable(WORKFLOW_EXCEPTION, workflowException);
} catch (Exception e) {
- buildAndThrowException(execution, e.getMessage());
+ logger.error("BPMN exception on activity execution: " + e.getMessage());
+ workflowException = new WorkflowException(EXECUTE_BUILDING_BLOCK, 7000, e.getMessage());
+ handlingCode = ABORT_HANDLING_CODE;
}
if (workflowException != null && handlingCode != null && handlingCode.equals(ABORT_HANDLING_CODE)) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
index c0056291ef..1fde3f4fbc 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
@@ -92,6 +92,19 @@ public class ExecuteActivityTest extends BaseTaskTest {
}
@Test
+ public void executeException_Test() throws Exception {
+ execution.setVariable("workflowSyncAckSent", true);
+ execution.setVariable("testProcessKey", "testProcessKeyValue");
+ thrown.expect(BpmnError.class);
+ executeActivity.execute(execution);
+ String errorMessage = (String) execution.getVariable("ExecuteActivityErrorMessage");
+ assertEquals(errorMessage, "not implemented");
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals(workflowException.getErrorMessage(), "not implemented");
+ assertEquals(workflowException.getErrorCode(), 7000);
+ }
+
+ @Test
public void buildAndThrowException_Test() throws Exception {
doNothing().when(workflowActionBBFailure).updateRequestStatusToFailed(execution);
doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);