diff options
author | Rob Daugherty <rd472p@att.com> | 2018-08-29 13:57:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-08-29 13:57:06 +0000 |
commit | 2490b90de024238af3a93ee457176b14f232af6d (patch) | |
tree | 42441915ebd88215a80116a647fb0e3082e0a799 /bpmn/so-bpmn-building-blocks/src | |
parent | 138f17fce465cdabb928525983323319162f20d2 (diff) | |
parent | 3cea07cfa59720df58e85f25081a5e8ff8d004cf (diff) |
Merge "Added GenericVnfHealthCheckBB, tasks, and tests"
Diffstat (limited to 'bpmn/so-bpmn-building-blocks/src')
4 files changed, 104 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/GenericVnfHealthCheckBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/GenericVnfHealthCheckBB.bpmn new file mode 100644 index 0000000000..d7828c5163 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/GenericVnfHealthCheckBB.bpmn @@ -0,0 +1,56 @@ +<?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="1.16.2"> + <bpmn:process id="GenericVnfHealthCheckBB" name="GenericVnfHealthCheckBB" isExecutable="true"> + <bpmn:startEvent id="Start_GenericVnfHealthChkBB" name="Start"> + <bpmn:outgoing>SequenceFlow_06ab7wm</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="SetParamsHealthCheck" name="Set Params HealthCheck" camunda:expression="${GenericVnfHealthCheck.setParamsForGenericVnfHealthCheck(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06ab7wm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yhmh9s</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_06ab7wm" sourceRef="Start_GenericVnfHealthChkBB" targetRef="SetParamsHealthCheck" /> + <bpmn:endEvent id="End_GenericVnfHealthChkBB" name="End"> + <bpmn:incoming>SequenceFlow_12srn62</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1yhmh9s" sourceRef="SetParamsHealthCheck" targetRef="Call-AppC-HealthCheck" /> + <bpmn:sequenceFlow id="SequenceFlow_12srn62" sourceRef="Call-AppC-HealthCheck" targetRef="End_GenericVnfHealthChkBB" /> + <bpmn:serviceTask id="Call-AppC-HealthCheck" name="Call APP-C For HealthCheck " camunda:expression="${GenericVnfHealthCheck.callAppcClient(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1yhmh9s</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12srn62</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericVnfHealthCheckBB"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_GenericVnfHealthChkBB"> + <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="SetParamsHealthCheck"> + <dc:Bounds x="261" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06ab7wm_di" bpmnElement="SequenceFlow_06ab7wm"> + <di:waypoint x="209" y="120" /> + <di:waypoint x="261" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_07e01q3_di" bpmnElement="End_GenericVnfHealthChkBB"> + <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_1yhmh9s_di" bpmnElement="SequenceFlow_1yhmh9s"> + <di:waypoint x="361" y="120" /> + <di:waypoint x="413" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_12srn62_di" bpmnElement="SequenceFlow_12srn62"> + <di:waypoint x="513" y="120" /> + <di:waypoint x="554" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0d1v1dn_di" bpmnElement="Call-AppC-HealthCheck"> + <dc:Bounds x="413" 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/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java index f6d81ba771..21b6dd402b 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 @@ -51,6 +51,7 @@ 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.CreateNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetworkCollection; +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.sdnc.tasks.SDNCActivateTasks; @@ -182,6 +183,9 @@ public abstract class BaseBPMNTest { @MockBean protected WorkflowActionBBTasks workflowActionBBTasks; + @MockBean + protected GenericVnfHealthCheck genericVnfHealthCheck; + @LocalServerPort private int port; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java new file mode 100644 index 0000000000..1c882e85d1 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java @@ -0,0 +1,41 @@ +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 GenericVnfHealthCheckBBTest extends BaseBPMNTest { + + @Test + public void sunnyDayGenericVnfHealthCheckBBTest() throws InterruptedException, IOException { + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck", + "Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB"); + assertThat(pi).isEnded(); + } + + @Test + public void genericVnfHealthCheckBBExceptionTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(genericVnfHealthCheck).setParamsForGenericVnfHealthCheck(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck") + .hasNotPassed("Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB"); + assertThat(pi).isEnded(); + } +} + + diff --git a/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml index d7bb084195..2d102afe9f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml +++ b/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml @@ -67,6 +67,9 @@ mso: workflow: message: endpoint: http://localhost:28090/workflows/messages/message + requestDb: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + endpoint: http://localhost:8081 async: core-pool-size: 50 |