summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-building-blocks/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-building-blocks/src/test')
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java8
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericControllerExecutionDETest.java54
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericControllerExecutionTest.java54
3 files changed, 116 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
index 5b7fe66f54..874e3415b2 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
@@ -55,6 +55,8 @@ import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterImpl;
import org.onap.so.bpmn.infrastructure.appc.tasks.AppcOrchestratorPreProcessor;
import org.onap.so.bpmn.infrastructure.appc.tasks.AppcRunTasks;
import org.onap.so.bpmn.infrastructure.audit.AuditTasks;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.ControllerExecutionBB;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.ControllerExecutionDE;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.ActivateVfModule;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetwork;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils;
@@ -254,6 +256,12 @@ public abstract class BaseBPMNTest {
@MockBean
protected ManualHandlingTasks manualHandlingTasks;
+ @MockBean
+ protected ControllerExecutionBB controllerExecutionBB;
+
+ @MockBean
+ protected ControllerExecutionDE controllerExecutionDE;
+
@LocalServerPort
protected int port;
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericControllerExecutionDETest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericControllerExecutionDETest.java
new file mode 100644
index 0000000000..83cf98ec0c
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericControllerExecutionDETest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+
+public class GenericControllerExecutionDETest extends BaseBPMNTest {
+
+ @Test
+ public void testExecution_validInput_expectedExecution() {
+
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericControllerExecutionDE", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_ControllerExecutionDE", "Call_ControllerExecutionDE",
+ "End_ControllerExecutionDE");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void testExecution_failedExecution_exceptionThrown() {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(controllerExecutionDE)
+ .execute(any(DelegateExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericControllerExecutionDE", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_ControllerExecutionDE", "Call_ControllerExecutionDE")
+ .hasNotPassed("End_ControllerExecutionDE");
+ assertThat(pi).isEnded();
+ }
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericControllerExecutionTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericControllerExecutionTest.java
new file mode 100644
index 0000000000..c2aa3af721
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericControllerExecutionTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+
+
+public class GenericControllerExecutionTest extends BaseBPMNTest {
+
+ @Test
+ public void testExecution_validInput_expectedExecution() {
+
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericControllerExecution", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_ControllerExecutionBB", "Call_ControllerExecutionBB",
+ "End_ControllerExecutionBB");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void testExecution_failedExecution_exceptionThrown() {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(controllerExecutionBB)
+ .execute(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericControllerExecution", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_ControllerExecutionBB", "Call_ControllerExecutionBB")
+ .hasNotPassed("End_ControllerExecutionBB");
+ assertThat(pi).isEnded();
+ }
+}