summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-building-blocks/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-building-blocks/src')
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/GenericControllerExecution.json15
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/GenericControllerExecutionDE.json15
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/GenericControllerExecution.bpmn44
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/GenericControllerExecutionDE.bpmn44
-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
7 files changed, 234 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/GenericControllerExecution.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/GenericControllerExecution.json
new file mode 100644
index 0000000000..d4a0e83546
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/GenericControllerExecution.json
@@ -0,0 +1,15 @@
+{
+ "name": "GenericControllerExecution",
+ "description": "Generic controller execution with BuildingBlockExecution context against controller northbound interface",
+ "categoryList": [
+ "VNF",
+ "PNF"
+ ],
+ "inputParameters": [],
+ "outputParameters": [
+ {
+ "name": "WorkflowException",
+ "type": "WorkflowException"
+ }
+ ]
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/GenericControllerExecutionDE.json b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/GenericControllerExecutionDE.json
new file mode 100644
index 0000000000..cd1fa865ee
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/ActivitySpec/GenericControllerExecutionDE.json
@@ -0,0 +1,15 @@
+{
+ "name": "GenericControllerExecutionDE",
+ "description": "Generic controller execution with DelegateExecution context against controller northbound interface",
+ "categoryList": [
+ "VNF",
+ "PNF"
+ ],
+ "inputParameters": [],
+ "outputParameters": [
+ {
+ "name": "WorkflowException",
+ "type": "WorkflowException"
+ }
+ ]
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/GenericControllerExecution.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/GenericControllerExecution.bpmn
new file mode 100644
index 0000000000..bd606738e2
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/GenericControllerExecution.bpmn
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0ky0lyw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
+ <bpmn:process id="GenericControllerExecution" name="GenericControllerExecution" isExecutable="true">
+ <bpmn:startEvent id="Start_ControllerExecutionBB" name="Start">
+ <bpmn:outgoing>SequenceFlow_06ab7wm</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_06ab7wm" sourceRef="Start_ControllerExecutionBB" targetRef="Call_ControllerExecutionBB" />
+ <bpmn:endEvent id="End_ControllerExecutionBB" name="End">
+ <bpmn:incoming>SequenceFlow_12srn62</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_12srn62" sourceRef="Call_ControllerExecutionBB" targetRef="End_ControllerExecutionBB" />
+ <bpmn:serviceTask id="Call_ControllerExecutionBB" name="Call ControllerExecutionBB&#10;" camunda:expression="${ControllerExecutionBB.execute(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_06ab7wm</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12srn62</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericControllerExecution">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_ControllerExecutionBB">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="180" y="145" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06ab7wm_di" bpmnElement="SequenceFlow_06ab7wm">
+ <di:waypoint x="209" y="120" />
+ <di:waypoint x="291" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_07e01q3_di" bpmnElement="End_ControllerExecutionBB">
+ <dc:Bounds x="554" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="562" y="145" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_12srn62_di" bpmnElement="SequenceFlow_12srn62">
+ <di:waypoint x="391" y="120" />
+ <di:waypoint x="554" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0d1v1dn_di" bpmnElement="Call_ControllerExecutionBB">
+ <dc:Bounds x="291" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions> \ No newline at end of file
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/GenericControllerExecutionDE.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/GenericControllerExecutionDE.bpmn
new file mode 100644
index 0000000000..b5dcec00cd
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/GenericControllerExecutionDE.bpmn
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0ky0lyw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
+ <bpmn:process id="GenericControllerExecutionDE" name="GenericControllerExecutionDE" isExecutable="true">
+ <bpmn:startEvent id="Start_ControllerExecutionDE" name="Start">
+ <bpmn:outgoing>SequenceFlow_06ab7wm</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_06ab7wm" sourceRef="Start_ControllerExecutionDE" targetRef="Call_ControllerExecutionDE" />
+ <bpmn:endEvent id="End_ControllerExecutionDE" name="End">
+ <bpmn:incoming>SequenceFlow_12srn62</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_12srn62" sourceRef="Call_ControllerExecutionDE" targetRef="End_ControllerExecutionDE" />
+ <bpmn:serviceTask id="Call_ControllerExecutionDE" name="Call ControllerExecutionDE&#10;" camunda:delegateExpression="${ControllerExecutionDE}">
+ <bpmn:incoming>SequenceFlow_06ab7wm</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12srn62</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericControllerExecutionDE">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_ControllerExecutionDE">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="180" y="145" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06ab7wm_di" bpmnElement="SequenceFlow_06ab7wm">
+ <di:waypoint x="209" y="120" />
+ <di:waypoint x="291" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_07e01q3_di" bpmnElement="End_ControllerExecutionDE">
+ <dc:Bounds x="554" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="562" y="145" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_12srn62_di" bpmnElement="SequenceFlow_12srn62">
+ <di:waypoint x="391" y="120" />
+ <di:waypoint x="554" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0d1v1dn_di" bpmnElement="Call_ControllerExecutionDE">
+ <dc:Bounds x="291" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
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();
+ }
+}