Skip to content

Commit

Permalink
CIV-9407 Trial Arrangements: Email Notification to Citizen on Complet…
Browse files Browse the repository at this point in the history
…ion of Trial Arrangements by the Defendant LiP (#673)

* CIV-9407 Conditions in diagrams modified to work with LiP

* CIV-9407 Error in conditions in diagrams modified to work with LiP fixed

* CIV-9407 Additional tests added

---------

Co-authored-by: pats-john <[email protected]>
Co-authored-by: hmcts-version1-ignacio <[email protected]>
Co-authored-by: hmcts-version1-ignacio <[email protected]>
  • Loading branch information
4 people authored Sep 13, 2023
1 parent f2c2989 commit 62b8c50
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 94 deletions.
94 changes: 47 additions & 47 deletions src/main/resources/camunda/applicant_trial_ready_notify_others.bpmn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0rn46su" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0">
<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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0rn46su" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.13.0">
<bpmn:process id="APPLICANT_TRIAL_READY_NOTIFY_OTHERS" isExecutable="true">
<bpmn:startEvent id="Event_0t2zome" name="Start">
<bpmn:outgoing>Flow_08myj65</bpmn:outgoing>
Expand Down Expand Up @@ -50,10 +50,10 @@
<bpmn:outgoing>Flow_06dicjn</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="Flow_Two_Respondent_Representatives" name="Yes" sourceRef="Gateway_19b5dvl" targetRef="OtherTrialReadyNotifyRespondentSolicitor2">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!empty flowFlags.TWO_RESPONDENT_REPRESENTATIVES &amp;&amp; flowFlags.TWO_RESPONDENT_REPRESENTATIVES}</bpmn:conditionExpression>
<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_06dicjn" name="No" sourceRef="Gateway_19b5dvl" targetRef="OtherTrialReadyNotifyRespondentSolicitor1">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!empty flowFlags.ONE_RESPONDENT_REPRESENTATIVE &amp;&amp; flowFlags.ONE_RESPONDENT_REPRESENTATIVE}</bpmn:conditionExpression>
<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:sequenceFlow id="Flow_10x6e34" sourceRef="OtherTrialReadyNotifyRespondentSolicitor2" targetRef="OtherTrialReadyNotifyRespondentSolicitor1" />
<bpmn:serviceTask id="OtherTrialReadyNotifyRespondentSolicitor2" name="Notify respondent solicitor 2" camunda:type="external" camunda:topic="processCaseEvent">
Expand Down Expand Up @@ -86,50 +86,6 @@
<bpmn:message id="Message_07vpgvo" name="APPLICANT_TRIAL_READY_NOTIFY_OTHERS" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="APPLICANT_TRIAL_READY_NOTIFY_OTHERS">
<bpmndi:BPMNEdge id="Flow_0g0jkyp_di" bpmnElement="Flow_0g0jkyp">
<di:waypoint x="920" y="260" />
<di:waypoint x="1000" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1ffw39w_di" bpmnElement="Flow_1ffw39w">
<di:waypoint x="330" y="260" />
<di:waypoint x="445" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_10x6e34_di" bpmnElement="Flow_10x6e34">
<di:waypoint x="640" y="130" />
<di:waypoint x="710" y="130" />
<di:waypoint x="710" y="220" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_06dicjn_di" bpmnElement="Flow_06dicjn">
<di:waypoint x="495" y="260" />
<di:waypoint x="660" y="260" />
<bpmndi:BPMNLabel>
<dc:Bounds x="580" y="238" width="15" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1aqhz9d_di" bpmnElement="Flow_Two_Respondent_Representatives">
<di:waypoint x="470" y="235" />
<di:waypoint x="470" y="130" />
<di:waypoint x="540" y="130" />
<bpmndi:BPMNLabel>
<dc:Bounds x="441" y="183" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_08myj65_di" bpmnElement="Flow_08myj65">
<di:waypoint x="188" y="260" />
<di:waypoint x="230" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0yvpi10_di" bpmnElement="Flow_0yvpi10">
<di:waypoint x="280" y="202" />
<di:waypoint x="280" y="178" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1gsn98m_di" bpmnElement="Flow_1gsn98m">
<di:waypoint x="760" y="260" />
<di:waypoint x="820" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1hce35l_di" bpmnElement="Flow_1hce35l">
<di:waypoint x="1100" y="260" />
<di:waypoint x="1152" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Event_1m02c2o_di" bpmnElement="Event_0t2zome">
<dc:Bounds x="152" y="242" width="36" height="36" />
<bpmndi:BPMNLabel>
Expand Down Expand Up @@ -170,6 +126,50 @@
<dc:Bounds x="297" y="183" width="27" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1hce35l_di" bpmnElement="Flow_1hce35l">
<di:waypoint x="1100" y="260" />
<di:waypoint x="1152" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1gsn98m_di" bpmnElement="Flow_1gsn98m">
<di:waypoint x="760" y="260" />
<di:waypoint x="820" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0yvpi10_di" bpmnElement="Flow_0yvpi10">
<di:waypoint x="280" y="202" />
<di:waypoint x="280" y="178" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_08myj65_di" bpmnElement="Flow_08myj65">
<di:waypoint x="188" y="260" />
<di:waypoint x="230" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1aqhz9d_di" bpmnElement="Flow_Two_Respondent_Representatives">
<di:waypoint x="470" y="235" />
<di:waypoint x="470" y="130" />
<di:waypoint x="540" y="130" />
<bpmndi:BPMNLabel>
<dc:Bounds x="441" y="183" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_06dicjn_di" bpmnElement="Flow_06dicjn">
<di:waypoint x="495" y="260" />
<di:waypoint x="660" y="260" />
<bpmndi:BPMNLabel>
<dc:Bounds x="580" y="238" width="15" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_10x6e34_di" bpmnElement="Flow_10x6e34">
<di:waypoint x="640" y="130" />
<di:waypoint x="710" y="130" />
<di:waypoint x="710" y="220" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1ffw39w_di" bpmnElement="Flow_1ffw39w">
<di:waypoint x="330" y="260" />
<di:waypoint x="445" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0g0jkyp_di" bpmnElement="Flow_0g0jkyp">
<di:waypoint x="920" y="260" />
<di:waypoint x="1000" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Association_0ycet74_di" bpmnElement="Association_0ycet74">
<di:waypoint x="470" y="285" />
<di:waypoint x="470" y="310" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0rn46su" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0">
<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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0rn46su" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.13.0">
<bpmn:process id="RESPONDENT1_TRIAL_READY_NOTIFY_OTHERS" isExecutable="true">
<bpmn:startEvent id="Event_0t2zome" name="Start">
<bpmn:outgoing>Flow_08myj65</bpmn:outgoing>
Expand Down Expand Up @@ -50,10 +50,10 @@
<bpmn:outgoing>Flow_06dicjn</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="Flow_Two_Respondent_Representatives" name="Yes" sourceRef="Gateway_19b5dvl" targetRef="OtherTrialReadyNotifyRespondentSolicitor2">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!empty flowFlags.TWO_RESPONDENT_REPRESENTATIVES &amp;&amp; flowFlags.TWO_RESPONDENT_REPRESENTATIVES}</bpmn:conditionExpression>
<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_06dicjn" name="No" sourceRef="Gateway_19b5dvl" targetRef="OtherTrialReadyNotifyApplicantSolicitor1">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!empty flowFlags.ONE_RESPONDENT_REPRESENTATIVE &amp;&amp; flowFlags.ONE_RESPONDENT_REPRESENTATIVE}</bpmn:conditionExpression>
<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:sequenceFlow id="Flow_10x6e34" sourceRef="OtherTrialReadyNotifyRespondentSolicitor2" targetRef="OtherTrialReadyNotifyApplicantSolicitor1" />
<bpmn:serviceTask id="OtherTrialReadyNotifyRespondentSolicitor2" name="Notify respondent solicitor 2" camunda:type="external" camunda:topic="processCaseEvent">
Expand Down Expand Up @@ -86,50 +86,6 @@
<bpmn:message id="Message_07vpgvo" name="RESPONDENT1_TRIAL_READY_NOTIFY_OTHERS" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="RESPONDENT1_TRIAL_READY_NOTIFY_OTHERS">
<bpmndi:BPMNEdge id="Flow_1j7lj74_di" bpmnElement="Flow_1j7lj74">
<di:waypoint x="930" y="260" />
<di:waypoint x="1000" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1ffw39w_di" bpmnElement="Flow_1ffw39w">
<di:waypoint x="330" y="260" />
<di:waypoint x="445" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_10x6e34_di" bpmnElement="Flow_10x6e34">
<di:waypoint x="640" y="130" />
<di:waypoint x="710" y="130" />
<di:waypoint x="710" y="220" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_06dicjn_di" bpmnElement="Flow_06dicjn">
<di:waypoint x="495" y="260" />
<di:waypoint x="660" y="260" />
<bpmndi:BPMNLabel>
<dc:Bounds x="580" y="238" width="15" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1aqhz9d_di" bpmnElement="Flow_Two_Respondent_Representatives">
<di:waypoint x="470" y="235" />
<di:waypoint x="470" y="130" />
<di:waypoint x="540" y="130" />
<bpmndi:BPMNLabel>
<dc:Bounds x="441" y="183" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_08myj65_di" bpmnElement="Flow_08myj65">
<di:waypoint x="188" y="260" />
<di:waypoint x="230" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0yvpi10_di" bpmnElement="Flow_0yvpi10">
<di:waypoint x="280" y="202" />
<di:waypoint x="280" y="178" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1gsn98m_di" bpmnElement="Flow_1gsn98m">
<di:waypoint x="760" y="260" />
<di:waypoint x="830" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1hce35l_di" bpmnElement="Flow_1hce35l">
<di:waypoint x="1100" y="260" />
<di:waypoint x="1172" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Event_1m02c2o_di" bpmnElement="Event_0t2zome">
<dc:Bounds x="152" y="242" width="36" height="36" />
<bpmndi:BPMNLabel>
Expand Down Expand Up @@ -169,6 +125,50 @@
<dc:Bounds x="297" y="183" width="27" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1hce35l_di" bpmnElement="Flow_1hce35l">
<di:waypoint x="1100" y="260" />
<di:waypoint x="1172" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1gsn98m_di" bpmnElement="Flow_1gsn98m">
<di:waypoint x="760" y="260" />
<di:waypoint x="830" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0yvpi10_di" bpmnElement="Flow_0yvpi10">
<di:waypoint x="280" y="202" />
<di:waypoint x="280" y="178" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_08myj65_di" bpmnElement="Flow_08myj65">
<di:waypoint x="188" y="260" />
<di:waypoint x="230" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1aqhz9d_di" bpmnElement="Flow_Two_Respondent_Representatives">
<di:waypoint x="470" y="235" />
<di:waypoint x="470" y="130" />
<di:waypoint x="540" y="130" />
<bpmndi:BPMNLabel>
<dc:Bounds x="441" y="183" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_06dicjn_di" bpmnElement="Flow_06dicjn">
<di:waypoint x="495" y="260" />
<di:waypoint x="660" y="260" />
<bpmndi:BPMNLabel>
<dc:Bounds x="580" y="238" width="15" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_10x6e34_di" bpmnElement="Flow_10x6e34">
<di:waypoint x="640" y="130" />
<di:waypoint x="710" y="130" />
<di:waypoint x="710" y="220" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1ffw39w_di" bpmnElement="Flow_1ffw39w">
<di:waypoint x="330" y="260" />
<di:waypoint x="445" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1j7lj74_di" bpmnElement="Flow_1j7lj74">
<di:waypoint x="930" y="260" />
<di:waypoint x="1000" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Association_0ycet74_di" bpmnElement="Association_0ycet74">
<di:waypoint x="470" y="285" />
<di:waypoint x="470" y="310" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,60 @@ void shouldSuccessfullyCompleteTrialReadyFormAndNotifyDefendantsHearing(boolean
assertNoExternalTasksLeft();
}

