Skip to content

Commit

Permalink
Feature/cot 928 (#2176)
Browse files Browse the repository at this point in the history
* Added new flag ST_CIC_WA_1_1 and enabled in local/pr

* Amended rule and tests to remove task-supervisor from a number of salaried judicial roles

* Updated functional tests

---------

Co-authored-by: mikebrownccd <104495891+mikebrownccd@users.noreply.github.com>
  • Loading branch information
ben-james-hmcts and mikebrownccd authored Dec 6, 2024
1 parent 4af4a71 commit 5ebe74e
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/functionalTest/resources/features/F-012/F-012.feature
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Feature: F-012 : Create Role Assignments for Special Tribunals Caseworker and Ju
And a successful call [to delete existing role assignments corresponding to the test actorId] as in [S-125_DeleteDataForRoleAssignments].

@S-126
@FeatureToggle(DB:st_cic_wa_1_0=on) @FeatureToggle(EV:JUDICIAL_FTA_ENABLED=on)
@FeatureToggle(DB:st_cic_wa_1_1=on) @FeatureToggle(EV:JUDICIAL_FTA_ENABLED=on)
Scenario: must successfully create judicial role mapping for President of Tribunal - Salaried appointment
Given a user with [an active IDAM profile with full permissions],
And a successful call [to delete existing role assignments corresponding to the test actorId] as in [S-126_DeleteDataForRoleAssignments],
Expand All @@ -88,7 +88,7 @@ Feature: F-012 : Create Role Assignments for Special Tribunals Caseworker and Ju
And a successful call [to delete existing role assignments corresponding to the test actorId] as in [S-126_DeleteDataForRoleAssignments].

@S-127
@FeatureToggle(DB:st_cic_wa_1_0=on) @FeatureToggle(EV:JUDICIAL_FTA_ENABLED=on)
@FeatureToggle(DB:st_cic_wa_1_1=on) @FeatureToggle(EV:JUDICIAL_FTA_ENABLED=on)
Scenario: must successfully create judicial role mapping for Tribunal Judge - Salaried appointment
Given a user with [an active IDAM profile with full permissions],
And a successful call [to delete existing role assignments corresponding to the test actorId] as in [S-127_DeleteDataForRoleAssignments],
Expand Down
20 changes: 0 additions & 20 deletions src/functionalTest/resources/features/F-012/S-127.td.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,6 @@
"workTypes": "access_requests"
},
"authorisations": "[[ANYTHING_PRESENT]]"
},
{
"id" : "[[ANYTHING_PRESENT]]",
"actorIdType": "IDAM",
"actorId": "${[scenarioContext][testData][request][body][queryRequests][1][actorId][0]}",
"roleType": "ORGANISATION",
"roleName": "task-supervisor",
"classification": "PUBLIC",
"grantType": "STANDARD",
"roleCategory": "JUDICIAL",
"readOnly": false,
"beginTime" : "[[ANYTHING_PRESENT]]",
"created" : "[[ANYTHING_PRESENT]]",
"attributes": {
"substantive": "N",
"contractType": "Salaried",
"primaryLocation" : "[[ANYTHING_PRESENT]]",
"jurisdiction": "ST_CIC"
},
"authorisations" : "[[ANYTHING_PRESENT]]"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public enum FeatureFlagEnum {
EMPLOYMENT_WA_1_4("employment_wa_1_4"),
PRIVATELAW_WA_1_2("privatelaw_wa_1_2"),
ST_CIC_WA_1_0("st_cic_wa_1_0"),
ST_CIC_WA_1_1("st_cic_wa_1_1"),
PUBLICLAW_WA_1_1("publiclaw_wa_1_1"),
CIVIL_WA_1_2("civil_wa_1_2"),
CIVIL_WA_1_3("civil_wa_1_3"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('st_cic_wa_1_1', 'local', 'st_cic', 'true');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('st_cic_wa_1_1', 'pr', 'st_cic', 'true');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('st_cic_wa_1_1', 'aat', 'st_cic', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('st_cic_wa_1_1', 'demo', 'st_cic', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('st_cic_wa_1_1', 'perftest', 'st_cic', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('st_cic_wa_1_1', 'ithc', 'st_cic', 'false');
INSERT INTO flag_config (flag_name, env, service_name, status) VALUES ('st_cic_wa_1_1', 'prod', 'st_cic', 'false');
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,14 @@ end;

/*
* 4: ST_CIC "task-supervisor" Org role mapping.
* Made obsolete in COT-928
* To be removed in DTSAM-624
*/

rule "st_cic_task_supervisor_org_role"
when
$f: FeatureFlag(status && flagName == FeatureFlagEnum.ST_CIC_WA_1_0.getValue())
$f2: FeatureFlag(status == false && flagName == FeatureFlagEnum.ST_CIC_WA_1_1.getValue())
$joh: JudicialOfficeHolder(office in ("ST_CIC President of Tribunal-Salaried",
"ST_CIC Principal Judge-Salaried",
"ST_CIC Tribunal Judge-Salaried",
Expand Down Expand Up @@ -199,6 +202,38 @@ then
logMsg("Rule : st_cic_task_supervisor_org_role");
end;

/*
* 4a: ST_CIC "task-supervisor" Org role mapping.
*/

rule "V1_1_st_cic_task_supervisor_org_role"
when
$f: FeatureFlag(status && flagName == FeatureFlagEnum.ST_CIC_WA_1_1.getValue())
$joh: JudicialOfficeHolder(office in ("ST_CIC President of Tribunal-Salaried",
"ST_CIC Principal Judge-Salaried"))
then
Map<String,JsonNode> attribute = new HashMap<>();
attribute.put("jurisdiction", JacksonUtils.convertObjectIntoJsonNode("ST_CIC"));
attribute.put("primaryLocation", JacksonUtils.convertObjectIntoJsonNode($joh.getPrimaryLocation()));
attribute.put("contractType", JacksonUtils.convertObjectIntoJsonNode("Salaried"));
insert(
RoleAssignment.builder()
.actorIdType(ActorIdType.IDAM)
.actorId($joh.getUserId())
.roleCategory(RoleCategory.JUDICIAL)
.roleType(RoleType.ORGANISATION)
.roleName("task-supervisor")
.grantType(GrantType.STANDARD)
.classification(Classification.PUBLIC)
.readOnly(false)
.beginTime($joh.getBeginTime())
.endTime($joh.getEndTime() !=null ? $joh.getEndTime().plusDays(1):null)
.attributes(attribute)
.authorisations($joh.getTicketCodes())
.build());
logMsg("Rule : V1_1_st_cic_task_supervisor_org_role");
end;

/*
* 5: ST_CIC "hmcts-judiciary" Org role mapping.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ class DroolStcicJudicialOfficeMappingTest extends DroolBase {
+ "hmcts-judiciary,specific-access-approver-judiciary'",
"Principal Judge,BBA2,'leadership-judge,senior-judge,judge,case-allocator,task-supervisor,"
+ "hmcts-judiciary,specific-access-approver-judiciary'",
"Tribunal Judge,BBA2,'judge,hmcts-judiciary,case-allocator,task-supervisor,"
"Tribunal Judge,BBA2,'judge,hmcts-judiciary,case-allocator,"
+ "specific-access-approver-judiciary'",
"Judge of the First-tier Tribunal,BBA2,'judge,hmcts-judiciary,case-allocator,task-supervisor,"
"Judge of the First-tier Tribunal,BBA2,'judge,hmcts-judiciary,case-allocator,"
+ "specific-access-approver-judiciary'",
"Circuit Judge,BBA2,'judge,hmcts-judiciary,case-allocator,task-supervisor,"
"Circuit Judge,BBA2,'judge,hmcts-judiciary,case-allocator,"
+ "specific-access-approver-judiciary'",
"Regional Tribunal Judge,BBA2,'judge,hmcts-judiciary,case-allocator,task-supervisor,"
"Regional Tribunal Judge,BBA2,'judge,hmcts-judiciary,case-allocator,"
+ "specific-access-approver-judiciary'",
"Tribunal Member Medical,BBA2,'medical,hmcts-judiciary'"
})
Expand All @@ -86,7 +86,7 @@ void shouldReturnSalariedRoles(String appointment, String appointmentType,

//Execute Kie session
List<RoleAssignment> roleAssignments =
buildExecuteKieSession(getFeatureFlags("st_cic_wa_1_0", true));
buildExecuteKieSession(getAllFeatureFlagsToggleByJurisdiction("ST_CIC", true));

//assertion
assertFalse(roleAssignments.isEmpty());
Expand Down Expand Up @@ -149,7 +149,7 @@ void shouldReturnFeePaidRoles(String appointment, String appointmentType, String

//Execute Kie session
List<RoleAssignment> roleAssignments =
buildExecuteKieSession(getFeatureFlags("st_cic_wa_1_0", true));
buildExecuteKieSession(getAllFeatureFlagsToggleByJurisdiction("ST_CIC", true));

//assertion
assertFalse(roleAssignments.isEmpty());
Expand Down Expand Up @@ -197,7 +197,7 @@ void shouldReturnVoluntaryRoles(String appointment, String appointmentType, Stri

//Execute Kie session
List<RoleAssignment> roleAssignments =
buildExecuteKieSession(getFeatureFlags("st_cic_wa_1_0", true));
buildExecuteKieSession(getAllFeatureFlagsToggleByJurisdiction("ST_CIC", true));

//assertion
assertFalse(roleAssignments.isEmpty());
Expand Down Expand Up @@ -227,7 +227,7 @@ void shouldNotReturnRolesExpiredEndDate(String appointment, String appointmentTy

//Execute Kie session
List<RoleAssignment> roleAssignments =
buildExecuteKieSession(getFeatureFlags("st_cic_wa_1_0", true));
buildExecuteKieSession(getAllFeatureFlagsToggleByJurisdiction("ST_CIC", true));

//assertion
assertTrue(roleAssignments.isEmpty());
Expand All @@ -249,7 +249,7 @@ void shouldNotReturnRolesWrongServiceCode(String appointment, String appointment

//Execute Kie session
List<RoleAssignment> roleAssignments =
buildExecuteKieSession(getFeatureFlags("st_cic_wa_1_0", true));
buildExecuteKieSession(getAllFeatureFlagsToggleByJurisdiction("ST_CIC", true));

//assertion
assertTrue(roleAssignments.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ static void assertCommonRoleAssignmentAttributes(RoleAssignment r) {
+ "hmcts-judiciary,specific-access-approver-judiciary'",
"ST_CIC Principal Judge-Salaried,'leadership-judge,senior-judge,judge,case-allocator,task-supervisor,"
+ "hmcts-judiciary,specific-access-approver-judiciary'",
"ST_CIC Tribunal Judge-Salaried,'judge,hmcts-judiciary,case-allocator,task-supervisor,"
"ST_CIC Tribunal Judge-Salaried,'judge,hmcts-judiciary,case-allocator,"
+ "specific-access-approver-judiciary'",
"ST_CIC Judge of the First-tier Tribunal-Salaried,'judge,hmcts-judiciary,case-allocator,task-supervisor,"
"ST_CIC Judge of the First-tier Tribunal-Salaried,'judge,hmcts-judiciary,case-allocator,"
+ "specific-access-approver-judiciary'",
"ST_CIC Circuit Judge-Salaried,'judge,hmcts-judiciary,case-allocator,task-supervisor,"
"ST_CIC Circuit Judge-Salaried,'judge,hmcts-judiciary,case-allocator,"
+ "specific-access-approver-judiciary'",
"ST_CIC Regional Tribunal Judge-Salaried,'judge,hmcts-judiciary,case-allocator,task-supervisor,"
"ST_CIC Regional Tribunal Judge-Salaried,'judge,hmcts-judiciary,case-allocator,"
+ "specific-access-approver-judiciary'",
"ST_CIC Tribunal Member Medical-Salaried,'medical,hmcts-judiciary'"
})
Expand All @@ -111,7 +111,7 @@ void shouldReturnSalariedRoles(String setOffice, String expectedRoles) {

//Execute Kie session
List<RoleAssignment> roleAssignments =
buildExecuteKieSession(getFeatureFlags("st_cic_wa_1_0", true));
buildExecuteKieSession(getAllFeatureFlagsToggleByJurisdiction("ST_CIC", true));

//assertion
assertFalse(roleAssignments.isEmpty());
Expand Down Expand Up @@ -176,7 +176,7 @@ void shouldReturnFeePaidRoles(String setOffice, String expectedRoles,

//Execute Kie session
List<RoleAssignment> roleAssignments =
buildExecuteKieSession(getFeatureFlags("st_cic_wa_1_0", true));
buildExecuteKieSession(getAllFeatureFlagsToggleByJurisdiction("ST_CIC", true));

//assertion
assertFalse(roleAssignments.isEmpty());
Expand Down Expand Up @@ -204,7 +204,7 @@ void shouldReturnVoluntaryRoles(String setOffice, String expectedRoles) {

//Execute Kie session
List<RoleAssignment> roleAssignments =
buildExecuteKieSession(getFeatureFlags("st_cic_wa_1_0", true));
buildExecuteKieSession(getAllFeatureFlagsToggleByJurisdiction("ST_CIC", true));

//assertion
assertFalse(roleAssignments.isEmpty());
Expand Down

0 comments on commit 5ebe74e

Please sign in to comment.