summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java43
2 files changed, 30 insertions, 48 deletions
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 c8e296d5ac..0a7a75c89b 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
@@ -82,7 +82,6 @@ public class ExecuteBuildingBlockRainyDay {
boolean aLaCarte = (boolean) execution.getVariable("aLaCarte");
boolean suppressRollback = (boolean) execution.getVariable("suppressRollback");
String handlingCode = "";
-
WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
try {
// Extract error data to be returned to WorkflowAction
@@ -97,6 +96,9 @@ public class ExecuteBuildingBlockRainyDay {
try {
serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
.getModelInfoServiceInstance().getServiceType();
+ if (serviceType == null || serviceType.isEmpty()) {
+ serviceType = ASTERISK;
+ }
} catch (Exception ex) {
// keep default serviceType value
}
@@ -118,6 +120,7 @@ public class ExecuteBuildingBlockRainyDay {
} catch (Exception ex) {
// keep default errorCode value
}
+
try {
errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode");
} catch (Exception ex) {
@@ -131,29 +134,19 @@ public class ExecuteBuildingBlockRainyDay {
// keep default workStep value
}
- RainyDayHandlerStatus rainyDayHandlerStatus;
- rainyDayHandlerStatus = catalogDbClient
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
- serviceType, vnfType, errorCode, workStep);
- if (rainyDayHandlerStatus == null) {
- rainyDayHandlerStatus = catalogDbClient
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
- ASTERISK, ASTERISK, errorCode, ASTERISK);
+ String errorMessage = ASTERISK;
+ try {
+ errorMessage = workflowException.getErrorMessage();
+ } catch (Exception ex) {
+ // keep default workStep value
}
+ RainyDayHandlerStatus rainyDayHandlerStatus;
+ rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatus(bbName, serviceType, vnfType,
+ errorCode, workStep, errorMessage);
+
if (rainyDayHandlerStatus == null) {
- rainyDayHandlerStatus = catalogDbClient
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
- ASTERISK, ASTERISK, ASTERISK, ASTERISK);
- if (rainyDayHandlerStatus == null) {
- handlingCode = "Abort";
- } else {
- if (primaryPolicy) {
- handlingCode = rainyDayHandlerStatus.getPolicy();
- } else {
- handlingCode = rainyDayHandlerStatus.getSecondaryPolicy();
- }
- }
+ handlingCode = "Abort";
} else {
if (primaryPolicy) {
handlingCode = rainyDayHandlerStatus.getPolicy();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
index e8d597a823..c5da3cbd51 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
@@ -68,6 +68,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
delegateExecution.setVariable("WorkflowException", new WorkflowException("", 7000, ""));
delegateExecution.setVariable("buildingBlock", executeBuildingBlock);
delegateExecution.setVariable("lookupKeyMap", lookupKeyMap);
+
+ delegateExecution.setVariable("WorkflowException", new WorkflowException("processKey", 7000, "errorMessage"));
}
@Test
@@ -101,12 +103,10 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setPolicy("Rollback");
rainyDayHandlerStatus.setWorkStep(ASTERISK);
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
-
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
}
@@ -126,15 +126,9 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setPolicy("Rollback");
rainyDayHandlerStatus.setWorkStep(ASTERISK);
- doReturn(null).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "st1", "vnft1", "7000", ASTERISK);
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", ASTERISK, ASTERISK, ASTERISK, ASTERISK);
-
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", ASTERISK, ASTERISK, "errorMessage");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
-
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
assertEquals(5, delegateExecution.getVariable("maxRetries"));
}
@@ -145,9 +139,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
vnf.setVnfType("vnft1");
delegateExecution.setVariable("aLaCarte", true);
- doReturn(null).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class),
- isA(String.class), isA(String.class), isA(String.class), isA(String.class));
+ doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class), isA(String.class),
+ isA(String.class), isA(String.class), isA(String.class), isA(String.class));
delegateExecution.setVariable("suppressRollback", false);
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -157,9 +150,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
@Test
public void queryRainyDayTableExceptionTest() {
- doThrow(RuntimeException.class).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class),
- isA(String.class), isA(String.class), isA(String.class), isA(String.class));
+ doThrow(RuntimeException.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class),
+ isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class));
delegateExecution.setVariable("aLaCarte", true);
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
delegateExecution.setVariable("suppressRollback", false);
@@ -184,9 +176,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setWorkStep(ASTERISK);
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, false);
@@ -210,9 +201,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setWorkStep(ASTERISK);
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -236,9 +226,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setWorkStep(ASTERISK);
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);