diff options
Diffstat (limited to 'bpmn/so-bpmn-building-blocks')
3 files changed, 123 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteInstanceGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteInstanceGroupBB.bpmn new file mode 100644 index 0000000000..d16f4405b2 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteInstanceGroupBB.bpmn @@ -0,0 +1,62 @@ +<?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_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> + <bpmn:process id="DeleteInstanceGroupBB" name="DeleteInstanceGroupBB" isExecutable="true"> + <bpmn:startEvent id="DeleteInstanceGroupBB_Start"> + <bpmn:outgoing>SequenceFlow_0wlfmtw</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="DeleteInstanceGroupBB_End"> + <bpmn:incoming>SequenceFlow_068apyw</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0wlfmtw" sourceRef="DeleteInstanceGroupBB_Start" targetRef="DeleteInstanceGroupNaming" /> + <bpmn:sequenceFlow id="SequenceFlow_18azuvq" sourceRef="DeleteInstanceGroupNaming" targetRef="DeleteInstanceGroupAAI" /> + <bpmn:sequenceFlow id="SequenceFlow_068apyw" sourceRef="DeleteInstanceGroupAAI" targetRef="DeleteInstanceGroupBB_End" /> + <bpmn:serviceTask id="DeleteInstanceGroupNaming" name="Delete Instance Group from Naming mS" camunda:expression="${NamingServiceDeleteTasks.deleteInstanceGroupName(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0wlfmtw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18azuvq</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="DeleteInstanceGroupAAI" name="Delete Instance Group from A&AI" camunda:expression="${AAIDeleteTasks.deleteInstanceGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_18azuvq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_068apyw</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteInstanceGroupBB"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DeleteInstanceGroupBB_Start"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1fy6x5e_di" bpmnElement="DeleteInstanceGroupBB_End"> + <dc:Bounds x="645" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="663" y="138" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0wlfmtw_di" bpmnElement="SequenceFlow_0wlfmtw"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="280" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="245" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18azuvq_di" bpmnElement="SequenceFlow_18azuvq"> + <di:waypoint xsi:type="dc:Point" x="380" y="120" /> + <di:waypoint xsi:type="dc:Point" x="460" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="420" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_068apyw_di" bpmnElement="SequenceFlow_068apyw"> + <di:waypoint xsi:type="dc:Point" x="560" y="120" /> + <di:waypoint xsi:type="dc:Point" x="645" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="603" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0nh16a5_di" bpmnElement="DeleteInstanceGroupNaming"> + <dc:Bounds x="280" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0ybtwi8_di" bpmnElement="DeleteInstanceGroupAAI"> + <dc:Bounds x="460" 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 79bade3cf3..f4b528c4be 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 @@ -61,6 +61,8 @@ import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetworkCollectio import org.onap.so.bpmn.infrastructure.flowspecific.tasks.GenericVnfHealthCheck; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.UnassignNetworkBB; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.UnassignVnf; +import org.onap.so.bpmn.infrastructure.namingservice.tasks.NamingServiceCreateTasks; +import org.onap.so.bpmn.infrastructure.namingservice.tasks.NamingServiceDeleteTasks; import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCActivateTasks; import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCAssignTasks; import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCChangeAssignTasks; @@ -230,6 +232,12 @@ public abstract class BaseBPMNTest { protected SniroHomingV2 sniroHoming; @MockBean + protected NamingServiceDeleteTasks namingServiceDeleteTasks; + + @MockBean + protected NamingServiceCreateTasks namingServiceCreateTasks; + + @MockBean protected WorkflowActionBBFailure workflowActionBBFailure; @MockBean diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java new file mode 100644 index 0000000000..6dc36ae100 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============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 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 DeleteInstanceGroupBBTest extends BaseBPMNTest{ + @Test + public void sunnyDay() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", "DeleteInstanceGroupAAI", + "DeleteInstanceGroupBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDay() throws Exception { + doThrow(BpmnError.class).when(aaiDeleteTasks).deleteInstanceGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", "DeleteInstanceGroupAAI") + .hasNotPassed("DeleteInstanceGroupBB_End"); + assertThat(pi).isEnded(); + } +} |