Skip to content

Commit

Permalink
CIV-15227 Stay lifted notification (#1103)
Browse files Browse the repository at this point in the history
* CIV-15227 stay lifted notification

* CIV-15227 fix test

* CIV-15227 update test
  • Loading branch information
miguelMolina3691 authored Oct 11, 2024
1 parent c6496e6 commit 85e5bfb
Show file tree
Hide file tree
Showing 2 changed files with 270 additions and 0 deletions.
181 changes: 181 additions & 0 deletions src/main/resources/camunda/stay_lifted.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
<?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="4.12.0">
<bpmn:process id="STAY_LIFTED" name="Stay Lifted" isExecutable="true" camunda:historyTimeToLive="P90D">
<bpmn:serviceTask id="NotifyClaimantStayLifted" name="Notify Claimant" camunda:type="external" camunda:topic="processCaseEvent">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="caseEvent">NOTIFY_CLAIMANT_STAY_LIFTED</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_78545522598879</bpmn:incoming>
<bpmn:outgoing>Flow_1fxs0vt2555454745</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:startEvent id="stay_case_event" name="Start">
<bpmn:outgoing>Flow_87785545545544</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_1dvrj2w" messageRef="Message_07sm7e9" />
</bpmn:startEvent>
<bpmn:endEvent id="Event_878884254666">
<bpmn:incoming>Flow_5845212254322</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_5845212254322" sourceRef="Activity_120199855233" targetRef="Event_878884254666" />
<bpmn:callActivity id="Activity_120199855233" name="End Business Process" calledElement="EndBusinessProcess">
<bpmn:extensionElements>
<camunda:properties>
<camunda:property name="variables" value="all" />
</camunda:properties>
<camunda:in variables="all" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_1xckrvu54455522188</bpmn:incoming>
<bpmn:outgoing>Flow_5845212254322</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:callActivity id="Activity_7842144454545" name="Start Business Process" calledElement="StartBusinessProcess">
<bpmn:extensionElements>
<camunda:in variables="all" />
<camunda:out variables="all" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_87785545545544</bpmn:incoming>
<bpmn:outgoing>Flow_78545522598879</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:endEvent id="Event_55878855778">
<bpmn:incoming>Flow_77875455488</bpmn:incoming>
</bpmn:endEvent>
<bpmn:boundaryEvent id="Event_0kza4it444" name="Abort" attachedToRef="Activity_7842144454545">
<bpmn:outgoing>Flow_77875455488</bpmn:outgoing>
<bpmn:errorEventDefinition id="ErrorEventDefinition_09jmy6o" />
</bpmn:boundaryEvent>
<bpmn:sequenceFlow id="Flow_77875455488" sourceRef="Event_0kza4it444" targetRef="Event_55878855778" />
<bpmn:sequenceFlow id="Flow_87785545545544" sourceRef="stay_case_event" targetRef="Activity_7842144454545" />
<bpmn:sequenceFlow id="Flow_78545522598879" sourceRef="Activity_7842144454545" targetRef="NotifyClaimantStayLifted" />
<bpmn:serviceTask id="NotifyDefendantStayLifted" name="Notify Defendant" camunda:type="external" camunda:topic="processCaseEvent">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="caseEvent">NOTIFY_DEFENDANT_STAY_LIFTED</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0s8cobk</bpmn:incoming>
<bpmn:incoming>Flow_1v2px67</bpmn:incoming>
<bpmn:outgoing>Flow_1xckrvu54455522188</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_1xckrvu54455522188" sourceRef="NotifyDefendantStayLifted" targetRef="Activity_120199855233" />
<bpmn:sequenceFlow id="Flow_1fxs0vt2555454745" sourceRef="NotifyClaimantStayLifted" targetRef="Gateway_030oovp" />
<bpmn:exclusiveGateway id="Gateway_030oovp">
<bpmn:incoming>Flow_1fxs0vt2555454745</bpmn:incoming>
<bpmn:outgoing>Flow_0s8cobk</bpmn:outgoing>
<bpmn:outgoing>Flow_0z093jw</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="Flow_0s8cobk" name="No" sourceRef="Gateway_030oovp" targetRef="NotifyDefendantStayLifted">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${(!empty flowFlags.ONE_RESPONDENT_REPRESENTATIVE &amp;&amp; flowFlags.ONE_RESPONDENT_REPRESENTATIVE) || (!empty flowFlags.UNREPRESENTED_DEFENDANT_ONE &amp;&amp; flowFlags.UNREPRESENTED_DEFENDANT_ONE)}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="NotifyDefendant2StayLifted" name="Notify Defendant 2" camunda:type="external" camunda:topic="processCaseEvent">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="caseEvent">NOTIFY_DEFENDANT2_STAY_LIFTED</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0z093jw</bpmn:incoming>
<bpmn:outgoing>Flow_1v2px67</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_0z093jw" name="Yes" sourceRef="Gateway_030oovp" targetRef="NotifyDefendant2StayLifted">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${(!empty flowFlags.TWO_RESPONDENT_REPRESENTATIVES &amp;&amp; flowFlags.TWO_RESPONDENT_REPRESENTATIVES) || (!empty flowFlags.UNREPRESENTED_DEFENDANT_TWO &amp;&amp; flowFlags.UNREPRESENTED_DEFENDANT_TWO)}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="Flow_1v2px67" sourceRef="NotifyDefendant2StayLifted" targetRef="NotifyDefendantStayLifted" />
<bpmn:textAnnotation id="TextAnnotation_0tzn7kc">
<bpmn:text>Two respondent representatives?</bpmn:text>
</bpmn:textAnnotation>
<bpmn:association id="Association_0gcnkmh" sourceRef="Gateway_030oovp" targetRef="TextAnnotation_0tzn7kc" />
</bpmn:process>
<bpmn:error id="Error_0lou1w7" name="StartBusinessAbort" errorCode="ABORT" />
<bpmn:message id="Message_07sm7e9" name="STAY_LIFTED" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="STAY_LIFTED">
<bpmndi:BPMNEdge id="Flow_1v2px67_di" bpmnElement="Flow_1v2px67">
<di:waypoint x="760" y="160" />
<di:waypoint x="760" y="227" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0z093jw_di" bpmnElement="Flow_0z093jw">
<di:waypoint x="570" y="242" />
<di:waypoint x="570" y="120" />
<di:waypoint x="710" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="576" y="178" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0s8cobk_di" bpmnElement="Flow_0s8cobk">
<di:waypoint x="595" y="267" />
<di:waypoint x="710" y="267" />
<bpmndi:BPMNLabel>
<dc:Bounds x="645" y="249" width="15" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1fxs0vt_di" bpmnElement="Flow_1fxs0vt2555454745">
<di:waypoint x="490" y="267" />
<di:waypoint x="545" y="267" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1xckrvu_di" bpmnElement="Flow_1xckrvu54455522188">
<di:waypoint x="810" y="269" />
<di:waypoint x="900" y="269" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1a5jscb_di" bpmnElement="Flow_78545522598879">
<di:waypoint x="330" y="267" />
<di:waypoint x="390" y="267" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_116h4jn_di" bpmnElement="Flow_87785545545544">
<di:waypoint x="188" y="270" />
<di:waypoint x="230" y="270" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1y0ic2q_di" bpmnElement="Flow_77875455488">
<di:waypoint x="280" y="209" />
<di:waypoint x="280" y="175" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0x2wz2v_di" bpmnElement="Flow_5845212254322">
<di:waypoint x="1000" y="270" />
<di:waypoint x="1112" y="270" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Activity_0ipbyde_di" bpmnElement="NotifyClaimantStayLifted">
<dc:Bounds x="390" y="227" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0vk0w99_di" bpmnElement="stay_case_event">
<dc:Bounds x="152" y="252" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="158" y="295" width="25" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1h61h5s_di" bpmnElement="Event_878884254666">
<dc:Bounds x="1112" y="252" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1j68eid_di" bpmnElement="Activity_120199855233">
<dc:Bounds x="900" y="230" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_15x2r24_di" bpmnElement="Activity_7842144454545">
<dc:Bounds x="230" y="227" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1n2x861_di" bpmnElement="Event_55878855778">
<dc:Bounds x="262" y="139" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_1smbj8l" bpmnElement="NotifyDefendantStayLifted">
<dc:Bounds x="710" y="227" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_030oovp_di" bpmnElement="Gateway_030oovp" isMarkerVisible="true">
<dc:Bounds x="545" y="242" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="OtherTrialReadyNotifyRespondentSolicitor2_di" bpmnElement="NotifyDefendant2StayLifted">
<dc:Bounds x="710" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="TextAnnotation_0tzn7kc_di" bpmnElement="TextAnnotation_0tzn7kc">
<dc:Bounds x="550" y="320" width="100" height="54" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0kza4it_di" bpmnElement="Event_0kza4it444">
<dc:Bounds x="262" y="209" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="296" y="190" width="27" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Association_0gcnkmh_di" bpmnElement="Association_0gcnkmh">
<di:waypoint x="578" y="284" />
<di:waypoint x="593" y="320" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
89 changes: 89 additions & 0 deletions src/test/java/uk/gov/hmcts/reform/civil/bpmn/StayLiftedTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
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.Test;

import java.util.Map;

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

public class StayLiftedTest extends BpmnBaseTest {

public static final String MESSAGE_NAME = "STAY_LIFTED";
public static final String PROCESS_ID = "STAY_LIFTED";

//CCD CASE EVENT
public static final String NOTIFY_CLAIMANT_STAY_LIFTED
= "NOTIFY_CLAIMANT_STAY_LIFTED";
public static final String NOTIFY_DEFENDANT_STAY_LIFTED
= "NOTIFY_DEFENDANT_STAY_LIFTED";
public static final String NOTIFY_DEFENDANT2_STAY_LIFTED
= "NOTIFY_DEFENDANT2_STAY_LIFTED";

//ACTIVITY IDs
private static final String NOTIFY_CLAIMANT_STAY_LIFTED_ACTIVITY_ID
= "NotifyClaimantStayLifted";
private static final String NOTIFY_DEFENDANT_STAY_LIFTED_ACTIVITY_ID
= "NotifyDefendantStayLifted";
private static final String NOTIFY_DEFENDANT2_STAY_LIFTED_ACTIVITY_ID
= "NotifyDefendant2StayLifted";

public StayLiftedTest() {
super("stay_lifted.bpmn", PROCESS_ID);
}

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

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

VariableMap variables = Variables.createVariables();
variables.put("flowFlags", Map.of(
TWO_RESPONDENT_REPRESENTATIVES, true
));

//complete the start business process
ExternalTask startBusiness = assertNextExternalTask(START_BUSINESS_TOPIC);
assertCompleteExternalTask(startBusiness, START_BUSINESS_TOPIC,
START_BUSINESS_EVENT, START_BUSINESS_ACTIVITY, variables
);

ExternalTask notificationTask;

//complete the claimant notification
notificationTask = assertNextExternalTask(PROCESS_CASE_EVENT);
assertCompleteExternalTask(notificationTask, PROCESS_CASE_EVENT,
NOTIFY_CLAIMANT_STAY_LIFTED,
NOTIFY_CLAIMANT_STAY_LIFTED_ACTIVITY_ID,
variables
);

//complete the defendant 2 notification
notificationTask = assertNextExternalTask(PROCESS_CASE_EVENT);
assertCompleteExternalTask(notificationTask, PROCESS_CASE_EVENT,
NOTIFY_DEFENDANT2_STAY_LIFTED,
NOTIFY_DEFENDANT2_STAY_LIFTED_ACTIVITY_ID,
variables
);

//complete the defendant notification
notificationTask = assertNextExternalTask(PROCESS_CASE_EVENT);
assertCompleteExternalTask(notificationTask, PROCESS_CASE_EVENT,
NOTIFY_DEFENDANT_STAY_LIFTED,
NOTIFY_DEFENDANT_STAY_LIFTED_ACTIVITY_ID,
variables
);

//end business process
ExternalTask endBusinessProcess = assertNextExternalTask(END_BUSINESS_PROCESS);
completeBusinessProcess(endBusinessProcess);

assertNoExternalTasksLeft();
}
}

0 comments on commit 85e5bfb

Please sign in to comment.