@ParameterizedTest
@CsvSource({"true", "false"})
void shouldSuccessfullyCompleteTrialReadyFormAndNotifyDefendantsHearingLiP(boolean twoRepresentatives) {
//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, twoRepresentatives,
UNREPRESENTED_DEFENDANT_ONE, true,
UNREPRESENTED_DEFENDANT_TWO, twoRepresentatives));

//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;
if (twoRepresentatives) {
//complete the defendant2 notification
notificationTask = assertNextExternalTask(PROCESS_CASE_EVENT);
assertCompleteExternalTask(notificationTask, PROCESS_CASE_EVENT,
NOTIFY_RESPONDENT_SOLICITOR2_FOR_OTHER_TRIAL_READY,
NOTIFY_RESPONDENT_SOLICITOR2_FOR_OTHER_TRIAL_READY_ACTIVITY_ID,
variables
);
}

//complete the applicant notification
notificationTask = assertNextExternalTask(PROCESS_CASE_EVENT);
assertCompleteExternalTask(notificationTask, PROCESS_CASE_EVENT,
NOTIFY_RESPONDENT_SOLICITOR1_FOR_OTHER_TRIAL_READY,
NOTIFY_RESPONDENT_SOLICITOR1_FOR_OTHER_TRIAL_READY_ACTIVITY_ID,
variables
);

//complete the hearing form process
notificationTask = assertNextExternalTask(PROCESS_CASE_EVENT);
assertCompleteExternalTask(notificationTask, PROCESS_CASE_EVENT,
GENERATE_TRIAL_READY_FORM_APPLICANT,
GENERATE_TRIAL_READY_FORM_APPLICANT_ACTIVITY_ID,
variables
);

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

assertNoExternalTasksLeft();
}

@Test
void shouldAbort_whenStartBusinessProcessThrowsAnError() {
//assert process has started
Expand Down
Loading

0 comments on commit 62b8c50

Please sign in to comment.