-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CIV-14295 Claimant LR Email notification: please resubmit discontinua…
…nce (#1040) * CIV-14295 Add new Camunda diagram * CIV-14295 Add Camunda and tests * CIV-14295 Add Camunda and tests * CIV-14295 Update Camunda diagram * CIV-14295 Update Camunda diagram * CIV-14295 Update Camunda diagram
- Loading branch information
1 parent
7f173be
commit c11a826
Showing
2 changed files
with
262 additions
and
0 deletions.
There are no files selected for viewing
162 changes: 162 additions & 0 deletions
162
src/main/resources/camunda/validate_discontinue_claim_claimant.bpmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
<?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="5.5.1"> | ||
<bpmn:process id="VALIDATE_DISCONTINUE_CLAIM_CLAIMANT" name="Validate Discontinue Claim Claimant" isExecutable="true"> | ||
<bpmn:startEvent id="ValidateDiscontinueClaimClaimant" name="Start"> | ||
<bpmn:outgoing>Flow_1if0h68</bpmn:outgoing> | ||
<bpmn:messageEventDefinition id="MessageEventDefinition_1cb4oje" messageRef="Message_2ej4dfj" /> | ||
</bpmn:startEvent> | ||
<bpmn:endEvent id="Event_0r8yo0r"> | ||
<bpmn:incoming>Flow_1hce35l</bpmn:incoming> | ||
</bpmn:endEvent> | ||
<bpmn:sequenceFlow id="Flow_1hce35l" sourceRef="Activity_0wretog" targetRef="Event_0r8yo0r" /> | ||
<bpmn:callActivity id="Activity_0wretog" name="End Business Process" calledElement="EndBusinessProcess"> | ||
<bpmn:extensionElements> | ||
<camunda:in variables="all" /> | ||
</bpmn:extensionElements> | ||
<bpmn:incoming>Flow_0gitrv4</bpmn:incoming> | ||
<bpmn:incoming>Flow_1n9ug08</bpmn:incoming> | ||
<bpmn:outgoing>Flow_1hce35l</bpmn:outgoing> | ||
</bpmn:callActivity> | ||
<bpmn:callActivity id="Activity_0y089q8" name="Start Business Process" calledElement="StartBusinessProcess"> | ||
<bpmn:extensionElements> | ||
<camunda:in variables="all" /> | ||
<camunda:out variables="all" /> | ||
</bpmn:extensionElements> | ||
<bpmn:incoming>Flow_1if0h68</bpmn:incoming> | ||
<bpmn:outgoing>Flow_1qffyiy</bpmn:outgoing> | ||
</bpmn:callActivity> | ||
<bpmn:endEvent id="Event_1mtqud7"> | ||
<bpmn:incoming>Flow_0h072ea</bpmn:incoming> | ||
</bpmn:endEvent> | ||
<bpmn:boundaryEvent id="Event_0o3sg3o" name="Abort" attachedToRef="Activity_0y089q8"> | ||
<bpmn:outgoing>Flow_0h072ea</bpmn:outgoing> | ||
<bpmn:errorEventDefinition id="ErrorEventDefinition_0uj9pwb" /> | ||
</bpmn:boundaryEvent> | ||
<bpmn:sequenceFlow id="Flow_0h072ea" sourceRef="Event_0o3sg3o" targetRef="Event_1mtqud7" /> | ||
<bpmn:sequenceFlow id="Flow_1if0h68" sourceRef="ValidateDiscontinueClaimClaimant" targetRef="Activity_0y089q8" /> | ||
<bpmn:sequenceFlow id="Flow_1qffyiy" sourceRef="Activity_0y089q8" targetRef="UpdateVisibilityNoticeOfDiscontinuance" /> | ||
<bpmn:exclusiveGateway id="Gateway_00bae9b"> | ||
<bpmn:incoming>Flow_0evp3v5</bpmn:incoming> | ||
<bpmn:outgoing>Flow_15io19y</bpmn:outgoing> | ||
<bpmn:outgoing>Flow_1n9ug08</bpmn:outgoing> | ||
</bpmn:exclusiveGateway> | ||
<bpmn:sequenceFlow id="Flow_15io19y" name="Discontinuance validation failed" sourceRef="Gateway_00bae9b" targetRef="NotifyValidationFailureClaimant"> | ||
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!discontinuanceValidationSuccess}</bpmn:conditionExpression> | ||
</bpmn:sequenceFlow> | ||
<bpmn:serviceTask id="NotifyValidationFailureClaimant" name="Notify Validation Failure" camunda:type="external" camunda:topic="processCaseEvent"> | ||
<bpmn:extensionElements> | ||
<camunda:inputOutput> | ||
<camunda:inputParameter name="caseEvent">NOTIFY_VALIDATION_DICONTINUANCE_FAILURE_CLAIMANT</camunda:inputParameter> | ||
</camunda:inputOutput> | ||
</bpmn:extensionElements> | ||
<bpmn:incoming>Flow_15io19y</bpmn:incoming> | ||
<bpmn:outgoing>Flow_0gitrv4</bpmn:outgoing> | ||
</bpmn:serviceTask> | ||
<bpmn:sequenceFlow id="Flow_0gitrv4" sourceRef="NotifyValidationFailureClaimant" targetRef="Activity_0wretog" /> | ||
<bpmn:sequenceFlow id="Flow_1n9ug08" name="Discontinuance validated successfully" sourceRef="Gateway_00bae9b" targetRef="Activity_0wretog"> | ||
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${discontinuanceValidationSuccess}</bpmn:conditionExpression> | ||
</bpmn:sequenceFlow> | ||
<bpmn:serviceTask id="UpdateVisibilityNoticeOfDiscontinuance" name="Update Visibility Notice of Discontinuance" camunda:type="external" camunda:topic="processCaseEvent"> | ||
<bpmn:extensionElements> | ||
<camunda:inputOutput> | ||
<camunda:inputParameter name="caseEvent">UPDATE_VISIBILITY_NOTICE_OF_DISCONTINUANCE</camunda:inputParameter> | ||
</camunda:inputOutput> | ||
</bpmn:extensionElements> | ||
<bpmn:incoming>Flow_1qffyiy</bpmn:incoming> | ||
<bpmn:outgoing>Flow_0evp3v5</bpmn:outgoing> | ||
</bpmn:serviceTask> | ||
<bpmn:sequenceFlow id="Flow_0evp3v5" sourceRef="UpdateVisibilityNoticeOfDiscontinuance" targetRef="Gateway_00bae9b" /> | ||
</bpmn:process> | ||
<bpmn:message id="Message_0slk3de" /> | ||
<bpmn:error id="Error_0t2ju7k" name="StartBusinessAbort" errorCode="ABORT" /> | ||
<bpmn:error id="Error_1237qii" name="StartBusinessAbort" errorCode="ABORT" /> | ||
<bpmn:message id="Message_0htno5u" /> | ||
<bpmn:message id="Message_00airaq" /> | ||
<bpmn:message id="Message_1koptmo" name="DEFAULT_JUDGEMENT_NON_DIVERGENT_SPEC" /> | ||
<bpmn:message id="Message_2ej4dfj" name="VALIDATE_DISCONTINUE_CLAIM_CLAIMANT" /> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VALIDATE_DISCONTINUE_CLAIM_CLAIMANT"> | ||
<bpmndi:BPMNShape id="Event_1m02c2o_di" bpmnElement="ValidateDiscontinueClaimClaimant"> | ||
<dc:Bounds x="142" y="242" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="149" y="285" width="24" height="14" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Activity_0y089q8_di" bpmnElement="Activity_0y089q8"> | ||
<dc:Bounds x="230" y="220" width="100" height="80" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_1mtqud7_di" bpmnElement="Event_1mtqud7"> | ||
<dc:Bounds x="262" y="122" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_0r8yo0r_di" bpmnElement="Event_0r8yo0r"> | ||
<dc:Bounds x="1152" y="242" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="1307" y="285" width="86" height="40" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Activity_1x5rl4x_di" bpmnElement="Activity_0wretog"> | ||
<dc:Bounds x="990" y="220" width="100" height="80" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="BPMNShape_0hdpgwf" bpmnElement="Gateway_00bae9b" isMarkerVisible="true"> | ||
<dc:Bounds x="585" y="235" width="50" height="50" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="738" y="412" width="87" height="14" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Activity_0ipbyde_di" bpmnElement="NotifyValidationFailureClaimant"> | ||
<dc:Bounds x="770" y="220" width="100" height="80" /> | ||
<bpmndi:BPMNLabel /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="BPMNShape_026gkzu" bpmnElement="UpdateVisibilityNoticeOfDiscontinuance"> | ||
<dc:Bounds x="410" y="220" width="100" height="80" /> | ||
<bpmndi:BPMNLabel /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_0o3sg3o_di" bpmnElement="Event_0o3sg3o"> | ||
<dc:Bounds x="262" y="202" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="297" y="183" width="26" height="14" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge id="Flow_0h072ea_di" bpmnElement="Flow_0h072ea"> | ||
<di:waypoint x="280" y="202" /> | ||
<di:waypoint x="280" y="158" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_1if0h68_di" bpmnElement="Flow_1if0h68"> | ||
<di:waypoint x="178" y="260" /> | ||
<di:waypoint x="230" y="260" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_1qffyiy_di" bpmnElement="Flow_1qffyiy"> | ||
<di:waypoint x="330" y="260" /> | ||
<di:waypoint x="410" y="260" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_1hce35l_di" bpmnElement="Flow_1hce35l"> | ||
<di:waypoint x="1090" y="260" /> | ||
<di:waypoint x="1152" y="260" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_0gitrv4_di" bpmnElement="Flow_0gitrv4"> | ||
<di:waypoint x="870" y="260" /> | ||
<di:waypoint x="990" y="260" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_1n9ug08_di" bpmnElement="Flow_1n9ug08"> | ||
<di:waypoint x="610" y="285" /> | ||
<di:waypoint x="610" y="360" /> | ||
<di:waypoint x="1040" y="360" /> | ||
<di:waypoint x="1040" y="300" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="622" y="300" width="76" height="40" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_15io19y_di" bpmnElement="Flow_15io19y"> | ||
<di:waypoint x="635" y="260" /> | ||
<di:waypoint x="770" y="260" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="646" y="226" width="76" height="27" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_0evp3v5_di" bpmnElement="Flow_0evp3v5"> | ||
<di:waypoint x="510" y="260" /> | ||
<di:waypoint x="585" y="260" /> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
100 changes: 100 additions & 0 deletions
100
src/test/java/uk/gov/hmcts/reform/civil/bpmn/ValidateDiscontinueClaimClaimantTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
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 org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
public class ValidateDiscontinueClaimClaimantTest extends BpmnBaseTest { | ||
|
||
public static final String MESSAGE_NAME = "VALIDATE_DISCONTINUE_CLAIM_CLAIMANT"; | ||
public static final String PROCESS_ID = "VALIDATE_DISCONTINUE_CLAIM_CLAIMANT"; | ||
|
||
//CCD CASE EVENTs | ||
public static final String NOTIFY_VALIDATION_DICONTINUANCE_FAILURE_CLAIMANT | ||
= "NOTIFY_VALIDATION_DICONTINUANCE_FAILURE_CLAIMANT"; | ||
public static final String UPDATE_VISIBILITY_NOTICE_OF_DISCONTINUANCE | ||
= "UPDATE_VISIBILITY_NOTICE_OF_DISCONTINUANCE"; | ||
|
||
//ACTIVITY IDs | ||
public static final String NOTIFY_VALIDATION_DICONTINUANCE_FAILURE_CLAIMANT_ACTIVITY_ID | ||
= "NotifyValidationFailureClaimant"; | ||
public static final String UPDATE_VISIBILITY_NOTICE_OF_DISCONTINUANCE_ACTIVITY_ID | ||
= "UpdateVisibilityNoticeOfDiscontinuance"; | ||
|
||
public ValidateDiscontinueClaimClaimantTest() { | ||
super("validate_discontinue_claim_claimant.bpmn", PROCESS_ID); | ||
} | ||
|
||
@ParameterizedTest | ||
@CsvSource({"true", "false"}) | ||
void shouldSuccessfullyComplete(boolean discontinuanceValidationSuccess) { | ||
|
||
//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("discontinuanceValidationSuccess", discontinuanceValidationSuccess); | ||
|
||
//complete the start business process | ||
ExternalTask startBusiness = assertNextExternalTask(START_BUSINESS_TOPIC); | ||
assertCompleteExternalTask( | ||
startBusiness, | ||
START_BUSINESS_TOPIC, | ||
START_BUSINESS_EVENT, | ||
START_BUSINESS_ACTIVITY, | ||
variables | ||
); | ||
|
||
//complete update visibility notice of discontinuance | ||
ExternalTask updateVisibilityTask = assertNextExternalTask(PROCESS_CASE_EVENT); | ||
assertCompleteExternalTask( | ||
updateVisibilityTask, | ||
PROCESS_CASE_EVENT, | ||
UPDATE_VISIBILITY_NOTICE_OF_DISCONTINUANCE, | ||
UPDATE_VISIBILITY_NOTICE_OF_DISCONTINUANCE_ACTIVITY_ID, | ||
variables | ||
); | ||
|
||
if (!discontinuanceValidationSuccess) { | ||
//complete send email notification to claimant | ||
ExternalTask notificationTask = assertNextExternalTask(PROCESS_CASE_EVENT); | ||
assertCompleteExternalTask( | ||
notificationTask, | ||
PROCESS_CASE_EVENT, | ||
NOTIFY_VALIDATION_DICONTINUANCE_FAILURE_CLAIMANT, | ||
NOTIFY_VALIDATION_DICONTINUANCE_FAILURE_CLAIMANT_ACTIVITY_ID, | ||
variables | ||
); | ||
} | ||
|
||
ExternalTask endBusinessProcess = assertNextExternalTask(END_BUSINESS_PROCESS); | ||
completeBusinessProcess(endBusinessProcess); | ||
|
||
assertNoExternalTasksLeft(); | ||
|
||
} | ||
|
||
@Test | ||
void shouldAbort_whenStartBusinessProcessThrowsAnError() { | ||
//assert process has started | ||
assertFalse(processInstance.isEnded()); | ||
|
||
//assert message start event | ||
assertThat(getProcessDefinitionByMessage(MESSAGE_NAME).getKey()).isEqualTo(PROCESS_ID); | ||
|
||
//fail the start business process | ||
ExternalTask startBusiness = assertNextExternalTask(START_BUSINESS_TOPIC); | ||
assertFailExternalTask(startBusiness, START_BUSINESS_TOPIC, START_BUSINESS_EVENT, START_BUSINESS_ACTIVITY); | ||
|
||
assertNoExternalTasksLeft(); | ||
} | ||
} |