Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIV-15151 added camunda flow for notifyinf #1100

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0yui333" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.14.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:collaboration id="terminateDocUploadGeneralApplicationBusinessProcess">
<bpmn:participant id="EndBusinessProcessGASpecWithoutWATaskId" name="Termination phase" processRef="GA_EndBusinessProcessWithoutWATask" />
</bpmn:collaboration>
<bpmn:process id="GA_EndBusinessProcessWithoutWATask" name="GA end business process without WA Task" isExecutable="true" camunda:historyTimeToLive="P90D">
<bpmn:serviceTask id="EndBusinessProcessGAWithoutWATaskID" name="End General Application Business Process Without WA Task" camunda:type="external" camunda:topic="END_BUSINESS_PROCESS_GASPEC_WITHOUT_WA_TASK">
<bpmn:incoming>Flow_0nhnyjm</bpmn:incoming>
<bpmn:outgoing>Flow_1jw9p2g</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:startEvent id="Event_1dagxjy">
<bpmn:outgoing>Flow_0nhnyjm</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_0nhnyjm" sourceRef="Event_1dagxjy" targetRef="EndBusinessProcessGAWithoutWATaskID" />
<bpmn:sequenceFlow id="Flow_1jw9p2g" sourceRef="EndBusinessProcessGAWithoutWATaskID" targetRef="Event_1ppqfy0" />
<bpmn:endEvent id="Event_1ppqfy0">
<bpmn:incoming>Flow_1jw9p2g</bpmn:incoming>
</bpmn:endEvent>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="terminateDocUploadGeneralApplicationBusinessProcess">
<bpmndi:BPMNShape id="Participant_17lzkvb_di" bpmnElement="EndBusinessProcessGASpecWithoutWATaskId" isHorizontal="true">
<dc:Bounds x="129" y="100" width="571" height="230" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1dcrftc_di" bpmnElement="EndBusinessProcessGAWithoutWATaskID">
<dc:Bounds x="379" y="185" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1dagxjy_di" bpmnElement="Event_1dagxjy">
<dc:Bounds x="288" y="207" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1ppqfy0_di" bpmnElement="Event_1ppqfy0">
<dc:Bounds x="592" y="207" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_0nhnyjm_di" bpmnElement="Flow_0nhnyjm">
<di:waypoint x="324" y="225" />
<di:waypoint x="379" y="225" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1jw9p2g_di" bpmnElement="Flow_1jw9p2g">
<di:waypoint x="479" y="225" />
<di:waypoint x="592" y="225" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_18h9iji" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.14.0">
<bpmn:process id="UPLOAD_TRANSLATED_DOCUMENT_GA_LIP_ID" name="Upload translated document GA Lip" isExecutable="true" camunda:historyTimeToLive="P90D">
<bpmn:startEvent id="StartEvent_1" name="Start">
<bpmn:outgoing>Flow_0g2t112</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_1oxj7lg" messageRef="Message_0ttrrz3" />
</bpmn:startEvent>
<bpmn:endEvent id="Event_07ek9xj">
<bpmn:incoming>Flow_0qmsc9o</bpmn:incoming>
</bpmn:endEvent>
<bpmn:callActivity id="Activity_1cweuly" name="End GA Business Process" calledElement="GA_EndBusinessProcessWithoutWATask">
<bpmn:extensionElements>
<camunda:in variables="all" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_1r0joyl</bpmn:incoming>
<bpmn:outgoing>Flow_0qmsc9o</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:callActivity id="Activity_0gt1863" name="Start Ga Business Process" calledElement="GA_StartGeneralApplicationBusinessProcess">
<bpmn:extensionElements>
<camunda:in variables="all" />
<camunda:out variables="all" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_0g2t112</bpmn:incoming>
<bpmn:outgoing>Flow_19mft34</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:endEvent id="Event_0nc34kd">
<bpmn:incoming>Flow_13dgz5v</bpmn:incoming>
</bpmn:endEvent>
<bpmn:boundaryEvent id="Event_1p3emre" name="Abort" attachedToRef="Activity_0gt1863">
<bpmn:outgoing>Flow_13dgz5v</bpmn:outgoing>
<bpmn:errorEventDefinition id="ErrorEventDefinition_0m9vye0" />
</bpmn:boundaryEvent>
<bpmn:sequenceFlow id="Flow_13dgz5v" sourceRef="Event_1p3emre" targetRef="Event_0nc34kd" />
<bpmn:sequenceFlow id="Flow_0g2t112" sourceRef="StartEvent_1" targetRef="Activity_0gt1863" />
<bpmn:sequenceFlow id="Flow_19mft34" sourceRef="Activity_0gt1863" targetRef="NotifyTranslatedDocumentUploadedToApplicantGA" />
<bpmn:serviceTask id="NotifyTranslatedDocumentUploadedToRespondentGA" name="Notify Respondent uploaded translated document GA" camunda:type="external" camunda:topic="processExternalCaseEventGASpec">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="caseEvent">NOTIFY_RESPONDENT_TRANSLATED_DOCUMENT_UPLOADED_GA</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_02cu20h</bpmn:incoming>
<bpmn:outgoing>Flow_1r0joyl</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="NotifyTranslatedDocumentUploadedToApplicantGA" name="Notify applicant uploaded translated document GA" camunda:type="external" camunda:topic="processExternalCaseEventGASpec">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="caseEvent">NOTIFY_APPLICANT_TRANSLATED_DOCUMENT_UPLOADED_GA</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_19mft34</bpmn:incoming>
<bpmn:outgoing>Flow_02cu20h</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_02cu20h" sourceRef="NotifyTranslatedDocumentUploadedToApplicantGA" targetRef="NotifyTranslatedDocumentUploadedToRespondentGA" />
<bpmn:sequenceFlow id="Flow_0qmsc9o" sourceRef="Activity_1cweuly" targetRef="Event_07ek9xj" />
<bpmn:sequenceFlow id="Flow_1r0joyl" sourceRef="NotifyTranslatedDocumentUploadedToRespondentGA" targetRef="Activity_1cweuly" />
</bpmn:process>
<bpmn:message id="Message_0ttrrz3" name="UPLOAD_TRANSLATED_DOCUMENT_GA_LIP" />
<bpmn:error id="Error_1alq6sw" name="StartBusinessAbort" errorCode="ABORT" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UPLOAD_TRANSLATED_DOCUMENT_GA_LIP_ID">
<bpmndi:BPMNShape id="Event_1diii28_di" bpmnElement="StartEvent_1">
<dc:Bounds x="152" y="192" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="158" y="235" width="25" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_07ek9xj_di" bpmnElement="Event_07ek9xj">
<dc:Bounds x="842" y="189" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_14sbez9_di" bpmnElement="Activity_1cweuly">
<dc:Bounds x="690" y="167" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0gt1863_di" bpmnElement="Activity_0gt1863">
<dc:Bounds x="230" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0nc34kd_di" bpmnElement="Event_0nc34kd">
<dc:Bounds x="262" y="79" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_15wxp1o_di" bpmnElement="NotifyTranslatedDocumentUploadedToRespondentGA">
<dc:Bounds x="530" y="168" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1up0lu9_di" bpmnElement="NotifyTranslatedDocumentUploadedToApplicantGA">
<dc:Bounds x="380" y="168" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1p3emre_di" bpmnElement="Event_1p3emre">
<dc:Bounds x="262" y="149" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="297" y="130" width="27" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_13dgz5v_di" bpmnElement="Flow_13dgz5v">
<di:waypoint x="280" y="149" />
<di:waypoint x="280" y="115" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0g2t112_di" bpmnElement="Flow_0g2t112">
<di:waypoint x="188" y="210" />
<di:waypoint x="230" y="210" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_19mft34_di" bpmnElement="Flow_19mft34">
<di:waypoint x="330" y="207" />
<di:waypoint x="380" y="207" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_02cu20h_di" bpmnElement="Flow_02cu20h">
<di:waypoint x="480" y="207" />
<di:waypoint x="530" y="207" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0qmsc9o_di" bpmnElement="Flow_0qmsc9o">
<di:waypoint x="790" y="207" />
<di:waypoint x="842" y="207" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1r0joyl_di" bpmnElement="Flow_1r0joyl">
<di:waypoint x="630" y="208" />
<di:waypoint x="690" y="208" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,20 @@ public void completeBusinessProcess(ExternalTask externalTask) {
completeTask(lockedEndBusinessProcessTask.get(0).getId());
}

