From 509b8aa9584c59166fa6b6bf9d5d142299bb8e8c Mon Sep 17 00:00:00 2001 From: Yogendra Upasani Date: Tue, 9 Jul 2024 00:56:32 +0100 Subject: [PATCH 01/16] PRL-3814 WA task for citizen uploaded documents --- .../wa-task-initiation-privatelaw-prlapps.dmn | 150 +++++++++++++++++- 1 file changed, 149 insertions(+), 1 deletion(-) diff --git a/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn b/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn index 20924a07..0de3d4a4 100644 --- a/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn +++ b/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn @@ -1,5 +1,5 @@ - + @@ -6205,6 +6205,154 @@ and additionalData.Data.isHearingTaskNeeded != null) then "reviewDocsFL401" + + + "citizen-case-update" + + + + + + "C100" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "CITIZEN" + + + "True" + + + + + + "reviewDocumentsForSolAndCafcassC100" + + + "Review Documents" + + + + + + "reviewDocsC100" + + + + + "citizen-case-update" + + + + + + "FL401" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "CITIZEN" + + + "True" + + + + + + "reviewDocumentsForSolAndCafcassFL401" + + + "Review Documents" + + + + + + "reviewDocsFL401" + + "c100RequestSupport" From 4f34d0efb3d16c45c14480baa81d35dcc72f9399 Mon Sep 17 00:00:00 2001 From: sairamkantheti1 Date: Tue, 16 Jul 2024 16:55:47 +0100 Subject: [PATCH 02/16] SNI-6246 enabled confidential check event from next step dropdown --- src/main/resources/wa-task-completion-privatelaw-prlapps.dmn | 2 +- .../prl/taskconfiguration/dmn/CamundaTaskCompletionTest.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/resources/wa-task-completion-privatelaw-prlapps.dmn b/src/main/resources/wa-task-completion-privatelaw-prlapps.dmn index aeef28a6..ae2d67f3 100644 --- a/src/main/resources/wa-task-completion-privatelaw-prlapps.dmn +++ b/src/main/resources/wa-task-completion-privatelaw-prlapps.dmn @@ -671,7 +671,7 @@ - "manageOrders","serviceOfApplication","createBundle","adminEditAndApproveAnOrder","returnApplication","sendOrReplyToMessages","adminRemoveLegalRepresentativeC100","adminRemoveLegalRepresentativeFL401","c100ManageFlags","fl401ManageFlags","statementOfService","issueAndSendToLocalCourtCallback" + "manageOrders","serviceOfApplication","createBundle","adminEditAndApproveAnOrder","returnApplication","sendOrReplyToMessages","adminRemoveLegalRepresentativeC100","adminRemoveLegalRepresentativeFL401","c100ManageFlags","fl401ManageFlags","statementOfService","issueAndSendToLocalCourtCallback","confidentialityCheck" diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskCompletionTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskCompletionTest.java index 9fffbd81..cec3c8c3 100644 --- a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskCompletionTest.java +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskCompletionTest.java @@ -319,7 +319,8 @@ static Stream scenarioProvider() { Map.of( "taskType", "confidentialCheckSOA", "completionMode", "Auto" - ) + ), + Map.of() ) ), Arguments.of( From 39511c73368b0198982b45e693d2bde4395bbf4e Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Thu, 18 Jul 2024 20:07:30 +0100 Subject: [PATCH 03/16] added test cases --- .../dmn/CamundaTaskConfigurationTest.java | 1287 +++++++++++++++++ 1 file changed, 1287 insertions(+) diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationTest.java index c80d0758..592d874b 100644 --- a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationTest.java +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationTest.java @@ -1,14 +1,26 @@ package uk.gov.hmcts.reform.prl.taskconfiguration.dmn; +import org.camunda.bpm.dmn.engine.DmnDecisionTableResult; import org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTable; import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTableBaseUnitTest; +import java.time.LocalDate; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; class CamundaTaskConfigurationTest extends DmnDecisionTableBaseUnitTest { @@ -25,4 +37,1279 @@ void if_this_test_fails_needs_updating_with_your_changes() { assertThat(logic.getOutputs().size(), is(3)); assertThat(logic.getRules().size(), is(86)); } + + @Test + void when_caseData_then_return_expected_appealType() { + VariableMap inputVariables = new VariableMapImpl(); + Map caseData = new HashMap<>(); // allow null values + caseData.put("appealType", "appealType"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "appealType", + "value", "appealType" + ))); + } + + @Test + void when_caseData_then_return_expected_caseManagementLocation() { + String region = "2"; + String baseLocation = "283922"; + String baseLocationName = "STOKE ON TRENT TRIBUNAL HEARING CENTRE"; + Map caseManagementLocation = new HashMap<>(); + caseManagementLocation.put("baseLocation", baseLocation); + caseManagementLocation.put("region", region); + caseManagementLocation.put("baseLocationName", baseLocationName); + Map caseData = new HashMap<>(); // allow null values + caseData.put("caseManagementLocation", caseManagementLocation); + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "region", + "value", "2", + "canReconfigure", true + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "location", + "value", "283922", + "canReconfigure", true + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "locationName", + "value", "STOKE ON TRENT TRIBUNAL HEARING CENTRE", + "canReconfigure", true + ))); + } + + @Test + void when_caseData_then_return_expected_caseManagementCategory() { + VariableMap inputVariables = new VariableMapImpl(); + Map caseData = new HashMap<>(); // allow null values + caseData.put("caseTypeOfApplication", "C100"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "caseManagementCategory", + "value", "Private Law - C100" + ))); + } + + @Test + void when_caseData_then_return_expected_nextHearing() { + Map caseData = new HashMap<>(); // allow null values + String hearingDateTime = "2023-04-13T09:00:00"; + String hearingID = "2000004862"; + Map nextHearingDetails = new HashMap<>(); + nextHearingDetails.put("hearingDateTime", hearingDateTime); + nextHearingDetails.put("hearingId", hearingID); + caseData.put("nextHearingDetails", nextHearingDetails); + + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "nextHearingDate", + "value", "2023-04-13T09:00:00", + "canReconfigure", true + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "nextHearingId", + "value", "2000004862", + "canReconfigure", true + ))); + } + + @Test + void when_caseData_then_return_expected_dueDateFields() { + VariableMap inputVariables = new VariableMapImpl(); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "minorPriority", + "value", "500" + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "calculatedDates", + "value", "nextHearingDate,dueDate,priorityDate", + "canReconfigure", true + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "dueDateOrigin", + "value", LocalDate.now().toString() + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "dueDateTime", + "value", "17:00" + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "dueDateNonWorkingCalendar", + "value", "https://www.gov.uk/bank-holidays/england-and-wales.json" + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "dueDateNonWorkingDaysOfWeek", + "value", "SATURDAY,SUNDAY" + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "dueDateSkipNonWorkingDays", + "value", "true" + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "dueDateMustBeWorkingDay", + "value", "No" + ))); + } + + @ParameterizedTest + @CsvSource({ + "checkApplicationC100", "checkApplicationResubmittedC100", "checkApplicationFL401", + "checkApplicationResubmittedFL401","addCaseNumber","addCaseNumberResubmitted", + "sendToGateKeeperFL401","sendToGateKeeperResubmittedFL401","sendToGateKeeperC100", + "sendToGateKeeperResubmittedC100","produceHearingBundleC100", + "updateHearingActualsC100","updateHearingActualsFL401","requestSolicitorOrderC100", + "requestSolicitorOrderFL401","confidentialCheckSOA","recreateApplicationPack", + "replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100","replyToMessageForLA", + "completefl416AndServe","listWithoutNoticeHearingC100","listOnNoticeHearingFL401","reviewLangAndSmReq" + }) + void when_given_task_type_then_return_dueDateIntervalDays_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("dueDateIntervalDays")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "dueDateIntervalDays", + "value", "1" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "createHearingRequest","createMultipleHearingRequest","createHearingRequestReserveListAssist" + }) + void when_given_task_type_then_return_dueDateIntervalDays_and_validate_description_for_hearing_request( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "Yolanda" + ) + ); + + Map caseData = new HashMap<>(); // allow null values + caseData.put("orderNameForAdminCreatedOrder", "Cooper"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("dueDateIntervalDays")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "dueDateIntervalDays", + "value", "1" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "directionOnIssue","directionOnIssueResubmitted","gateKeeping","gateKeepingResubmitted", + "serviceOfApplicationC100","serviceOfApplicationFL401","serviceOfApplicationC100", + "serviceOfApplicationFL401","reviewRaRequestsC100","reviewRaRequestsFL401", + "reviewInactiveRaRequestsC100","reviewInactiveRaRequestsFL401" + }) + void when_given_task_type_then_return_dueDateIntervalDaysIsTwo_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("dueDateIntervalDays")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "dueDateIntervalDays", + "value", "2" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "adminServeOrderC100","adminServeOrderFL401" + }) + void when_given_task_type_then_return_dueDateIntervalDays_and_validate_description_for_adminServeOrder( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "Yolanda" + ) + ); + + Map caseData = new HashMap<>(); // allow null values + caseData.put("orderNameForJudgeApproved", "Cooper"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("dueDateIntervalDays")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "dueDateIntervalDays", + "value", "2" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewAdminOrderProvided","reviewAdminOrderByManager" + }) + void when_given_task_type_then_return_dueDateIntervalDays_and_validate_description_for_reviewAdminOrder( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "Yolanda" + ) + ); + + Map caseData = new HashMap<>(); // allow null values + caseData.put("orderNameForAdminCreatedOrder", "Cooper"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("dueDateIntervalDays")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "dueDateIntervalDays", + "value", "2" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewAdditionalApplication" + }) + void when_given_task_type_then_return_dueDateIntervalDays_and_validate_description_for_reviewAdditionalApplication( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "awpWaTaskLastName" + ) + ); + + Map caseData = new HashMap<>(); // allow null values + caseData.put("awpWaTaskName", "awpWaTaskFirstName"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("dueDateIntervalDays")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "dueDateIntervalDays", + "value", "2" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "removeLegalRepresentativeC100","removeLegalRepresentativeFL401", + "reviewDocumentsForSolAndCafcassC100", "reviewDocumentsForSolAndCafcassFL401" + }) + void when_given_task_type_then_return_dueDateIntervalDaysIsThree_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("dueDateIntervalDays")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "dueDateIntervalDays", + "value", "3" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewSolicitorOrderProvided", "reviewCorrespondenceC100","reviewCorrespondenceFL401", + "replyToMessageForJudiciary","appStatementOfServiceBySol","appStatementOfServiceByLiP", + "appStatementOfServiceByBailiff","arrangeBailiffSOA","appStatementOfServiceByAdmin" + }) + void when_given_task_type_then_return_dueDateIntervalDaysIsFive_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "Solicitor Name" + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("dueDateIntervalDays")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "dueDateIntervalDays", + "value", "5" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "checkApplicationFL401","checkApplicationResubmittedFL401","sendToGateKeeperFL401", + "sendToGateKeeperResubmittedFL401","serviceOfApplicationFL401","adminServeOrderFL401", + "updateHearingActualsFL401","requestSolicitorOrderFL401", + "checkApplicationC100","checkApplicationResubmittedC100","addCaseNumber", + "addCaseNumberResubmitted","sendToGateKeeperC100","sendToGateKeeperResubmittedC100", + "serviceOfApplicationC100","adminServeOrderC100","updateHearingActualsC100", + "requestSolicitorOrderC100","reviewAdminOrderProvided", + "removeLegalRepresentativeC100","removeLegalRepresentativeFL401","confidentialCheckSOA", + "replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100", + "replyToMessageForJudiciary","reviewDocumentsForSolAndCafcassC100", + "reviewDocumentsForSolAndCafcassFL401","replyToMessageForLA","reviewAdminOrderByManager", + "createHearingRequest","createMultipleHearingRequest","createHearingRequestReserveListAssist", + "reviewRaRequestsC100","reviewRaRequestsFL401","reviewInactiveRaRequestsC100", + "reviewInactiveRaRequestsFL401","appStatementOfServiceBySol","appStatementOfServiceByLiP", + "appStatementOfServiceByBailiff","arrangeBailiffSOA","appStatementOfServiceByAdmin", + "completefl416AndServe","reviewAdditionalApplication","reviewLangAndSmReq" + }) + void when_given_task_type_then_return_priorityDateOriginRef_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "LastName" + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("priorityDateOriginRef")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "priorityDateOriginRef", + "value", "dueDate", + "canReconfigure", true + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewSpecificAccessRequestAdmin", "reviewSpecificAccessRequestCTSC" + }) + void when_given_task_type_then_return_priorityDateOriginRef_and_not_validate_description_for_reviewSpecificAccess( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "LastName" + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("priorityDateOriginRef")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "priorityDateOriginRef", + "value", "dueDate", + "canReconfigure", true + ))); + } + + @ParameterizedTest + @CsvSource({ + "reviewCorrespondenceFL401","produceHearingBundleFL401","reviewCorrespondenceC100", + "produceHearingBundleC100","directionOnIssue","directionOnIssueResubmitted", + "gateKeeping","gateKeepingResubmitted","reviewSolicitorOrderProvided", + "replyToMessageForJudiciary" + }) + void when_given_task_type_then_return_calculatedDates_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "LastName" + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("calculatedDates")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(2)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "calculatedDates", + "value", "nextHearingDate,nextHearingDatePreDate,dueDate,priorityDate", + "canReconfigure", true + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewCorrespondenceFL401","produceHearingBundleFL401","reviewCorrespondenceC100", + "produceHearingBundleC100","directionOnIssue","directionOnIssueResubmitted", + "gateKeeping","gateKeepingResubmitted","reviewSolicitorOrderProvided" + }) + void when_given_task_type_then_return_nextHearingDateFields_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "LastName" + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + //For nextHearingDatePreDateNonWorkingDaysOfWeek entry + validateNextHearingDatePreDateNonWorkingDaysOfWeek(dmnDecisionTableResult); + + // For nextHearingDatePreDateNonWorkingCalendar entry + validateNextHearingDatePreDateNonWorkingCalendar(dmnDecisionTableResult); + + //For nextHearingDatePreDateIntervalDays entry + validateNextHearingDatePreDateIntervalDays(dmnDecisionTableResult); + + //For nextHearingDatePreDateOriginRef entry + validateNextHearingDatePreDateOriginRef(dmnDecisionTableResult); + + //For calculatedDates entry + validateCalculatedDates(dmnDecisionTableResult); + + //For nextHearingDatePreDateSkipNonWorkingDays entry + validateNextHearingDatePreDateSkipNonWorkingDays(dmnDecisionTableResult); + + //For nextHearingDatePreDateMustBeWorkingDay entry + validateNextHearingDatePreDateMustBeWorkingDay(dmnDecisionTableResult); + + //For priorityDateOriginEarliest entry + validatePriorityDateOriginEarliest(dmnDecisionTableResult); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "checkApplicationFL401","checkApplicationResubmittedFL401","sendToGateKeeperFL401", + "sendToGateKeeperResubmittedFL401","directionOnIssue","directionOnIssueResubmitted", + "serviceOfApplicationFL401","adminServeOrderFL401","updateHearingActualsFL401", + "requestSolicitorOrderFL401", "reviewCorrespondenceFL401","produceHearingBundleFL401", + "removeLegalRepresentativeFL401", "replyToMessageForCourtAdminFL401", + "reviewDocumentsForSolAndCafcassFL401","listWithoutNoticeHearingC100","listOnNoticeHearingFL401" + }) + void when_given_task_type_then_return_majorPriorityForValue1000_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "LastName" + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("majorPriority")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "majorPriority", + "value", "1000" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewSpecificAccessRequestAdmin", "replyToMessageForLAFL401" + }) + void when_given_task_type_then_return_priorityDateOriginRef_and_not_validate_description_for_replyToMessage( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("majorPriority")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + assertTrue(workTypeResultList.contains(Map.of( + "name", "majorPriority", + "value", "1000" + ))); + } + + @ParameterizedTest + @CsvSource({ + "checkApplicationC100","checkApplicationResubmittedC100","sendToGateKeeperC100", + "sendToGateKeeperResubmittedC100","gateKeeping","gateKeepingResubmitted" + }) + void when_given_task_type_then_return_majorPriorityForUrgentCase_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "LastName" + ) + ); + + Map caseData = new HashMap<>(); // allow null values + caseData.put("newAllegationsOfHarmYesNo", "Yes"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("majorPriority")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "majorPriority", + "value", "3000" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "addCaseNumber","addCaseNumberResubmitted","serviceOfApplicationC100", + "adminServeOrderC100","updateHearingActualsC100","requestSolicitorOrderC100", + "reviewCorrespondenceC100", "produceHearingBundleC100", + "removeLegalRepresentativeC100","replyToMessageForCourtAdminC100" + }) + void when_given_task_type_then_return_majorPriorityForValue5000_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "LastName" + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("majorPriority")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "majorPriority", + "value", "5000" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewSpecificAccessRequestCTSC" + }) + void when_given_task_type_then_return_majorPriorityForValue5000_and_not_validate_desc_for_reviewSpecificAccess( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("majorPriority")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "majorPriority", + "value", "5000" + ))); + } + + @ParameterizedTest + @CsvSource({ + "reviewSolicitorOrderProvided","reviewAdminOrderProvided","confidentialCheckSOA", + "recreateApplicationPack","replyToMessageForJudiciary","reviewAdminOrderByManager", + "appStatementOfServiceBySol","appStatementOfServiceByLiP","appStatementOfServiceByBailiff", + "arrangeBailiffSOA","appStatementOfServiceByAdmin","completefl416AndServe", + "replyToMessageForLA","createHearingRequest","createMultipleHearingRequest", + "createHearingRequestReserveListAssist" + }) + void when_given_task_type_then_return_majorPriorityForCaseTypeOfApplication_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "LastName" + ) + ); + Map caseData = new HashMap<>(); // allow null values + caseData.put("caseTypeOfApplication", "C100"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("majorPriority")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "majorPriority", + "value", "5000" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewAdditionalApplication" + }) + void when_given_task_type_then_return_majorPriorityForReviewAdditionalApplication_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "LastName" + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("majorPriority")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "majorPriority", + "value", "1000" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewRaRequestsC100","reviewRaRequestsFL401", + "reviewInactiveRaRequestsC100","reviewInactiveRaRequestsFL401","reviewLangAndSmReq" + }) + void when_given_task_type_then_return_majorPriorityForValue3000_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "LastName" + ) + ); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("majorPriority")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "majorPriority", + "value", "3000" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "adminServeOrderC100","adminServeOrderFL401" + }) + void when_given_task_type_then_return_titleForOrderNameForJudgeApproved_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + Map caseData = new HashMap<>(); // allow null values + caseData.put("orderNameForJudgeApproved", "LastName"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("title")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "title", + "value", "FirstName - LastName", + "canReconfigure", false + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "adminServeOrderCreatedByJudgeC100","adminServeOrderCreatedByJudgeFL401" + }) + void when_given_task_type_then_return_titleForOrderNameForJudgeApproved_and_not_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + Map caseData = new HashMap<>(); // allow null values + caseData.put("orderNameForJudgeApproved", "LastName"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("title")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "title", + "value", "FirstName - LastName", + "canReconfigure", false + ))); + } + + @ParameterizedTest + @CsvSource({ + "reviewSolicitorOrderProvided" + }) + void when_given_task_type_then_return_titleForOrderNameForSolicitorCreatedOrder_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + Map caseData = new HashMap<>(); // allow null values + caseData.put("orderNameForSolicitorCreatedOrder", "LastName"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("title")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "title", + "value", "FirstName - LastName", + "canReconfigure", false + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewAdminOrderProvided","reviewAdminOrderByManager","createHearingRequest", + "createMultipleHearingRequest","createHearingRequestReserveListAssist" + }) + void when_given_task_type_then_return_titleForOrderNameForAdminCreatedOrder_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + Map caseData = new HashMap<>(); // allow null values + caseData.put("orderNameForAdminCreatedOrder", "LastName"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("title")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "title", + "value", "FirstName - LastName", + "canReconfigure", false + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewAdditionalApplication" + }) + void when_given_task_type_then_return_titleForAwpWaTaskName_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + Map caseData = new HashMap<>(); // allow null values + caseData.put("awpWaTaskName", "LastName"); + inputVariables.putValue("caseData", caseData); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("title")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "title", + "value", "FirstName - LastName", + "canReconfigure", false + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + private void validatePriorityDateOriginEarliest(DmnDecisionTableResult dmnDecisionTableResult) { + List> workTypeResultListPriorityDateOriginEarliest = + dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("priorityDateOriginEarliest")) + .collect(Collectors.toList()); + + assertThat(workTypeResultListPriorityDateOriginEarliest.size(), is(1)); + assertTrue(workTypeResultListPriorityDateOriginEarliest.contains(Map.of( + "name", "priorityDateOriginEarliest", + "value", "nextHearingDatePreDate,dueDate", + "canReconfigure", true + ))); + } + + private void validateNextHearingDatePreDateMustBeWorkingDay(DmnDecisionTableResult dmnDecisionTableResult) { + List> workTypeResultListNextHearingDatePreDateMustBeWorkingDay = + dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("nextHearingDatePreDateMustBeWorkingDay")) + .collect(Collectors.toList()); + + assertThat(workTypeResultListNextHearingDatePreDateMustBeWorkingDay.size(), is(1)); + assertTrue(workTypeResultListNextHearingDatePreDateMustBeWorkingDay.contains(Map.of( + "name", "nextHearingDatePreDateMustBeWorkingDay", + "value", "No", + "canReconfigure", true + ))); + } + + private static void validateNextHearingDatePreDateSkipNonWorkingDays( + DmnDecisionTableResult dmnDecisionTableResult) { + List> workTypeResultListNextHearingDatePreDateSkipNonWorkingDays = + dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("nextHearingDatePreDateSkipNonWorkingDays")) + .collect(Collectors.toList()); + + assertThat(workTypeResultListNextHearingDatePreDateSkipNonWorkingDays.size(), is(1)); + assertTrue(workTypeResultListNextHearingDatePreDateSkipNonWorkingDays.contains(Map.of( + "name", "nextHearingDatePreDateSkipNonWorkingDays", + "value", "true", + "canReconfigure", true + ))); + } + + private static void validateCalculatedDates(DmnDecisionTableResult dmnDecisionTableResult) { + List> workTypeResultListCalculatedDates = + dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("calculatedDates")) + .collect(Collectors.toList()); + + assertThat(workTypeResultListCalculatedDates.size(), is(2)); + assertTrue(workTypeResultListCalculatedDates.contains(Map.of( + "name", "calculatedDates", + "value", "nextHearingDate,nextHearingDatePreDate,dueDate,priorityDate", + "canReconfigure", true + ))); + } + + private static void validateNextHearingDatePreDateOriginRef(DmnDecisionTableResult dmnDecisionTableResult) { + List> workTypeResultListNextHearingDatePreDateOriginRef = + dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("nextHearingDatePreDateOriginRef")) + .collect(Collectors.toList()); + + assertThat(workTypeResultListNextHearingDatePreDateOriginRef.size(), is(1)); + assertTrue(workTypeResultListNextHearingDatePreDateOriginRef.contains(Map.of( + "name", "nextHearingDatePreDateOriginRef", + "value", "nextHearingDate", + "canReconfigure", true + ))); + } + + private static void validateNextHearingDatePreDateIntervalDays(DmnDecisionTableResult dmnDecisionTableResult) { + List> workTypeResultListNextHearingDatePreDateIntervalDays = + dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("nextHearingDatePreDateIntervalDays")) + .collect(Collectors.toList()); + + assertThat(workTypeResultListNextHearingDatePreDateIntervalDays.size(), is(1)); + assertTrue(workTypeResultListNextHearingDatePreDateIntervalDays.contains(Map.of( + "name", "nextHearingDatePreDateIntervalDays", + "value", "-3", + "canReconfigure", true + ))); + } + + private static void validateNextHearingDatePreDateNonWorkingCalendar( + DmnDecisionTableResult dmnDecisionTableResult) { + List> workTypeResultListNextHearingDatePreDateNonWorkingCalendar = + dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("nextHearingDatePreDateNonWorkingCalendar")) + .collect(Collectors.toList()); + + assertThat(workTypeResultListNextHearingDatePreDateNonWorkingCalendar.size(), is(1)); + assertTrue(workTypeResultListNextHearingDatePreDateNonWorkingCalendar.contains(Map.of( + "name", "nextHearingDatePreDateNonWorkingCalendar", + "value", "https://www.gov.uk/bank-holidays/england-and-wales.json", + "canReconfigure", true + ))); + } + + private static void validateNextHearingDatePreDateNonWorkingDaysOfWeek( + DmnDecisionTableResult dmnDecisionTableResult) { + List> workTypeResultListNextHearingDatePreDateNonWorkingDaysOfWeek = + dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("nextHearingDatePreDateNonWorkingDaysOfWeek")) + .collect(Collectors.toList()); + + assertThat(workTypeResultListNextHearingDatePreDateNonWorkingDaysOfWeek.size(), is(1)); + assertTrue(workTypeResultListNextHearingDatePreDateNonWorkingDaysOfWeek.contains(Map.of( + "name", "nextHearingDatePreDateNonWorkingDaysOfWeek", + "value", "SATURDAY, SUNDAY", + "canReconfigure", true + ))); + } + + private void assertDescriptionField(String taskType, DmnDecisionTableResult dmnDecisionTableResult) { + List> descriptionResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("description")) + .toList(); + assertThat(descriptionResultList.size(), is(1)); + + String description = getDescriptionBasedOnTaskType(taskType); + + assertTrue(descriptionResultList.contains(Map.of( + "name", "description", + "value", description + ))); + } + + private static String getDescriptionBasedOnTaskType(String taskType) { + switch (taskType) { + case "checkApplicationFL401": + case "checkApplicationResubmittedFL401": + return "[Add Case Number](/cases/case-details/${[CASE_REFERENCE]}/trigger/" + + "fl401AddCaseNumber/fl401AddCaseNumber1)"; + + case "checkApplicationC100": + case "checkApplicationResubmittedC100": + return "[Issue and send to local Court](/cases/case-details/${[CASE_REFERENCE]}" + + "/trigger/issueAndSendToLocalCourtCallback/issueAndSendToLocalCourtCallback1)"; + + case "addCaseNumber": + case "addCaseNumberResubmitted": + return "[Add Case Number](/cases/case-details/${[CASE_REFERENCE]}/trigger/caseNumber/caseNumber1)"; + + case "sendToGateKeeperFL401": + case "sendToGateKeeperResubmittedFL401": + return "[Send To Gatekeeper](/cases/case-details/${[CASE_REFERENCE]}/trigger/" + + "fl401SendToGateKeeper/fl401SendToGateKeeper1)"; + + case "sendToGateKeeperC100": + case "sendToGateKeeperResubmittedC100": + return "[Send To Gatekeeper](/cases/case-details/${[CASE_REFERENCE]}/trigger" + + "/sendToGateKeeper/sendToGateKeeper1)"; + + case "produceHearingBundleC100": + case "produceHearingBundleFL401": + return "[Create Bundle](/cases/case-details/${[CASE_REFERENCE]}/trigger/createBundle/createBundle1)"; + + case "adminServeOrderFL401": + case "adminServeOrderC100": + return "[Complete the Order](/cases/case-details/${[CASE_REFERENCE]}/trigger" + + "/adminEditAndApproveAnOrder/adminEditAndApproveAnOrder1)"; + + case "serviceOfApplicationFL401": + case "serviceOfApplicationC100": + return "[Service of Application](/cases/case-details/${[CASE_REFERENCE]}/" + + "trigger/serviceOfApplication/serviceOfApplication1)"; + + case "reviewCorrespondenceFL401": + case "reviewCorrespondenceC100": + return "[Review Correspondence](/cases/case-details/${[CASE_REFERENCE]}#Casedocuments)"; + + case "updateHearingActualsFL401": + case "updateHearingActualsC100": + return "[Update Hearing Actuals](/cases/case-details/${[CASE_REFERENCE]}/trigger/)"; + + case "requestSolicitorOrderFL401": + case "requestSolicitorOrderC100": + return "[Request Solicitor to Submit the Order]"; + + case "directionOnIssue": + case "directionOnIssueResubmitted": + return "[Directions on Issue]"; + + case "gateKeeping": + case "gateKeepingResubmitted": + return "[Gatekeeping]"; + + case "reviewSolicitorOrderProvided": + return "[Review and Approve Legal rep Order](/cases/case-details/${[CASE_REFERENCE]}" + + "/trigger/editAndApproveAnOrder/editAndApproveAnOrder1)"; + + case "reviewAdminOrderProvided": + case "reviewAdminOrderByManager": + return "[Review and Approve Admin Order](/cases/case-details/${[CASE_REFERENCE]}" + + "/trigger/editAndApproveAnOrder/editAndApproveAnOrder1)"; + + case "removeLegalRepresentativeC100": + return "[Remove Legal Representative](/cases/case-details/${[CASE_REFERENCE]}" + + "/trigger/adminRemoveLegalRepresentativeC100/adminRemoveLegalRepresentativeC1001)"; + + case "removeLegalRepresentativeFL401": + return "[Remove Legal Representative](/cases/case-details/${[CASE_REFERENCE]}" + + "/trigger/adminRemoveLegalRepresentativeFL401/adminRemoveLegalRepresentativeFL4011)"; + + case "confidentialCheckSOA": + return "[Confidential Check](/cases/case-details/${[CASE_REFERENCE]}" + + "/trigger/confidentialityCheck/confidentialityCheck1)"; + + case "recreateApplicationPack": + return "[Recreate Application Pack](/cases/case-details/${[CASE_REFERENCE]}" + + "/trigger/serviceOfApplication/serviceOfApplication1)"; + + case "appStatementOfServiceBySol": + return "[Waiting for Applicant's Solicitor to upload Statement of Service]"; + + case "appStatementOfServiceByLiP": + return "[Waiting for Unrepresented Applicant LiP to upload Statement of Service]"; + + case "appStatementOfServiceByBailiff": + return "[Upload Statement of Service provided by Court Bailiff](/cases" + + "/case-details/${[CASE_REFERENCE]}/trigger/statementOfService/statementOfService1)"; + + case "arrangeBailiffSOA": + return "[Arrange bailiff service of application]"; + + case "appStatementOfServiceByAdmin": + return "[Upload Statement of Service](/cases/case-details/${[CASE_REFERENCE]}" + + "/trigger/statementOfService/statementOfService1)"; + + case "completefl416AndServe": + return "[Complete FL416 and serve applicant only]"; + + case "replyToMessageForCourtAdminFL401": + case "replyToMessageForCourtAdminC100": + case "replyToMessageForJudiciary": + case "replyToMessageForLA": + return "[Reply to Message](/cases/case-details/${[CASE_REFERENCE]}/trigger/sendOrReplyToMessages)"; + + case "reviewDocumentsForSolAndCafcassC100": + case "reviewDocumentsForSolAndCafcassFL401": + return "[Review Documents](/cases/case-details/${[CASE_REFERENCE]}/trigger/reviewDocuments)"; + + case "reviewRaRequestsC100": + return "[Review RA request](/cases/case-details/${[CASE_REFERENCE]}/trigger" + + "/c100ManageFlags/c100ManageFlags)"; + + case "reviewRaRequestsFL401": + return "[Review RA request](/cases/case-details/${[CASE_REFERENCE]}" + + "/trigger/fl401ManageFlags/fl401ManageFlags)"; + + case "reviewInactiveRaRequestsC100": + case "reviewInactiveRaRequestsFL401": + return "[Review inactive case flags](/cases/case-details/${[CASE_REFERENCE]}#Case%20Flags)"; + + case "createHearingRequestReserveListAssist": + return "[Reserve Hearings in List Assist]"; + + case "createHearingRequest": + case "createMultipleHearingRequest": + return "[Create Hearing Request](/cases/case-details/${[CASE_REFERENCE]}/hearings)"; + + case "listWithoutNoticeHearingC100": + case "listOnNoticeHearingFL401": + return ""; + + case "reviewAdditionalApplication": + return "[Review other applications](/cases/case-details/${[CASE_REFERENCE]}#Other%20applications)"; + + case "reviewLangAndSmReq": + return "[Review case notes](/cases/case-details/${[CASE_REFERENCE]}#Case%20Notes)"; + + default: + break; + } + return null; + } } From 759dc738ceb6a112b286aa9b1c765914b04b0ae0 Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Thu, 18 Jul 2024 20:42:07 +0100 Subject: [PATCH 04/16] added test cases --- .../dmn/CamundaTaskConfigurationTest.java | 328 ++++++++++++++++++ 1 file changed, 328 insertions(+) diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationTest.java index 592d874b..2256f622 100644 --- a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationTest.java +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationTest.java @@ -1034,6 +1034,334 @@ void when_given_task_type_then_return_titleForAwpWaTaskName_and_validate_descrip assertDescriptionField(taskType, dmnDecisionTableResult); } + @ParameterizedTest + @CsvSource({ + "addCaseNumber","addCaseNumberResubmitted","sendToGateKeeperC100", + "sendToGateKeeperResubmittedC100","sendToGateKeeperFL401", + "sendToGateKeeperResubmittedFL401","serviceOfApplicationC100", + "adminServeOrderC100","serviceOfApplicationFL401","adminServeOrderFL401", + "requestSolicitorOrderC100","requestSolicitorOrderFL401","reviewCorrespondenceC100", + "reviewCorrespondenceFL401","removeLegalRepresentativeC100", + "removeLegalRepresentativeFL401","confidentialCheckSOA", + "reviewDocumentsForSolAndCafcassC100","reviewDocumentsForSolAndCafcassFL401", + "replyToMessageForCourtAdminC100","replyToMessageForLA","replyToMessageForJudiciary", + "reviewRaRequestsC100","reviewRaRequestsFL401","reviewInactiveRaRequestsC100", + "reviewInactiveRaRequestsFL401","appStatementOfServiceBySol", + "appStatementOfServiceByLiP","appStatementOfServiceByBailiff","arrangeBailiffSOA", + "appStatementOfServiceByAdmin","completefl416AndServe","listWithoutNoticeHearingC100", + "listOnNoticeHearingFL401","reviewAdditionalApplication","reviewLangAndSmReq" + }) + void when_given_task_type_then_return_workType_and_validate_description(String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("workType")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "workType", + "value", "routine_work" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "directionOnIssue","directionOnIssueResubmitted","gateKeeping", + "gateKeepingResubmitted","reviewSolicitorOrderProvided", + "reviewAdminOrderProvided","reviewAdminOrderByManager" + }) + void when_given_task_type_then_return_workTypeForValueDecision_making_work_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("workType")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "workType", + "value", "decision_making_work" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "produceHearingBundleC100","produceHearingBundleFL401","updateHearingActualsC100", + "updateHearingActualsFL401","createHearingRequest","createMultipleHearingRequest", + "createHearingRequestReserveListAssist" + }) + void when_given_task_type_then_return_workTypeForValueHearing_work_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("workType")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "workType", + "value", "hearing_work" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "checkApplicationC100", "checkApplicationFL401", + "checkApplicationResubmittedC100", "checkApplicationResubmittedFL401" + }) + void when_given_task_type_then_return_workTypeForValueApplications_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("workType")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "workType", + "value", "applications" + ))); + + assertDescriptionField(taskType, dmnDecisionTableResult); + } + + @ParameterizedTest + @CsvSource({ + "reviewSpecificAccessRequestJudiciary", "reviewSpecificAccessRequestLegalOps", + "reviewSpecificAccessRequestAdmin","reviewSpecificAccessRequestCTSC" + }) + void when_given_task_type_then_return_workTypeForValueAccess_requests_and_not_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("workType")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "workType", + "value", "access_requests" + ))); + } + + @ParameterizedTest + @CsvSource({ + "reviewSpecificAccessRequestJudiciary", "reviewSpecificAccessRequestLegalOps", + "reviewSpecificAccessRequestAdmin","reviewSpecificAccessRequestCTSC" + }) + void when_given_task_type_then_return_additionalProperties_roleAssignmentId_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName", + "roleAssignmentId", "roleAssignmentId" + ) + ); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("additionalProperties_roleAssignmentId")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "additionalProperties_roleAssignmentId", + "value", "roleAssignmentId" + ))); + } + + @ParameterizedTest + @CsvSource({ + "reviewSpecificAccessRequestLegalOps","replyToMessageForLAC100","replyToMessageForLA" + }) + void when_given_task_type_then_return_roleCategory_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType + ) + ); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("roleCategory")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "roleCategory", + "value", "LEGAL_OPERATIONS" + ))); + } + + @ParameterizedTest + @CsvSource({ + "checkApplicationFL401","checkApplicationResubmittedFL401","sendToGateKeeperFL401", + "sendToGateKeeperResubmittedFL401","sendToGateKeeperC100", + "sendToGateKeeperResubmittedC100","produceHearingBundleFL401", + "produceHearingBundleC100","serviceOfApplicationFL401","adminServeOrderFL401", + "updateHearingActualsFL401","requestSolicitorOrderFL401","reviewCorrespondenceFL401", + "serviceOfApplicationC100","adminServeOrderC100","updateHearingActualsC100", + "requestSolicitorOrderC100","reviewCorrespondenceC100","reviewSpecificAccessRequestAdmin", + "removeLegalRepresentativeFL401","reviewDocumentsForSolAndCafcassFL401", + "reviewDocumentsForSolAndCafcassC100","reviewAdminOrderByManager","createHearingRequest", + "createMultipleHearingRequest","createHearingRequestReserveListAssist", + "reviewRaRequestsFL401","reviewInactiveRaRequestsFL401","recreateApplicationPack", + "appStatementOfServiceBySol","appStatementOfServiceByLiP","appStatementOfServiceByBailiff", + "arrangeBailiffSOA","appStatementOfServiceByAdmin","confidentialCheckSOA", + "completefl416AndServe","removeLegalRepresentativeC100","replyToMessageForCourtAdminC100", + "replyToMessageForCourtAdminFL401","reviewRaRequestsC100","reviewInactiveRaRequestsC100", + "listWithoutNoticeHearingC100","listOnNoticeHearingFL401","reviewAdditionalApplication", + "reviewLangAndSmReq" + }) + void when_given_task_type_then_return_roleCategoryForValueAdmin_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("roleCategory")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "roleCategory", + "value", "ADMIN" + ))); + } + + @ParameterizedTest + @CsvSource({ + "checkApplicationC100", "checkApplicationResubmittedC100", + "addCaseNumber", "addCaseNumberResubmitted", + "reviewSpecificAccessRequestCTSC" + }) + void when_given_task_type_then_return_roleCategoryForValueCtsc_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("roleCategory")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "roleCategory", + "value", "CTSC" + ))); + } + + @ParameterizedTest + @CsvSource({ + "directionOnIssue","directionOnIssueResubmitted","gateKeeping", + "gateKeepingResubmitted", "reviewSpecificAccessRequestJudiciary", + "reviewSolicitorOrderProvided","reviewAdminOrderProvided", + "replyToMessageForJudiciary" + }) + void when_given_task_type_then_return_roleCategoryForValueJudicial_and_validate_description( + String taskType) { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue( + "taskAttributes", + Map.of("taskId", "1234", + "taskType", taskType, + "name", "FirstName" + ) + ); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + List> workTypeResultList = dmnDecisionTableResult.getResultList().stream() + .filter((r) -> r.containsValue("roleCategory")) + .collect(Collectors.toList()); + + assertThat(workTypeResultList.size(), is(1)); + + assertTrue(workTypeResultList.contains(Map.of( + "name", "roleCategory", + "value", "JUDICIAL" + ))); + } + private void validatePriorityDateOriginEarliest(DmnDecisionTableResult dmnDecisionTableResult) { List> workTypeResultListPriorityDateOriginEarliest = dmnDecisionTableResult.getResultList().stream() From ef31cef4edf6fc169b9f7686ec2ee1c7e7a9d83b Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:21:41 +0100 Subject: [PATCH 05/16] intentional add a syntax error to verify failure of tests --- src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn b/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn index 0626c99e..4b6f227e 100644 --- a/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn +++ b/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn @@ -293,7 +293,7 @@ taskAttributes. taskType else if(taskType != null) then taskType else null - "checkApplicationC100","checkApplicationResubmittedC100","checkApplicationFL401","checkApplicationResubmittedFL401","addCaseNumber","addCaseNumberResubmitted","sendToGateKeeperFL401","sendToGateKeeperResubmittedFL401","sendToGateKeeperC100","sendToGateKeeperResubmittedC100","produceHearingBundleC100","produceHearingBundleFL100","updateHearingActualsC100","updateHearingActualsFL401","requestSolicitorOrderC100","requestSolicitorOrderFL401","confidentialCheckSOA","recreateApplicationPack","replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100","replyToMessageForLA","createHearingRequest","createMultipleHearingRequest","createHearingRequestReserveListAssist","completefl416AndServe","listWithoutNoticeHearingC100","listOnNoticeHearingFL401","reviewLangAndSmReq" + "checkApplicationC100","checkApplicationResubmittedC100","checkApplicationFL401","checkApplicationResubmittedFL401","addCaseNumber","addCaseNumberResubmitted","sendToGateKeeperFL401","sendToGateKeeperResubmittedFL401","sendToGateKeeperC100","sendToGateKeeperResubmittedC100","produceHearingBundleC100","produceHearingBundleFL100","updateHearingActualsC100","updateHearingActualsFL401","requestSolicitorOrderC100","requestSolicitorOrderFL401","confidentialCheckSOA","recreateApplicationPack","replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100","replyToMessageForLA","createHearingRequest","createMultipleHearingRequest","createHearingRequestReserveListAssist","completefl416AndServe","listWithoutNoticeHearingC100,"listOnNoticeHearingFL401","reviewLangAndSmReq" "dueDateIntervalDays" From 170d6aab29dddc067453e47a7aa26caa446f938c Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:33:37 +0100 Subject: [PATCH 06/16] generate artifacts always post checkout --- Jenkinsfile_CNP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index 7d94fdb8..fdedf6ac 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -11,7 +11,7 @@ def branchesToSync = ['demo', 'perftest', "ithc"] withCamundaOnlyPipeline(type, product, component, s2sServiceName, tenantId) { - afterSuccess('test') { + afterAlways('test') { steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/reports/tests/**/*' steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/reports/tests/integration/**/*' } From ec8fbc2117776da13bcc38beed3d0f70eef3ba8e Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:03:13 +0100 Subject: [PATCH 07/16] fixed known added test failure --- src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn b/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn index 4b6f227e..0626c99e 100644 --- a/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn +++ b/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn @@ -293,7 +293,7 @@ taskAttributes. taskType else if(taskType != null) then taskType else null - "checkApplicationC100","checkApplicationResubmittedC100","checkApplicationFL401","checkApplicationResubmittedFL401","addCaseNumber","addCaseNumberResubmitted","sendToGateKeeperFL401","sendToGateKeeperResubmittedFL401","sendToGateKeeperC100","sendToGateKeeperResubmittedC100","produceHearingBundleC100","produceHearingBundleFL100","updateHearingActualsC100","updateHearingActualsFL401","requestSolicitorOrderC100","requestSolicitorOrderFL401","confidentialCheckSOA","recreateApplicationPack","replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100","replyToMessageForLA","createHearingRequest","createMultipleHearingRequest","createHearingRequestReserveListAssist","completefl416AndServe","listWithoutNoticeHearingC100,"listOnNoticeHearingFL401","reviewLangAndSmReq" + "checkApplicationC100","checkApplicationResubmittedC100","checkApplicationFL401","checkApplicationResubmittedFL401","addCaseNumber","addCaseNumberResubmitted","sendToGateKeeperFL401","sendToGateKeeperResubmittedFL401","sendToGateKeeperC100","sendToGateKeeperResubmittedC100","produceHearingBundleC100","produceHearingBundleFL100","updateHearingActualsC100","updateHearingActualsFL401","requestSolicitorOrderC100","requestSolicitorOrderFL401","confidentialCheckSOA","recreateApplicationPack","replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100","replyToMessageForLA","createHearingRequest","createMultipleHearingRequest","createHearingRequestReserveListAssist","completefl416AndServe","listWithoutNoticeHearingC100","listOnNoticeHearingFL401","reviewLangAndSmReq" "dueDateIntervalDays" From 2c6a9e79415841412cdde15a3fa894d11931460c Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:03:43 +0100 Subject: [PATCH 08/16] added tests for task type dmn --- .../wa-task-types-privatelaw-prlapps.dmn | 2 +- .../dmn/CamundaTaskTypeFilterTest.java | 215 ++++++++++++++++++ 2 files changed, 216 insertions(+), 1 deletion(-) diff --git a/src/main/resources/wa-task-types-privatelaw-prlapps.dmn b/src/main/resources/wa-task-types-privatelaw-prlapps.dmn index 7e081684..3194418f 100644 --- a/src/main/resources/wa-task-types-privatelaw-prlapps.dmn +++ b/src/main/resources/wa-task-types-privatelaw-prlapps.dmn @@ -1,5 +1,5 @@ - + diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskTypeFilterTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskTypeFilterTest.java index 71e85707..60755b3c 100644 --- a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskTypeFilterTest.java +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskTypeFilterTest.java @@ -1,11 +1,22 @@ package uk.gov.hmcts.reform.prl.taskconfiguration.dmn; +import org.camunda.bpm.dmn.engine.DmnDecisionTableResult; import org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTable; import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTableBaseUnitTest; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -16,6 +27,210 @@ public static void initialization() { CURRENT_DMN_DECISION_TABLE = DmnDecisionTable.WA_TASK_TASKTYPEFILTER; } + static Stream scenarioProvider() { + List> taskTypes = List.of( + Map.of( + "taskTypeId", "checkApplicationC100", + "taskTypeName", "Check application C100" + ), + Map.of( + "taskTypeId", "checkApplicationResubmittedC100", + "taskTypeName", "Check resubmitted application C100" + ), + Map.of( + "taskTypeId", "checkApplicationFL401", + "taskTypeName", "Check application FL401" + ), + Map.of( + "taskTypeId", "checkApplicationResubmittedFL401", + "taskTypeName", "Check resubmitted application FL401" + ), + Map.of( + "taskTypeId", "addCaseNumber", + "taskTypeName", "Add Case Number" + ), + Map.of( + "taskTypeId", "AddCaseNumberResubmitted", + "taskTypeName", "Add Case Number Resubmitted" + ), + Map.of( + "taskTypeId", "sendToGateKeeperFL401", + "taskTypeName", "Send To Gatekeeper FL401" + ), + Map.of( + "taskTypeId", "sendToGateKeeperC100", + "taskTypeName", "Send To Gatekeeper C100" + ), + Map.of( + "taskTypeId", "sendToGateKeeperResubmittedFL401", + "taskTypeName", "Send to Gatekeeper Resubmitted FL401" + ), + Map.of( + "taskTypeId", "sendToGateKeeperResubmittedC100", + "taskTypeName", "Send to Gatekeeper Resubmitted C100" + ), + Map.of( + "taskTypeId", "directionOnIssue", + "taskTypeName", "Directions on Issue" + ), + Map.of( + "taskTypeId", "directionOnIssueResubmitted", + "taskTypeName", "Directions on Issue Resubmitted" + ), + Map.of( + "taskTypeId", "gateKeeping", + "taskTypeName", "Gatekeeping" + ), + Map.of( + "taskTypeId", "gateKeepingResubmitted", + "taskTypeName", "Gatekeeping Resubmitted" + ), + Map.of( + "taskTypeId", "serviceOfApplicationC100", + "taskTypeName", "Service Of Application C100" + ), + Map.of( + "taskTypeId", "serviceOfApplicationFL401", + "taskTypeName", "Service Of Application FL401" + ), + Map.of( + "taskTypeId", "serviceOfOrderC100", + "taskTypeName", "Service Of Order C100" + ), + Map.of( + "taskTypeId", "serviceOfOrderFL401", + "taskTypeName", "Service Of Order FL401" + ), + Map.of( + "taskTypeId", "produceHearingBundleC100", + "taskTypeName", "Produce Hearing Bundle C100" + ), + Map.of( + "taskTypeId", "produceHearingBundleFL401", + "taskTypeName", "Produce Hearing Bundle FL401" + ), + Map.of( + "taskTypeId", "createOrderC100", + "taskTypeName", "Create Order C100" + ), + Map.of( + "taskTypeId", "createOrderFL401", + "taskTypeName", "Create Order FL401" + ), + Map.of( + "taskTypeId", "reviewSolicitorOrderProvided", + "taskTypeName", "Review Solicitor Order" + ), + Map.of( + "taskTypeId", "requestSolicitorOrderC100", + "taskTypeName", "Request Solicitor Order C100" + ), + Map.of( + "taskTypeId", "requestSolicitorOrderFL401", + "taskTypeName", "Request Solicitor Order FL401" + ), + Map.of( + "taskTypeId", "updateHearingActualsC100", + "taskTypeName", "Update Hearing Actuals C100" + ), + Map.of( + "taskTypeId", "updateHearingActualsFL401", + "taskTypeName", "Update Hearing Actuals FL401" + ), + Map.of( + "taskTypeId", "reviewCorrespondenceC100", + "taskTypeName", "Review Correspondence C100" + ), + Map.of( + "taskTypeId", "reviewCorrespondenceFL401", + "taskTypeName", "Review Correspondence FL401" + ), + Map.of( + "taskTypeId", "removeLegalRepresentativeC100", + "taskTypeName", "Remove legal representative C100" + ), + Map.of( + "taskTypeId", "removeLegalRepresentativeFL401", + "taskTypeName", "Remove legal representative FL401" + ), + Map.of( + "taskTypeId", "confidentialCheckSOA", + "taskTypeName", "C8 - Confidential details check" + ), + Map.of( + "taskTypeId", "replyToMessageForCourtAdminFL401", + "taskTypeName", "Reply To Message FL401" + ), + Map.of( + "taskTypeId", "replyToMessageForCourtAdminC100", + "taskTypeName", "Reply To Message C100" + ), + Map.of( + "taskTypeId", "replyToMessageForLA", + "taskTypeName", "Reply To Message C100" + ), + Map.of( + "taskTypeId", "replyToMessageForJudiciary", + "taskTypeName", "Reply To Message Judicial" + ), + Map.of( + "taskTypeId", "reviewDocumentsForSolAndCafcassC100", + "taskTypeName", "C100 Review Documents Submitted By Sol or Cafcass" + ), + Map.of( + "taskTypeId", "reviewDocumentsForSolAndCafcassFL401", + "taskTypeName", "FL401 Review Documents Submitted By Sol or Cafcass" + ), + Map.of( + "taskTypeId", "reviewRaRequestsC100", + "taskTypeName", "Review RA request" + ), + Map.of( + "taskTypeId", "reviewRaRequestsFL401", + "taskTypeName", "Review RA request" + ), + Map.of( + "taskTypeId", "reviewInactiveRaRequestsC100", + "taskTypeName", "Review inactive RA request" + ), + Map.of( + "taskTypeId", "reviewInactiveRaRequestsFL401", + "taskTypeName", "Review inactive RA request" + ), + Map.of( + "taskTypeId", "listWithoutNoticeHearingC100", + "taskTypeName", "List without notice hearing(see case notes)" + ), + Map.of( + "taskTypeId", "listOnNoticeHearingFL401", + "taskTypeName", "Listing instructions (refer to case notes)" + ), + Map.of( + "taskTypeId", "reviewAdditionalApplication", + "taskTypeName", "Review additional application" + ), + Map.of( + "taskTypeId", "reviewLangAndSmReq", + "taskTypeName", "Review Language and SM requirements" + ) + ); + return Stream.of( + Arguments.of( + taskTypes + ) + ); + } + + @ParameterizedTest(name = "retrieve all task type data") + @MethodSource("scenarioProvider") + void should_evaluate_dmn_return_all_task_type_fields(List> expectedTaskTypes) { + + VariableMap inputVariables = new VariableMapImpl(); + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + MatcherAssert.assertThat(dmnDecisionTableResult.getResultList(), is(expectedTaskTypes)); + + } + @Test void if_this_test_fails_needs_updating_with_your_changes() { //The purpose of this test is to prevent adding new rows without being tested From 74520db5e7ee7ff073548718b0b8a891845668cf Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:38:35 +0100 Subject: [PATCH 09/16] intentionally added error for testing --- src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn b/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn index 0626c99e..4b6f227e 100644 --- a/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn +++ b/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn @@ -293,7 +293,7 @@ taskAttributes. taskType else if(taskType != null) then taskType else null - "checkApplicationC100","checkApplicationResubmittedC100","checkApplicationFL401","checkApplicationResubmittedFL401","addCaseNumber","addCaseNumberResubmitted","sendToGateKeeperFL401","sendToGateKeeperResubmittedFL401","sendToGateKeeperC100","sendToGateKeeperResubmittedC100","produceHearingBundleC100","produceHearingBundleFL100","updateHearingActualsC100","updateHearingActualsFL401","requestSolicitorOrderC100","requestSolicitorOrderFL401","confidentialCheckSOA","recreateApplicationPack","replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100","replyToMessageForLA","createHearingRequest","createMultipleHearingRequest","createHearingRequestReserveListAssist","completefl416AndServe","listWithoutNoticeHearingC100","listOnNoticeHearingFL401","reviewLangAndSmReq" + "checkApplicationC100","checkApplicationResubmittedC100","checkApplicationFL401","checkApplicationResubmittedFL401","addCaseNumber","addCaseNumberResubmitted","sendToGateKeeperFL401","sendToGateKeeperResubmittedFL401","sendToGateKeeperC100","sendToGateKeeperResubmittedC100","produceHearingBundleC100","produceHearingBundleFL100","updateHearingActualsC100","updateHearingActualsFL401","requestSolicitorOrderC100","requestSolicitorOrderFL401","confidentialCheckSOA","recreateApplicationPack","replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100","replyToMessageForLA","createHearingRequest","createMultipleHearingRequest","createHearingRequestReserveListAssist","completefl416AndServe","listWithoutNoticeHearingC100,"listOnNoticeHearingFL401","reviewLangAndSmReq" "dueDateIntervalDays" From 7381868bc24d00a073bc50d8be47856d081f8b8f Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:50:04 +0100 Subject: [PATCH 10/16] Revert "intentionally added error for testing" This reverts commit 74520db5e7ee7ff073548718b0b8a891845668cf. --- src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn b/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn index 4b6f227e..0626c99e 100644 --- a/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn +++ b/src/main/resources/wa-task-configuration-privatelaw-prlapps.dmn @@ -293,7 +293,7 @@ taskAttributes. taskType else if(taskType != null) then taskType else null - "checkApplicationC100","checkApplicationResubmittedC100","checkApplicationFL401","checkApplicationResubmittedFL401","addCaseNumber","addCaseNumberResubmitted","sendToGateKeeperFL401","sendToGateKeeperResubmittedFL401","sendToGateKeeperC100","sendToGateKeeperResubmittedC100","produceHearingBundleC100","produceHearingBundleFL100","updateHearingActualsC100","updateHearingActualsFL401","requestSolicitorOrderC100","requestSolicitorOrderFL401","confidentialCheckSOA","recreateApplicationPack","replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100","replyToMessageForLA","createHearingRequest","createMultipleHearingRequest","createHearingRequestReserveListAssist","completefl416AndServe","listWithoutNoticeHearingC100,"listOnNoticeHearingFL401","reviewLangAndSmReq" + "checkApplicationC100","checkApplicationResubmittedC100","checkApplicationFL401","checkApplicationResubmittedFL401","addCaseNumber","addCaseNumberResubmitted","sendToGateKeeperFL401","sendToGateKeeperResubmittedFL401","sendToGateKeeperC100","sendToGateKeeperResubmittedC100","produceHearingBundleC100","produceHearingBundleFL100","updateHearingActualsC100","updateHearingActualsFL401","requestSolicitorOrderC100","requestSolicitorOrderFL401","confidentialCheckSOA","recreateApplicationPack","replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100","replyToMessageForLA","createHearingRequest","createMultipleHearingRequest","createHearingRequestReserveListAssist","completefl416AndServe","listWithoutNoticeHearingC100","listOnNoticeHearingFL401","reviewLangAndSmReq" "dueDateIntervalDays" From 8f8bddd53ceff9d609e12a557b1c45b6f5c91961 Mon Sep 17 00:00:00 2001 From: yogendraU <66823759+yogendraU@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:56:46 +0100 Subject: [PATCH 11/16] Update wa-task-initiation-privatelaw-prlapps.dmn --- src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn b/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn index 0de3d4a4..e2883670 100644 --- a/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn +++ b/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn @@ -1,6 +1,5 @@ - - + From 955dd37b5d6794fcb0d3fa8094a9535735cc443e Mon Sep 17 00:00:00 2001 From: alokDatta Date: Tue, 23 Jul 2024 13:00:55 +0100 Subject: [PATCH 12/16] remove unneccessary changes --- src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn b/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn index e2883670..d0e72bfb 100644 --- a/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn +++ b/src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn @@ -1,5 +1,6 @@ - + + From 453b73a510ac772d07ef6a666ad7a3706b4cf2d4 Mon Sep 17 00:00:00 2001 From: Yogendra Upasani Date: Tue, 23 Jul 2024 13:05:14 +0100 Subject: [PATCH 13/16] fix test cases --- .../prl/taskconfiguration/dmn/CamundaTaskInitiationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationTest.java index 04d1d859..5ebb64f8 100644 --- a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationTest.java +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationTest.java @@ -37,7 +37,7 @@ void if_this_test_fails_needs_updating_with_your_changes() { DmnDecisionTableImpl logic = (DmnDecisionTableImpl) decision.getDecisionLogic(); assertThat(logic.getInputs().size(), is(20)); assertThat(logic.getOutputs().size(), is(4)); - assertThat(logic.getRules().size(), is(100)); + assertThat(logic.getRules().size(), is(102)); } static Stream scenarioProvider() { From 49b6c0dd2d74d6c1a5f8cf8943a8e861569274d8 Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Tue, 23 Jul 2024 16:31:05 +0100 Subject: [PATCH 14/16] added test cases for all exception record dmn --- ...-privatelaw-privatelaw_exceptionrecord.dmn | 2 +- .../taskconfiguration/DmnDecisionTable.java | 13 ++- ...aTaskCompletionForExceptionRecordTest.java | 66 +++++++++++++ ...skConfigurationForExceptionRecordTest.java | 73 +++++++++++++++ ...aTaskInitiationForExceptionRecordTest.java | 92 +++++++++++++++++++ .../dmn/CamundaTaskInitiationTest.java | 1 - ...aTaskPermissionForExceptionRecordTest.java | 82 +++++++++++++++++ ...aTaskTypeFilterForExceptionRecordTest.java | 46 ++++++++++ 8 files changed, 372 insertions(+), 3 deletions(-) create mode 100644 src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskCompletionForExceptionRecordTest.java create mode 100644 src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationForExceptionRecordTest.java create mode 100644 src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationForExceptionRecordTest.java create mode 100644 src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskPermissionForExceptionRecordTest.java create mode 100644 src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskTypeFilterForExceptionRecordTest.java diff --git a/src/main/resources/wa-task-initiation-privatelaw-privatelaw_exceptionrecord.dmn b/src/main/resources/wa-task-initiation-privatelaw-privatelaw_exceptionrecord.dmn index 01d84047..38b81e71 100644 --- a/src/main/resources/wa-task-initiation-privatelaw-privatelaw_exceptionrecord.dmn +++ b/src/main/resources/wa-task-initiation-privatelaw-privatelaw_exceptionrecord.dmn @@ -1,5 +1,5 @@ - + diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/DmnDecisionTable.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/DmnDecisionTable.java index 984024d8..42a7ef02 100644 --- a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/DmnDecisionTable.java +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/DmnDecisionTable.java @@ -9,7 +9,18 @@ public enum DmnDecisionTable { WA_TASK_CONFIGS("wa-task-configuration-privatelaw-prlapps", "wa-task-configuration-privatelaw-prlapps.dmn"), WA_TASK_INITIATION("wa-task-initiation-privatelaw-prlapps", "wa-task-initiation-privatelaw-prlapps.dmn"), WA_TASK_PERMISSION("wa-task-permissions-privatelaw-prlapps", "wa-task-permissions-privatelaw-prlapps.dmn"), - WA_TASK_TASKTYPEFILTER("wa-task-types-privatelaw-prlapps", "wa-task-types-privatelaw-prlapps.dmn"); + WA_TASK_TASKTYPEFILTER("wa-task-types-privatelaw-prlapps", "wa-task-types-privatelaw-prlapps.dmn"), + + WA_TASK_COMPLETION_EXCEPTION_RECORD("wa-task-completion-privatelaw-privatelaw_exceptionrecord", + "wa-task-completion-privatelaw-privatelaw_exceptionrecord.dmn"), + WA_TASK_CONFIGS_EXCEPTION_RECORD("wa-task-configuration-privatelaw-privatelaw_exceptionrecord", + "wa-task-configuration-privatelaw-privatelaw_exceptionrecord.dmn"), + WA_TASK_INITIATION_EXCEPTION_RECORD("wa-task-initiation-privatelaw-privatelaw_exceptionrecord", + "wa-task-initiation-privatelaw-privatelaw_exceptionrecord.dmn"), + WA_TASK_PERMISSION_EXCEPTION_RECORD("wa-task-permissions-privatelaw-privatelaw_exceptionrecord", + "wa-task-permissions-privatelaw-privatelaw_exceptionrecord.dmn"), + WA_TASK_TASKTYPEFILTER_EXCEPTION_RECORD("wa-task-types-privatelaw-privatelaw_exceptionrecord", + "wa-task-types-privatelaw-privatelaw_exceptionrecord.dmn"); @JsonValue private final String key; diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskCompletionForExceptionRecordTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskCompletionForExceptionRecordTest.java new file mode 100644 index 00000000..28ecf4a1 --- /dev/null +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskCompletionForExceptionRecordTest.java @@ -0,0 +1,66 @@ +package uk.gov.hmcts.reform.prl.taskconfiguration.dmn; + +import org.camunda.bpm.dmn.engine.DmnDecisionTableResult; +import org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.hamcrest.MatcherAssert; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTableBaseUnitTest; + +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + +import static java.util.Arrays.asList; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTable.WA_TASK_COMPLETION_EXCEPTION_RECORD; + +class CamundaTaskCompletionForExceptionRecordTest extends DmnDecisionTableBaseUnitTest { + + @BeforeAll + public static void initialization() { + CURRENT_DMN_DECISION_TABLE = WA_TASK_COMPLETION_EXCEPTION_RECORD; + } + + static Stream scenarioProvider() { + + return Stream.of( + Arguments.of( + "createException", + asList( + Map.of( + "taskType", "reviewExceptionBulkScanRecord", + "completionMode", "Auto" + ) + ) + ) + ); + } + + @ParameterizedTest(name = "event id: {0} post event state: {1}") + @MethodSource("scenarioProvider") + void event_ids_should_evaluate_dmn(String eventId, List> expectation) { + + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue("eventId", eventId); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + MatcherAssert.assertThat(dmnDecisionTableResult.getResultList(), is(expectation)); + } + + @Test + void if_this_test_fails_needs_updating_with_your_changes() { + + //The purpose of this test is to prevent adding new rows without being tested + DmnDecisionTableImpl logic = (DmnDecisionTableImpl) decision.getDecisionLogic(); + assertThat(logic.getInputs().size(), is(1)); + assertThat(logic.getOutputs().size(), is(2)); + assertThat(logic.getRules().size(), is(1)); + } +} diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationForExceptionRecordTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationForExceptionRecordTest.java new file mode 100644 index 00000000..6c61aa21 --- /dev/null +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationForExceptionRecordTest.java @@ -0,0 +1,73 @@ +package uk.gov.hmcts.reform.prl.taskconfiguration.dmn; + + +import org.camunda.bpm.dmn.engine.DmnDecisionTableResult; +import org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTable; +import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTableBaseUnitTest; + +import java.util.Map; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class CamundaTaskConfigurationForExceptionRecordTest extends DmnDecisionTableBaseUnitTest { + + @BeforeAll + public static void initialization() { + CURRENT_DMN_DECISION_TABLE = DmnDecisionTable.WA_TASK_CONFIGS_EXCEPTION_RECORD; + } + + @Test + void if_this_test_fails_needs_updating_with_your_changes() { + //The purpose of this test is to prevent adding new rows without being tested + DmnDecisionTableImpl logic = (DmnDecisionTableImpl) decision.getDecisionLogic(); + assertThat(logic.getInputs().size(), is(2)); + assertThat(logic.getOutputs().size(), is(3)); + assertThat(logic.getRules().size(), is(6)); + } + + @Test + void when_given_task_type_then_return_dueDateIntervalDays() { + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue("taskType", "reviewExceptionBulkScanRecord"); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "dueDateIntervalDays", + "value", "1" + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "majorPriority", + "value", "1000" + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "workType", + "value", "routine_work" + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "roleCategory", + "value", "ADMIN" + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "roleCategory", + "value", "CTSC" + ))); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "name", "description", + "value", "[Review Exception Record Documents](/cases/case-details/${[CASE_REFERENCE]}" + + "/trigger/attachToExistingCase/attachToExistingCase1)" + ))); + } +} diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationForExceptionRecordTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationForExceptionRecordTest.java new file mode 100644 index 00000000..41852639 --- /dev/null +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationForExceptionRecordTest.java @@ -0,0 +1,92 @@ +package uk.gov.hmcts.reform.prl.taskconfiguration.dmn; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.camunda.bpm.dmn.engine.DmnDecisionTableResult; +import org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTable; +import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTableBaseUnitTest; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + +import static java.util.Collections.singletonList; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +class CamundaTaskInitiationForExceptionRecordTest extends DmnDecisionTableBaseUnitTest { + + @BeforeAll + public static void initialization() { + CURRENT_DMN_DECISION_TABLE = DmnDecisionTable.WA_TASK_INITIATION_EXCEPTION_RECORD; + } + + @Test + void if_this_test_fails_needs_updating_with_your_changes() { + //The purpose of this test is to prevent adding new rows without being tested + DmnDecisionTableImpl logic = (DmnDecisionTableImpl) decision.getDecisionLogic(); + assertThat(logic.getInputs().size(), is(3)); + assertThat(logic.getOutputs().size(), is(4)); + assertThat(logic.getRules().size(), is(1)); + } + + static Stream scenarioProvider() { + + return Stream.of( + Arguments.of( + "createException", + null, + mapAdditionalData("{\n" + + " \"Data\":{\n" + + " \"poBoxJurisdiction\":\"" + "PRIVATELAW" + "\"\n" + + " }" + + "}"), + singletonList( + Map.of( + "taskId", "reviewExceptionBulkScanRecord", + "name", "Review Exceptional Record from Bulk Scan", + "processCategories", "bulkScanExceptionalRecord" + ) + ) + ) + ); + } + + @ParameterizedTest(name = "event id: {0} post event state: {1} additional data: {2}") + @MethodSource("scenarioProvider") + void given_multiple_event_ids_should_evaluate_dmn(String eventId, + String postEventState, + Map map, + List> expectation) { + + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue("eventId", eventId); + inputVariables.putValue("postEventState", postEventState); + inputVariables.putValue("AdditionalData", map); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + assertThat(dmnDecisionTableResult.getResultList(), is(expectation)); + } + + private static Map mapAdditionalData(String additionalData) { + ObjectMapper mapper = new ObjectMapper(); + try { + TypeReference> typeRef = new TypeReference<>() { + }; + return mapper.readValue(additionalData, typeRef); + } catch (IOException exp) { + return null; + } + } +} diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationTest.java index 04d1d859..eb7dbcd5 100644 --- a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationTest.java +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskInitiationTest.java @@ -1091,7 +1091,6 @@ void given_multiple_event_ids_should_evaluate_dmn(String eventId, inputVariables.putValue("additionalData", map); DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); - System.out.println(dmnDecisionTableResult); assertThat(dmnDecisionTableResult.getResultList(), is(expectation)); } diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskPermissionForExceptionRecordTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskPermissionForExceptionRecordTest.java new file mode 100644 index 00000000..3bbef276 --- /dev/null +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskPermissionForExceptionRecordTest.java @@ -0,0 +1,82 @@ +package uk.gov.hmcts.reform.prl.taskconfiguration.dmn; + +import org.camunda.bpm.dmn.engine.DmnDecisionTableResult; +import org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTableBaseUnitTest; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTable.WA_TASK_PERMISSION_EXCEPTION_RECORD; + +class CamundaTaskPermissionForExceptionRecordTest extends DmnDecisionTableBaseUnitTest { + + + @BeforeAll + public static void initialization() { + CURRENT_DMN_DECISION_TABLE = WA_TASK_PERMISSION_EXCEPTION_RECORD; + } + + /* + important: permissions rules in the DMN are in order, in case you can't find why your test fails. + */ + @ParameterizedTest + @MethodSource("scenarioProvider") + void given_taskType_and_CaseData_when_evaluate_then_returns_expected_rules( + String taskType, + + List> expectedRules) { + + VariableMap inputVariables = new VariableMapImpl(); + inputVariables.putValue("taskAttributes", Map.of("taskType", taskType)); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + Assertions.assertEquals(expectedRules, dmnDecisionTableResult); + } + + static Stream scenarioProvider() { + return Stream.of( + Arguments.of( + "reviewExceptionBulkScanRecord", + List.of( + Map.of( + "authorisations","SKILL:ABA5:CHECKAPPLICATIONFL401", + "roleCategory", "ADMIN", + "name", "hearing-centre-admin", + "autoAssignable", false, + "value", "Read,Own,CompleteOwn,CancelOwn,UnclaimAssign,Claim,Unclaim,UnassignClaim" + ), + Map.of( + "roleCategory", "CTSC", + "authorisations","SKILL:ABA5:CHECKAPPLICATIONC100", + "autoAssignable", false, + "name", "ctsc", + "value", "Read,Own,CompleteOwn,CancelOwn,UnclaimAssign,Claim,Unclaim,UnassignClaim" + + ) + ) + ) + ); + } + + @Test + void if_this_test_fails_needs_updating_with_your_changes() { + //The purpose of this test is to prevent adding new rows without being tested + DmnDecisionTableImpl logic = (DmnDecisionTableImpl) decision.getDecisionLogic(); + assertThat(logic.getInputs().size(), is(2)); + assertThat(logic.getOutputs().size(), is(7)); + assertThat(logic.getRules().size(), is(2)); + } +} diff --git a/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskTypeFilterForExceptionRecordTest.java b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskTypeFilterForExceptionRecordTest.java new file mode 100644 index 00000000..2cfcac47 --- /dev/null +++ b/src/test/java/uk/gov/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskTypeFilterForExceptionRecordTest.java @@ -0,0 +1,46 @@ +package uk.gov.hmcts.reform.prl.taskconfiguration.dmn; + +import org.camunda.bpm.dmn.engine.DmnDecisionTableResult; +import org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl; +import org.camunda.bpm.engine.variable.VariableMap; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTable; +import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTableBaseUnitTest; + +import java.util.Map; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class CamundaTaskTypeFilterForExceptionRecordTest extends DmnDecisionTableBaseUnitTest { + + @BeforeAll + public static void initialization() { + CURRENT_DMN_DECISION_TABLE = DmnDecisionTable.WA_TASK_TASKTYPEFILTER_EXCEPTION_RECORD; + } + + @Test + void if_this_test_fails_needs_updating_with_your_changes() { + //The purpose of this test is to prevent adding new rows without being tested + DmnDecisionTableImpl logic = (DmnDecisionTableImpl) decision.getDecisionLogic(); + assertThat(logic.getInputs().size(), is(1)); + assertThat(logic.getOutputs().size(), is(2)); + assertThat(logic.getRules().size(), is(1)); + } + + @Test + void given_taskType_and_CaseData_when_evaluate_then_returns_expected_rules() { + + VariableMap inputVariables = new VariableMapImpl(); + + DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); + + assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( + "taskTypeId", "reviewExceptionBulkScanRecord", + "taskTypeName", "Review Private Law Exception Record Message" + ))); + } +} From 263925dc6ab0652e61ac88ca6474bc184b2e59d1 Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Wed, 24 Jul 2024 14:39:36 +0100 Subject: [PATCH 15/16] reverted the exporter version in dmn --- src/main/resources/wa-task-types-privatelaw-prlapps.dmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/wa-task-types-privatelaw-prlapps.dmn b/src/main/resources/wa-task-types-privatelaw-prlapps.dmn index 3194418f..7e081684 100644 --- a/src/main/resources/wa-task-types-privatelaw-prlapps.dmn +++ b/src/main/resources/wa-task-types-privatelaw-prlapps.dmn @@ -1,5 +1,5 @@ - + From 608888aba897a7f57a6c28f75c9213d7e4cd1703 Mon Sep 17 00:00:00 2001 From: mohitvijay45 <107183474+mohitvijay45@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:00:16 +0100 Subject: [PATCH 16/16] reverted the exporter version --- ...wa-task-initiation-privatelaw-privatelaw_exceptionrecord.dmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/wa-task-initiation-privatelaw-privatelaw_exceptionrecord.dmn b/src/main/resources/wa-task-initiation-privatelaw-privatelaw_exceptionrecord.dmn index 38b81e71..01d84047 100644 --- a/src/main/resources/wa-task-initiation-privatelaw-privatelaw_exceptionrecord.dmn +++ b/src/main/resources/wa-task-initiation-privatelaw-privatelaw_exceptionrecord.dmn @@ -1,5 +1,5 @@ - +