Skip to content

Commit

Permalink
CIV-14811 Add Camunda task JUDGMENT_PAID_IN_FULL (#1076)
Browse files Browse the repository at this point in the history
* CIV-14811

* CIV-14811

* CIV-14811 Changes for Camunda Task for Judgement Paid in full
  • Loading branch information
Omaira-Melo-Hmcts authored Sep 9, 2024
1 parent 5e490d4 commit 85473da
Show file tree
Hide file tree
Showing 2 changed files with 170 additions and 0 deletions.
103 changes: 103 additions & 0 deletions src/main/resources/camunda/judgement_paid_in_full.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?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.16.0">
<bpmn:process id="JUDGMENT_PAID_IN_FULL" name="Judgment Paid In Full" isExecutable="true">
<bpmn:startEvent id="Event_JUDGMENT_PAID_IN_FULL" name="Start" camunda:initiator="JUDGMENT_PAID_IN_FULL">
<bpmn:outgoing>Flow_1if0h68</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_1cb4oje" messageRef="Message_0l5z4jd" />
</bpmn:startEvent>
<bpmn:endEvent id="Event_0r8yo0r">
<bpmn:incoming>Flow_1hce35l</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1hce35l" sourceRef="Activity_EndBusinessProcess" targetRef="Event_0r8yo0r" />
<bpmn:callActivity id="Activity_EndBusinessProcess" name="End Business Process" calledElement="EndBusinessProcess">
<bpmn:extensionElements>
<camunda:in variables="all" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_RPA_Continuous_Feed_Completed</bpmn:incoming>
<bpmn:outgoing>Flow_1hce35l</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:callActivity id="Activity_StartBusinessProcess" 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_04rigbl</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_StartBusinessProcess">
<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="Event_JUDGMENT_PAID_IN_FULL" targetRef="Activity_StartBusinessProcess" />
<bpmn:serviceTask id="SendJudgmentDetailsToCJES" name="Send Judgment Details To CJES" camunda:type="external" camunda:topic="processCaseEvent">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="caseEvent">SEND_JUDGMENT_DETAILS_CJES</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_04rigbl</bpmn:incoming>
<bpmn:outgoing>Flow_RPA_Continuous_Feed_Completed</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_RPA_Continuous_Feed_Completed" sourceRef="SendJudgmentDetailsToCJES" targetRef="Activity_EndBusinessProcess" />
<bpmn:sequenceFlow id="Flow_04rigbl" sourceRef="Activity_StartBusinessProcess" targetRef="SendJudgmentDetailsToCJES" />
</bpmn:process>
<bpmn:error id="Error_0t2ju7k" name="StartBusinessAbort" errorCode="ABORT" />
<bpmn:error id="Error_1237qii" name="StartBusinessAbort" errorCode="ABORT" />
<bpmn:message id="Message_0l5z4jd" name="JUDGMENT_PAID_IN_FULL" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="JUDGMENT_PAID_IN_FULL">
<bpmndi:BPMNShape id="Event_1m02c2o_di" bpmnElement="Event_JUDGMENT_PAID_IN_FULL">
<dc:Bounds x="152" y="232" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="158" y="275" width="24" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0r8yo0r_di" bpmnElement="Event_0r8yo0r">
<dc:Bounds x="742" y="232" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1x5rl4x_di" bpmnElement="Activity_EndBusinessProcess">
<dc:Bounds x="590" y="210" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0y089q8_di" bpmnElement="Activity_StartBusinessProcess">
<dc:Bounds x="250" y="210" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1mtqud7_di" bpmnElement="Event_1mtqud7">
<dc:Bounds x="282" y="92" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_03n7uky_di" bpmnElement="SendJudgmentDetailsToCJES">
<dc:Bounds x="420" y="210" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0o3sg3o_di" bpmnElement="Event_0o3sg3o">
<dc:Bounds x="282" y="192" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="316" y="173" width="27" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1hce35l_di" bpmnElement="Flow_1hce35l">
<di:waypoint x="690" y="250" />
<di:waypoint x="742" y="250" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0h072ea_di" bpmnElement="Flow_0h072ea">
<di:waypoint x="300" y="192" />
<di:waypoint x="300" y="128" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1if0h68_di" bpmnElement="Flow_1if0h68">
<di:waypoint x="188" y="250" />
<di:waypoint x="250" y="250" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0bi5uzr_di" bpmnElement="Flow_RPA_Continuous_Feed_Completed">
<di:waypoint x="520" y="250" />
<di:waypoint x="590" y="250" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_04rigbl_di" bpmnElement="Flow_04rigbl">
<di:waypoint x="350" y="250" />
<di:waypoint x="420" y="250" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package uk.gov.hmcts.reform.civil.bpmn;

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

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

class JudgementPaidInFullTest extends BpmnBaseTest {

public static final String MESSAGE_NAME = "JUDGMENT_PAID_IN_FULL";
public static final String PROCESS_ID = "JUDGMENT_PAID_IN_FULL";
private static final String SEND_JUDGMENT_DETAILS_CJES = "SEND_JUDGMENT_DETAILS_CJES";
private static final String SEND_JUDGMENT_DETAILS_CJES_ACTIVITY_ID = "SendJudgmentDetailsToCJES";

public JudgementPaidInFullTest() {
super("judgement_paid_in_full.bpmn", PROCESS_ID);
}

@Test
void shouldSuccessfullyCompleteJudgmentPaidInFull_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_BUSINESS_EVENT,
START_BUSINESS_ACTIVITY
);

//complete the Robotics notification
ExternalTask forRobotics = assertNextExternalTask(PROCESS_CASE_EVENT);
assertCompleteExternalTask(
forRobotics,
PROCESS_CASE_EVENT,
SEND_JUDGMENT_DETAILS_CJES,
SEND_JUDGMENT_DETAILS_CJES_ACTIVITY_ID
);

//end business process
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();
}
}

0 comments on commit 85473da

Please sign in to comment.