diff --git a/src/contractTest/java/uk/gov/hmcts/reform/roleassignment/CreateRoleAssignmentProviderTest.java b/src/contractTest/java/uk/gov/hmcts/reform/roleassignment/CreateRoleAssignmentProviderTest.java index d6cc3a252c..77ec41d8bb 100644 --- a/src/contractTest/java/uk/gov/hmcts/reform/roleassignment/CreateRoleAssignmentProviderTest.java +++ b/src/contractTest/java/uk/gov/hmcts/reform/roleassignment/CreateRoleAssignmentProviderTest.java @@ -22,7 +22,6 @@ import uk.gov.hmcts.reform.roleassignment.domain.model.Case; import uk.gov.hmcts.reform.roleassignment.domain.model.ExistingRoleAssignment; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.Classification; -import uk.gov.hmcts.reform.roleassignment.domain.model.enums.FeatureFlagEnum; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleCategory; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleType; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.Status; @@ -125,7 +124,6 @@ private void setInitMock() { when(persistenceService.persistRequest(any())).thenReturn(createEntity()); doReturn(assignmentList).when(persistenceService) .retrieveRoleAssignmentsByQueryRequest(any(), anyInt(), anyInt(), any(), any(), anyBoolean()); - when(persistenceService.getStatusByParam(FeatureFlagEnum.IAC_1_1.getValue(), "pr")).thenReturn(true); when(dataStoreApi.getCaseDataV2(anyString())).thenReturn(Case.builder().id("1212121212121213").jurisdiction( "IA").caseTypeId("Asylum").securityClassification(Classification.PUBLIC).build()); when(securityUtils.getUserId()).thenReturn("3168da13-00b3-41e3-81fa-cbc71ac28a0f"); diff --git a/src/contractTest/java/uk/gov/hmcts/reform/roleassignment/DeleteRoleAssignmentProviderTest.java b/src/contractTest/java/uk/gov/hmcts/reform/roleassignment/DeleteRoleAssignmentProviderTest.java index 9a1a2b158a..c15ffd6a32 100644 --- a/src/contractTest/java/uk/gov/hmcts/reform/roleassignment/DeleteRoleAssignmentProviderTest.java +++ b/src/contractTest/java/uk/gov/hmcts/reform/roleassignment/DeleteRoleAssignmentProviderTest.java @@ -24,7 +24,6 @@ import uk.gov.hmcts.reform.roleassignment.domain.model.ExistingRoleAssignment; import uk.gov.hmcts.reform.roleassignment.domain.model.Request; import uk.gov.hmcts.reform.roleassignment.domain.model.RoleAssignment; -import uk.gov.hmcts.reform.roleassignment.domain.model.enums.FeatureFlagEnum; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.GrantType; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleCategory; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleType; @@ -129,7 +128,6 @@ private void initCommonMocks() { .thenReturn(TestDataBuilder.buildRequestEntity( TestDataBuilder.buildRequest(Status.LIVE, false))); when(securityUtils.getServiceName()).thenReturn("am_org_role_mapping_service"); - when(persistenceService.getStatusByParam(FeatureFlagEnum.IAC_1_1.getValue(), "pr")).thenReturn(true); when(securityUtils.getUserId()).thenReturn(AUTH_USER_ID); JsonNode attributes = buildAttributesFromFile("attributesCase.json"); diff --git a/src/functionalTest/resources/features/F-001/F-001.feature b/src/functionalTest/resources/features/F-001/F-001.feature index 4d9b3a208b..de041af8f1 100644 --- a/src/functionalTest/resources/features/F-001/F-001.feature +++ b/src/functionalTest/resources/features/F-001/F-001.feature @@ -401,7 +401,6 @@ Feature: F-001 : Create Role Assignments And a successful call [to delete role assignments just created above] as in [DeleteDataForRoleAssignments]. @S-202 - @FeatureToggle(RAS:iac_jrd_1_0=on) Scenario: must successfully create lead-judge Case Role Assignment Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -418,7 +417,6 @@ Feature: F-001 : Create Role Assignments And a successful call [to delete role assignments just created above] as in [S-202_DeleteDataForRoleAssignmentsForOrgRoles]. @S-203 - @FeatureToggle(RAS:iac_jrd_1_0=on) Scenario: must successfully create hearing-judge Case Role Assignment Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -435,7 +433,6 @@ Feature: F-001 : Create Role Assignments And a successful call [to delete role assignments just created above] as in [S-203_DeleteDataForRoleAssignmentsForOrgRoles]. @S-204 - @FeatureToggle(RAS:iac_jrd_1_0=on) Scenario: must successfully create ftpa-judge Case Role Assignment Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -452,7 +449,6 @@ Feature: F-001 : Create Role Assignments And a successful call [to delete role assignments just created above] as in [S-204_DeleteDataForRoleAssignmentsForOrgRoles]. @S-205 - @FeatureToggle(RAS:iac_jrd_1_0=on) Scenario: must successfully create hearing-panel-judge Case Role Assignment Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -469,7 +465,6 @@ Feature: F-001 : Create Role Assignments And a successful call [to delete role assignments just created above] as in [S-205_DeleteDataForRoleAssignmentsForOrgRoles]. @S-206 - @FeatureToggle(RAS:iac_jrd_1_0=on) Scenario: must successfully create case-allocator Case Role Assignment Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], diff --git a/src/functionalTest/resources/features/F-008/F-008.feature b/src/functionalTest/resources/features/F-008/F-008.feature index 6dbe6cd868..f999ac7c3e 100644 --- a/src/functionalTest/resources/features/F-008/F-008.feature +++ b/src/functionalTest/resources/features/F-008/F-008.feature @@ -99,7 +99,6 @@ Feature: F-008 : Create And Replace Staff Role Assignments for IAC And a successful call [to delete role assignments just created above] as in [S-106_DeleteDataForRoleAssignmentsForOrgRoles]. @S-201 - @FeatureToggle(RAS:iac_1_1=on) Scenario: must successfully create case-manager Case Role Assignment Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -114,7 +113,6 @@ Feature: F-008 : Create And Replace Staff Role Assignments for IAC And a successful call [to delete role assignments just created above] as in [S-201_DeleteDataForRoleAssignmentsForOrgRoles]. @S-207 - @FeatureToggle(RAS:iac_1_1=on) Scenario: must successfully create case-allocator Case Role Assignment Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -129,7 +127,6 @@ Feature: F-008 : Create And Replace Staff Role Assignments for IAC And a successful call [to delete role assignments just created above] as in [S-207_DeleteDataForRoleAssignmentsForOrgRoles]. @S-208 - @FeatureToggle(RAS:iac_1_1=on) Scenario: must successfully create conflict-of-interest Case Role Assignment for self Given a user with [an active IDAM profile with full permissions], And a user [Befta2 - who is the actor for requested role], @@ -145,7 +142,6 @@ Feature: F-008 : Create And Replace Staff Role Assignments for IAC And a successful call [to delete role assignments just created above] as in [S-208_DeleteDataForRoleAssignmentsForOrgRoles]. @S-209 - @FeatureToggle(RAS:iac_1_1=on) Scenario: must successfully create conflict-of-interest Case Role Assignment for other Actor Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], diff --git a/src/functionalTest/resources/features/F-011/F-011.feature b/src/functionalTest/resources/features/F-011/F-011.feature index 00a56a9c6d..8be2a88c16 100644 --- a/src/functionalTest/resources/features/F-011/F-011.feature +++ b/src/functionalTest/resources/features/F-011/F-011.feature @@ -5,7 +5,6 @@ Feature: F-011 : Create Specific Role Assignments Given an appropriate test context as detailed in the test data source @S-210 - @FeatureToggle(RAS:iac_specific_1_0=on) Scenario: must successfully create specific access requested role for judiciary Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -20,7 +19,6 @@ Feature: F-011 : Create Specific Role Assignments And a successful call [to delete role assignments just created above] as in [S-210_DeleteDataForRoleAssignmentsForRequestedRole]. @S-212 - @FeatureToggle(RAS:iac_specific_1_0=on) Scenario: must successfully create specific access denied by requester Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -35,7 +33,6 @@ Feature: F-011 : Create Specific Role Assignments And a successful call [to delete role assignments just created above] as in [S-212_DeleteDataForRoleAssignmentsForOrgRoles], @S-231 - @FeatureToggle(RAS:iac_specific_1_0=on) Scenario: must successfully create specific access granted role for CIVIL judiciary Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -50,7 +47,6 @@ Feature: F-011 : Create Specific Role Assignments And a successful call [to delete role assignments just created above] as in [S-231_DeleteDataForRoleAssignmentsForOrgRoles]. @S-232 - @FeatureToggle(RAS:iac_specific_1_0=on) Scenario: must successfully create specific access denied role for PRIVATELAW admin Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], diff --git a/src/functionalTest/resources/features/F-012/F-012.feature b/src/functionalTest/resources/features/F-012/F-012.feature index ab4322123a..fb8853dd96 100644 --- a/src/functionalTest/resources/features/F-012/F-012.feature +++ b/src/functionalTest/resources/features/F-012/F-012.feature @@ -5,7 +5,6 @@ Feature: F-012 : Create Challenged Access Role for IA Given an appropriate test context as detailed in the test data source @S-213 - @FeatureToggle(RAS:iac_challenged_1_0=on) Scenario: must successfully create challenged-access-legal-operations role Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -19,7 +18,6 @@ Feature: F-012 : Create Challenged Access Role for IA And a successful call [to delete role assignments just created above] as in [S-213_DeleteDataForRoleAssignmentsForChallengedAccess]. @S-214 - @FeatureToggle(RAS:iac_challenged_1_0=on) Scenario: must successfully create challenged-access-judiciary role Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -33,7 +31,6 @@ Feature: F-012 : Create Challenged Access Role for IA And a successful call [to delete role assignments just created above] as in [S-214_DeleteDataForRoleAssignmentsForChallengedAccess]. @S-215 - @FeatureToggle(RAS:iac_challenged_1_0=on) Scenario: must successfully create challenged-access-admin role Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], diff --git a/src/functionalTest/resources/features/F-013/F-013.feature b/src/functionalTest/resources/features/F-013/F-013.feature index 3080c95dce..4433b340d5 100644 --- a/src/functionalTest/resources/features/F-013/F-013.feature +++ b/src/functionalTest/resources/features/F-013/F-013.feature @@ -5,7 +5,6 @@ Feature: F-013 : Create CIVIL Challenged Access Role Assignments Given an appropriate test context as detailed in the test data source @S-216 - @FeatureToggle(RAS:iac_challenged_1_0=on) Scenario: must successfully create challenged-access-judiciary role Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], diff --git a/src/functionalTest/resources/features/F-014/F-014.feature b/src/functionalTest/resources/features/F-014/F-014.feature index 98f9931a15..ac4d5a34c7 100644 --- a/src/functionalTest/resources/features/F-014/F-014.feature +++ b/src/functionalTest/resources/features/F-014/F-014.feature @@ -5,7 +5,6 @@ Feature: F-014 : Create Challenged Access Role for Privatelaw Given an appropriate test context as detailed in the test data source @S-219 - @FeatureToggle(RAS:iac_challenged_1_0=on) Scenario: must successfully create challenged-access-ctsc role Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], @@ -19,7 +18,6 @@ Feature: F-014 : Create Challenged Access Role for Privatelaw And a successful call [to delete role assignments just created above] as in [S-219_DeleteDataForRoleAssignmentsForChallengedAccess]. @S-220 - @FeatureToggle(RAS:iac_challenged_1_0=on) Scenario: must successfully create challenged-access-legal-ops role Given a user with [an active IDAM profile with full permissions], And a user [Befta1 - who is the actor for requested role], diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/roleassignment/controller/DroolPassAssignmentCreateAndDeleteIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/roleassignment/controller/DroolPassAssignmentCreateAndDeleteIntegrationTest.java index 10f6cca35c..3548dc8de0 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/roleassignment/controller/DroolPassAssignmentCreateAndDeleteIntegrationTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/roleassignment/controller/DroolPassAssignmentCreateAndDeleteIntegrationTest.java @@ -52,7 +52,7 @@ import static uk.gov.hmcts.reform.roleassignment.helper.TestDataBuilder.getRequestedOrgRole; import static uk.gov.hmcts.reform.roleassignment.util.JacksonUtils.convertValueJsonNode; -@TestPropertySource(properties = {"org.request.byPassOrgDroolRule=false", "dbFeature.flags.enable=iac_jrd_1_0"}) +@TestPropertySource(properties = {"org.request.byPassOrgDroolRule=false"}) public class DroolPassAssignmentCreateAndDeleteIntegrationTest extends BaseTest { private static final Logger logger = diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/roleassignment/controller/RoleAssignmentCreateAndDeleteIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/roleassignment/controller/RoleAssignmentCreateAndDeleteIntegrationTest.java index 573230c9b8..5d6eafa649 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/roleassignment/controller/RoleAssignmentCreateAndDeleteIntegrationTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/roleassignment/controller/RoleAssignmentCreateAndDeleteIntegrationTest.java @@ -15,7 +15,6 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -49,7 +48,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static uk.gov.hmcts.reform.roleassignment.domain.model.enums.Status.CREATE_REQUESTED; -@TestPropertySource(properties = {"dbFeature.flags.enable=iac_jrd_1_0"}) public class RoleAssignmentCreateAndDeleteIntegrationTest extends BaseTest { private static final Logger logger = LoggerFactory.getLogger(RoleAssignmentCreateAndDeleteIntegrationTest.class); diff --git a/src/main/java/uk/gov/hmcts/reform/roleassignment/domain/model/enums/FeatureFlagEnum.java b/src/main/java/uk/gov/hmcts/reform/roleassignment/domain/model/enums/FeatureFlagEnum.java index 608cd076e9..b7d8de92aa 100644 --- a/src/main/java/uk/gov/hmcts/reform/roleassignment/domain/model/enums/FeatureFlagEnum.java +++ b/src/main/java/uk/gov/hmcts/reform/roleassignment/domain/model/enums/FeatureFlagEnum.java @@ -1,11 +1,7 @@ package uk.gov.hmcts.reform.roleassignment.domain.model.enums; public enum FeatureFlagEnum { - IAC_1_1("iac_1_1"), - IAC_JRD_1_0("iac_jrd_1_0"), CCD_BYPASS_1_0("ccd_bypass_1_0"), - IAC_SPECIFIC_1_0("iac_specific_1_0"), - IAC_CHALLENGED_1_0("iac_challenged_1_0"), WA_BYPASS_1_0("wa_bypass_1_0"), SSCS_WA_1_0("sscs_wa_1_0"); diff --git a/src/main/resources/db/migration/V2_6__remove_unused_flags_iac.sql b/src/main/resources/db/migration/V2_6__remove_unused_flags_iac.sql new file mode 100644 index 0000000000..d55b7a2d7c --- /dev/null +++ b/src/main/resources/db/migration/V2_6__remove_unused_flags_iac.sql @@ -0,0 +1,6 @@ +-- AM-2521: Remove old unused DB flags for IAC + +delete from flag_config where flag_name='iac_1_1'; +delete from flag_config where flag_name='iac_specific_1_0'; +delete from flag_config where flag_name='iac_challenged_1_0'; +delete from flag_config where flag_name='iac_jrd_1_0'; diff --git a/src/main/resources/validationrules/civil/common/civil-specific-access.drl b/src/main/resources/validationrules/civil/common/civil-specific-access.drl index 146dec2e5f..ad57fb0770 100644 --- a/src/main/resources/validationrules/civil/common/civil-specific-access.drl +++ b/src/main/resources/validationrules/civil/common/civil-specific-access.drl @@ -24,7 +24,6 @@ import java.time.temporal.ChronoUnit; rule "civil_create_specific_access_case_role" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) $rq: Request( // The assigner must be the current user. assignerId == authenticatedUserId, diff --git a/src/main/resources/validationrules/core/challenged-access-global.drl b/src/main/resources/validationrules/core/challenged-access-global.drl index 6fee4c7d61..84e7844b11 100644 --- a/src/main/resources/validationrules/core/challenged-access-global.drl +++ b/src/main/resources/validationrules/core/challenged-access-global.drl @@ -19,7 +19,7 @@ import java.time.ZoneOffset import java.time.temporal.ChronoUnit; /* - * The below rules are required for Challenged Access, It will be toggled on with new IAC_CHALLENGED_1_0 DB flag. + * The below rules are required for Challenged Access. */ /* @@ -27,7 +27,6 @@ import java.time.temporal.ChronoUnit; */ rule "challenged_access_create_case_role" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_CHALLENGED_1_0.getValue()) $rq: Request( // The assigner must be the current user. assignerId == authenticatedUserId, @@ -82,7 +81,6 @@ end; */ rule "challenged_delete_case_role" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_CHALLENGED_1_0.getValue()) $rq: Request( assignerId == authenticatedUserId) $ra: RoleAssignment( diff --git a/src/main/resources/validationrules/core/specific-access-global.drl b/src/main/resources/validationrules/core/specific-access-global.drl index 5cb24caf62..1724f07229 100644 --- a/src/main/resources/validationrules/core/specific-access-global.drl +++ b/src/main/resources/validationrules/core/specific-access-global.drl @@ -19,7 +19,7 @@ import java.time.ZoneOffset import java.time.temporal.ChronoUnit; /* - * The below rules are required for Specific Access, It will be toggled on with new IAC_SPECIFIC_1_0 DB flag. + * The below rules are required for Specific Access. */ @@ -28,7 +28,6 @@ import java.time.temporal.ChronoUnit; */ rule "create_specific_access_requested_case_role_for_self" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) $rq: Request( // The assigner must be the current user. assignerId == authenticatedUserId, @@ -66,7 +65,6 @@ import java.time.temporal.ChronoUnit; */ rule "create_specific_access_denied_case_role_for_self" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) $rq: Request( // The assigner must be the current user. assignerId == authenticatedUserId, @@ -95,7 +93,6 @@ import java.time.temporal.ChronoUnit; */ rule "delete_specific_access_request_of_case_role_for_self" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) $rq: Request( // The assignee and the assigner must be the current user. assignerId == authenticatedUserId) @@ -116,7 +113,6 @@ import java.time.temporal.ChronoUnit; */ rule "create_specific_access_granted_or_denied_case_role" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) $rq: Request( clientId == "xui_webapp", process == "specific-access", @@ -153,7 +149,6 @@ import java.time.temporal.ChronoUnit; */ rule "delete_specific_access_granted_or_denied_case_role" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) $rq: Request( clientId == "xui_webapp", process == "specific-access", @@ -175,7 +170,6 @@ import java.time.temporal.ChronoUnit; rule "specific_access_approver_create_specific_access_case_role" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) $rq: Request( // The assigner must be the current user. assignerId == authenticatedUserId, diff --git a/src/main/resources/validationrules/iac/common/iac-case-role-validation.drl b/src/main/resources/validationrules/iac/common/iac-case-role-validation.drl index 8df51a6295..e9d3e6361c 100644 --- a/src/main/resources/validationrules/iac/common/iac-case-role-validation.drl +++ b/src/main/resources/validationrules/iac/common/iac-case-role-validation.drl @@ -25,7 +25,6 @@ import java.time.ZonedDateTime; */ rule "ia_staff_case_allocator_approved_delete_case_role_v11" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_1_1.getValue()) $ca: CaseAllocatorApproval( roleAssignment.status == Status.DELETE_REQUESTED, roleAssignment.attributes["jurisdiction"].asText() == "IA") diff --git a/src/main/resources/validationrules/iac/common/iac-specific-access.drl b/src/main/resources/validationrules/iac/common/iac-specific-access.drl index 30b93553d9..5f46786876 100644 --- a/src/main/resources/validationrules/iac/common/iac-specific-access.drl +++ b/src/main/resources/validationrules/iac/common/iac-specific-access.drl @@ -24,7 +24,6 @@ import java.time.temporal.ChronoUnit; rule "iac_create_specific_access_case_role" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) $rq: Request( // The assigner must be the current user. assignerId == authenticatedUserId, diff --git a/src/main/resources/validationrules/iac/iac-case-role-validation-judicial.drl b/src/main/resources/validationrules/iac/iac-case-role-validation-judicial.drl index 9ea6eea8d8..13a5d63c8c 100644 --- a/src/main/resources/validationrules/iac/iac-case-role-validation-judicial.drl +++ b/src/main/resources/validationrules/iac/iac-case-role-validation-judicial.drl @@ -24,7 +24,6 @@ import java.time.temporal.ChronoUnit; rule "ia_lead_judge_create_case_roles" when - $f: FeatureFlag(status && flagName == FeatureFlagEnum.IAC_JRD_1_0.getValue()) $ca: CaseAllocatorApproval( roleAssignment.status == Status.CREATE_REQUESTED, roleAssignment.attributes["jurisdiction"].asText() == "IA", @@ -49,7 +48,6 @@ end; rule "ia_hearing_judge_create_case_roles" when - $f: FeatureFlag(status && flagName == FeatureFlagEnum.IAC_JRD_1_0.getValue()) $ca: CaseAllocatorApproval( roleAssignment.status == Status.CREATE_REQUESTED, roleAssignment.attributes["jurisdiction"].asText() == "IA", @@ -74,7 +72,6 @@ end; rule "ia_ftpa_judge_create_case_roles" when - $f: FeatureFlag(status && flagName == FeatureFlagEnum.IAC_JRD_1_0.getValue()) $ca: CaseAllocatorApproval( roleAssignment.status == Status.CREATE_REQUESTED, roleAssignment.attributes["jurisdiction"].asText() == "IA", @@ -99,7 +96,6 @@ end; rule "ia_hearing_panel_judge_create_case_roles" when - $f: FeatureFlag(status && flagName == FeatureFlagEnum.IAC_JRD_1_0.getValue()) $ca: CaseAllocatorApproval( roleAssignment.status == Status.CREATE_REQUESTED, roleAssignment.attributes["jurisdiction"].asText() == "IA", @@ -124,7 +120,6 @@ end; rule "ia_case_allocator_create_case_roles" when - $f: FeatureFlag(status && flagName == FeatureFlagEnum.IAC_JRD_1_0.getValue()) $ca: CaseAllocatorApproval( roleAssignment.status == Status.CREATE_REQUESTED, roleAssignment.attributes["jurisdiction"].asText() == "IA", @@ -149,7 +144,6 @@ end; rule "ia_judicial_case_allocator_approved_delete_case_role_v11" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_JRD_1_0.getValue()) $ca: CaseAllocatorApproval( roleAssignment.status == Status.DELETE_REQUESTED, roleAssignment.attributes["jurisdiction"].asText() == "IA") diff --git a/src/main/resources/validationrules/iac/iac-case-role-validation-legal-ops.drl b/src/main/resources/validationrules/iac/iac-case-role-validation-legal-ops.drl index 989c3fc5e4..93b0da9403 100644 --- a/src/main/resources/validationrules/iac/iac-case-role-validation-legal-ops.drl +++ b/src/main/resources/validationrules/iac/iac-case-role-validation-legal-ops.drl @@ -31,7 +31,6 @@ import java.time.temporal.ChronoUnit; */ rule "ia_case_allocator_approved_create_case_manager_role_v11" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_1_1.getValue()) $ca: CaseAllocatorApproval( roleAssignment.status == Status.CREATE_REQUESTED, roleAssignment.attributes["jurisdiction"].asText() == "IA", @@ -55,7 +54,6 @@ end; */ rule "ia_case_allocator_approved_create_tribunal_caseworker_role_v11" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_1_1.getValue()) $ca: CaseAllocatorApproval( roleAssignment.status == Status.CREATE_REQUESTED, roleAssignment.attributes["jurisdiction"].asText() == "IA", @@ -81,7 +79,6 @@ end; rule "ia_case_allocator_approved_create_case_allocator_role_v11" when - $f : FeatureFlag(status && flagName == FeatureFlagEnum.IAC_1_1.getValue()) $ca: CaseAllocatorApproval( roleAssignment.status == Status.CREATE_REQUESTED, roleAssignment.attributes["jurisdiction"].asText() == "IA", diff --git a/src/test/java/uk/gov/hmcts/reform/roleassignment/controller/FeatureFlagControllerTest.java b/src/test/java/uk/gov/hmcts/reform/roleassignment/controller/FeatureFlagControllerTest.java index dbfce6b2ab..a4e5d6442b 100644 --- a/src/test/java/uk/gov/hmcts/reform/roleassignment/controller/FeatureFlagControllerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/roleassignment/controller/FeatureFlagControllerTest.java @@ -41,14 +41,13 @@ public void setUp() { @Test void getFlagStatus() { - String flagName = "iac_1_1"; + String flagName = "ccd_bypass_1_0"; String env = "pr"; Mockito.when(persistenceService.getStatusByParam(flagName, env)).thenReturn(Boolean.TRUE); ResponseEntity responseEntity = sut.getFeatureFlag(flagName, env); assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); assertTrue((Boolean) Objects.requireNonNull(responseEntity.getBody())); - } @Test @@ -56,8 +55,8 @@ void createFeatureFlag() { FlagRequest flagRequest = FlagRequest.builder() .env("pr") - .flagName("iac_1_1") - .serviceName("iac") + .flagName("ccd_bypass_1_0") + .serviceName("ccd") .status(Boolean.TRUE) .build(); @@ -75,6 +74,5 @@ void createFeatureFlag() { assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); assertNotNull(responseEntity.getBody()); - } } diff --git a/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/common/PersistenceServiceTest.java b/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/common/PersistenceServiceTest.java index a12dcc9a67..d9b581db08 100644 --- a/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/common/PersistenceServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/common/PersistenceServiceTest.java @@ -883,12 +883,12 @@ void postRoleAssignmentsByQueryRequestWithTrueFlagAndPageSizeZero_throwException @Test void getFlagStatus() { - String flagName = "iac_1_1"; + String flagName = "ccd_bypass_1_0"; String env = "pr"; FlagConfig flagConfig = FlagConfig.builder() .env("pr") - .flagName("iac_1_1") - .serviceName("iac") + .flagName("ccd_bypass_1_0") + .serviceName("ccd") .status(Boolean.TRUE) .build(); when(flagConfigRepository.findByFlagNameAndEnv(flagName, env)).thenReturn(flagConfig); @@ -902,8 +902,8 @@ void persistFlagConfig() { FlagConfig flagConfig = FlagConfig.builder() .env("pr") - .flagName("iac_1_1") - .serviceName("iac") + .flagName("ccd_bypass_1_0") + .serviceName("ccd") .status(Boolean.TRUE) .build(); when(flagConfigRepository.save(flagConfig)).thenReturn(flagConfig); @@ -914,12 +914,12 @@ void persistFlagConfig() { @Test void getFlagStatus_False() { - String flagName = "iac_1_1"; + String flagName = "ccd_bypass_1_0"; String env = "pr"; FlagConfig flagConfig = FlagConfig.builder() .env("pr") - .flagName("iac_1_1") - .serviceName("iac") + .flagName("ccd_bypass_1_0") + .serviceName("ccd") .status(Boolean.FALSE) .build(); when(flagConfigRepository.findByFlagNameAndEnv(flagName, env)).thenReturn(flagConfig); diff --git a/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/ChallengedAccessDroolsTest.java b/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/ChallengedAccessDroolsTest.java index 3939db6259..3f0ec5bb8c 100644 --- a/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/ChallengedAccessDroolsTest.java +++ b/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/ChallengedAccessDroolsTest.java @@ -6,9 +6,7 @@ import org.junit.jupiter.params.provider.CsvSource; import uk.gov.hmcts.reform.roleassignment.domain.model.Case; import uk.gov.hmcts.reform.roleassignment.domain.model.ExistingRoleAssignment; -import uk.gov.hmcts.reform.roleassignment.domain.model.FeatureFlag; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.Classification; -import uk.gov.hmcts.reform.roleassignment.domain.model.enums.FeatureFlagEnum; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.GrantType; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleCategory; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleType; @@ -67,10 +65,6 @@ void shouldGrantAccessFor_ChallengedAccess(String jurisdiction, String roleName, ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_CHALLENGED_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode(jurisdiction)); existingAttributes.put("caseType", convertValueJsonNode(caseDetails.getCaseTypeId())); @@ -142,10 +136,6 @@ void shouldGrantAccessFor_ChallengedAccess_MaxAttributes(String jurisdiction, St ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_CHALLENGED_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode(jurisdiction)); existingAttributes.put("caseType", convertValueJsonNode(caseDetails.getCaseTypeId())); @@ -214,10 +204,6 @@ void shouldRejectAccessFor_ChallengedAccess_MaxAttributes_sameRegion(String juri ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_CHALLENGED_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode(jurisdiction)); existingAttributes.put("caseType", convertValueJsonNode(caseDetails.getCaseTypeId())); @@ -273,10 +259,6 @@ void shouldRejectAccessFor_ChallengedAccess_IncorrectRoleName(String roleName, S ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_CHALLENGED_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("IA")); existingAttributes.put("caseType", convertValueJsonNode("Asylum")); @@ -330,10 +312,6 @@ void shouldRejectAccessFor_ChallengedAccess_IncorrectFlagEnabled(String roleName ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("IA")); existingAttributes.put("caseType", convertValueJsonNode("Asylum")); @@ -385,10 +363,6 @@ void shouldRejectAccessFor_ChallengedAccess_InsufficientNotes(String roleName, S ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_CHALLENGED_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("IA")); existingAttributes.put("caseType", convertValueJsonNode("Asylum")); @@ -444,10 +418,6 @@ void shouldRejectAccessFor_ChallengedAccess_PastEndTime(String roleName, String assignmentRequest.getRequestedRoles().stream().findFirst() .get().setEndTime(ZonedDateTime.now().minusHours(1L)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_CHALLENGED_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("IA")); existingAttributes.put("caseType", convertValueJsonNode("Asylum")); @@ -499,11 +469,6 @@ void shouldRejectAccessFor_ChallengedAccess_ExistingPastEndTime(String roleName, ) .build(); - - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_CHALLENGED_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("IA")); existingAttributes.put("caseType", convertValueJsonNode("Asylum")); diff --git a/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/IacJudicialCaseRoleTest.java b/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/IacJudicialCaseRoleTest.java index adb961905e..7b7068dd31 100644 --- a/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/IacJudicialCaseRoleTest.java +++ b/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/IacJudicialCaseRoleTest.java @@ -7,10 +7,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; import uk.gov.hmcts.reform.roleassignment.domain.model.ExistingRoleAssignment; -import uk.gov.hmcts.reform.roleassignment.domain.model.FeatureFlag; import uk.gov.hmcts.reform.roleassignment.domain.model.RoleAssignment; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.Classification; -import uk.gov.hmcts.reform.roleassignment.domain.model.enums.FeatureFlagEnum; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.GrantType; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleCategory; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleType; @@ -52,9 +50,6 @@ void shouldApproveRequestedRoleForCase_CaseAllocator() { IA_CASE_ID, CREATE_REQUESTED); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of( TestDataBuilder.buildExistingRole(requestedRole1.getActorId(), @@ -89,12 +84,6 @@ void shouldDeleteApprovedRequestedRoleForCase_CaseAllocator(String roleName) { "1234567890123456", DELETE_REQUESTED); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - FeatureFlag featureFlag1 = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - featureFlags.add(featureFlag1); HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("IA")); @@ -122,9 +111,6 @@ void shouldApproveRequestedRoleForCase_JudgeRoles_Lead_Hearing() { SPECIFIC, "caseId", IA_CASE_ID, CREATE_REQUESTED); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of( TestDataBuilder.buildExistingRole(requestedRole1.getActorId(), @@ -154,9 +140,6 @@ void shouldApproveRequestedRoleForCase_JudgeRoles_Ftpa_HearingPanel() { IA_CASE_ID, CREATE_REQUESTED); assignmentRequest.setRequestedRoles(List.of(requestedRole1, requestedRole2)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of( TestDataBuilder.buildExistingRole(requestedRole1.getActorId(), @@ -189,9 +172,6 @@ void shouldRejectRequestedRole_WrongRequesterRoleName() { IA_CASE_ID, CREATE_REQUESTED); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of( TestDataBuilder.buildExistingRole(requestedRole1.getActorId(), @@ -216,9 +196,6 @@ void shouldRejectRequestedRoleForWrongData_GrantType() { "1234567890123456", CREATE_REQUESTED); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); Map attributes = new HashMap<>(); attributes.put("jurisdiction", convertValueJsonNode("IA")); @@ -248,10 +225,6 @@ void shouldRejectRequestedRole_WrongAssignerID() { assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - executeDroolRules(List.of( TestDataBuilder.buildExistingRole(requestedRole1.getActorId(), "case-allocator", @@ -277,10 +250,6 @@ void shouldRejectRequestedRoleForDelete_WrongAssignerID() { assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - executeDroolRules(List.of( TestDataBuilder.buildExistingRole(requestedRole1.getActorId(), "case-allocator", @@ -302,10 +271,6 @@ void shouldRejectRequestedRole_MissingCaseId() { SPECIFIC); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - executeDroolRules(List.of( TestDataBuilder.buildExistingRole(requestedRole1.getActorId(), "case-allocator", @@ -328,11 +293,6 @@ void shouldRejectCaseValidation_MissingExistingRA() { "1234567890123456", CREATE_REQUESTED); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - - executeDroolRules(List.of(TestDataBuilder.buildExistingRole(assignmentRequest.getRequest().getAssignerId(), "case-allocator", RoleCategory.JUDICIAL, @@ -356,10 +316,6 @@ void shouldRejectRequestedRoleF_WrongRequesterJurisdiction() { requestedRoles.add(requestedRole1); assignmentRequest.setRequestedRoles(requestedRoles); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - ExistingRoleAssignment existingActorAssignment1 = TestDataBuilder.buildExistingRole( requestedRole1.getActorId(), "case-allocator", @@ -397,10 +353,6 @@ void shouldRejectRequestedRoleF_WrongAssigneeJurisdiction() { requestedRoles.add(requestedRole1); assignmentRequest.setRequestedRoles(requestedRoles); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - ExistingRoleAssignment existingActorAssignment1 = TestDataBuilder.buildExistingRole( requestedRole1.getActorId(), "leadership-judge", @@ -435,9 +387,6 @@ void shouldRejectRequestedRoleForCreate_IACFlagFalse() { "1234567890123456", CREATE_REQUESTED); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_JRD_1_0.getValue()) - .status(false).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of( TestDataBuilder.buildExistingRole(requestedRole1.getActorId(), diff --git a/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/IacStaffCaseRoleTest.java b/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/IacStaffCaseRoleTest.java index 6a5d84416d..3e4001740b 100644 --- a/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/IacStaffCaseRoleTest.java +++ b/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/IacStaffCaseRoleTest.java @@ -10,10 +10,8 @@ import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; import uk.gov.hmcts.reform.roleassignment.domain.model.ExistingRoleAssignment; -import uk.gov.hmcts.reform.roleassignment.domain.model.FeatureFlag; import uk.gov.hmcts.reform.roleassignment.domain.model.RoleAssignment; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.Classification; -import uk.gov.hmcts.reform.roleassignment.domain.model.enums.FeatureFlagEnum; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.GrantType; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RequestType; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleCategory; @@ -390,9 +388,6 @@ void shouldApprovedCaseValidationForTCW_RequesterSTCW_Version1_1() { SPECIFIC, "caseId", IA_CASE_ID, CREATE_REQUESTED); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of(buildExistingRole(requestedRole1.getActorId(), "senior-tribunal-caseworker", @@ -418,9 +413,6 @@ void shouldDeleteApprovedRequestedRoleForCase_V1_1() { SPECIFIC, "caseId", "1234567890123456", DELETE_REQUESTED); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("IA")); @@ -467,9 +459,6 @@ private void verifyCreateCaseRole_V1_1(String roleName, String existingRole, Rol "caseType", convertValueJsonNode("Asylum"), "caseId", convertValueJsonNode(IA_CASE_ID))); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); //Assignee holding existing role executeDroolRules(List.of(buildExistingRole(requestedRole1.getActorId(), @@ -517,9 +506,6 @@ private void rejectCreateCaseRole_V1_1(String existingRole, String caseAllocJuri "caseId", convertValueJsonNode(caseId))); requestedRole1.setRoleType(RoleType.CASE); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); Map attributes = new HashMap<>(); attributes.put("jurisdiction",convertValueJsonNode(caseAllocJurisdiction)); @@ -558,38 +544,6 @@ private void rejectCreateCaseRole_V1_1(String existingRole, String caseAllocJuri assignmentRequest.getRequestedRoles().forEach(ra -> assertEquals(Status.REJECTED, ra.getStatus())); } - @Test - @DisplayName("Reject the case-manager, case-allocator roles with disabled IAC_1_1 flag") - void shouldRejectCaseRolesCreation_disableFlag() { - verifyCreateCaseRole_V1_0("case-manager", "tribunal-caseworker"); - verifyCreateCaseRole_V1_0("case-manager", "senior-tribunal-caseworker"); - verifyCreateCaseRole_V1_0("case-allocator", "case-allocator"); - } - - private void verifyCreateCaseRole_V1_0(String roleName, String existingRole) { - RoleAssignment requestedRole1 = getRequestedCaseRole_ra(RoleCategory.LEGAL_OPERATIONS, roleName, - SPECIFIC, "caseId", - "1234567890123456", CREATE_REQUESTED); - requestedRole1.getAttributes().putAll(Map.of("jurisdiction", convertValueJsonNode("IA"), - "caseType", convertValueJsonNode("Asylum"), - "caseId", convertValueJsonNode("1234567890123456"))); - assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - - executeDroolRules(List.of(buildExistingRole(requestedRole1.getActorId(), - existingRole, - RoleCategory.LEGAL_OPERATIONS, - attributes, RoleType.ORGANISATION, - Classification.PUBLIC, GrantType.STANDARD,Status.LIVE), - buildExistingRole(assignmentRequest.getRequest().getAssignerId(), - "case-allocator", - RoleCategory.LEGAL_OPERATIONS, - attributes, RoleType.ORGANISATION, - Classification.PUBLIC, GrantType.STANDARD,Status.LIVE))); - - //assertion - assignmentRequest.getRequestedRoles().forEach(ra -> assertEquals(Status.REJECTED, ra.getStatus())); - } - @Test @DisplayName("Reject creation of the case-manager role actioned by neither TCW nor STCW." + "expected Actioned by case-allocator") @@ -602,9 +556,6 @@ void shouldRejectCaseManagerRole_NoTCW_NoSTCW() { "caseType", convertValueJsonNode("Asylum"), "caseId", convertValueJsonNode("1234567890123456"))); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of(buildExistingRole(requestedRole1.getActorId(), "case-allocator", @@ -632,9 +583,6 @@ void shouldRejectCaseManagerRoleCreation_NoAssigner() { "caseType", convertValueJsonNode("Asylum"), "caseId", convertValueJsonNode("1234567890123456"))); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of()); @@ -653,9 +601,6 @@ void shouldRejectCaseAllocatorRoleCreation_actionByTCW() { "caseType", convertValueJsonNode("Asylum"), "caseId", convertValueJsonNode("1234567890123456"))); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of(buildExistingRole(requestedRole1.getActorId(), "tribunal-caseworker", @@ -683,9 +628,6 @@ void shouldRejectCaseAllocatorRoleCreation_withWrongMappingFields() { "caseType", convertValueJsonNode("Asylum"), "caseId", convertValueJsonNode("1234567890123456"))); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of(buildExistingRole(requestedRole1.getActorId(), "case-allocator", @@ -720,9 +662,6 @@ private void verifyDeleteCaseRole_V1_1(String roleName, String testType) { "caseType", convertValueJsonNode("Asylum"), "caseId", convertValueJsonNode("1234567890123456"))); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); List existingRoleAssignments = List.of(buildExistingRole(assignmentRequest @@ -764,9 +703,6 @@ void shouldApproveDeleteCaseAllocatorRoles_withDifferentCategory() { "caseType", convertValueJsonNode("Asylum"), "caseId", convertValueJsonNode("1234567890123456"))); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of(buildExistingRole(assignmentRequest.getRequest().getAssignerId(), "case-allocator", @@ -796,9 +732,6 @@ private void deleteCaseRole_V1_1(String roleName, String testType) { "caseType", convertValueJsonNode("Asylum"), "caseId", convertValueJsonNode("1234567890123456"))); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); List existingRoleAssignments = List.of(buildExistingRole(assignmentRequest @@ -837,38 +770,6 @@ private void deleteCaseRole_V1_1(String roleName, String testType) { assignmentRequest.getRequestedRoles().forEach(ra -> assertEquals(Status.DELETE_REJECTED, ra.getStatus())); } - @Test - @DisplayName("Reject delete the case-manager, case-allocator roles with disabled IAC_1_1 flag") - void shouldRejectDeleteCaseRoles_V1_0_diabledFlag() { - verifyDeleteCaseRole_V1_0("case-manager", "tribunal-caseworker"); - verifyDeleteCaseRole_V1_0("case-manager", "senior-tribunal-caseworker"); - verifyDeleteCaseRole_V1_0("case-allocator","case-allocator"); - } - - private void verifyDeleteCaseRole_V1_0(String roleName, String existingRole) { - RoleAssignment requestedRole1 = getRequestedCaseRole_ra(RoleCategory.LEGAL_OPERATIONS, roleName, - SPECIFIC, "caseId", - "1234567890123456", DELETE_REQUESTED); - requestedRole1.getAttributes().putAll(Map.of("jurisdiction", convertValueJsonNode("IA"), - "caseType", convertValueJsonNode("Asylum"), - "caseId", convertValueJsonNode("1234567890123456"))); - assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - - executeDroolRules(List.of(buildExistingRole(requestedRole1.getActorId(), - existingRole, - RoleCategory.LEGAL_OPERATIONS, - attributes, RoleType.ORGANISATION, - Classification.PUBLIC, GrantType.STANDARD,Status.LIVE), - buildExistingRole(assignmentRequest.getRequest().getAssignerId(), - "case-allocator", - RoleCategory.LEGAL_OPERATIONS, - attributes, RoleType.ORGANISATION, - Classification.PUBLIC, GrantType.STANDARD,Status.LIVE))); - - //assertion - assignmentRequest.getRequestedRoles().forEach(ra -> assertEquals(Status.DELETE_REJECTED, ra.getStatus())); - } - @Test @DisplayName("Reject deletion of the case-allocator role without existing Assigner. Expected is case-allocator") void shouldRejectDeleteCaseAllocatorRole_V1_1_noExistingAssigner() { @@ -879,9 +780,6 @@ void shouldRejectDeleteCaseAllocatorRole_V1_1_noExistingAssigner() { "caseType", convertValueJsonNode("Asylum"), "caseId", convertValueJsonNode("1234567890123456"))); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of()); @@ -899,9 +797,6 @@ void shouldRejectDeleteCaseAllocatorRole_V1_1_assignerAsTCW() { "caseType", convertValueJsonNode("Asylum"), "caseId", convertValueJsonNode("1234567890123456"))); assignmentRequest.setRequestedRoles(List.of(requestedRole1)); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_1_1.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); executeDroolRules(List.of(buildExistingRole(assignmentRequest.getRequest().getAssignerId(), "tribunal-caseworker", diff --git a/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/SpecificAccessDroolsTest.java b/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/SpecificAccessDroolsTest.java index 3e9c548c49..325e44be41 100644 --- a/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/SpecificAccessDroolsTest.java +++ b/src/test/java/uk/gov/hmcts/reform/roleassignment/domain/service/drools/SpecificAccessDroolsTest.java @@ -8,9 +8,7 @@ import org.mockito.junit.MockitoJUnitRunner; import uk.gov.hmcts.reform.roleassignment.domain.model.Case; import uk.gov.hmcts.reform.roleassignment.domain.model.ExistingRoleAssignment; -import uk.gov.hmcts.reform.roleassignment.domain.model.FeatureFlag; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.Classification; -import uk.gov.hmcts.reform.roleassignment.domain.model.enums.FeatureFlagEnum; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.GrantType; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleCategory; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleType; @@ -70,10 +68,6 @@ void shouldCreate_SpecificAccessRequested(String jurisdiction, String roleName, ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode(jurisdiction)); existingAttributes.put("caseTypeId", convertValueJsonNode(caseDetails.getCaseTypeId())); @@ -136,10 +130,6 @@ void shouldCreate_SpecificAccessDenied(String jurisdiction, String roleName, Str ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - executeDroolRules(Collections.emptyList()); assignmentRequest.getRequestedRoles().forEach(roleAssignment -> { @@ -196,9 +186,6 @@ void shouldGrantAccessFor_SpecificAccess_CaseAllocator(String caseJurisdiction, ) .build(); - featureFlags.add(FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build()); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode(caseJurisdiction)); existingAttributes.put("caseType", convertValueJsonNode(caseDetails.getCaseTypeId())); @@ -279,10 +266,6 @@ void shouldGrantAccessFor_SpecificAccessGranted_XuiClient(String jurisdiction, S ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode(caseDetails.getJurisdiction())); existingAttributes.put("caseTypeId", convertValueJsonNode(caseDetails.getCaseTypeId())); @@ -355,10 +338,6 @@ void shouldRejectAccessFor_SpecificAccess_CaseAllocator_selfApproval(String juri ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode(jurisdiction)); existingAttributes.put("caseType", convertValueJsonNode(jurisdiction)); @@ -418,10 +397,6 @@ void shouldDeleteAccessFor_SpecificAccess(String rolename,String clientId,String ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - buildExecuteKieSession(); assignmentRequest.getRequestedRoles() @@ -460,10 +435,6 @@ void shouldRejectAccessFor_SpecificAccess_IncorrectFlagEnabled(String roleName, + roleAssignmentAttributes.get("requestedRole").asText() + "/" + ACTORID ).build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_CHALLENGED_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("IA")); existingAttributes.put("caseTypeId", convertValueJsonNode("Asylum")); @@ -518,10 +489,6 @@ void shouldRejectAccessFor_SpecificAccess_InsufficientNotes(String roleName, Str ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("CIVIL")); existingAttributes.put("caseTypeId", convertValueJsonNode("CIVIL")); @@ -573,10 +540,6 @@ void shouldRejectAccessFor_Specific_IncorrectRoleName(String roleName, String ro ) .build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("notIA")); existingAttributes.put("caseTypeId", convertValueJsonNode("notAsylum")); @@ -629,10 +592,6 @@ void shouldRejectAccessFor_SpecificAccess_NotXuiClient(String roleName, String r + roleAssignmentAttributes.get("requestedRole").asText() + "/" + ACTORID ).build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("CIVIL")); existingAttributes.put("caseTypeId", convertValueJsonNode("Asylum")); @@ -685,10 +644,6 @@ void shouldRejectAccessFor_SpecificAccess_CaseAllocator(String roleName, String + roleAssignmentAttributes.get("requestedRole").asText() + "/" + ACTORID ).build(); - FeatureFlag featureFlag = FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build(); - featureFlags.add(featureFlag); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("CIVIL")); existingAttributes.put("caseType", convertValueJsonNode("Asylum")); @@ -746,9 +701,6 @@ void shouldRejectAccessFor_SpecificAccess_CaseAllocatorWithInvalidTime(String ro ) .build(); - featureFlags.add(FeatureFlag.builder().flagName(FeatureFlagEnum.IAC_SPECIFIC_1_0.getValue()) - .status(true).build()); - HashMap existingAttributes = new HashMap<>(); existingAttributes.put("jurisdiction", convertValueJsonNode("CIVIL")); existingAttributes.put("caseType", convertValueJsonNode(caseDetails.getCaseTypeId())); diff --git a/src/test/java/uk/gov/hmcts/reform/roleassignment/util/PersistenceUtilTest.java b/src/test/java/uk/gov/hmcts/reform/roleassignment/util/PersistenceUtilTest.java index c86f359056..11c585a111 100644 --- a/src/test/java/uk/gov/hmcts/reform/roleassignment/util/PersistenceUtilTest.java +++ b/src/test/java/uk/gov/hmcts/reform/roleassignment/util/PersistenceUtilTest.java @@ -244,16 +244,16 @@ void convertEntityWithNullAttributesToExistingRoleAssignment() throws IOExceptio void convertFlagRequestToFlagConfig() { FlagRequest flagRequest = FlagRequest.builder() .env("pr") - .flagName("iac_1_1") - .serviceName("iac") + .flagName("ccd_bypass_1_0") + .serviceName("ccd") .status(Boolean.TRUE) .build(); FlagConfig flagConfig = persistenceUtil.convertFlagRequestToFlagConfig(flagRequest); assertNotNull(flagConfig); assertEquals("pr", flagConfig.getEnv()); - assertEquals("iac_1_1", flagConfig.getFlagName()); - assertEquals("iac", flagConfig.getServiceName()); + assertEquals("ccd_bypass_1_0", flagConfig.getFlagName()); + assertEquals("ccd", flagConfig.getServiceName()); assertEquals(true, flagConfig.getStatus()); }