/**
* Completes the external task with topic name END_BUSINESS_PROCESS.
*
* @param externalTask the id of the external task to complete.
*/
public void completeBusinessProcessForGADocUpload(ExternalTask externalTask) {
assertThat(externalTask.getTopicName()).isEqualTo("END_BUSINESS_PROCESS_GASPEC_WITHOUT_WA_TASK");

List<LockedExternalTask> lockedEndBusinessProcessTask = fetchAndLockTask("END_BUSINESS_PROCESS_GASPEC_WITHOUT_WA_TASK");

assertThat(lockedEndBusinessProcessTask).hasSize(1);
completeTask(lockedEndBusinessProcessTask.get(0).getId());
}

/**
* Completes the external task with topic name END_GA_HWF_NOTIFY_PROCESS.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package uk.gov.hmcts.reform.civil.bpmn;

import org.camunda.bpm.engine.externaltask.ExternalTask;
import org.camunda.bpm.engine.variable.VariableMap;
import org.camunda.bpm.engine.variable.Variables;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertFalse;

public class NotifyGATranslatedUploadedDocumentsTest extends BpmnBaseGASpecTest {

public static final String NOTIFY_EVENT = "processExternalCaseEventGASpec";
private static final String START_BUSINESS_TOPIC = "START_GA_BUSINESS_PROCESS";
private static final String LIP_APPLICANT = "LIP_APPLICANT";
private static final String LIP_RESPONDENT = "LIP_RESPONDENT";
public static final String END_BUSINESS_PROCESS = "END_BUSINESS_PROCESS_GASPEC_WITHOUT_WA_TASK";

public NotifyGATranslatedUploadedDocumentsTest() {
super("upload_translated_document_ga_lip_notify.bpmn", "UPLOAD_TRANSLATED_DOCUMENT_GA_LIP_ID");
}

@BeforeEach
void setup() {
//deploy process
startBusinessProcessDeployment = engine.getRepositoryService()
.createDeployment()
.addClasspathResource(String.format(DIAGRAM_PATH,
"start_business_process_in_general_application.bpmn"))
.deploy();
endBusinessProcessDeployment = engine.getRepositoryService()
.createDeployment()
.addClasspathResource(String.format(DIAGRAM_PATH, "end_general_application_business_process_without_WA_task.bpmn"))
.deploy();
deployment = engine.getRepositoryService()
.createDeployment()
.addClasspathResource(String.format(DIAGRAM_PATH, bpmnFileName))
.deploy();
processInstance = engine.getRuntimeService().startProcessInstanceByKey(processId);
}

@Test
void shouldNotifyTranslatedDocumentUploaded() {
VariableMap variables = Variables.createVariables();
variables.put("flowFlags", Map.of(
LIP_APPLICANT, false,
LIP_RESPONDENT, false));

//assert process has started
assertFalse(processInstance.isEnded());
//complete the start business process
ExternalTask startBusiness = assertNextExternalTask(START_BUSINESS_TOPIC);
assertCompleteExternalTask(
startBusiness,
START_BUSINESS_TOPIC,
START_GA_BUSINESS_EVENT,
START_GA_BUSINESS_ACTIVITY,
variables
);
//complete the applicant notification
ExternalTask notificationApplicantTask = assertNextExternalTask(NOTIFY_EVENT);
assertCompleteExternalTask(
notificationApplicantTask,
NOTIFY_EVENT,
"NOTIFY_APPLICANT_TRANSLATED_DOCUMENT_UPLOADED_GA",
"NotifyTranslatedDocumentUploadedToApplicantGA",
variables
);
//complete the respondent notification
ExternalTask notificationRespondentTask = assertNextExternalTask(NOTIFY_EVENT);
assertCompleteExternalTask(
notificationRespondentTask,
NOTIFY_EVENT,
"NOTIFY_RESPONDENT_TRANSLATED_DOCUMENT_UPLOADED_GA",
"NotifyTranslatedDocumentUploadedToRespondentGA",
variables
);

//end business process
ExternalTask endBusinessProcess = assertNextExternalTask(END_BUSINESS_PROCESS);
completeBusinessProcessForGADocUpload(endBusinessProcess);
assertNoExternalTasksLeft();
}
}
Loading