diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index 82e782eb5d..34efa9e087 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -35,7 +35,9 @@ def secrets = [ 's2s-${env}': [ secret('microservicekey-am-role-assignment-service', 'AM_ROLE_ASSIGNMENT_SERVICE_SECRET'), secret('microservicekey-am-role-assignment-service', 'BEFTA_S2S_CLIENT_SECRET'), - secret('microservicekey-am-org-role-mapping-service', 'AM_ORG_S2S_SECRET') + secret('microservicekey-am-org-role-mapping-service', 'BEFTA_S2S_CLIENT_SECRET_OF_AM_ORG_ROLE_MAPPING_SERVICE'), + secret('microservicekey-ccd-data', 'BEFTA_S2S_CLIENT_SECRET_OF_CCD_DATA'), + secret('microservicekey-xui-webapp', 'BEFTA_S2S_CLIENT_SECRET_OF_XUI_WEBAPP') ], 'am-${env}': [ secret('role-assignment-service-IDAM-CLIENT-SECRET', 'ROLE_ASSIGNMENT_IDAM_CLIENT_SECRET'), @@ -44,17 +46,11 @@ def secrets = [ secret('test-am-user2-befta-pwd', 'TEST_AM_USER2_BEFTA_PWD'), secret('test-am-user3-befta-pwd', 'TEST_AM_USER3_BEFTA_PWD'), secret('role-assignment-service-IDAM-CLIENT-SECRET', 'OAUTH2_CLIENT_SECRET') - ], - 'ccd-${env}': [ - secret('ccd-data-s2s-secret', 'CCD_DATA_S2S_SECRET') - ], - 'rpx-${env}': [ - secret('xui-webapp', 'XUI_WEBAPP_S2S_SECRET') ] ] // Configure branches to sync with master branch -def branchesToSync = ['demo', 'perftest', 'ithc'] +def branchesToSync = ['demo', 'perftest'] // Vars needed for functional and smoke tests to run against AKS env.IDAM_URL = "https://idam-api.aat.platform.hmcts.net" @@ -64,6 +60,9 @@ env.DEFINITION_STORE_HOST = "http://ccd-definition-store-api-aat.service.core-co env.DEFINITION_STORE_URL_BASE = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal" env.CCD_DATA_STORE_URL = "http://ccd-data-store-api-aat.service.core-compute-aat.internal" env.BEFTA_S2S_CLIENT_ID = "am_role_assignment_service" +env.BEFTA_S2S_CLIENT_ID_OF_AM_ORG_ROLE_MAPPING_SERVICE = "am_org_role_mapping_service" +env.BEFTA_S2S_CLIENT_ID_OF_CCD_DATA = "ccd_data" +env.BEFTA_S2S_CLIENT_ID_OF_XUI_WEBAPP = "xui_webapp" env.OAUTH2_CLIENT_ID = "am_role_assignment" env.OAUTH2_REDIRECT_URI = "http://am-role-assignment-service-aat.service.core-compute-aat.internal/oauth2redirect" env.OAUTH2_ACCESS_TOKEN_TYPE = "OIDC" diff --git a/Jenkinsfile_nightly b/Jenkinsfile_nightly index f7d13a1dca..3b8d0f7de0 100644 --- a/Jenkinsfile_nightly +++ b/Jenkinsfile_nightly @@ -19,9 +19,12 @@ def component = "role-assignment-service" def secrets = [ 's2s-${env}': [ + secret('microservicekey-am-role-assignment-service', 'AM_ROLE_ASSIGNMENT_SERVICE_SECRET'), secret('microservicekey-am-role-assignment-service', 'BEFTA_S2S_CLIENT_SECRET'), secret('microservicekey-am-role-assignment-service', 'S2S_SECRET'), - secret('microservicekey-am-org-role-mapping-service', 'AM_ORG_S2S_SECRET') + secret('microservicekey-am-org-role-mapping-service', 'BEFTA_S2S_CLIENT_SECRET_OF_AM_ORG_ROLE_MAPPING_SERVICE'), + secret('microservicekey-ccd-data', 'BEFTA_S2S_CLIENT_SECRET_OF_CCD_DATA'), + secret('microservicekey-xui-webapp', 'BEFTA_S2S_CLIENT_SECRET_OF_XUI_WEBAPP') ], 'am-${env}': [ secret('role-assignment-service-IDAM-CLIENT-SECRET', 'ROLE_ASSIGNMENT_IDAM_CLIENT_SECRET'), @@ -30,12 +33,6 @@ def secrets = [ secret('test-am-user2-befta-pwd', 'TEST_AM_USER2_BEFTA_PWD'), secret('test-am-user3-befta-pwd', 'TEST_AM_USER3_BEFTA_PWD'), secret('role-assignment-service-IDAM-CLIENT-SECRET', 'OAUTH2_CLIENT_SECRET') - ], - 'ccd-${env}': [ - secret('ccd-data-s2s-secret', 'CCD_DATA_S2S_SECRET') - ], - 'rpx-${env}': [ - secret('xui-webapp', 'XUI_WEBAPP_S2S_SECRET') ] ] @@ -70,6 +67,9 @@ withNightlyPipeline(type, product, component) { env.S2S_URL = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal" env.S2S_URL_BASE = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal" env.BEFTA_S2S_CLIENT_ID = "am_role_assignment_service" + env.BEFTA_S2S_CLIENT_ID_OF_AM_ORG_ROLE_MAPPING_SERVICE = "am_org_role_mapping_service" + env.BEFTA_S2S_CLIENT_ID_OF_CCD_DATA = "ccd_data" + env.BEFTA_S2S_CLIENT_ID_OF_XUI_WEBAPP = "xui_webapp" env.DEFINITION_STORE_HOST = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal" env.DEFINITION_STORE_URL_BASE = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal" env.CCD_DATA_STORE_URL = "http://ccd-data-store-api-aat.service.core-compute-aat.internal" diff --git a/build.gradle b/build.gradle index 7257ff09b1..2ad6d0dda1 100644 --- a/build.gradle +++ b/build.gradle @@ -51,7 +51,7 @@ def versions = [ springSecurity : '5.7.11', springHystrix : '2.1.1.RELEASE', swagger2Version: '2.10.5', - tomcat : '9.0.96', + tomcat : '9.0.97', pact_version : '4.1.7', rest_assured : '3.3.0', cucumber : '5.7.0', diff --git a/src/functionalTest/java/uk/gov/hmcts/reform/roleassignment/befta/RoleAssignmentTestAutomationAdapter.java b/src/functionalTest/java/uk/gov/hmcts/reform/roleassignment/befta/RoleAssignmentTestAutomationAdapter.java index 54f1dc77ed..82ee2d4916 100644 --- a/src/functionalTest/java/uk/gov/hmcts/reform/roleassignment/befta/RoleAssignmentTestAutomationAdapter.java +++ b/src/functionalTest/java/uk/gov/hmcts/reform/roleassignment/befta/RoleAssignmentTestAutomationAdapter.java @@ -3,9 +3,6 @@ import lombok.extern.slf4j.Slf4j; import uk.gov.hmcts.befta.DefaultTestAutomationAdapter; import uk.gov.hmcts.befta.player.BackEndFunctionalTestScenarioContext; -import uk.gov.hmcts.reform.roleassignment.befta.utils.TokenUtils; -import uk.gov.hmcts.reform.roleassignment.befta.utils.UserTokenProviderConfig; -import uk.gov.hmcts.reform.roleassignment.util.EnvironmentVariableUtils; import java.time.LocalDate; import java.util.Date; @@ -17,25 +14,16 @@ public class RoleAssignmentTestAutomationAdapter extends DefaultTestAutomationAd @Override public Object calculateCustomValue(BackEndFunctionalTestScenarioContext scenarioContext, Object key) { - //the docAMUrl is is referring the self link in PR - switch (key.toString()) { - case ("generateUUID"): - return UUID.randomUUID(); - case ("generateCaseId"): - return generateCaseId(); - case ("generateS2STokenForCcd"): - return new TokenUtils().generateServiceToken(buildCcdSpecificConfig()); - case ("generateS2STokenForXui"): - return new TokenUtils().generateServiceToken(buildXuiSpecificConfig()); - case ("generateS2STokenForOrm"): - return new TokenUtils().generateServiceToken(buildOrmSpecificConfig()); - case ("tomorrow"): - return LocalDate.now().plusDays(1); - case ("today"): - return LocalDate.now(); - default: - return super.calculateCustomValue(scenarioContext, key); - } + return switch (key.toString()) { + case ("generateUUID") -> UUID.randomUUID(); + case ("generateCaseId") -> generateCaseId(); + case ("generateS2STokenForCcd") -> super.getNewS2SToken("ccd_data"); + case ("generateS2STokenForOrm") -> super.getNewS2SToken("am_org_role_mapping_service"); + case ("generateS2STokenForXui") -> super.getNewS2SToken("xui_webapp"); + case ("tomorrow") -> LocalDate.now().plusDays(1); + case ("today") -> LocalDate.now(); + default -> super.calculateCustomValue(scenarioContext, key); + }; } private Object generateCaseId() { @@ -44,27 +32,4 @@ private Object generateCaseId() { return time + ("0000000000000000".substring(time.length())); } - private UserTokenProviderConfig buildCcdSpecificConfig() { - UserTokenProviderConfig config = new UserTokenProviderConfig(); - config.setMicroService("ccd_data"); - config.setSecret(System.getenv("CCD_DATA_S2S_SECRET")); - config.setS2sUrl(EnvironmentVariableUtils.getRequiredVariable("IDAM_S2S_URL")); - return config; - } - - private UserTokenProviderConfig buildXuiSpecificConfig() { - UserTokenProviderConfig config = new UserTokenProviderConfig(); - config.setMicroService("xui_webapp"); - config.setSecret(System.getenv("XUI_WEBAPP_S2S_SECRET")); - config.setS2sUrl(EnvironmentVariableUtils.getRequiredVariable("IDAM_S2S_URL")); - return config; - } - - private UserTokenProviderConfig buildOrmSpecificConfig() { - UserTokenProviderConfig config = new UserTokenProviderConfig(); - config.setMicroService("am_org_role_mapping_service"); - config.setSecret(System.getenv("AM_ORG_S2S_SECRET")); - config.setS2sUrl(EnvironmentVariableUtils.getRequiredVariable("IDAM_S2S_URL")); - return config; - } } diff --git a/src/functionalTest/resources/features/F-001/F-001_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-001/F-001_Test_Data_Base.td.json index 33098b2658..8580eeb4bb 100644 --- a/src/functionalTest/resources/features/F-001/F-001_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-001/F-001_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-002/F-002_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-002/F-002_Test_Data_Base.td.json index afcf86c335..47ea2b18dd 100644 --- a/src/functionalTest/resources/features/F-002/F-002_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-002/F-002_Test_Data_Base.td.json @@ -5,5 +5,10 @@ "specs": [ "an active IDAM profile with full permissions" ], - "method": "DELETE" + "method": "DELETE", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-003/F-003_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-003/F-003_Test_Data_Base.td.json index 9875edf550..12e282e9e6 100644 --- a/src/functionalTest/resources/features/F-003/F-003_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-003/F-003_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "uri": "/am/role-assignments/{assignmentId}", "specs": [ "an active IDAM profile with full permissions" - ] + ], + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-005/F-005_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-005/F-005_Test_Data_Base.td.json index 1f5ec6a699..d7c997a2d0 100644 --- a/src/functionalTest/resources/features/F-005/F-005_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-005/F-005_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "GET", - "uri": "/am/role-assignments/actors/{actorId}" + "uri": "/am/role-assignments/actors/{actorId}", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-006/F-006_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-006/F-006_Test_Data_Base.td.json index 10fa9ebdc3..f8811ef5f2 100644 --- a/src/functionalTest/resources/features/F-006/F-006_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-006/F-006_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "/am/role-assignments/query" + "uri": "/am/role-assignments/query", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-007/F-007_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-007/F-007_Test_Data_Base.td.json index eb77f26a85..9159506870 100644 --- a/src/functionalTest/resources/features/F-007/F-007_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-007/F-007_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "GET", - "uri": "am/role-assignments/roles" + "uri": "am/role-assignments/roles", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-008/F-008_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-008/F-008_Test_Data_Base.td.json index 487e39ecac..447dcc726d 100644 --- a/src/functionalTest/resources/features/F-008/F-008_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-008/F-008_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-009/F-009_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-009/F-009_Test_Data_Base.td.json index f9e7401fb9..583e85836b 100644 --- a/src/functionalTest/resources/features/F-009/F-009_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-009/F-009_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "/am/role-assignments/query" + "uri": "/am/role-assignments/query", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-010/F-010_Test_Data_Base-Create.td.json b/src/functionalTest/resources/features/F-010/F-010_Test_Data_Base-Create.td.json index ca9d851e63..a2ede3d2d7 100644 --- a/src/functionalTest/resources/features/F-010/F-010_Test_Data_Base-Create.td.json +++ b/src/functionalTest/resources/features/F-010/F-010_Test_Data_Base-Create.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-010/F-010_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-010/F-010_Test_Data_Base.td.json index b64b1e0aad..c4cb1d07da 100644 --- a/src/functionalTest/resources/features/F-010/F-010_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-010/F-010_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "/am/role-assignments/query/delete" + "uri": "/am/role-assignments/query/delete", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-011/F-011_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-011/F-011_Test_Data_Base.td.json index 7784e2b5f8..824c1688e5 100644 --- a/src/functionalTest/resources/features/F-011/F-011_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-011/F-011_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-012/F-012_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-012/F-012_Test_Data_Base.td.json index 2a7c695d8c..57d24ee24d 100644 --- a/src/functionalTest/resources/features/F-012/F-012_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-012/F-012_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-013/F-013_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-013/F-013_Test_Data_Base.td.json index f92401aff3..fe59d522cb 100644 --- a/src/functionalTest/resources/features/F-013/F-013_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-013/F-013_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-014/F-014_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-014/F-014_Test_Data_Base.td.json index 46f4edcb37..b611acf14b 100644 --- a/src/functionalTest/resources/features/F-014/F-014_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-014/F-014_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-015/F-015_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-015/F-015_Test_Data_Base.td.json index d051561657..da1c7d00f6 100644 --- a/src/functionalTest/resources/features/F-015/F-015_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-015/F-015_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-016/F-016_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-016/F-016_Test_Data_Base.td.json index a053eff1df..75404cad7f 100644 --- a/src/functionalTest/resources/features/F-016/F-016_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-016/F-016_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-017/F-017_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-017/F-017_Test_Data_Base.td.json index 0e1210d8b3..ff7830ded7 100644 --- a/src/functionalTest/resources/features/F-017/F-017_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-017/F-017_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-017/F-017_Test_Data_Base_Get.td.json b/src/functionalTest/resources/features/F-017/F-017_Test_Data_Base_Get.td.json index 69259c7b17..f7087c8ddc 100644 --- a/src/functionalTest/resources/features/F-017/F-017_Test_Data_Base_Get.td.json +++ b/src/functionalTest/resources/features/F-017/F-017_Test_Data_Base_Get.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "GET", - "uri": "/am/role-assignments/actors/{actorId}" + "uri": "/am/role-assignments/actors/{actorId}", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/F-018/F-018_Test_Data_Base.td.json b/src/functionalTest/resources/features/F-018/F-018_Test_Data_Base.td.json index 12e4b2a9dd..1b318405c6 100644 --- a/src/functionalTest/resources/features/F-018/F-018_Test_Data_Base.td.json +++ b/src/functionalTest/resources/features/F-018/F-018_Test_Data_Base.td.json @@ -7,5 +7,10 @@ "an active IDAM profile with full permissions" ], "method": "POST", - "uri": "am/role-assignments" + "uri": "am/role-assignments", + "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + } + } } diff --git a/src/functionalTest/resources/features/common/CreationDataBaseForRoleAssignment.td.json b/src/functionalTest/resources/features/common/CreationDataBaseForRoleAssignment.td.json index 702034c959..51add1745b 100644 --- a/src/functionalTest/resources/features/common/CreationDataBaseForRoleAssignment.td.json +++ b/src/functionalTest/resources/features/common/CreationDataBaseForRoleAssignment.td.json @@ -16,7 +16,7 @@ "request": { "headers": { "Authorization": "[[DEFAULT_AUTO_VALUE]]", - "ServiceAuthorization": "[[DEFAULT_AUTO_VALUE]]", + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}", "X-Correlation-ID": "003352d0-e699-48bc-b6f5-5810411e60af", "Content-Type": "application/json" }, diff --git a/src/functionalTest/resources/features/common/CreationDataForRoleAssignment.td.json b/src/functionalTest/resources/features/common/CreationDataForRoleAssignment.td.json index 3067d164ad..fd6b2f15ba 100644 --- a/src/functionalTest/resources/features/common/CreationDataForRoleAssignment.td.json +++ b/src/functionalTest/resources/features/common/CreationDataForRoleAssignment.td.json @@ -2,6 +2,9 @@ "_guid_": "CreationDataForRoleAssignment", "_extends_": "CreationDataBaseForRoleAssignment", "request": { + "headers": { + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}" + }, "body": { "roleRequest": { "reference": "${[scenarioContext][customValues][generateUUID]}", diff --git a/src/functionalTest/resources/features/common/DeleteDataForRoleAssignments.td.json b/src/functionalTest/resources/features/common/DeleteDataForRoleAssignments.td.json index 7edc3c3351..d9eb6373dc 100644 --- a/src/functionalTest/resources/features/common/DeleteDataForRoleAssignments.td.json +++ b/src/functionalTest/resources/features/common/DeleteDataForRoleAssignments.td.json @@ -15,7 +15,7 @@ "request": { "headers": { "Authorization": "[[DEFAULT_AUTO_VALUE]]", - "ServiceAuthorization": "[[DEFAULT_AUTO_VALUE]]", + "ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}", "X-Correlation-ID": "003352d0-e699-48bc-b6f5-5810411e60af" }, "pathVariables": { diff --git a/src/main/java/uk/gov/hmcts/reform/roleassignment/domain/service/common/ValidationModelService.java b/src/main/java/uk/gov/hmcts/reform/roleassignment/domain/service/common/ValidationModelService.java index 9bff05d8ea..b7babcf30d 100644 --- a/src/main/java/uk/gov/hmcts/reform/roleassignment/domain/service/common/ValidationModelService.java +++ b/src/main/java/uk/gov/hmcts/reform/roleassignment/domain/service/common/ValidationModelService.java @@ -177,12 +177,19 @@ private void runRulesOnAllRequestedAssignments(AssignmentRequest assignmentReque } /** - * This utility method is used to capture the log in drools. + * This utility method is used to capture the log in drools and log at DEBUG level. */ public static void logMsg(final String message) { log.debug(message); } + /** + * This utility method is used to capture the log in drools and log at INFO level. + */ + public static void logInfoMsg(final String message) { + log.info(message); + } + private void getFlagValuesFromDB(Map droolFlagStates) { for (FeatureFlagEnum featureFlagEnum : FeatureFlagEnum.values()) { Boolean status = persistenceService.getStatusByParam(featureFlagEnum.getValue(), environment); diff --git a/src/main/resources/validationrules/core/case-allocator-global.drl b/src/main/resources/validationrules/core/case-allocator-global.drl index 708311821b..8be7bf54ab 100644 --- a/src/main/resources/validationrules/core/case-allocator-global.drl +++ b/src/main/resources/validationrules/core/case-allocator-global.drl @@ -63,6 +63,20 @@ then $ra.log("Case Allocator approved : case_allocator_approve_create_case_role"); update($ra); logMsg("Rule : case_allocator_approve_create_case_role"); + if (!RoleCategory.LEGAL_OPERATIONS.equals($ra.getRoleCategory()) && + !RoleCategory.JUDICIAL.equals($ra.getRoleCategory()) && + !RoleCategory.ADMIN.equals($ra.getRoleCategory()) && + !RoleCategory.OTHER_GOV_DEPT.equals($ra.getRoleCategory()) && + !RoleCategory.CTSC.equals($ra.getRoleCategory())) { + logInfoMsg("Rule : case_allocator_approve_create_case_role" + + " request id: " + ($rq.getId() != null ? $rq.getId() : "null") + + " clientId: " + ($rq.getClientId() != null ? $rq.getClientId() : "null") + + " process: " + ($rq.getProcess() != null ? $rq.getProcess() : "null") + + " reference: " + ($rq.getReference() != null ? $rq.getReference() : "null") + + " roleCategory: " + ($ra.getRoleCategory() != null ? $ra.getRoleCategory() : "null") + + " roleName: " + ($ra.getRoleName() != null ? $ra.getRoleName() : "null") + + " jurisdiction: " + ($c.getJurisdiction() != null ? $c.getJurisdiction() : "null")); + } end; /* @@ -118,4 +132,18 @@ then $ra.log("Case Allocator approved : case_allocator_approve_delete_case_role_all_wa_services"); update($ra); logMsg("Rule : case_allocator_approve_delete_case_role_all_wa_services"); + if (!RoleCategory.LEGAL_OPERATIONS.equals($ra.getRoleCategory()) && + !RoleCategory.JUDICIAL.equals($ra.getRoleCategory()) && + !RoleCategory.ADMIN.equals($ra.getRoleCategory()) && + !RoleCategory.OTHER_GOV_DEPT.equals($ra.getRoleCategory()) && + !RoleCategory.CTSC.equals($ra.getRoleCategory())) { + logInfoMsg("Rule : case_allocator_approve_delete_case_role_all_wa_services" + + " request id: " + ($rq.getId() != null ? $rq.getId() : "null") + + " clientId: " + ($rq.getClientId() != null ? $rq.getClientId() : "null") + + " process: " + ($rq.getProcess() != null ? $rq.getProcess() : "null") + + " reference: " + ($rq.getReference() != null ? $rq.getReference() : "null") + + " roleCategory: " + ($ra.getRoleCategory() != null ? $ra.getRoleCategory() : "null") + + " roleName: " + ($ra.getRoleName() != null ? $ra.getRoleName() : "null") + + " jurisdiction: " + ($c.getJurisdiction() != null ? $c.getJurisdiction() : "null")); + } end; diff --git a/src/main/resources/validationrules/core/organisational-role-mapping-common.drl b/src/main/resources/validationrules/core/organisational-role-mapping-common.drl index 3bc6c01437..1f720b5a1d 100644 --- a/src/main/resources/validationrules/core/organisational-role-mapping-common.drl +++ b/src/main/resources/validationrules/core/organisational-role-mapping-common.drl @@ -7,6 +7,7 @@ import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RequestType; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleCategory; import uk.gov.hmcts.reform.roleassignment.domain.model.enums.RoleType; import function uk.gov.hmcts.reform.roleassignment.domain.service.common.ValidationModelService.logMsg; +import function uk.gov.hmcts.reform.roleassignment.domain.service.common.ValidationModelService.logInfoMsg; /* * Generic rule for validation of roles created by the staff organisational @@ -29,6 +30,14 @@ then $ra.log("Create approved : staff_organisational_role_mapping_service_create"); update($ra); logMsg("Rule : staff_organisational_role_mapping_service_create"); + + if (!"am_org_role_mapping_service".equals($rq.getClientId())) { + logInfoMsg("Rule : staff_organisational_role_mapping_service_create " + + " request id: " + ($rq.getId() != null ? $rq.getId() : "null") + + " clientId: " + ($rq.getClientId() != null ? $rq.getClientId() : "null") + + " process: " + ($rq.getProcess() != null ? $rq.getProcess() : "null") + + " reference: " + ($rq.getReference() != null ? $rq.getReference() : "null")); + } end; /* @@ -50,6 +59,14 @@ then update($ra); logMsg("Rule :: staff_organisational_role_mapping_service_delete"); + + if (!"am_org_role_mapping_service".equals($rq.getClientId())) { + logInfoMsg("Rule : staff_organisational_role_mapping_service_delete " + + " request id: " + ($rq.getId() != null ? $rq.getId() : "null") + + " clientId: " + ($rq.getClientId() != null ? $rq.getClientId() : "null") + + " process: " + ($rq.getProcess() != null ? $rq.getProcess() : "null") + + " reference: " + ($rq.getReference() != null ? $rq.getReference() : "null")); + } end; rule "sscs_system_user_hearings_roles_create"