summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test/java
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2022-08-31 13:45:15 +0000
committerGerrit Code Review <gerrit@onap.org>2022-08-31 13:45:15 +0000
commit66b09af14e0a2cf774e9f917562f4ae54587eb19 (patch)
treeeaa03610d63a864351933d58b3cfe1a52feb8469 /bpmn/so-bpmn-tasks/src/test/java
parentea65e0397e030bbd0a685f473b1c8416dd0a82f3 (diff)
parent5baa1ed97c1d2b98952a025c3bc76f60587e9670 (diff)
Merge "Enable long-running processes in ControllerExecutionBB"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBBTest.java32
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java2
2 files changed, 33 insertions, 1 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBBTest.java
index 0f9b4d9012..abc2cc4f76 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBBTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBBTest.java
@@ -20,6 +20,10 @@
package org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.MockControllerBB.TEST_ACTION;
@@ -27,7 +31,10 @@ import static org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.M
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.cds.PayloadConstants;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.beans.PnfResourceCustomization;
@@ -70,6 +77,9 @@ public class ControllerExecutionBBTest {
@MockBean
private ControllerSelectionReference controllerSelectionReference;
+ @MockBean
+ ExceptionBuilder exceptionBuilder;
+
@Before
public void setUp() {
when(execution.getVariable(ACTOR_PARAM)).thenReturn(TEST_ACTOR);
@@ -157,4 +167,26 @@ public class ControllerExecutionBBTest {
expectedVnfControllerActor, controllerActor);
}
}
+
+ @Test
+ public void testHandleFailure() {
+ when(execution.getVariable(PayloadConstants.CONTROLLER_ERROR_MESSAGE)).thenReturn("ERROR MESSAGE");
+
+ controllerExecutionBB.handleFailure(execution);
+
+ verify(exceptionBuilder).buildAndThrowWorkflowException(execution, 9003, "ERROR MESSAGE", ONAPComponents.SO);
+ }
+
+ @Test
+ public void testHandleTimeoutFailure() {
+ when(execution.getVariable(PayloadConstants.CONTROLLER_MSG_TIMEOUT_REACHED)).thenReturn(true);
+
+ controllerExecutionBB.handleFailure(execution);
+
+ ArgumentCaptor<String> errMsgCaptor = ArgumentCaptor.forClass(String.class);
+ verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), anyInt(),
+ errMsgCaptor.capture(), any());
+
+ assertTrue(errMsgCaptor.getValue().contains("timeout"));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java
index d8f607f6d9..3c3dc839c8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java
@@ -50,7 +50,7 @@ public class PnfConfigCdsControllerDETest {
@MockBean
private ControllerPreparable<DelegateExecution> preparable;
- @Mock
+ @MockBean
private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils;
@Test