summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-13 10:19:40 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-13 10:19:58 -0500
commit1e9abc1e59393d85f81b478301cd2918fcd520b8 (patch)
tree38c5f9792282c720e9a9d0fdef5662848cf5fb71 /bpmn/so-bpmn-tasks/src/test
parent641d9e6b68a964dc69dbec7c63f82e73b61433e2 (diff)
workflow action should read config for max retries
workflow action should also read config for max retries Change-Id: Ib0617b59ca95df7c82fb2ab54895c9c83586f02f Issue-ID: SO-1504 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java25
1 files changed, 25 insertions, 0 deletions
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 f3b094f645..2fc62978fb 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
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
+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;
@@ -46,6 +47,7 @@ import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.springframework.core.env.Environment;
public class WorkflowActionBBTasksTest extends BaseTaskTest {
@@ -64,6 +66,9 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
private DelegateExecution execution;
+ @Mock
+ protected Environment environment;
+
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -287,6 +292,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
String reqId = "reqId123";
execution.setVariable("mso-request-id", reqId);
doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+ doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
execution.setVariable("handlingCode","Retry");
execution.setVariable("retryCount", 1);
execution.setVariable("gCurrentSequence",1);
@@ -297,6 +303,25 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void checkRetryStatusTestExceededMaxRetries(){
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+ doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
+ execution.setVariable("handlingCode","Retry");
+ execution.setVariable("retryCount", 6);
+ execution.setVariable("gCurrentSequence",1);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ try{
+ workflowActionBBTasks.checkRetryStatus(execution);
+ } catch (BpmnError e) {
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals("Exceeded maximum retries. Ending flow with status Abort",exception.getErrorMessage());
+ }
+ }
+
+ @Test
public void checkRetryStatusNoRetryTest(){
String reqId = "reqId123";
execution.setVariable("mso-request-id", reqId);