Skip to content

Commit

Permalink
Merge branch 'master' into FPET-1030-revert-event-access
Browse files Browse the repository at this point in the history
  • Loading branch information
sairamkantheti1 authored Aug 27, 2024
2 parents b8a8c19 + e364285 commit 12468ef
Show file tree
Hide file tree
Showing 13 changed files with 2,354 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@
</rule>
<rule id="DecisionRule_05kvogz">
<inputEntry id="UnaryTests_0cb5u2c">
<text>"manageOrders","serviceOfApplication","createBundle","adminEditAndApproveAnOrder","returnApplication","sendOrReplyToMessages","adminRemoveLegalRepresentativeC100","adminRemoveLegalRepresentativeFL401","c100ManageFlags","fl401ManageFlags","statementOfService"</text>
<text>"manageOrders","serviceOfApplication","createBundle","adminEditAndApproveAnOrder","returnApplication","sendOrReplyToMessages","adminRemoveLegalRepresentativeC100","adminRemoveLegalRepresentativeFL401","c100ManageFlags","fl401ManageFlags","statementOfService","confidentialityCheck"</text>
</inputEntry>
<outputEntry id="LiteralExpression_1o5rfjh">
<text></text>
Expand Down
148 changes: 148 additions & 0 deletions src/main/resources/wa-task-initiation-privatelaw-prlapps.dmn
Original file line number Diff line number Diff line change
Expand Up @@ -6205,6 +6205,154 @@ and additionalData.Data.isHearingTaskNeeded != null) then
<text>"reviewDocsFL401"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1wn7pso">
<inputEntry id="UnaryTests_1asuvu7">
<text>"citizen-case-update"</text>
</inputEntry>
<inputEntry id="UnaryTests_1vern7t">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_15xq37c">
<text>"C100"</text>
</inputEntry>
<inputEntry id="UnaryTests_1v6alki">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_0ogo6vd">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1r9r00s">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_13wuyal">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_19v7544">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_0t9gn32">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_07vxiz5">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1u3qhqn">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_0n6p7aa">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_03r9tqp">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1lxc3vg">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_16ly882">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_04bcoco">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1k9lc6y">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_0dc8h6i">
<text>"CITIZEN"</text>
</inputEntry>
<inputEntry id="UnaryTests_0ygsom1">
<text>"True"</text>
</inputEntry>
<inputEntry id="UnaryTests_1hsfejo">
<text></text>
</inputEntry>
<outputEntry id="LiteralExpression_12kx0zd">
<text>"reviewDocumentsForSolAndCafcassC100"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0imc1ni">
<text>"Review Documents"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1fws54x">
<text></text>
</outputEntry>
<outputEntry id="LiteralExpression_05ix5h3">
<text>"reviewDocsC100"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1f6tsf2">
<inputEntry id="UnaryTests_02gv1t5">
<text>"citizen-case-update"</text>
</inputEntry>
<inputEntry id="UnaryTests_1uvywx2">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1uc2bn2">
<text>"FL401"</text>
</inputEntry>
<inputEntry id="UnaryTests_0mkd7if">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1119i6z">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_03tn7hu">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1mknrft">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_0xqrnpp">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_00zxz09">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_0r2pa9s">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1ajrlbt">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_0u6b7wy">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_0aegcl6">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1yhzjkg">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_05z9sqv">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1t2sjhj">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1q3g6r6">
<text></text>
</inputEntry>
<inputEntry id="UnaryTests_1gzhpwo">
<text>"CITIZEN"</text>
</inputEntry>
<inputEntry id="UnaryTests_0sbwu7m">
<text>"True"</text>
</inputEntry>
<inputEntry id="UnaryTests_022rvyw">
<text></text>
</inputEntry>
<outputEntry id="LiteralExpression_1w8gr8d">
<text>"reviewDocumentsForSolAndCafcassFL401"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1g3ipfl">
<text>"Review Documents"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1guy4q7">
<text></text>
</outputEntry>
<outputEntry id="LiteralExpression_0yakvv8">
<text>"reviewDocsFL401"</text>
</outputEntry>
</rule>
<rule id="DecisionRule_0qv9tjo">
<inputEntry id="UnaryTests_0z8e4ec">
<text>"c100RequestSupport"</text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Arguments> 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<Map<String, String>> 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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ static Stream<Arguments> scenarioProvider() {
Map.of(
"taskType", "confidentialCheckSOA",
"completionMode", "Auto"
)
),
Map.of()
)
),
Arguments.of(
Expand Down
Original file line number Diff line number Diff line change
@@ -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)"
)));
}
}
Loading

0 comments on commit 12468ef

Please sign in to comment.