diff options
Diffstat (limited to 'bpmn/so-bpmn-building-blocks/src')
3 files changed, 111 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigurationScaleOutBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigurationScaleOutBB.bpmn new file mode 100644 index 0000000000..98a604951f --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigurationScaleOutBB.bpmn @@ -0,0 +1,68 @@ +<?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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0ky0lyw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="ConfigurationScaleOutBB" name="ConfigurationScaleOutBB" isExecutable="true"> + <bpmn:startEvent id="Start_ConfigScaleOutBB" name="Start"> + <bpmn:outgoing>SequenceFlow_06ab7wm</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="QueryVfModule" name="Query VF Module (SDNC)" camunda:expression="${SDNCQueryTasks.queryVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06ab7wm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_149xlbu</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_06ab7wm" sourceRef="Start_ConfigScaleOutBB" targetRef="QueryVfModule" /> + <bpmn:endEvent id="End_ConfigScaleOutBB" name="End"> + <bpmn:incoming>SequenceFlow_12srn62</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_12srn62" sourceRef="Call-AppC-ConfigScaleOut" targetRef="End_ConfigScaleOutBB" /> + <bpmn:sequenceFlow id="SequenceFlow_149xlbu" sourceRef="QueryVfModule" targetRef="GetConfigScaleOutParams" /> + <bpmn:sequenceFlow id="SequenceFlow_1juznaa" sourceRef="GetConfigScaleOutParams" targetRef="Call-AppC-ConfigScaleOut" /> + <bpmn:serviceTask id="GetConfigScaleOutParams" name="Get Config Scale Out Params" camunda:expression="${ConfigurationScaleOut.setParamsForConfigurationScaleOut(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_149xlbu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1juznaa</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Call-AppC-ConfigScaleOut" name="Call APP-C For Configuration Scale Out " camunda:expression="${ConfigurationScaleOut.callAppcClient(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1juznaa</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12srn62</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ConfigurationScaleOutBB"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_ConfigScaleOutBB"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="179" y="145" width="25" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1juzqvs_di" bpmnElement="QueryVfModule"> + <dc:Bounds x="261" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06ab7wm_di" bpmnElement="SequenceFlow_06ab7wm"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="261" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_07e01q3_di" bpmnElement="End_ConfigScaleOutBB"> + <dc:Bounds x="694" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="702" y="145" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_12srn62_di" bpmnElement="SequenceFlow_12srn62"> + <di:waypoint xsi:type="dc:Point" x="653" y="120" /> + <di:waypoint xsi:type="dc:Point" x="694" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_149xlbu_di" bpmnElement="SequenceFlow_149xlbu"> + <di:waypoint xsi:type="dc:Point" x="361" y="120" /> + <di:waypoint xsi:type="dc:Point" x="406" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1juznaa_di" bpmnElement="SequenceFlow_1juznaa"> + <di:waypoint xsi:type="dc:Point" x="506" y="120" /> + <di:waypoint xsi:type="dc:Point" x="553" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1jq0gvz_di" bpmnElement="GetConfigScaleOutParams"> + <dc:Bounds x="406" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1778mx4_di" bpmnElement="Call-AppC-ConfigScaleOut"> + <dc:Bounds x="553" 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 21b6dd402b..e8891eeb53 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 @@ -49,6 +49,7 @@ import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterImpl; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignVnf; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.ConfigurationScaleOut; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetworkCollection; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.GenericVnfHealthCheck; @@ -186,6 +187,9 @@ public abstract class BaseBPMNTest { @MockBean protected GenericVnfHealthCheck genericVnfHealthCheck; + @MockBean + protected ConfigurationScaleOut configurationScaleOut; + @LocalServerPort private int port; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java new file mode 100644 index 0000000000..edf131d538 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java @@ -0,0 +1,39 @@ +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +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 ConfigurationScaleOutBBTest extends BaseBPMNTest { + + @Test + public void sunnyDayConfigurationScaleOutBBTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule", "GetConfigScaleOutParams", + "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB"); + assertThat(pi).isEnded(); + } + + @Test + public void configurationScaleOutBBExceptionTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks).queryVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule") + .hasNotPassed("GetConfigScaleOutParams", "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB"); + assertThat(pi).isEnded(); + } +} |