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-12772 Application Fee - Claimant Notification #1041

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 46 additions & 0 deletions src/main/resources/camunda/end_ga_hwf_notify_process.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0lk4l3o" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.7.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.18.0">
<bpmn:collaboration id="Collaboration_0thk5ck">
<bpmn:participant id="Participant_04x1tuo" name="Termination phase" processRef="EndGaHwfNotifyBusinessProcess" />
</bpmn:collaboration>
<bpmn:process id="EndGaHwfNotifyBusinessProcess" name="End GA Hwf Notify business process" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1cazao8</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:serviceTask id="EndGaHwfNotifyProcessTaskId" name="End Ga Hwf Notify Process" camunda:type="external" camunda:topic="END_GA_HWF_NOTIFY_PROCESS">
<bpmn:incoming>Flow_1cazao8</bpmn:incoming>
<bpmn:outgoing>Flow_0z3iagm</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_1cazao8" sourceRef="StartEvent_1" targetRef="EndGaHwfNotifyProcessTaskId" />
<bpmn:endEvent id="Event_1gsylqf">
<bpmn:incoming>Flow_0z3iagm</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0z3iagm" sourceRef="EndGaHwfNotifyProcessTaskId" targetRef="Event_1gsylqf" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0thk5ck">
<bpmndi:BPMNShape id="Participant_04x1tuo_di" bpmnElement="Participant_04x1tuo" isHorizontal="true">
<dc:Bounds x="129" y="70" width="600" height="250" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="159" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_163grby_di" bpmnElement="EndGaHwfNotifyProcessTaskId">
<dc:Bounds x="320" y="137" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1j16vid_di" bpmnElement="Event_1gsylqf">
<dc:Bounds x="532" y="159" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1cazao8_di" bpmnElement="Flow_1cazao8">
<di:waypoint x="215" y="177" />
<di:waypoint x="320" y="177" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0z3iagm_di" bpmnElement="Flow_0z3iagm">
<di:waypoint x="420" y="177" />
<di:waypoint x="532" y="177" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
97 changes: 97 additions & 0 deletions src/main/resources/camunda/notify_ga_applicant_hwf_outcome.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?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:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_08ytvkk" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.7.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.18.0">
<bpmn:process id="GA_NOTIFY_HWF" name="GA_NOTIFY_HWF" isExecutable="true">
<bpmn:startEvent id="Event_1lvwg15">
<bpmn:outgoing>Flow_00k55c0</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_0856wjw" messageRef="Message_2rkk3ep" />
</bpmn:startEvent>
<bpmn:callActivity id="Activity_0bpusws" name="Start Ga Business Process" calledElement="GA_StartGeneralApplicationBusinessProcess">
<bpmn:extensionElements>
<camunda:in variables="all" />
<camunda:out variables="all" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_00k55c0</bpmn:incoming>
<bpmn:outgoing>Flow_1q56h70</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:boundaryEvent id="Event_1s3mbx5" attachedToRef="Activity_0bpusws">
<bpmn:outgoing>Flow_0vydxos</bpmn:outgoing>
<bpmn:errorEventDefinition id="ErrorEventDefinition_0l5y5hm" />
</bpmn:boundaryEvent>
<bpmn:endEvent id="Event_0itvqvj">
<bpmn:incoming>Flow_0vydxos</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0vydxos" sourceRef="Event_1s3mbx5" targetRef="Event_0itvqvj" />
<bpmn:serviceTask id="Notify_App_Lip_Hwf" name="Notify Applicant Lip Help with fees" camunda:type="external" camunda:topic="applicationProcessCaseEventGASpec">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="caseEvent">NOTIFY_APPLICANT_LIP_HWF</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1q56h70</bpmn:incoming>
<bpmn:outgoing>Flow_0mc7ipq</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_00k55c0" sourceRef="Event_1lvwg15" targetRef="Activity_0bpusws" />
<bpmn:sequenceFlow id="Flow_1q56h70" sourceRef="Activity_0bpusws" targetRef="Notify_App_Lip_Hwf" />
<bpmn:callActivity id="Activity_1ow8b5z" name="End Ga HWF Notify Business Process" calledElement="EndGaHwfNotifyBusinessProcess">
<bpmn:extensionElements>
<camunda:in variables="all" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_0mc7ipq</bpmn:incoming>
<bpmn:outgoing>Flow_0ybhx73</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:sequenceFlow id="Flow_0mc7ipq" sourceRef="Notify_App_Lip_Hwf" targetRef="Activity_1ow8b5z" />
<bpmn:endEvent id="Event_1uho69x">
<bpmn:incoming>Flow_0ybhx73</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0ybhx73" sourceRef="Activity_1ow8b5z" targetRef="Event_1uho69x" />
</bpmn:process>
<bpmn:message id="Message_2rkk3ep" name="NOTIFY_APPLICANT_LIP_HWF" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GA_NOTIFY_HWF">
<bpmndi:BPMNShape id="Event_0i79vxh_di" bpmnElement="Event_1lvwg15">
<dc:Bounds x="192" y="172" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0gtuzb7_di" bpmnElement="Activity_0bpusws">
<dc:Bounds x="280" y="150" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0itvqvj_di" bpmnElement="Event_0itvqvj">
<dc:Bounds x="312" y="62" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0jt3yqe_di" bpmnElement="Notify_App_Lip_Hwf">
<dc:Bounds x="450" y="150" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0fsshcf_di" bpmnElement="Activity_1ow8b5z">
<dc:Bounds x="620" y="150" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1uho69x_di" bpmnElement="Event_1uho69x">
<dc:Bounds x="822" y="172" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_04i1xcj_di" bpmnElement="Event_1s3mbx5">
<dc:Bounds x="312" y="132" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_0vydxos_di" bpmnElement="Flow_0vydxos">
<di:waypoint x="330" y="132" />
<di:waypoint x="330" y="98" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_00k55c0_di" bpmnElement="Flow_00k55c0">
<di:waypoint x="228" y="190" />
<di:waypoint x="280" y="190" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1q56h70_di" bpmnElement="Flow_1q56h70">
<di:waypoint x="380" y="190" />
<di:waypoint x="450" y="190" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0mc7ipq_di" bpmnElement="Flow_0mc7ipq">
<di:waypoint x="550" y="190" />
<di:waypoint x="620" y="190" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0ybhx73_di" bpmnElement="Flow_0ybhx73">
<di:waypoint x="720" y="190" />
<di:waypoint x="822" y="190" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ public abstract class BpmnBaseGASpecTest {
public static final String WORKER_ID = "test-worker";
public static final String START_BUSINESS_TOPIC = "START_BUSINESS_PROCESS_GASPEC";
public static final String START_BUSINESS_EVENT = "START_BUSINESS_PROCESS_GASPEC";
public static final String START_GA_BUSINESS_EVENT = "START_GA_BUSINESS_PROCESS";
public static final String START_BUSINESS_ACTIVITY = "StartBusinessProcessGAspecTaskId";
public static final String START_GA_BUSINESS_ACTIVITY = "StartGeneralApplicationBusinessProcessTaskId";
public static final String CREATE_APPLICATION_CASE_EVENT = "createApplicationEventGASpec";
public static final String APPLICATION_EVENT_GASPEC = "applicationEventGASpec";
public static final String END_BUSINESS_PROCESS = "END_BUSINESS_PROCESS_GASPEC";
public static final String END_GA_HWF_NOTIFY_PROCESS = "END_GA_HWF_NOTIFY_PROCESS";
public static final String ERROR_CODE = "TEST_CODE";

public final String bpmnFileName;
Expand Down Expand Up @@ -259,6 +262,20 @@ public void completeBusinessProcess(ExternalTask externalTask) {
completeTask(lockedEndBusinessProcessTask.get(0).getId());
}

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

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

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

public void assertCronTriggerFiresAtExpectedTime(CronExpression expression,
LocalDateTime now,
LocalDateTime nextDate) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package uk.gov.hmcts.reform.civil.bpmn;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;

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

public class GaHwfNotifyTest extends BpmnBaseGASpecTest {

private static final String FILE_NAME = "notify_ga_applicant_hwf_outcome.bpmn";
private static final String MESSAGE_NAME = "NOTIFY_APPLICANT_LIP_HWF";
private static final String PROCESS_ID = "GA_NOTIFY_HWF";
private static final String ACTIVITY_ID = "Notify_App_Lip_Hwf";
private static final String START_BUSINESS_TOPIC = "START_GA_BUSINESS_PROCESS";
public static final String NOTIFY_EVENT = "applicationProcessCaseEventGASpec";

public GaHwfNotifyTest() {
super(FILE_NAME, PROCESS_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_ga_hwf_notify_process.bpmn"))
.deploy();
deployment = engine.getRepositoryService()
.createDeployment()
.addClasspathResource(String.format(DIAGRAM_PATH, bpmnFileName))
.deploy();
processInstance = engine.getRuntimeService().startProcessInstanceByKey(processId);
}

@Test
void shouldSuccessfullyCompleteNotifyApplicant_whenCalled() {
//assert process has started
assertFalse(processInstance.isEnded());

//assert message start event
assertThat(getProcessDefinitionByMessage(MESSAGE_NAME).getKey()).isEqualTo(PROCESS_ID);

//complete the start business process
ExternalTask startBusiness = assertNextExternalTask(START_BUSINESS_TOPIC);
assertCompleteExternalTask(
startBusiness,
START_BUSINESS_TOPIC,
START_GA_BUSINESS_EVENT,
START_GA_BUSINESS_ACTIVITY
);
ExternalTask notifyTask = assertNextExternalTask(NOTIFY_EVENT);
assertCompleteExternalTask(
notifyTask,
NOTIFY_EVENT,
MESSAGE_NAME,
ACTIVITY_ID
);

//end business process
ExternalTask endBusinessProcess = assertNextExternalTask(END_GA_HWF_NOTIFY_PROCESS);
completeGaBusinessProcess(endBusinessProcess);

assertNoExternalTasksLeft();
}
}
Loading