summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-building-blocks/src/test
diff options
context:
space:
mode:
authoreeginux <henry.xie@est.tech>2019-11-20 13:23:49 +0000
committerXuefeng Xie <henry.xie@est.tech>2020-01-24 10:12:25 +0000
commit8c9f2c73f4366ae42ad7e2c1742885b5ad793360 (patch)
tree7664c0f06c29b67bba254b14873c4d18f20d6b45 /bpmn/so-bpmn-building-blocks/src/test
parent8d77d8544d88dfb91e9287b1620212cc9821bd54 (diff)
decision point API
ControllerRunnable interface: implemented by controller ControllerContext: Controller Context for controller execution ControllerPreparable interface:used to setup execution context ControllerExecutionBB:controller execution for building block ControllerExecutionDE:controller execution for camunda Skeleton implementation for APPC controller Skeleton implementation for SDNC controller Use ControllerExecutionDE for existing PNF configuration. Add integration tests for controllerExecutionBB/DE Add GenericControllerExecution activity for BuildingBlockExecution based Add GenericControllerExecutionDE activity for DelegateExecution based. CDS controller to be implemented by SO-CDS generic buildingBlock Actor seletion based on ingested metadata Issue-ID: SO-2070 Change-Id: I4020c2ce21468939690e2cef78bbadbfff4bd3e4 Signed-off-by: eeginux<henry.xie@est.tech>
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();
+ }
+}