diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP
index 816cc713b6..670e772df6 100644
--- a/Jenkinsfile_CNP
+++ b/Jenkinsfile_CNP
@@ -20,8 +20,8 @@ def branchesToSync = ['demo', 'ithc', 'perftest', 'develop']
// Variables to switch pipeline logic and wiring per type of build
-def definitionStoreDevelopPr = "PR-575" // This doesn't change frequently, but when it does, only change this value.
-def dataStoreApiDevelopPr = "PR-1260" // This doesn't change frequently, but when it does, only change this value.
+def definitionStoreDevelopPr = "PR-1529" // This doesn't change frequently, but when it does, only change this value.
+def dataStoreApiDevelopPr = "PR-2520" // This doesn't change frequently, but when it does, only change this value.
def prsToUseAat = "PR-1793,PR-1888" // Set this value to a PR number, or add it as a comma-separated value, if it's to follow CI/CD.
def secrets = [
diff --git a/build.gradle b/build.gradle
index 4a5147cb8c..6229a075d1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -36,7 +36,7 @@ ext['spring-framework.version'] = '5.3.27'
ext['jackson.version'] = '2.16.0'
//overriding for easy access to the version for FT testing
ext['beftaFwVersion'] = '9.2.3'
-ext['ccdTestDefinitionVersion'] = '7.25.2'
+ext['ccdTestDefinitionVersion'] = '7.26.2-prerelease-CCD-5329'
configurations {
compileClasspath {
diff --git a/charts/ccd-data-store-api/values.preview.template.yaml b/charts/ccd-data-store-api/values.preview.template.yaml
index 31c16a7631..157cad95f4 100644
--- a/charts/ccd-data-store-api/values.preview.template.yaml
+++ b/charts/ccd-data-store-api/values.preview.template.yaml
@@ -27,7 +27,7 @@ java:
DATA_STORE_DB_PASSWORD: "{{ .Values.postgresql.auth.password}}"
DATA_STORE_DB_OPTIONS: "?stringtype=unspecified"
DATA_STORE_DB_MAX_POOL_SIZE: 10
- DEFINITION_STORE_HOST: http://ccd-definition-store-api-pr-575-java/
+ DEFINITION_STORE_HOST: http://ccd-definition-store-api-pr-1529-java/
USER_PROFILE_HOST: http://ccd-user-profile-api-pr-399-java/
ELASTIC_SEARCH_ENABLED: true # enable whenever ES required on a particular PR
ELASTIC_SEARCH_NODES_DISCOVERY_ENABLED: true
diff --git a/src/aat/resources/features/F-028 - Get Event Trigger for Case V1 Internal/S-044.td.json b/src/aat/resources/features/F-028 - Get Event Trigger for Case V1 Internal/S-044.td.json
index ba2fd13e63..c2bcf50e65 100644
--- a/src/aat/resources/features/F-028 - Get Event Trigger for Case V1 Internal/S-044.td.json
+++ b/src/aat/resources/features/F-028 - Get Event Trigger for Case V1 Internal/S-044.td.json
@@ -1469,6 +1469,58 @@
"delete": true
}
]
+ },
+ {
+ "id" : "CollectionPermissionField",
+ "label" : "A `Collection` of `Text` fields",
+ "hidden" : false,
+ "value" : null,
+ "metadata" : false,
+ "hint_text" : "Zero to many items, here of type `Text`",
+ "field_type" : {
+ "id" : "[[ANYTHING_PRESENT]]",
+ "type" : "Collection",
+ "min" : null,
+ "max" : null,
+ "regular_expression" : null,
+ "fixed_list_items" : [ ],
+ "complex_fields" : [ ],
+ "collection_field_type" : {
+ "id" : "Text",
+ "type" : "Text",
+ "min" : null,
+ "max" : null,
+ "regular_expression" : null,
+ "fixed_list_items" : [ ],
+ "complex_fields" : [ ],
+ "collection_field_type" : null
+ }
+ },
+ "validation_expr" : null,
+ "security_label" : "PUBLIC",
+ "order" : null,
+ "formatted_value" : null,
+ "display_context" : "OPTIONAL",
+ "display_context_parameter" : "#COLLECTION(allowDelete,allowInsert,allowUpdate)",
+ "show_condition" : null,
+ "show_summary_change_option" : false,
+ "show_summary_content_option" : null,
+ "retain_hidden_value" : null,
+ "publish" : false,
+ "publish_as" : null,
+ "acls" : [ {
+ "create" : true,
+ "read" : false,
+ "update" : true,
+ "delete" : true,
+ "role" : "caseworker-autotest1"
+ }, {
+ "create" : true,
+ "read" : true,
+ "update" : true,
+ "delete" : true,
+ "role" : "caseworker-autotest1-private"
+ } ]
}
],
"event_token": "[[ANYTHING_PRESENT]]",
@@ -1576,6 +1628,12 @@
"__ordering__": "unordered",
"__elementId__": "case_field_id"
},
+ {
+ "case_field_id" : "CollectionPermissionField",
+ "order" : 6,
+ "page_column_no" : null,
+ "complex_field_overrides" : [ ]
+ },
{
"case_field_id": "CollectionField",
"order": 2,
diff --git a/src/aat/resources/features/F-051 - Get Profile/S-105.td.json b/src/aat/resources/features/F-051 - Get Profile/S-105.td.json
index b19b445cf1..256225ccb7 100644
--- a/src/aat/resources/features/F-051 - Get Profile/S-105.td.json
+++ b/src/aat/resources/features/F-051 - Get Profile/S-105.td.json
@@ -354,69 +354,7 @@
"name" : "BEFTA Case Type No Read",
"jurisdiction": null,
"events": [],
- "states": [
- {
- "__ordering__": "unordered",
- "__elementId__": "id"
- },
- {
- "id": "TODO",
- "name": "To do",
- "description": null,
- "order": 1,
- "title_display": null,
- "acls": [
- {
- "__ordering__": "unordered",
- "__elementId__": "role"
- },
- {
- "_extends_": "CaseworkerBeftaJurisdiction1AccessControlList"
- },
- {
- "_extends_": "CaseworkerCaaAccessControlList"
- }
- ]
- },
- {
- "id": "IN_PROGRESS",
- "name": "In progress",
- "description": null,
- "order": 2,
- "title_display": null,
- "acls": [
- {
- "__ordering__": "unordered",
- "__elementId__": "role"
- },
- {
- "_extends_": "CaseworkerBeftaJurisdiction1AccessControlList"
- },
- {
- "_extends_": "CaseworkerCaaAccessControlList"
- }
- ]
- },
- {
- "id": "DONE",
- "name": "Done",
- "description": null,
- "order": 3,
- "title_display": null,
- "acls": [
- {
- "__ordering__": "unordered",
- "__elementId__": "role"
- },
- {
- "_extends_": "CaseworkerBeftaJurisdiction1AccessControlList"
- },
- {
- "_extends_": "CaseworkerCaaAccessControlList"
- }
- ]
- }
- ],
+ "states": [],
"searchAliasFields": [],
"searchParties" : [],
"searchCriterias" : [],
diff --git a/src/aat/resources/features/F-051 - Get Profile/S-109.td.json b/src/aat/resources/features/F-051 - Get Profile/S-109.td.json
index 379e698ccc..8a6cd43b80 100644
--- a/src/aat/resources/features/F-051 - Get Profile/S-109.td.json
+++ b/src/aat/resources/features/F-051 - Get Profile/S-109.td.json
@@ -354,69 +354,7 @@
"name" : "BEFTA Case Type No Read",
"jurisdiction": null,
"events": [],
- "states": [
- {
- "__ordering__": "unordered",
- "__elementId__": "id"
- },
- {
- "id": "TODO",
- "name": "To do",
- "description": null,
- "order": 1,
- "title_display": null,
- "acls": [
- {
- "__ordering__": "unordered",
- "__elementId__": "role"
- },
- {
- "_extends_": "CaseworkerBeftaJurisdiction1AccessControlList"
- },
- {
- "_extends_": "CaseworkerCaaAccessControlList"
- }
- ]
- },
- {
- "id": "IN_PROGRESS",
- "name": "In progress",
- "description": null,
- "order": 2,
- "title_display": null,
- "acls": [
- {
- "__ordering__": "unordered",
- "__elementId__": "role"
- },
- {
- "_extends_": "CaseworkerBeftaJurisdiction1AccessControlList"
- },
- {
- "_extends_": "CaseworkerCaaAccessControlList"
- }
- ]
- },
- {
- "id": "DONE",
- "name": "Done",
- "description": null,
- "order": 3,
- "title_display": null,
- "acls": [
- {
- "__ordering__": "unordered",
- "__elementId__": "role"
- },
- {
- "_extends_": "CaseworkerBeftaJurisdiction1AccessControlList"
- },
- {
- "_extends_": "CaseworkerCaaAccessControlList"
- }
- ]
- }
- ],
+ "states": [],
"searchAliasFields": [],
"searchParties" : [],
"searchCriterias" : [],
diff --git a/src/aat/resources/features/F-102 - Get Jurisdictions V1 Internal/S-580.td.json b/src/aat/resources/features/F-102 - Get Jurisdictions V1 Internal/S-580.td.json
index 770dc4a5f2..7bc212a4f5 100644
--- a/src/aat/resources/features/F-102 - Get Jurisdictions V1 Internal/S-580.td.json
+++ b/src/aat/resources/features/F-102 - Get Jurisdictions V1 Internal/S-580.td.json
@@ -575,10 +575,10 @@
"__elementId__": "role"
},
{
- "_extends_": "CaseworkerBeftaJurisdiction1AccessControlList"
+ "_extends_": "CaseworkerBeftaJurisdiction1NoReadAccessControlList"
},
{
- "_extends_": "CaseworkerCaaAccessControlList"
+ "_extends_": "CaseworkerCaaNoReadAccessControlList"
}
]
},
@@ -594,10 +594,10 @@
"__elementId__": "role"
},
{
- "_extends_": "CaseworkerBeftaJurisdiction1AccessControlList"
+ "_extends_": "CaseworkerBeftaJurisdiction1NoReadAccessControlList"
},
{
- "_extends_": "CaseworkerCaaAccessControlList"
+ "_extends_": "CaseworkerCaaNoReadAccessControlList"
}
]
},
@@ -613,10 +613,10 @@
"__elementId__": "role"
},
{
- "_extends_": "CaseworkerBeftaJurisdiction1AccessControlList"
+ "_extends_": "CaseworkerBeftaJurisdiction1NoReadAccessControlList"
},
{
- "_extends_": "CaseworkerCaaAccessControlList"
+ "_extends_": "CaseworkerCaaNoReadAccessControlList"
}
]
}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026.feature b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026.feature
new file mode 100644
index 0000000000..a7f344948d
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026.feature
@@ -0,0 +1,152 @@
+@F-1026
+Feature: F-1026: Submit Case Creation Handle OrganisationProfileField with newCase
+
+ Background: Load test data for the scenario
+ Given an appropriate test context as detailed in the test data source
+
+
+ #=======================================
+ # Submit Case Creation Event: v1_external#/case-details-endpoint/saveCaseDetailsForCaseWorkerUsingPOST
+ #=======================================
+
+ @S-1026.1 #AC-1
+ Scenario: Invoke saveCaseDetailsForCaseWorkerUsingPOST and organisationProfile with no newCase
+ Given a user with [an active profile in CCD]
+ When a request is prepared with appropriate values
+ And the request [contains correctly configured values]
+ And the request [contains some OrganisationPolicy fields with all correct values]
+ And the request [is of caseType where case_data has organisationProfile with no newCase]
+ And it is submitted to call the [Submit case creation as Case worker] operation of [CCD Data Store]
+ Then a positive response is received
+ And the response has all other details as expected
+ And the response [contains updated values for case_data and data_classification]
+
+ @S-1026.2 #AC-2
+ Scenario: Invoke saveCaseDetailsForCaseWorkerUsingPOST with newCase set to No
+ Given a user with [an active profile in CCD]
+ When a request is prepared with appropriate values
+ And the request [contains correctly configured values]
+ And the request [contains some OrganisationPolicy fields with all correct values]
+ And the request [is of caseType where case_data has organisationProfile with newCase set to No]
+ And it is submitted to call the [Submit case creation as Case worker] operation of [CCD Data Store]
+ Then a positive response is received
+ And the response has all other details as expected
+ And the response [contains updated values for case_data and data_classification]
+
+ @S-1026.3 #AC-3
+ Scenario: Invoke saveCaseDetailsForCaseWorkerUsingPOST when OrganisationID is empty
+ Given a user with [an active profile in CCD]
+ When a request is prepared with appropriate values
+ And the request [contains correctly configured values]
+ And the request [contains some OrganisationPolicy fields with all correct values]
+ And the request [is of caseType where case_data has organisationProfile with newCase set to Yes],
+ And the request [caseData Organisation.OrganisationID value is empty value],
+ And it is submitted to call the [Submit case creation as Case worker] operation of [CCD Data Store]
+ Then a positive response is received
+ And the response has all other details as expected
+ And the response [contains updated values for case_data and data_classification]
+
+ @S-1026.4 #AC-4
+ Scenario: case_data has organisationProfile with newCase set to YES and Submit Case Creation Event is invoked on v1_external#/case-details-endpoint/saveCaseDetailsForCaseWorkerUsingPOST
+ Given a user with [an active profile in CCD]
+ When a request is prepared with appropriate values
+ And the request [contains correctly configured values]
+ And the request [is of caseType where case_data case data has Organisation.OrganisationID and organisationProfile with newCase set to Yes]
+ And it is submitted to call the [Submit case creation as Case worker] operation of [CCD Data Store]
+ Then a positive response is received
+ And the response has all other details as expected
+ And the response [contains updated values for case_data and data_classification]
+
+ @S-1026.5 #AC-5
+ Scenario: case_data has multiple organisationProfile with newCase set to YES or No and Submit Case Creation Event is invoked on v1_external#/case-details-endpoint/saveCaseDetailsForCaseWorkerUsingPOST
+ Given a user with [an active profile in CCD]
+ When a request is prepared with appropriate values
+ And the request [contains correctly configured values]
+ And the request [is of caseType where case_data case data has Organisation.OrganisationID and multiple organisationProfile with newCase set to Yes or No]
+ And it is submitted to call the [Submit case creation as Case worker] operation of [CCD Data Store]
+ Then a positive response is received
+ And the response has all other details as expected
+ And the response [contains updated values for case_data and data_classification]
+
+ #=======================================
+ # Submit Event Creation: v2_external#/case-controller/createCaseUsingPOST
+ #=======================================
+
+ @S-1026.6 #AC-06
+ Scenario: Invoke v2_external#/case-controller/createCaseUsingPOST has organisationProfile with newCase set to No
+ Given a user with [an active profile in CCD]
+ When a request is prepared with appropriate values
+ And the request [contains correctly configured values]
+ And the request [contains some OrganisationPolicy fields with all correct values]
+ And the request [is of caseType where case_data has organisationProfile with newCase set to No]
+ And it is submitted to call the [Submit case creation as Case worker (V2)] operation of [CCD Data Store]
+ Then a positive response is received
+ And the response has all other details as expected
+ And the response [contains updated values for data and data_classification]
+
+ @S-1026.7 #AC-07
+ Scenario: Invoke v2_external#/case-controller/createCaseUsingPOST and has organisationProfile with newCase set to Yes
+ Given a user with [an active profile in CCD]
+ When a request is prepared with appropriate values
+ And the request [contains correctly configured values]
+ And the request [contains some OrganisationPolicy fields with all correct values]
+ And the request [is of caseType where case_data has organisationProfile with newCase set to YES]
+ And it is submitted to call the [Submit case creation as Case worker (V2)] operation of [CCD Data Store]
+ Then a positive response is received
+ And the response has all other details as expected
+ And the response [contains updated values for data and data_classification]
+
+ @S-1026.8 #AC-08
+ Scenario: Invoke v2_external#/case-controller/createCaseUsingPOST and has multiple organisationProfile with newCase set to Yes/No
+ Given a user with [an active profile in CCD]
+ When a request is prepared with appropriate values
+ And the request [contains correctly configured values]
+ And the request [contains some OrganisationPolicy fields with all correct values]
+ And the request [is of caseType where case_data has multiple organisationProfile with newCase set to YES/No]
+ And it is submitted to call the [Submit case creation as Case worker (V2)] operation of [CCD Data Store]
+ Then a positive response is received
+ And the response has all other details as expected
+ And the response [contains updated values for data and data_classification]
+
+
+#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+# v1_external#/case-details-endpoint/createCaseEventForCaseWorkerUsingPOST
+#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ @S-1026.9 #AC-09
+ Scenario: Submit Event is invoked on v1_external#/case-details-endpoint/createCaseEventForCaseWorkerUsingPOST and case_data has organisationProfile with newCase set to YES
+ Given a user with [an active profile in CCD]
+ And a successful call [to create a case] as in [F-1026_CreateCasePreRequisiteCaseworker]
+ And a successful call [to get an event token for the case just created] as in [S-1026-GetUpdateEventToken]
+ When a request is prepared with appropriate values
+ And the request [contains a case Id that has just been created as in F-1026_CreateCasePreRequisiteCaseworker]
+ And the request [contains an event token for the case just created above]
+ And the request [contains some OrganisationPolicy fields with all correct values]
+ And the request [is of caseType where case_data case data has Organisation.OrganisationID and organisationProfile with newCase set to Yes]
+ And the request [specifying the case to be updated, as created in F-1026_CreateCasePreRequisiteCaseworker]
+ And it is submitted to call the [Submit event creation as Case worker] operation of [CCD Data Store]
+ Then a positive response is received
+ And the response has all other details as expected
+
+#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+# v2_external#/case-controller/createEventUsingPOST
+#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ @S-1026.10 #AC-10
+ Scenario: Submit Event is invoked on v2_external#/case-controller/createEventUsingPOST and multiple organisationProfile with newCase set to Yes or No
+ Given a user with [an active profile in CCD]
+ And a successful call [to create a case] as in [F-1026_CreateCasePreRequisiteCaseworker]
+
+ When a request is prepared with appropriate values
+ And the request [contains a case Id that has just been created as in F-1026_CreateCasePreRequisiteCaseworker]
+ And the request [contains an event token for the case just created above]
+ And the request [contains some OrganisationPolicy fields with all correct values]
+ And the request [is of caseType where case data has Organisation.OrganisationID and multiple organisationProfile with newCase set to Yes or No]
+ And the request [specifying the case to be updated, as created in F-1026_CreateCasePreRequisiteCaseworker]
+ And it is submitted to call the [Submit event creation (v2_ext)] operation of [CCD Data Store]
+
+ Then a positive response is received
+ And the response has all other details as expected
+
+
+
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_CreateCasePreRequisiteCaseworker.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_CreateCasePreRequisiteCaseworker.td.json
new file mode 100644
index 0000000000..69fee7676e
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_CreateCasePreRequisiteCaseworker.td.json
@@ -0,0 +1,70 @@
+{
+ "_guid_": "F-1026_CreateCasePreRequisiteCaseworker",
+ "_extends_": "Case_Creation_Data_Base",
+ "specs": [
+ "to create a case",
+ "As a prerequisite"
+ ],
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetCreateToken"
+ }
+ ],
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaMasterCaseworker"
+ }
+ },
+ "request": {
+ "pathVariables": {
+ "jid": "BEFTA_MASTER",
+ "ctid": "FT_NewCaseSupplementry"
+ },
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "Yes",
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "event": {
+ "id": "createCase",
+ "summary": "",
+ "description": ""
+ },
+ "event_token": "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}"
+ }
+ },
+
+ "expectedResponse": {
+ "body": {
+ "id": "[[ANYTHING_PRESENT]]",
+ "jurisdiction": "BEFTA_MASTER",
+ "state" : "CaseCreated",
+ "case_type_id": "FT_NewCaseSupplementry",
+ "created_date": "[[ANYTHING_PRESENT]]",
+ "last_modified": "[[ANYTHING_PRESENT]]",
+ "last_state_modified_date": "[[ANYTHING_PRESENT]]",
+ "security_classification": "PUBLIC",
+ "case_data": {
+ "OrganisationPolicyField": {
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "data_classification": {
+ },
+ "supplementary_data" : {
+ "new_case" : {
+ "orgID1" : "true"
+ }
+ }
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_Test_Data_Base.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_Test_Data_Base.td.json
new file mode 100644
index 0000000000..db98fec388
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_Test_Data_Base.td.json
@@ -0,0 +1,41 @@
+{
+ "_guid_": "F-1026_Test_Data_Base",
+ "_extends_": "Case_Creation_Base",
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaMasterCaseworker"
+ }
+ },
+
+ "request": {
+ "pathVariables": {
+ "jid": "BEFTA_MASTER",
+ "ctid": "FT_NewCaseSupplementry"
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "_extends_": "Common_Response_Headers"
+ },
+ "body" : {
+ "id" : "[[ANYTHING_PRESENT]]",
+ "jurisdiction" : "BEFTA_MASTER",
+ "state" : "CaseCreated",
+ "case_type_id" : "FT_NewCaseSupplementry",
+ "version" : 0,
+ "created_date" : "[[ANY_STRING_NOT_NULLABLE]]",
+ "last_modified" : "[[ANY_STRING_NOT_NULLABLE]]",
+ "last_state_modified_date" : "[[ANY_STRING_NOT_NULLABLE]]",
+ "security_classification" : "PUBLIC",
+ "supplementary_data" : null,
+ "after_submit_callback_response" : null,
+ "callback_response_status_code" : null,
+ "callback_response_status" : null,
+ "delete_draft_response_status_code" : null,
+ "delete_draft_response_status" : null
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_Test_Data_Base_V2.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_Test_Data_Base_V2.td.json
new file mode 100644
index 0000000000..f94f087fbf
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_Test_Data_Base_V2.td.json
@@ -0,0 +1,23 @@
+{
+ "_guid_": "F-1026_Test_Data_Base_V2",
+ "_extends_": "Case_Creation_V2_Data_Base",
+
+ "request": {
+ "headers": {
+ "Content-Type": "application/vnd.uk.gov.hmcts.ccd-data-store-api.create-event.v2+json",
+ "experimental": true
+ },
+ "pathVariables": {
+ "CaseTypeID": "FT_NewCaseSupplementry"
+ }
+ },
+
+ "expectedResponse": {
+ "body" : {
+ "_links" : "[[ANYTHING_PRESENT]]",
+ "jurisdiction" : "BEFTA_MASTER",
+ "case_type" : "FT_NewCaseSupplementry",
+ "state" : "CaseCreated"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_Test_Data_Event_Caseworker.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_Test_Data_Event_Caseworker.td.json
new file mode 100644
index 0000000000..4cbcf31f67
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/F-1026_Test_Data_Event_Caseworker.td.json
@@ -0,0 +1,39 @@
+{
+ "_guid_": "F-1026_Test_Data_Event_Caseworker",
+ "_extends_": "Event_Creation_Caseworker_Base",
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaMasterCaseworker"
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "_extends_": "Common_Response_Headers"
+ },
+ "body" : {
+ "id" : "OVERRIDE",
+ "jurisdiction" : "BEFTA_MASTER",
+ "case_type_id" : "FT_NewCaseSupplementry",
+ "state" : "CaseUpdated",
+ "version" : 1,
+ "created_date" : "[[ANY_STRING_NOT_NULLABLE]]",
+ "last_modified" : "[[ANY_STRING_NOT_NULLABLE]]",
+ "last_state_modified_date" : "[[ANY_STRING_NOT_NULLABLE]]",
+ "security_classification" : "PUBLIC",
+ "supplementary_data" : null,
+ "after_submit_callback_response" : null,
+ "callback_response_status_code" : null,
+ "callback_response_status" : null,
+ "delete_draft_response_status_code" : null,
+ "delete_draft_response_status" : null,
+
+ "case_data" : {
+ },
+ "data_classification": {
+ }
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026-GetUpdateEventToken.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026-GetUpdateEventToken.td.json
new file mode 100644
index 0000000000..d3ef765e77
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026-GetUpdateEventToken.td.json
@@ -0,0 +1,30 @@
+{
+ "title": "should create an event token for correct inputs",
+ "_guid_": "S-1026-GetUpdateEventToken",
+ "_extends_": "Token_Creation_Data_For_Master_Caseworker_Case_Creation",
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaMasterCaseworker"
+ }
+ },
+
+ "request": {
+ "pathVariables": {
+ "cid": "${[scenarioContext][siblingContexts][F-1026_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}"
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "Common_200_Response",
+ "headers": {
+ "Content-Encoding": "gzip",
+ "Content-Length": "[[ANYTHING_PRESENT]]"
+ },
+ "body": {
+ "token": "[[ANYTHING_PRESENT]]",
+ "case_details": "[[ANYTHING_PRESENT]]",
+ "event_id": "updateCase"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.1.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.1.td.json
new file mode 100644
index 0000000000..e4be5d01a1
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.1.td.json
@@ -0,0 +1,68 @@
+{
+ "_guid_": "S-1026.1",
+ "_extends_": "F-1026_Test_Data_Base",
+ "title": "Invoke saveCaseDetailsForCaseWorkerUsingPOST and organisationProfile with no newCase",
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetCreateToken"
+ }
+ ],
+ "specs": [
+ "an active profile in CCD",
+ "contains some OrganisationPolicy fields with all correct values",
+ "is of caseType where case_data has organisationProfile with no newCase",
+ "Submit case creation as Case worker",
+ "contains correctly configured values",
+ "contains updated values for case_data and data_classification"
+ ],
+ "request": {
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "event": {
+ "id": "createCase"
+ },
+ "event_token": "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}"
+ }
+ },
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "Content-Encoding": "gzip",
+ "vary": "accept-encoding",
+ "Content-Length": "[[ANYTHING_PRESENT]]"
+ },
+ "body": {
+ "id": "[[ANYTHING_PRESENT]]",
+ "jurisdiction": "BEFTA_MASTER",
+ "case_type_id": "FT_NewCaseSupplementry",
+ "created_date": "[[ANYTHING_PRESENT]]",
+ "last_modified": "[[ANYTHING_PRESENT]]",
+ "last_state_modified_date": "[[ANYTHING_PRESENT]]",
+ "security_classification": "PUBLIC",
+ "case_data": {
+ "OrganisationPolicyField" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID1",
+ "OrganisationName" : "orgName1"
+ }
+ }
+ },
+ "data_classification": {
+ }
+ },
+ "supplementary_data": null,
+ "after_submit_callback_response": null,
+ "callback_response_status_code": null,
+ "callback_response_status": null,
+ "delete_draft_response_status_code": null,
+ "delete_draft_response_status": null
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.10.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.10.td.json
new file mode 100644
index 0000000000..d75dfd676b
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.10.td.json
@@ -0,0 +1,109 @@
+{
+ "_guid_": "S-1026.10",
+ "_extends_": "SubmitEvent_v2Ext__PositiveResponse_Base",
+
+ "title": "Submit Event Creation is invoked on v2_external#/case-controller/createEventUsingPOST and multiple organisationProfile with newCase set to Yes or No",
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetUpdateTokenCaseworker"
+ }
+ ],
+
+ "specs": [
+ "an active profile in CCD",
+ "contains a case Id that has just been created as in F-1026_CreateCasePreRequisiteCaseworker",
+ "contains an event token for the case just created above",
+ "contains some OrganisationPolicy fields with all correct values",
+ "is of caseType where case data has Organisation.OrganisationID and multiple organisationProfile with newCase set to Yes or No",
+ "contains correctly configured OrganisationPolicy field in F-1026_CreateCasePreRequisiteCaseworker",
+ "specifying the case to be updated, as created in F-1026_CreateCasePreRequisiteCaseworker"
+ ],
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaMasterCaseworker"
+ }
+ },
+
+ "request": {
+ "pathVariables": {
+ "cid": "${[scenarioContext][childContexts][F-1026_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}"
+ },
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "Yes",
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ },
+ "OrganisationPolicyField3" : {
+ "newCase": "Yes",
+ "Organisation": {
+ "OrganisationID": "orgID3",
+ "OrganisationName": "orgName3"
+ }
+ },
+ "OrganisationPolicyField5" : {
+ "newCase" : "no",
+ "Organisation" : {
+ "OrganisationID" : "orgID2a",
+ "OrganisationName" : "orgName2a"
+ }
+ },
+ "OrganisationPolicyField4" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID2",
+ "OrganisationName" : "orgName2"
+ }
+ }
+ },
+ "event": {
+ "id": "updateCase",
+ "summary": "",
+ "description": ""
+ },
+ "event_token" : "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}"
+ }
+ },
+
+ "expectedResponse": {
+ "body" : {
+ "id" : "[[ANYTHING_PRESENT]]",
+
+ "jurisdiction" : "BEFTA_MASTER",
+ "case_type" : "FT_NewCaseSupplementry",
+
+ "state" : "CaseUpdated",
+
+ "data" : {
+ "OrganisationPolicyField" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID1",
+ "OrganisationName" : "orgName1"
+ }
+ },
+ "OrganisationPolicyField3" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID3",
+ "OrganisationName" : "orgName3"
+ }
+ },
+ "OrganisationPolicyField5" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID2a",
+ "OrganisationName" : "orgName2a"
+ }
+ },
+ "OrganisationPolicyField4" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID2",
+ "OrganisationName" : "orgName2"
+ }
+ }
+ },
+ "data_classification": {}
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.2.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.2.td.json
new file mode 100644
index 0000000000..f99ebf9da4
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.2.td.json
@@ -0,0 +1,69 @@
+{
+ "_guid_": "S-1026.2",
+ "_extends_": "F-1026_Test_Data_Base",
+ "title": "Invoke saveCaseDetailsForCaseWorkerUsingPOST has organisationProfile with newCase set to No",
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetCreateToken"
+ }
+ ],
+ "specs": [
+ "an active profile in CCD",
+ "contains some OrganisationPolicy fields with all correct values",
+ "is of caseType where case_data has organisationProfile with newCase set to No",
+ "Submit case creation as Case worker",
+ "contains correctly configured values",
+ "contains updated values for case_data and data_classification"
+
+ ],
+ "request": {
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "No",
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "event": {
+ "id": "createCase"
+ },
+ "event_token": "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}"
+ }
+ },
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "Content-Encoding": "gzip",
+ "vary": "accept-encoding",
+ "Content-Length": "[[ANYTHING_PRESENT]]"
+ },
+ "body": {
+ "id": "[[ANYTHING_PRESENT]]",
+ "jurisdiction": "BEFTA_MASTER",
+ "case_type_id": "FT_NewCaseSupplementry",
+ "created_date": "[[ANYTHING_PRESENT]]",
+ "last_modified": "[[ANYTHING_PRESENT]]",
+ "last_state_modified_date": "[[ANYTHING_PRESENT]]",
+ "security_classification": "PUBLIC",
+ "case_data": {
+ "OrganisationPolicyField" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID1",
+ "OrganisationName" : "orgName1"
+ }
+ }
+ },
+ "data_classification" : {
+ }
+ },
+ "supplementary_data" : null,
+ "after_submit_callback_response": null,
+ "callback_response_status_code": null,
+ "callback_response_status": null,
+ "delete_draft_response_status_code": null,
+ "delete_draft_response_status": null
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.3.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.3.td.json
new file mode 100644
index 0000000000..ab332ece59
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.3.td.json
@@ -0,0 +1,69 @@
+{
+ "_guid_": "S-1026.3",
+ "_extends_": "F-1026_Test_Data_Base",
+ "title": "Invoke saveCaseDetailsForCaseWorkerUsingPOST when OrganisationID is empty",
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetCreateToken"
+ }
+ ],
+ "specs": [
+ "an active profile in CCD",
+ "contains some OrganisationPolicy fields with all correct values",
+ "is of caseType where case_data has organisationProfile with newCase set to Yes",
+ "caseData Organisation.OrganisationID value is empty value",
+ "Submit case creation as Case worker",
+ "contains correctly configured values",
+ "contains updated values for case_data and data_classification"
+
+ ],
+ "request": {
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "Yes",
+ "Organisation": {
+ "OrganisationID": "",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "event": {
+ "id": "createCase"
+ },
+ "event_token": "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}"
+ }
+ },
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "Content-Encoding": "gzip",
+ "vary": "accept-encoding",
+ "Content-Length": "[[ANYTHING_PRESENT]]"
+ },
+ "body": {
+ "id": "[[ANYTHING_PRESENT]]",
+ "jurisdiction": "BEFTA_MASTER",
+ "case_type_id": "FT_NewCaseSupplementry",
+ "created_date": "[[ANYTHING_PRESENT]]",
+ "last_modified": "[[ANYTHING_PRESENT]]",
+ "last_state_modified_date": "[[ANYTHING_PRESENT]]",
+ "security_classification": "PUBLIC",
+ "case_data": {
+ "OrganisationPolicyField": {
+ "Organisation": {
+ "OrganisationID": "",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "data_classification" : {}
+ },
+ "supplementary_data" : null,
+ "after_submit_callback_response": null,
+ "callback_response_status_code": null,
+ "callback_response_status": null,
+ "delete_draft_response_status_code": null,
+ "delete_draft_response_status": null
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.4.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.4.td.json
new file mode 100644
index 0000000000..edbc233e91
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.4.td.json
@@ -0,0 +1,75 @@
+{
+ "_guid_": "S-1026.4",
+ "_extends_": "F-1026_Test_Data_Base",
+ "title": "Invoke saveCaseDetailsForCaseWorkerUsingPOST where case_data has organisationProfile with newCase set to YES",
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetCreateToken"
+ }
+ ],
+ "specs": [
+ "an active profile in CCD",
+ "contains some OrganisationPolicy fields with all correct values",
+ "is of caseType where case_data case data has Organisation.OrganisationID and organisationProfile with newCase set to Yes",
+ "Submit case creation as Case worker",
+ "contains correctly configured values",
+ "contains updated values for case_data and data_classification"
+
+ ],
+ "request": {
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "yes",
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "event": {
+ "id": "createCase"
+ },
+ "event_token": "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}",
+ "event_data": {
+ }
+ }
+ },
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "Content-Encoding": "gzip",
+ "vary": "accept-encoding",
+ "Content-Length": "[[ANYTHING_PRESENT]]"
+ },
+ "body": {
+ "id": "[[ANYTHING_PRESENT]]",
+ "jurisdiction": "BEFTA_MASTER",
+ "case_type_id": "FT_NewCaseSupplementry",
+ "created_date": "[[ANYTHING_PRESENT]]",
+ "last_modified": "[[ANYTHING_PRESENT]]",
+ "last_state_modified_date": "[[ANYTHING_PRESENT]]",
+ "security_classification": "PUBLIC",
+ "case_data": {
+ "OrganisationPolicyField": {
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "data_classification": {},
+ "supplementary_data": {
+ "new_case":
+ {
+ "orgID1": "true"
+ }
+ },
+ "after_submit_callback_response": null,
+ "callback_response_status_code": null,
+ "callback_response_status": null,
+ "delete_draft_response_status_code": null,
+ "delete_draft_response_status": null
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.5.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.5.td.json
new file mode 100644
index 0000000000..ee81a8fa2c
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.5.td.json
@@ -0,0 +1,114 @@
+{
+ "_guid_": "S-1026.5",
+ "_extends_": "F-1026_Test_Data_Base",
+ "title": "Invoke saveCaseDetailsForCaseWorkerUsingPOST where case_data has multiple organisationProfile with newCase set to YES or NO",
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetCreateToken"
+ }
+ ],
+ "specs": [
+ "an active profile in CCD",
+ "contains some OrganisationPolicy fields with all correct values",
+ "is of caseType where case_data case data has Organisation.OrganisationID and multiple organisationProfile with newCase set to Yes or No",
+ "Submit case creation as Case worker",
+ "contains correctly configured values",
+ "contains updated values for case_data and data_classification"
+
+ ],
+ "request": {
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "yes",
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ },
+ "OrganisationPolicyField5": {
+ "newCase": "no",
+ "Organisation": {
+ "OrganisationID": "orgID2",
+ "OrganisationName": "orgName2"
+ }
+ },
+ "OrganisationPolicyField4": {
+ "Organisation": {
+ "OrganisationID": "orgID2a",
+ "OrganisationName": "orgName2a"
+ }
+ },
+ "OrganisationPolicyField3": {
+ "newCase": "Yes",
+ "Organisation": {
+ "OrganisationID": "orgID3",
+ "OrganisationName": "orgName3"
+ }
+ }
+ },
+ "event": {
+ "id": "createCase"
+ },
+ "event_token": "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}",
+ "event_data": {
+ }
+ }
+ },
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "Content-Encoding": "gzip",
+ "vary": "accept-encoding",
+ "Content-Length": "[[ANYTHING_PRESENT]]"
+ },
+ "body": {
+ "id": "[[ANYTHING_PRESENT]]",
+ "jurisdiction": "BEFTA_MASTER",
+ "case_type_id": "FT_NewCaseSupplementry",
+ "created_date": "[[ANYTHING_PRESENT]]",
+ "last_modified": "[[ANYTHING_PRESENT]]",
+ "last_state_modified_date": "[[ANYTHING_PRESENT]]",
+ "security_classification": "PUBLIC",
+ "case_data": {
+ "OrganisationPolicyField" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID1",
+ "OrganisationName" : "orgName1"
+ }
+ },
+ "OrganisationPolicyField3" : {
+ "Organisation": {
+ "OrganisationID": "orgID3",
+ "OrganisationName": "orgName3"
+ }
+ },
+ "OrganisationPolicyField4" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID2a",
+ "OrganisationName" : "orgName2a"
+ }
+ },
+ "OrganisationPolicyField5" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID2",
+ "OrganisationName" : "orgName2"
+ }
+ }
+ },
+ "data_classification": {},
+ "supplementary_data": {
+ "new_case":
+ {
+ "orgID1" : "true",
+ "orgID3" : "true"
+ }
+ },
+ "after_submit_callback_response": null,
+ "callback_response_status_code": null,
+ "callback_response_status": null,
+ "delete_draft_response_status_code": null,
+ "delete_draft_response_status": null
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.6.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.6.td.json
new file mode 100644
index 0000000000..f9b507556c
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.6.td.json
@@ -0,0 +1,67 @@
+{
+ "_guid_": "S-1026.6",
+ "_extends_": "F-1026_Test_Data_Base_V2",
+ "title": "Invoke v2_external#/case-controller/createCaseUsingPOST has organisationProfile with newCase set to No",
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetCreateToken"
+ }
+ ],
+ "specs": [
+ "an active profile in CCD",
+ "contains some OrganisationPolicy fields with all correct values",
+ "is of caseType where case_data has organisationProfile with newCase set to No",
+ "Submit case creation as Case worker (V2)",
+ "contains correctly configured values",
+ "contains updated values for data and data_classification"
+ ],
+ "request": {
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "NO",
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "event": {
+ "id": "createCase"
+ },
+ "event_token": "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}"
+ }
+ },
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "Content-Encoding": "gzip",
+ "vary": "accept-encoding",
+ "Content-Length": "[[ANYTHING_PRESENT]]"
+ },
+ "body": {
+ "_links" : "[[ANYTHING_PRESENT]]",
+ "id": "[[ANYTHING_PRESENT]]",
+ "jurisdiction": "BEFTA_MASTER",
+ "created_on": "[[ANYTHING_PRESENT]]",
+ "last_modified_on": "[[ANYTHING_PRESENT]]",
+ "last_state_modified_on": "[[ANYTHING_PRESENT]]",
+ "security_classification": "PUBLIC",
+ "data": {
+ "OrganisationPolicyField" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID1",
+ "OrganisationName" : "orgName1"
+ }
+ }
+ },
+ "data_classification": {
+ },
+ "after_submit_callback_response": null,
+ "callback_response_status_code": null,
+ "callback_response_status": null,
+ "delete_draft_response_status_code": null,
+ "delete_draft_response_status": null
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.7.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.7.td.json
new file mode 100644
index 0000000000..e77eeadfe9
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.7.td.json
@@ -0,0 +1,75 @@
+{
+ "_guid_": "S-1026.7",
+ "_extends_": "F-1026_Test_Data_Base_V2",
+ "title": "Invoke v2_external#/case-controller/createCaseUsingPOST has organisationProfile with newCase set to Yes",
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetCreateToken"
+ }
+ ],
+ "specs": [
+ "an active profile in CCD",
+ "contains some OrganisationPolicy fields with all correct values",
+ "is of caseType where case_data has organisationProfile with newCase set to YES",
+ "Submit case creation as Case worker (V2)",
+ "contains correctly configured values",
+ "contains updated values for data and data_classification"
+
+ ],
+ "request": {
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "Yes",
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "event": {
+ "id": "createCase"
+ },
+ "event_token": "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}"
+ }
+ },
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "Content-Encoding": "gzip",
+ "vary": "accept-encoding",
+ "Content-Length": "[[ANYTHING_PRESENT]]"
+ },
+ "body": {
+ "_links" : "[[ANYTHING_PRESENT]]",
+ "id": "[[ANYTHING_PRESENT]]",
+ "jurisdiction": "BEFTA_MASTER",
+ "created_on": "[[ANYTHING_PRESENT]]",
+ "last_modified_on": "[[ANYTHING_PRESENT]]",
+ "last_state_modified_on": "[[ANYTHING_PRESENT]]",
+ "security_classification": "PUBLIC",
+ "data": {
+ "OrganisationPolicyField" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID1",
+ "OrganisationName" : "orgName1"
+ }
+ }
+ },
+ "data_classification" : {
+ }
+ },
+ "supplementary_data": {
+ "new_case": [
+ {
+ "orgID1" : "true"
+ }
+ ]
+ },
+ "after_submit_callback_response": null,
+ "callback_response_status_code": null,
+ "callback_response_status": null,
+ "delete_draft_response_status_code": null,
+ "delete_draft_response_status": null
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.8.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.8.td.json
new file mode 100644
index 0000000000..c93f4a09dc
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.8.td.json
@@ -0,0 +1,124 @@
+{
+ "_guid_": "S-1026.8",
+ "_extends_": "F-1026_Test_Data_Base_V2",
+ "title": "Invoke v2_external#/case-controller/createCaseUsingPOST and where case_data has multiple organisationProfile with newCase set to YES/No",
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetCreateToken"
+ }
+ ],
+ "specs": [
+ "an active profile in CCD",
+ "contains some OrganisationPolicy fields with all correct values",
+ "is of caseType where case_data has multiple organisationProfile with newCase set to YES/No",
+ "caseData Organisation.OrganisationID value is empty value",
+ "Submit case creation as Case worker (V2)",
+ "contains correctly configured values",
+ "contains updated values for data and data_classification"
+
+ ],
+ "request": {
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "Yes",
+ "Organisation": {
+ "OrganisationID": "",
+ "OrganisationName": "orgName1"
+ }
+ },
+ "OrganisationPolicyField" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID1",
+ "OrganisationName" : "orgName1"
+ }
+ },
+ "OrganisationPolicyField3" : {
+ "Organisation": {
+ "OrganisationID": "orgID3",
+ "OrganisationName": "orgName3"
+ }
+ },
+ "OrganisationPolicyField5" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID2a",
+ "OrganisationName" : "orgName2a"
+ }
+ },
+ "OrganisationPolicyField4" : {
+ "newCase" : "no",
+ "Organisation" : {
+ "OrganisationID" : "orgID2",
+ "OrganisationName" : "orgName2"
+ }
+ }
+ },
+ "event": {
+ "id": "createCase"
+ },
+ "event_token": "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}"
+ }
+ },
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "Content-Encoding": "gzip",
+ "vary": "accept-encoding",
+ "Content-Length": "[[ANYTHING_PRESENT]]"
+ },
+ "body": {
+ "_links" : "[[ANYTHING_PRESENT]]",
+ "id": "[[ANYTHING_PRESENT]]",
+ "jurisdiction": "BEFTA_MASTER",
+ "created_on": "[[ANYTHING_PRESENT]]",
+ "last_modified_on": "[[ANYTHING_PRESENT]]",
+ "last_state_modified_on": "[[ANYTHING_PRESENT]]",
+ "security_classification": "PUBLIC",
+ "data": {
+ "OrganisationPolicyField": {
+ "Organisation": {
+ "OrganisationID": "",
+ "OrganisationName": "orgName1"
+ }
+ },
+ "OrganisationPolicyField" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID1",
+ "OrganisationName" : "orgName1"
+ }
+ },
+ "OrganisationPolicyField3" : {
+ "Organisation": {
+ "OrganisationID": "orgID3",
+ "OrganisationName": "orgName3"
+ }
+ },
+ "OrganisationPolicyField5" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID2a",
+ "OrganisationName" : "orgName2a"
+ }
+ },
+ "OrganisationPolicyField4" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID2",
+ "OrganisationName" : "orgName2"
+ }
+ }
+ },
+ "data_classification" : {}
+ },
+ "supplementary_data": {
+ "new_case":
+ {
+ "orgID1" : "true",
+ "orgID3" : "true"
+ }
+ },
+ "after_submit_callback_response": null,
+ "callback_response_status_code": null,
+ "callback_response_status": null,
+ "delete_draft_response_status_code": null,
+ "delete_draft_response_status": null
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.9.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.9.td.json
new file mode 100644
index 0000000000..bbfb572f27
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026.9.td.json
@@ -0,0 +1,85 @@
+{
+ "_guid_": "S-1026.9",
+ "_extends_": "F-1026_Test_Data_Event_Caseworker",
+
+ "title": "Submit Event is invoked on v1_external#/case-details-endpoint/createCaseEventForCaseWorkerUsingPOST and case_data has organisationProfile with newCase set to YES",
+ "prerequisites" : [ {
+ "Token_Creation": "S-1026_GetUpdateTokenCaseworker"
+ }
+ ],
+
+ "specs": [
+ "an active profile in CCD",
+ "contains a case Id that has just been created as in F-1026_CreateCasePreRequisiteCaseworker",
+ "contains an event token for the case just created above",
+ "contains some OrganisationPolicy fields with all correct values",
+ "is of caseType where case_data case data has Organisation.OrganisationID and organisationProfile with newCase set to Yes",
+ "contains correctly configured OrganisationPolicy field in F-1026_CreateCasePreRequisiteCaseworker",
+ "specifying the case to be updated, as created in F-1026_CreateCasePreRequisiteCaseworker"
+ ],
+
+ "request": {
+ "pathVariables": {
+ "ctid" : "FT_NewCaseSupplementry",
+ "cid": "${[scenarioContext][childContexts][F-1026_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}"
+ },
+ "headers": {
+ "_extends_": "Common_Request_Headers"
+ },
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "Yes",
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "event": {
+ "id": "updateCase",
+ "summary": "",
+ "description": ""
+ },
+ "security_classification": "PUBLIC",
+ "event_token" : "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}",
+ "ignore_warning": true
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "body" : {
+ "id" : "[[ANYTHING_PRESENT]]",
+ "jurisdiction" : "BEFTA_MASTER",
+ "state" : "CaseUpdated",
+ "version" : 1,
+ "case_type_id" : "FT_NewCaseSupplementry",
+ "created_date" : "[[ANYTHING_PRESENT]]",
+ "last_modified" : "[[ANYTHING_PRESENT]]",
+ "last_state_modified_date" : "[[ANYTHING_PRESENT]]",
+ "security_classification" : "PUBLIC",
+ "case_data": {
+ "OrganisationPolicyField" : {
+ "Organisation" : {
+ "OrganisationID" : "orgID1",
+ "OrganisationName" : "orgName1"
+ }
+ }
+ },
+ "data_classification": {
+ },
+ "data_classification" : { },
+ "supplementary_data" : {
+ "new_case" : {
+ "orgID1" : "true"
+ }
+ },
+ "after_submit_callback_response" : null,
+ "callback_response_status_code" : null,
+ "callback_response_status" : null,
+ "delete_draft_response_status_code" : null,
+ "delete_draft_response_status" : null
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026_GetCreateToken.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026_GetCreateToken.td.json
new file mode 100644
index 0000000000..2276d23ac9
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026_GetCreateToken.td.json
@@ -0,0 +1,28 @@
+{
+ "_guid_": "S-1026_GetCreateToken",
+ "_extends_": "Standard_Token_Creation_Data_For_Case_Creation",
+
+ "specs": [
+ "to create a token for case creation",
+ "As a prerequisite"
+ ],
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaMasterCaseworker"
+ }
+ },
+
+ "request": {
+ "pathVariables": {
+ "jid": "BEFTA_MASTER",
+ "ctid": "FT_NewCaseSupplementry",
+ "etid": "createCase"
+ }
+ },
+ "expectedResponse": {
+ "body": {
+ "event_id": "createCase"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026_GetEventTokenBase.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026_GetEventTokenBase.td.json
new file mode 100644
index 0000000000..7cd64dca2f
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026_GetEventTokenBase.td.json
@@ -0,0 +1,33 @@
+{
+ "_guid_": "S-1026_GetEventTokenBase",
+ "_extends_": "StartEvent_v2Ext__PositiveResponse_Base",
+
+ "specs": [
+ "As a prerequisite"
+ ],
+
+ "request": {
+ "pathVariables": {
+ "cid": "OVERRIDE",
+ "etid": "updateCase"
+ }
+ },
+
+ "expectedResponse": {
+ "body": {
+ "case_details": {
+ "id": "[[ANYTHING_PRESENT]]",
+ "version": "[[ANY_INTEGER_NOT_NULLABLE]]",
+
+ "jurisdiction": "BEFTA_MASTER",
+ "case_type_id": "[[ANYTHING_PRESENT]]",
+
+ "case_data": "[[ANYTHING_PRESENT]]",
+ "data_classification": "[[ANYTHING_PRESENT]]",
+ "supplementary_data": "[[ANYTHING_PRESENT]]"
+ },
+
+ "event_id": "updateCase"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026_GetUpdateTokenCaseworker.td.json b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026_GetUpdateTokenCaseworker.td.json
new file mode 100644
index 0000000000..57dd9fc6a0
--- /dev/null
+++ b/src/aat/resources/features/F-1026 - Case create supplementry data with new_case/S-1026_GetUpdateTokenCaseworker.td.json
@@ -0,0 +1,16 @@
+{
+ "_guid_": "S-1026_GetUpdateTokenCaseworker",
+ "_extends_": "S-1026_GetEventTokenBase",
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaMasterCaseworker"
+ }
+ },
+
+ "request": {
+ "pathVariables": {
+ "cid": "${[scenarioContext][parentContext][childContexts][F-1026_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/F-105.feature b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/F-105.feature
index 7fe0109e34..36bb27df86 100644
--- a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/F-105.feature
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/F-105.feature
@@ -293,3 +293,24 @@ Feature: F-105: Add Case-Assigned Users and Roles
And the response has all the details as expected,
And a call [to verify Olawale's reception of the role CR-2 over the case C1] will get the expected response as in [S-105.18_Verify_Case_Roles_for_Case_C1],
And a call [to verify the count of users assigned to a case has changed] will get the expected response as in [F-105_Verify_Counter_Changed].
+
+ # CCD-5333 AC-1
+ @S-105.19
+ Scenario: Must successfully set new_case attribute to false for the organisation when assigning a user and case role for a specific case (by a user calling through/from an authorised application)
+ Given an appropriate test context as detailed in the test data source,
+ And a user [BeftaMasterCaseworker - who can create a case],
+ And a user [Dil - who is to add some case role assignment for a case],
+ And a user [Olawale - with an active solicitor profile],
+ And a user [Hemanth - with an active solicitor profile],
+ And a successful call [to create a case] as in [F-105_CreateCasePreRequisiteCaseworker]
+ When a request is prepared with appropriate values,
+ And the request [is made from an authorised application, by Dil, with the Case ID of C1, User ID of Olawale, proper Case Role CR-1 and CR-2 and the Organisation ID of Olawale],
+ And it is submitted to call the [Add Case-Assigned Users and Roles] operation of [CCD Data Store Api],
+ Then a positive response is received,
+ And the response has all the details as expected,
+ And a call [to verify Olawale's reception of the role CR-1 and CR-2 over the case C1] will get the expected response as in [S-105.19_Verify_Case_Roles_for_Case_NewCase],
+ And a call [to verify newCase assigned to C1 is not set in the supplementary data] will get the expected response as in [S-105.19_Verify_NewCase_1],
+ And a call [to repeat the same request as above] will get the expected response as in [S-105.19_Repeated_Call_to_Add_Case_Assigned_Users_and_Roles],
+ And a call [to verify newCase organisationId assigned to C1 is set to false in the supplementary data] will get the expected response as in [S-105.19_Verify_NewCase_2],
+ And a call [to repeat the same request as above this time with a different user, Hemanth] will get the expected response as in [S-105.19_Repeated_Call_to_Add_Case_Assigned_Users_and_Roles_Hemanth],
+ And a call [to verify the new_case of users assigned to a case is set to false in the supplementary data] will get the expected response as in [S-105.19_Verify_NewCase_3].
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/F-105_CreateCasePreRequisiteCaseworker.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/F-105_CreateCasePreRequisiteCaseworker.td.json
new file mode 100644
index 0000000000..b85e8c808f
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/F-105_CreateCasePreRequisiteCaseworker.td.json
@@ -0,0 +1,70 @@
+{
+ "_guid_": "F-105_CreateCasePreRequisiteCaseworker",
+ "_extends_": "Case_Creation_Data_Base",
+ "specs": [
+ "to create a case",
+ "As a prerequisite"
+ ],
+
+ "prerequisites" : [ {
+ "Token_Creation": "S-105_GetCreateTokenNewCase"
+ }
+ ],
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaMasterCaseworker"
+ }
+ },
+ "request": {
+ "pathVariables": {
+ "jid": "BEFTA_MASTER",
+ "ctid": "FT_NewCaseSupplementry"
+ },
+ "body": {
+ "data": {
+ "OrganisationPolicyField": {
+ "newCase": "Yes",
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "event": {
+ "id": "createCase",
+ "summary": "",
+ "description": ""
+ },
+ "event_token": "${[scenarioContext][childContexts][Token_Creation][testData][actualResponse][body][token]}"
+ }
+ },
+
+ "expectedResponse": {
+ "body": {
+ "id": "[[ANYTHING_PRESENT]]",
+ "jurisdiction": "BEFTA_MASTER",
+ "state" : "CaseCreated",
+ "case_type_id": "FT_NewCaseSupplementry",
+ "created_date": "[[ANYTHING_PRESENT]]",
+ "last_modified": "[[ANYTHING_PRESENT]]",
+ "last_state_modified_date": "[[ANYTHING_PRESENT]]",
+ "security_classification": "PUBLIC",
+ "case_data": {
+ "OrganisationPolicyField": {
+ "Organisation": {
+ "OrganisationID": "orgID1",
+ "OrganisationName": "orgName1"
+ }
+ }
+ },
+ "data_classification": {
+ },
+ "supplementary_data" : {
+ "new_case" : {
+ "orgID1" : "true"
+ }
+ }
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/F-105_Get_Case_Roles_for_Case_NewCase_Base.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/F-105_Get_Case_Roles_for_Case_NewCase_Base.td.json
new file mode 100644
index 0000000000..e5d4686b61
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/F-105_Get_Case_Roles_for_Case_NewCase_Base.td.json
@@ -0,0 +1,34 @@
+{
+ "title": "Get Case-Assigned Users and Roles",
+
+ "_guid_": "F-105_Get_Case_Roles_for_Case_NewCase_Base",
+
+ "productName": "CCD Data Store",
+ "operationName": "Get Case-Assigned Users and Roles",
+
+ "method": "GET",
+ "uri": "/case-users",
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaCaseworkerCaa"
+ }
+ },
+
+ "request": {
+ "_extends_": "Common_Request",
+ "queryParams": {
+ "case_ids": "${[scenarioContext][parentContext][testData][request][body][case_users][0][case_id]}"
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "Common_200_Response",
+ "headers": {
+ "_extends_": "Common_Response_Headers",
+ "Content-Length": "[[ANYTHING_PRESENT]]",
+ "Content-Type": "[[ANYTHING_PRESENT]]",
+ "Content-Encoding": "[[ANYTHING_PRESENT]]"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/F-105_Test_Data_Base.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/F-105_Test_Data_Base.td.json
new file mode 100644
index 0000000000..44ecbeebb7
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/F-105_Test_Data_Base.td.json
@@ -0,0 +1,41 @@
+{
+ "_guid_": "F-105_Test_Data_Base",
+ "_extends_": "Case_Creation_Base",
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaMasterCaseworker"
+ }
+ },
+
+ "request": {
+ "pathVariables": {
+ "jid": "BEFTA_MASTER",
+ "ctid": "FT_NewCaseSupplementry"
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "Common_201_Response",
+ "headers": {
+ "_extends_": "Common_Response_Headers"
+ },
+ "body" : {
+ "id" : "[[ANYTHING_PRESENT]]",
+ "jurisdiction" : "BEFTA_MASTER",
+ "state" : "CaseCreated",
+ "case_type_id" : "FT_NewCaseSupplementry",
+ "version" : 0,
+ "created_date" : "[[ANY_STRING_NOT_NULLABLE]]",
+ "last_modified" : "[[ANY_STRING_NOT_NULLABLE]]",
+ "last_state_modified_date" : "[[ANY_STRING_NOT_NULLABLE]]",
+ "security_classification" : "PUBLIC",
+ "supplementary_data" : null,
+ "after_submit_callback_response" : null,
+ "callback_response_status_code" : null,
+ "callback_response_status" : null,
+ "delete_draft_response_status_code" : null,
+ "delete_draft_response_status" : null
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19.td.json
new file mode 100644
index 0000000000..c683e4bc58
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19.td.json
@@ -0,0 +1,44 @@
+{
+ "title": "Must successfully set new_case attribute to false for the organisation when assigning a user and case role for a specific case (by a user calling through/from an authorised application)",
+
+ "_guid_": "S-105.19",
+ "_extends_": "F-105_Add_Case_Assigned_User_Roles_Base",
+
+ "specs": [
+ "BeftaMasterCaseworker - who can create a case",
+ "Dil - who is to add some case role assignment for a case",
+ "Olawale - with an active solicitor profile",
+ "Hemanth - with an active solicitor profile",
+ "is made from an authorised application, by Dil, with the Case ID of C1, User ID of Olawale, proper Case Role CR-1 and CR-2 and the Organisation ID of Olawale"
+ ],
+
+ "users": {
+ "_extends_": "F-105_Users"
+ },
+
+ "request": {
+ "headers": {
+ "Authorization": "Bearer ${[scenarioContext][testData][users][userDil][accessToken]}"
+ },
+ "body": {
+ "case_users": [
+ {
+ "case_id": "${[scenarioContext][childContexts][F-105_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}",
+ "user_id": "${[scenarioContext][testData][users][userOlawale][id]}",
+ "case_role": "[CR-1]",
+ "organisation_id": "${[scenarioContext][childContexts][F-105_Prerequisite_NewCase_Check_Call][childContexts][F-105_Get_Organisation_Identifier_Olawale][testData][actualResponse][body][organisationIdentifier]}"
+ },
+ {
+ "case_id": "${[scenarioContext][childContexts][F-105_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}",
+ "user_id": "${[scenarioContext][testData][users][userOlawale][id]}",
+ "case_role": "[CR-2]",
+ "organisation_id": "${[scenarioContext][childContexts][F-105_Prerequisite_NewCase_Check_Call][childContexts][F-105_Get_Organisation_Identifier_Olawale][testData][actualResponse][body][organisationIdentifier]}"
+ }
+ ]
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "F-105_Add_Case_Assigned_User_Roles_201_response"
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Repeated_Call_to_Add_Case_Assigned_Users_and_Roles.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Repeated_Call_to_Add_Case_Assigned_Users_and_Roles.td.json
new file mode 100644
index 0000000000..4224b64a9c
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Repeated_Call_to_Add_Case_Assigned_Users_and_Roles.td.json
@@ -0,0 +1,37 @@
+{
+ "_guid_": "S-105.19_Repeated_Call_to_Add_Case_Assigned_Users_and_Roles",
+ "_extends_": "F-105_Add_Case_Assigned_User_Roles_Base",
+
+ "specs": [
+ "to repeat the same request as above"
+ ],
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "F-105_User_Dil"
+ }
+ },
+
+ "request": {
+ "body": {
+ "case_users": [
+ {
+ "case_id": "${[scenarioContext][siblingContexts][F-105_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}",
+ "user_id": "${[scenarioContext][parentContext][testData][users][userOlawale][id]}",
+ "case_role": "[CR-1]",
+ "organisation_id": "${[scenarioContext][siblingContexts][F-105_Prerequisite_NewCase_Check_Call][childContexts][F-105_Get_Organisation_Identifier_Olawale][testData][actualResponse][body][organisationIdentifier]}"
+ },
+ {
+ "case_id": "${[scenarioContext][siblingContexts][F-105_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}",
+ "user_id": "${[scenarioContext][parentContext][testData][users][userOlawale][id]}",
+ "case_role": "[CR-2]",
+ "organisation_id": "${[scenarioContext][siblingContexts][F-105_Prerequisite_NewCase_Check_Call][childContexts][F-105_Get_Organisation_Identifier_Olawale][testData][actualResponse][body][organisationIdentifier]}"
+ }
+ ]
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "F-105_Add_Case_Assigned_User_Roles_201_response"
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Repeated_Call_to_Add_Case_Assigned_Users_and_Roles_Hemanth.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Repeated_Call_to_Add_Case_Assigned_Users_and_Roles_Hemanth.td.json
new file mode 100644
index 0000000000..8e114be0c4
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Repeated_Call_to_Add_Case_Assigned_Users_and_Roles_Hemanth.td.json
@@ -0,0 +1,41 @@
+{
+ "_guid_": "S-105.19_Repeated_Call_to_Add_Case_Assigned_Users_and_Roles_Hemanth",
+ "_extends_": "F-105_Add_Case_Assigned_User_Roles_Base",
+
+ "specs": [
+ "to repeat the same request as above this time with a different user, Hemanth"
+ ],
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "F-105_User_Dil"
+ }
+ },
+
+ "prerequisites": [
+ "F-105_Get_Organisation_Identifier_Hemanth"
+ ],
+
+ "request": {
+ "body": {
+ "case_users": [
+ {
+ "case_id": "${[scenarioContext][siblingContexts][F-105_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}",
+ "user_id": "${[scenarioContext][parentContext][testData][users][userHemanth][id]}",
+ "case_role": "[CR-1]",
+ "organisation_id": "${[scenarioContext][childContexts][F-105_Get_Organisation_Identifier_Hemanth][testData][actualResponse][body][organisationIdentifier]}"
+ },
+ {
+ "case_id": "${[scenarioContext][siblingContexts][F-105_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}",
+ "user_id": "${[scenarioContext][parentContext][testData][users][userHemanth][id]}",
+ "case_role": "[CR-2]",
+ "organisation_id": "${[scenarioContext][childContexts][F-105_Get_Organisation_Identifier_Hemanth][testData][actualResponse][body][organisationIdentifier]}"
+ }
+ ]
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "F-105_Add_Case_Assigned_User_Roles_201_response"
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_Case_Roles_for_Case_NewCase.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_Case_Roles_for_Case_NewCase.td.json
new file mode 100644
index 0000000000..22ee1387db
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_Case_Roles_for_Case_NewCase.td.json
@@ -0,0 +1,29 @@
+{
+ "_guid_": "S-105.19_Verify_Case_Roles_for_Case_NewCase",
+ "_extends_": "F-105_Get_Case_Roles_for_Case_NewCase_Base",
+
+ "specs": [
+ "to verify Olawale's reception of the role CR-1 and CR-2 over the case C1"
+ ],
+
+ "expectedResponse": {
+ "body": {
+ "case_users": [
+ {
+ "__ordering__": "UNORDERED",
+ "__elementId__": "case_id,user_id,case_role"
+ },
+ {
+ "case_id": "${}${[scenarioContext][siblingContexts][F-105_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}",
+ "user_id": "${[scenarioContext][parentContext][testData][users][userOlawale][id]}",
+ "case_role": "[CR-1]"
+ },
+ {
+ "case_id": "${}${[scenarioContext][siblingContexts][F-105_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}",
+ "user_id": "${[scenarioContext][parentContext][testData][users][userOlawale][id]}",
+ "case_role": "[CR-2]"
+ }
+ ]
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_NewCase_1.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_NewCase_1.td.json
new file mode 100644
index 0000000000..5cdf3af93e
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_NewCase_1.td.json
@@ -0,0 +1,14 @@
+{
+ "_guid_": "S-105.19_Verify_NewCase_1",
+ "_extends_": "F-105_Check_NewCase_Users_Base",
+
+ "specs": [
+ "to verify newCase assigned to C1 is not set in the supplementary data"
+ ],
+
+ "expectedResponse": {
+ "body": {
+ "supplementary_data": "${[scenarioContext][customValues][siblingContexts.F-105_Prerequisite_No_NewCase_Check_Call.childContexts.F-105_Get_Organisation_Identifier_Olawale|siblingContexts.F-105_Prerequisite_No_NewCase_Check_Call|1]}"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_NewCase_2.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_NewCase_2.td.json
new file mode 100644
index 0000000000..ab95111478
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_NewCase_2.td.json
@@ -0,0 +1,14 @@
+{
+ "_guid_": "S-105.19_Verify_NewCase_2",
+ "_extends_": "F-105_Check_NewCase_Users_Base",
+
+ "specs": [
+ "to verify newCase organisationId assigned to C1 is set to false in the supplementary data"
+ ],
+
+ "expectedResponse": {
+ "body": {
+ "supplementary_data": "${[scenarioContext][customValues]siblingContexts.F-105_Prerequisite_NewCase_Check_Call.childContexts.F-105_Get_Organisation_Identifier_Olawale|siblingContexts.S-105\\.19_Verify_NewCase_1|0]}"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_NewCase_3.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_NewCase_3.td.json
new file mode 100644
index 0000000000..2ffd7ecfae
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105.19_Verify_NewCase_3.td.json
@@ -0,0 +1,14 @@
+{
+ "_guid_": "S-105.19_Verify_NewCase_3",
+ "_extends_": "F-105_Check_NewCase_Users_Base",
+
+ "specs": [
+ "to verify the new_case of users assigned to a case is set to false in the supplementary data"
+ ],
+
+ "expectedResponse": {
+ "body": {
+ "supplementary_data": "${[scenarioContext][customValues][new_case_siblingContexts.F-105_Prerequisite_NewCase_Check_Call.childContexts.F-105_Get_Organisation_Identifier_Olawale|siblingContexts.S-105\\.19_Verify_NewCase_2|1]}"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105_GetCreateTokenNewCase.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105_GetCreateTokenNewCase.td.json
new file mode 100644
index 0000000000..2c98ec5da3
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/S-105.19/S-105_GetCreateTokenNewCase.td.json
@@ -0,0 +1,28 @@
+{
+ "_guid_": "S-105_GetCreateTokenNewCase",
+ "_extends_": "Standard_Token_Creation_Data_For_Case_Creation",
+
+ "specs": [
+ "to create a token for case creation",
+ "As a prerequisite"
+ ],
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaMasterCaseworker"
+ }
+ },
+
+ "request": {
+ "pathVariables": {
+ "jid": "BEFTA_MASTER",
+ "ctid": "FT_NewCaseSupplementry",
+ "etid": "createCase"
+ }
+ },
+ "expectedResponse": {
+ "body": {
+ "event_id": "createCase"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Check_NewCase_Users_Base.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Check_NewCase_Users_Base.td.json
new file mode 100644
index 0000000000..a2ee86d1c3
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Check_NewCase_Users_Base.td.json
@@ -0,0 +1,46 @@
+{
+ "title": "Check new_case users in supplementary data",
+
+ "_guid_": "F-105_Check_NewCase_Users_Base",
+
+ "productName": "CCD Data Store",
+ "operationName": "New Case in Supplementary Data",
+
+ "method": "POST",
+ "uri": "/cases/{cid}/supplementary-data",
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaCaseworkerCaa"
+ }
+ },
+
+ "request": {
+ "_extends_": "Common_Request",
+ "pathVariables": {
+ "cid": "${[scenarioContext][siblingContexts][F-105_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}"
+ },
+ "body": {
+ "supplementary_data_updates": {
+ "$set": {
+ "new_case.QUK822N": false
+ }
+ }
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "Common_200_Response",
+ "headers": {
+ "_extends_": "Common_Response_Headers",
+ "Content-Length": "[[ANYTHING_PRESENT]]",
+ "Content-Type": "[[ANYTHING_PRESENT]]",
+ "Content-Encoding": "[[ANYTHING_PRESENT]]"
+ },
+ "body" : {
+ "supplementary_data" : {
+ "new_case.QUK822N" : false
+ }
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Check_No_NewCase_Users_Base.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Check_No_NewCase_Users_Base.td.json
new file mode 100644
index 0000000000..493ecfba15
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Check_No_NewCase_Users_Base.td.json
@@ -0,0 +1,38 @@
+{
+ "title": "Check new_case users in supplementary data",
+
+ "_guid_": "F-105_Check_No_NewCase_Users_Base",
+
+ "productName": "CCD Data Store",
+ "operationName": "New Case in Supplementary Data",
+
+ "method": "POST",
+ "uri": "/cases/{cid}/supplementary-data",
+
+ "users": {
+ "invokingUser": {
+ "_extends_": "BeftaCaseworkerCaa"
+ }
+ },
+
+ "request": {
+ "_extends_": "Common_Request",
+ "pathVariables": {
+ "cid": "${[scenarioContext][siblingContexts][F-105_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}"
+ },
+ "body": {
+ }
+ },
+
+ "expectedResponse": {
+ "_extends_": "Common_200_Response",
+ "headers": {
+ "_extends_": "Common_Response_Headers",
+ "Content-Length": "[[ANYTHING_PRESENT]]",
+ "Content-Type": "[[ANYTHING_PRESENT]]",
+ "Content-Encoding": "[[ANYTHING_PRESENT]]"
+ },
+ "body" : {
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Prerequisite_NewCase_Check_Call.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Prerequisite_NewCase_Check_Call.td.json
new file mode 100644
index 0000000000..8d5bb86bdf
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Prerequisite_NewCase_Check_Call.td.json
@@ -0,0 +1,18 @@
+{
+ "_guid_": "F-105_Prerequisite_NewCase_Check_Call",
+ "_extends_": "F-105_Check_NewCase_Users_Base",
+
+ "specs": [
+ "to check the number of users having access to C1 in its supplementary data"
+ ],
+
+ "prerequisites": [
+ "F-105_Get_Organisation_Identifier_Olawale"
+ ],
+
+ "expectedResponse": {
+ "body": {
+ "supplementary_data": "[[ANYTHING_PRESENT]]"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Prerequisite_No_NewCase_Check_Call.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Prerequisite_No_NewCase_Check_Call.td.json
new file mode 100644
index 0000000000..b86cf27a60
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/With Organisation Context/common/F-105_Prerequisite_No_NewCase_Check_Call.td.json
@@ -0,0 +1,18 @@
+{
+ "_guid_": "F-105_Prerequisite_No_NewCase_Check_Call",
+ "_extends_": "F-105_Check_No_NewCase_Users_Base",
+
+ "specs": [
+ "to check the number of users having access to C1 is not in supplementary data"
+ ],
+
+ "prerequisites": [
+ "F-105_Get_Organisation_Identifier_Olawale"
+ ],
+
+ "expectedResponse": {
+ "body": {
+ "supplementary_data": "[[ANYTHING_PRESENT]]"
+ }
+ }
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/common/F-105_User_BeftaMasterCaseworker.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/common/F-105_User_BeftaMasterCaseworker.td.json
new file mode 100644
index 0000000000..d750913988
--- /dev/null
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/common/F-105_User_BeftaMasterCaseworker.td.json
@@ -0,0 +1,5 @@
+{
+ "_guid_": "F-105_User_BeftaMasterCaseworker",
+
+ "_extends_": "BeftaMasterCaseworker"
+}
diff --git a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/common/F-105_Users.td.json b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/common/F-105_Users.td.json
index 3fad24a872..8f013eefc4 100644
--- a/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/common/F-105_Users.td.json
+++ b/src/aat/resources/features/F-105 - Add Case-Assigned Users and Roles/common/F-105_Users.td.json
@@ -1,6 +1,5 @@
{
"_guid_": "F-105_Users",
-
"userRichard": {
"_extends_": "F-105_User_Richard"
},
@@ -12,5 +11,8 @@
},
"userHemanth": {
"_extends_": "F-105_User_Hemanth"
+ },
+ "userMaster": {
+ "_extends_": "F-105_User_BeftaMasterCaseworker"
}
}
diff --git a/src/aat/resources/features/common/case/befta_new/Befta_Default_Full_Case_Creation_Data_NoRead.td.json b/src/aat/resources/features/common/case/befta_new/Befta_Default_Full_Case_Creation_Data_NoRead.td.json
index 925ddba57f..6c68e69d21 100644
--- a/src/aat/resources/features/common/case/befta_new/Befta_Default_Full_Case_Creation_Data_NoRead.td.json
+++ b/src/aat/resources/features/common/case/befta_new/Befta_Default_Full_Case_Creation_Data_NoRead.td.json
@@ -15,7 +15,6 @@
},
"body": {
"data": {
- "_extends_": "Befta_Default_Full_Case_Data"
}
}
},
@@ -25,16 +24,8 @@
"jurisdiction": "BEFTA_JURISDICTION_1",
"case_type_id": "BEFTA_CASETYPE_NO_READ",
"case_data": {
- "_extends_": "Befta_Default_Full_Case_Data"
- },
- "data_classification": {
- "MoneyGBPField": "PUBLIC",
- "PhoneUKField": "PUBLIC",
- "NumberField": "PUBLIC",
- "YesOrNoField": "PUBLIC",
- "EmailField": "PUBLIC",
- "TextField": "PUBLIC"
},
+ "data_classification": {},
"supplementary_data": null
}
}
diff --git a/src/aat/resources/logback.xml b/src/aat/resources/logback.xml
index d64d0da556..887ad04e3b 100644
--- a/src/aat/resources/logback.xml
+++ b/src/aat/resources/logback.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/src/main/java/uk/gov/hmcts/ccd/domain/model/std/SupplementaryData.java b/src/main/java/uk/gov/hmcts/ccd/domain/model/std/SupplementaryData.java
index 5d8caf3b7a..1de902fa7f 100644
--- a/src/main/java/uk/gov/hmcts/ccd/domain/model/std/SupplementaryData.java
+++ b/src/main/java/uk/gov/hmcts/ccd/domain/model/std/SupplementaryData.java
@@ -16,6 +16,7 @@
import lombok.NoArgsConstructor;
import lombok.ToString;
import uk.gov.hmcts.ccd.config.JacksonUtils;
+import uk.gov.hmcts.ccd.domain.service.common.NewCaseUtils;
import uk.gov.hmcts.ccd.endpoint.exceptions.ServiceException;
@ToString
@@ -40,7 +41,11 @@ public SupplementaryData(JsonNode data, Set requestKeys) {
Object value = context.read("$." + key, Object.class);
this.response.put(key, value);
} catch (PathNotFoundException e) {
- throw new ServiceException(String.format("Path %s is not found", key));
+ if (key.contains(NewCaseUtils.ORG_POLICY_NEW_CASE)) {
+ this.response.put(key, null);
+ } else {
+ throw new ServiceException(String.format("Path %s is not found", key));
+ }
}
});
}
diff --git a/src/main/java/uk/gov/hmcts/ccd/domain/service/caseaccess/CaseAccessOperation.java b/src/main/java/uk/gov/hmcts/ccd/domain/service/caseaccess/CaseAccessOperation.java
index 4cbe00e5f6..a21730b898 100644
--- a/src/main/java/uk/gov/hmcts/ccd/domain/service/caseaccess/CaseAccessOperation.java
+++ b/src/main/java/uk/gov/hmcts/ccd/domain/service/caseaccess/CaseAccessOperation.java
@@ -1,8 +1,8 @@
package uk.gov.hmcts.ccd.domain.service.caseaccess;
+import com.google.common.collect.Sets;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
-import org.elasticsearch.common.util.set.Sets;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -21,8 +21,10 @@
import uk.gov.hmcts.ccd.domain.model.std.CaseAssignedUserRole;
import uk.gov.hmcts.ccd.domain.model.std.CaseAssignedUserRoleWithOrganisation;
import uk.gov.hmcts.ccd.domain.service.casedataaccesscontrol.RoleAssignmentService;
+import uk.gov.hmcts.ccd.domain.service.common.NewCaseUtils;
import uk.gov.hmcts.ccd.domain.service.getcase.CaseNotFoundException;
import uk.gov.hmcts.ccd.endpoint.exceptions.InvalidCaseRoleException;
+import uk.gov.hmcts.ccd.endpoint.exceptions.ServiceException;
import uk.gov.hmcts.ccd.v2.external.domain.CaseUser;
import java.util.ArrayList;
@@ -40,6 +42,7 @@
public class CaseAccessOperation {
public static final String ORGS_ASSIGNED_USERS_PATH = "orgs_assigned_users.";
+ public static final String NEW_CASE_ORG_PATH = NewCaseUtils.ORG_POLICY_NEW_CASE + ".";
private final CaseUserRepository caseUserRepository;
private final CaseDetailsRepository caseDetailsRepository;
@@ -194,10 +197,11 @@ public void addCaseUserRoles(List caseUser
);
newUserCounts.forEach((caseReference, orgNewUserCountMap) ->
- orgNewUserCountMap.forEach((organisationId, newUserCount) ->
+ orgNewUserCountMap.forEach((organisationId, newUserCount) -> {
supplementaryDataRepository.incrementSupplementaryData(caseReference,
- ORGS_ASSIGNED_USERS_PATH + organisationId, newUserCount)
- )
+ ORGS_ASSIGNED_USERS_PATH + organisationId, newUserCount);
+ setUserAssignedNewCaseForOrganisationIdToFalse(caseReference, organisationId);
+ })
);
}
@@ -506,4 +510,16 @@ private void revokeRemovedCaseRoles(String userId,
userId,
currentRole));
}
+
+ private void setUserAssignedNewCaseForOrganisationIdToFalse(String caseReference, String organisationId) {
+ // Set supplementary data new cases for organisationId to false
+ String orgNewCaseSupDataKey = NEW_CASE_ORG_PATH + organisationId;
+ try {
+ supplementaryDataRepository.setSupplementaryData(caseReference,
+ orgNewCaseSupDataKey, false);
+ } catch (ServiceException e) {
+ // do nothing
+ }
+
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/ccd/domain/service/common/CaseAccessGroupUtils.java b/src/main/java/uk/gov/hmcts/ccd/domain/service/common/CaseAccessGroupUtils.java
index b023bf99c0..99a733f4c0 100644
--- a/src/main/java/uk/gov/hmcts/ccd/domain/service/common/CaseAccessGroupUtils.java
+++ b/src/main/java/uk/gov/hmcts/ccd/domain/service/common/CaseAccessGroupUtils.java
@@ -17,6 +17,9 @@
import uk.gov.hmcts.ccd.endpoint.exceptions.ValidationException;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Objects;
+import java.util.Optional;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
@@ -57,23 +60,10 @@ public void updateCaseAccessGroupsInCaseDetails(CaseDetails caseDetails, CaseTyp
if (filteredAccessTypeRolesDefinitions != null) {
List caseAccessGroupWithIds = new ArrayList<>();
for (AccessTypeRoleDefinition acd : filteredAccessTypeRolesDefinitions) {
- JsonNode caseAssignedRoleFieldNode = findOrganisationPolicyNodeForCaseRole(caseDetails,
- acd.getCaseAssignedRoleField());
- if (caseAssignedRoleFieldNode != null) {
- String orgIdentifier = caseAssignedRoleFieldNode.get(ORGANISATION)
- .get(ORGANISATIONID).textValue();
-
- if (orgIdentifier != null && !orgIdentifier.isEmpty()) {
- String caseGroupID = acd.getCaseAccessGroupIdTemplate()
- .replace(ORG_IDENTIFIER_TEMPLATE, orgIdentifier);
-
- CaseAccessGroup caseAccessGroup = CaseAccessGroup.builder().caseAccessGroupId(caseGroupID)
- .caseAccessGroupType(CCD_ALL_CASES).build();
- CaseAccessGroupWithId caseAccessGroupWithId = CaseAccessGroupWithId.builder()
- .caseAccessGroup(caseAccessGroup).id(UUID.randomUUID().toString()).build();
-
- caseAccessGroupWithIds.add(caseAccessGroupWithId);
- }
+ List caseAssignedRoleFieldNodes =
+ findListOfOrganisationPolicyNodeForCaseRole(caseDetails, acd.getCaseAssignedRoleField());
+ for (JsonNode caseAssignedRoleFieldNode : caseAssignedRoleFieldNodes) {
+ addCaseAccessGroupWithIds(caseAssignedRoleFieldNode, acd, caseAccessGroupWithIds);
}
}
setUpModifiedCaseAccessGroups(caseDetails, caseAccessGroupWithIds, caseTypeDefinition);
@@ -81,6 +71,27 @@ public void updateCaseAccessGroupsInCaseDetails(CaseDetails caseDetails, CaseTyp
}
+ private void addCaseAccessGroupWithIds(JsonNode caseAssignedRoleFieldNode,
+ AccessTypeRoleDefinition acd,
+ List caseAccessGroupWithIds) {
+ if (caseAssignedRoleFieldNode != null) {
+ String orgIdentifier = caseAssignedRoleFieldNode.get(ORGANISATION)
+ .get(ORGANISATIONID).textValue();
+
+ if (orgIdentifier != null && !orgIdentifier.isEmpty()) {
+ String caseGroupID = acd.getCaseAccessGroupIdTemplate()
+ .replace(ORG_IDENTIFIER_TEMPLATE, orgIdentifier);
+
+ CaseAccessGroup caseAccessGroup = CaseAccessGroup.builder().caseAccessGroupId(caseGroupID)
+ .caseAccessGroupType(CCD_ALL_CASES).build();
+ CaseAccessGroupWithId caseAccessGroupWithId = CaseAccessGroupWithId.builder()
+ .caseAccessGroup(caseAccessGroup).id(UUID.randomUUID().toString()).build();
+
+ caseAccessGroupWithIds.add(caseAccessGroupWithId);
+ }
+ }
+ }
+
public Map updateCaseDataClassificationWithCaseGroupAccess(
CaseDetails caseDetails, CaseTypeDefinition caseTypeDefinition) {
Map dataClassification = caseDetails.getDataClassification();
@@ -147,30 +158,27 @@ private void setUpModifiedCaseAccessGroups(CaseDetails caseDetails,
caseDetails.setDataClassification(caseDataClassificationWithCaseAccessGroup);
}
- public JsonNode findOrganisationPolicyNodeForCaseRole(CaseDetails caseDetails, String caseRoleId) {
- JsonNode caseRoleNode = caseDetails.getData().values().stream()
- .filter(node -> node.get(ORG_POLICY_CASE_ASSIGNED_ROLE) != null
+ public List findListOfOrganisationPolicyNodeForCaseRole(CaseDetails caseDetails, String caseRoleId) {
+
+ List caseRoleNodes = Optional.ofNullable(caseDetails.getData().values())
+ .orElseGet(Collections::emptyList)
+ .stream()
+ .filter(Objects::nonNull)
+ .filter(node -> node != null && node.get(ORG_POLICY_CASE_ASSIGNED_ROLE) != null
&& node.get(ORG_POLICY_CASE_ASSIGNED_ROLE).asText().equalsIgnoreCase(caseRoleId))
- .reduce((a, b) -> {
- LOG.debug("No Organisation found for CASE_ACCESS_GROUPS={} caseType={} version={} ORGANISATION={},"
- + "ORGANISATIONID={}, ORG_POLICY_CASE_ASSIGNED_ROLE={}.",
- CASE_ACCESS_GROUPS,
- caseDetails.getCaseTypeId(),caseDetails.getVersion(),
- ORGANISATION,ORGANISATIONID,ORG_POLICY_CASE_ASSIGNED_ROLE);
- return null;
- }).orElse(null);
-
- LOG.debug("Organisation found for CASE_ACCESS_GROUPS={} caseType={} version={} ORGANISATION={},"
- + "ORGANISATIONID={}, ORG_POLICY_CASE_ASSIGNED_ROLE={}.",
+ .toList();
+
+ LOG.debug("Organisations found for CASE_ACCESS_GROUPS={} caseType={} version={} ORGANISATION={},"
+ + "ORGANISATIONID={}, ORG_POLICY_CASE_ASSIGNED_ROLE={} .caseRoleNodes={}.",
CASE_ACCESS_GROUPS,
caseDetails.getCaseTypeId(),caseDetails.getVersion(),
- ORGANISATION,ORGANISATIONID,ORG_POLICY_CASE_ASSIGNED_ROLE);
- return caseRoleNode;
+ ORGANISATION,ORGANISATIONID,ORG_POLICY_CASE_ASSIGNED_ROLE, caseRoleNodes);
+ return caseRoleNodes;
}
-
public boolean hasOrganisationPolicyNodeForCaseRole(CaseDetails caseDetails, String caseRoleId) {
- JsonNode organisationPolicyNodeForCaseRole = findOrganisationPolicyNodeForCaseRole(caseDetails, caseRoleId);
+ List organisationPolicyNodeForCaseRole =
+ findListOfOrganisationPolicyNodeForCaseRole(caseDetails, caseRoleId);
return (organisationPolicyNodeForCaseRole != null && !organisationPolicyNodeForCaseRole.isEmpty());
}
diff --git a/src/main/java/uk/gov/hmcts/ccd/domain/service/common/NewCaseUtils.java b/src/main/java/uk/gov/hmcts/ccd/domain/service/common/NewCaseUtils.java
new file mode 100644
index 0000000000..b4193e1469
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/ccd/domain/service/common/NewCaseUtils.java
@@ -0,0 +1,115 @@
+package uk.gov.hmcts.ccd.domain.service.common;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import lombok.experimental.UtilityClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import uk.gov.hmcts.ccd.domain.model.definition.CaseDetails;
+
+import java.util.Collections;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+
+@UtilityClass
+public class NewCaseUtils {
+
+ private static final Logger LOG = LoggerFactory.getLogger(NewCaseUtils.class);
+
+ private static final String ORGANISATION = "Organisation";
+ private static final String ORGANISATIONID = "OrganisationID";
+ public static final String ORG_POLICY_NEW_CASE = "newCase";
+ public static final String SUPPLEMENTRY_DATA_NEW_CASE = "new_case";
+ public static final String CASE_NEW_YES = "YES";
+ public static final String CASE_NEW_NO = "NO";
+
+ public static void setupSupplementryDataWithNewCase(CaseDetails caseDetailsAfterCallbackWithoutHashes) {
+ // Identify organizationProfiles with newCase set to (YES) true
+ List organizationProfilesYes
+ = NewCaseUtils.findListOfOrganisationPolicyNodesForNewCase(caseDetailsAfterCallbackWithoutHashes,
+ CASE_NEW_YES);
+
+ // Update case supplementary data
+ NewCaseUtils.updateCaseSupplementaryData(caseDetailsAfterCallbackWithoutHashes, organizationProfilesYes);
+
+ // Clear organizationProfiles newCase attributes from case data
+ NewCaseUtils.clearNewCaseAttributes(organizationProfilesYes);
+
+ // Clear newCase attributes from case data if case_new set to No (false)
+ clearNewCaseAttributesFromCaseDetailsSetToFalse(caseDetailsAfterCallbackWithoutHashes);
+ }
+
+ public static List findListOfOrganisationPolicyNodesForNewCase(CaseDetails caseDetails,
+ String newCaseValue) {
+ if (caseDetails.getData() == null) {
+ return Collections.emptyList();
+ }
+
+ List orgPolicyNewCaseNodes = Optional.ofNullable(caseDetails.getData().values())
+ .orElseGet(Collections::emptyList)
+ .stream()
+ .filter(Objects::nonNull)
+ .filter(node -> node != null && node.get(ORG_POLICY_NEW_CASE) != null
+ && node.get(ORG_POLICY_NEW_CASE).asText().toUpperCase().equals(newCaseValue))
+ .toList();
+
+ LOG.debug("Organisation found for caseType={} version={} ORGANISATION={},"
+ + "ORGANISATIONID={}, ORG_POLICY_CASE_ASSIGNED_ROLE={}.",
+ caseDetails.getCaseTypeId(),caseDetails.getVersion(),
+ ORGANISATION,ORGANISATIONID,ORG_POLICY_NEW_CASE, orgPolicyNewCaseNodes);
+ return orgPolicyNewCaseNodes;
+ }
+
+ private static void updateCaseSupplementaryData(CaseDetails caseDetails, List organizationProfiles) {
+
+ ObjectNode orgNode = new ObjectMapper().createObjectNode();
+ for (JsonNode orgProfile : organizationProfiles) {
+ String orgIdentifier = orgProfile.get(ORGANISATION)
+ .get(ORGANISATIONID).textValue();
+ if (orgIdentifier != null && !orgIdentifier.isEmpty()) {
+ orgNode.put(orgIdentifier, Boolean.TRUE.toString());
+ }
+ }
+
+ Map supplementaryData = caseDetails.getSupplementaryData();
+
+ if (!orgNode.isEmpty()) {
+ if (supplementaryData == null) {
+ supplementaryData = new HashMap<>();
+ } else {
+ // Remove any other `new_case` keys from the supplementary data
+ supplementaryData.keySet().removeIf(key -> key.equalsIgnoreCase(SUPPLEMENTRY_DATA_NEW_CASE));
+ }
+ supplementaryData.put(SUPPLEMENTRY_DATA_NEW_CASE, orgNode);
+ } else {
+ if (supplementaryData != null) {
+ // Remove any other `new_case` keys from the supplementary data
+ supplementaryData.keySet().removeIf(key -> key.equalsIgnoreCase(SUPPLEMENTRY_DATA_NEW_CASE));
+ }
+ }
+ LOG.debug("new_case SupplementaryData ={} .", supplementaryData);
+ caseDetails.setSupplementaryData(supplementaryData);
+
+ }
+
+ private static void clearNewCaseAttributes(List organizationProfiles) {
+ for (JsonNode orgProfile : organizationProfiles) {
+ ((ObjectNode) orgProfile).remove(ORG_POLICY_NEW_CASE);
+ }
+ }
+
+ public static void clearNewCaseAttributesFromCaseDetailsSetToFalse(CaseDetails caseDetails) {
+ // Identify organizationProfiles with newCase set to (No) false
+ List organizationProfiles
+ = NewCaseUtils.findListOfOrganisationPolicyNodesForNewCase(caseDetails, CASE_NEW_NO);
+
+ for (JsonNode orgProfile : organizationProfiles) {
+ ((ObjectNode) orgProfile).remove(ORG_POLICY_NEW_CASE);
+ }
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransaction.java b/src/main/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransaction.java
index 79fb34677b..cc87b10f28 100644
--- a/src/main/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransaction.java
+++ b/src/main/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransaction.java
@@ -22,6 +22,7 @@
import uk.gov.hmcts.ccd.domain.service.common.SecurityClassificationService;
import uk.gov.hmcts.ccd.domain.service.common.UIDService;
import uk.gov.hmcts.ccd.domain.service.common.CaseAccessGroupUtils;
+import uk.gov.hmcts.ccd.domain.service.common.NewCaseUtils;
import uk.gov.hmcts.ccd.domain.service.getcasedocument.CaseDocumentService;
import uk.gov.hmcts.ccd.domain.service.getcasedocument.CaseDocumentTimestampService;
import uk.gov.hmcts.ccd.domain.service.message.MessageContext;
@@ -113,7 +114,7 @@ public CaseDetails submitCase(Event event,
been assigned and the UID generation has to be part of a retryable transaction in order to recover from
collisions.
*/
- AboutToSubmitCallbackResponse aboutToSubmitCallbackResponse = callbackInvoker.invokeAboutToSubmitCallback(
+ final AboutToSubmitCallbackResponse aboutToSubmitCallbackResponse = callbackInvoker.invokeAboutToSubmitCallback(
caseEventDefinition,
null,
caseDetailsWithoutHashes,
@@ -140,6 +141,8 @@ public CaseDetails submitCase(Event event,
caseTypeDefinition);
}
+ NewCaseUtils.setupSupplementryDataWithNewCase(caseDetailsAfterCallbackWithoutHashes);
+
final CaseDetails savedCaseDetails = saveAuditEventForCaseDetails(
aboutToSubmitCallbackResponse,
event,
diff --git a/src/main/java/uk/gov/hmcts/ccd/domain/service/createevent/CreateCaseEventService.java b/src/main/java/uk/gov/hmcts/ccd/domain/service/createevent/CreateCaseEventService.java
index 4bfdd4c23c..e776bf9739 100644
--- a/src/main/java/uk/gov/hmcts/ccd/domain/service/createevent/CreateCaseEventService.java
+++ b/src/main/java/uk/gov/hmcts/ccd/domain/service/createevent/CreateCaseEventService.java
@@ -28,6 +28,7 @@
import uk.gov.hmcts.ccd.domain.service.casedeletion.TimeToLiveService;
import uk.gov.hmcts.ccd.domain.service.caselinking.CaseLinkService;
import uk.gov.hmcts.ccd.domain.service.common.CaseAccessGroupUtils;
+import uk.gov.hmcts.ccd.domain.service.common.NewCaseUtils;
import uk.gov.hmcts.ccd.domain.service.common.CaseDataService;
import uk.gov.hmcts.ccd.domain.service.common.CasePostStateService;
import uk.gov.hmcts.ccd.domain.service.common.CaseService;
@@ -237,6 +238,11 @@ public CreateCaseEventResult createCaseEvent(final String caseReference, final C
caseTypeDefinition);
}
+ // Identify organizations with newCase set to true
+ // Update case supplementary data
+ // Clear newCase attributes
+ NewCaseUtils.setupSupplementryDataWithNewCase(caseDetailsAfterCallbackWithoutHashes);
+
caseDetailsAfterCallbackWithoutHashes
.setResolvedTTL(timeToLiveService.getUpdatedResolvedTTL(caseDetailsAfterCallback.getData()));
diff --git a/src/test/java/uk/gov/hmcts/ccd/data/casedetails/supplementarydata/DefaultSupplementaryDataRepositoryTest.java b/src/test/java/uk/gov/hmcts/ccd/data/casedetails/supplementarydata/DefaultSupplementaryDataRepositoryTest.java
index 3c86e7416a..b53659e0b1 100644
--- a/src/test/java/uk/gov/hmcts/ccd/data/casedetails/supplementarydata/DefaultSupplementaryDataRepositoryTest.java
+++ b/src/test/java/uk/gov/hmcts/ccd/data/casedetails/supplementarydata/DefaultSupplementaryDataRepositoryTest.java
@@ -22,7 +22,7 @@
class DefaultSupplementaryDataRepositoryTest extends WireMockBaseTest {
- private static final int NUMBER_OF_CASES = 6;
+ private static final int NUMBER_OF_CASES = 7;
private JdbcTemplate template;
private final SupplementaryDataRepository supplementaryDataRepository;
diff --git a/src/test/java/uk/gov/hmcts/ccd/domain/service/caseaccess/CaseAccessOperationTest.java b/src/test/java/uk/gov/hmcts/ccd/domain/service/caseaccess/CaseAccessOperationTest.java
index 1f8b6bc4a2..5932dfdd3b 100644
--- a/src/test/java/uk/gov/hmcts/ccd/domain/service/caseaccess/CaseAccessOperationTest.java
+++ b/src/test/java/uk/gov/hmcts/ccd/domain/service/caseaccess/CaseAccessOperationTest.java
@@ -28,6 +28,7 @@
import uk.gov.hmcts.ccd.domain.model.std.CaseAssignedUserRoleWithOrganisation;
import uk.gov.hmcts.ccd.domain.service.casedataaccesscontrol.RoleAssignmentCategoryService;
import uk.gov.hmcts.ccd.domain.service.casedataaccesscontrol.RoleAssignmentService;
+import uk.gov.hmcts.ccd.domain.service.common.NewCaseUtils;
import uk.gov.hmcts.ccd.domain.service.getcase.CaseNotFoundException;
import uk.gov.hmcts.ccd.endpoint.exceptions.InvalidCaseRoleException;
import uk.gov.hmcts.ccd.v2.external.domain.CaseUser;
@@ -1407,6 +1408,59 @@ void shouldNotIncrementOrganisationUserCountForNewCreatorRoleWithExistingRelatio
verify(supplementaryDataRepository, never()).incrementSupplementaryData(anyString(), anyString(), any());
}
+ @Test
+ @DisplayName("should clear organisation user new_case for single new case-user relationship")
+ void shouldClearNewCaseOrganisationForSingleNewRelationship() {
+
+ // ARRANGE
+ when(applicationParams.getEnableAttributeBasedAccessControl()).thenReturn(false);
+
+ List caseUserRoles = Lists.newArrayList(
+ new CaseAssignedUserRoleWithOrganisation(CASE_REFERENCE.toString(), USER_ID, CASE_ROLE, ORGANISATION)
+ );
+
+ // behave as no existing case roles
+ mockExistingCaseUserRoles(new ArrayList<>());
+
+ // ACT
+ caseAccessOperation.addCaseUserRoles(caseUserRoles);
+
+ // ASSERT
+ verify(supplementaryDataRepository, times(1))
+ .setSupplementaryData(CASE_REFERENCE.toString(), getOrgUserNewCaseSupDataKey(ORGANISATION), false);
+
+ verifyNoInteractions(roleAssignmentService);
+ }
+
+ @Test
+ @DisplayName("should clear organisation new user for multiple new case-user relationship")
+ void shouldClearNewCaseOrganisationForMultipleNewRelationships() {
+
+ // ARRANGE
+ when(applicationParams.getEnableAttributeBasedAccessControl()).thenReturn(false);
+
+ List caseUserRoles = getCaseAssignedUserRoleWithOrganisations();
+
+ // register existing case role
+ mockExistingCaseUserRoles(List.of(
+ // ** CASE_REFERENCE_OTHER + USER_ID_OTHER as exiting relationship
+ // (i.e. to check adjusting count still works in multiple)
+ createCaseUserEntity(CASE_ID_OTHER, CASE_ROLE_OTHER, USER_ID_OTHER)
+ ));
+
+ // ACT
+ caseAccessOperation.addCaseUserRoles(caseUserRoles);
+
+ // ASSERT
+ verify(supplementaryDataRepository, never()) // NB: never called as exiting relationship ignored
+ .findSupplementaryData(
+ CASE_REFERENCE_OTHER.toString(),
+ Collections.singleton(getOrgUserNewCaseSupDataKey(ORGANISATION_OTHER))
+ );
+
+ verifyNoInteractions(roleAssignmentService);
+ }
+
@Test
@DisplayName("should increment organisation user count for multiple new case-user relationship")
void shouldIncrementOrganisationUserCountForMultipleNewRelationships() {
@@ -2551,6 +2605,10 @@ private String getOrgUserCountSupDataKey(String organisationId) {
return "orgs_assigned_users." + organisationId;
}
+ private String getOrgUserNewCaseSupDataKey(String organisationId) {
+ return NewCaseUtils.ORG_POLICY_NEW_CASE + "." + organisationId;
+ }
+
@SuppressWarnings("SameParameterValue")
private void assertCorrectlyPopulatedRoleAssignmentsDeleteRequest(
final String expectedCaseId,
@@ -2601,4 +2659,30 @@ private void mockExistingCaseUserRolesForRA(List existingC
.thenReturn(secondCallCaseUserRoles);
}
+ private List getCaseAssignedUserRoleWithOrganisations() {
+ return Lists.newArrayList(
+ // CASE_REFERENCE/CASE_ID
+ // (2 orgs with 2 users with 2 roles >> 2 org counts incremented by 2)
+ new CaseAssignedUserRoleWithOrganisation(CASE_REFERENCE.toString(), USER_ID, CASE_ROLE, ORGANISATION),
+ new CaseAssignedUserRoleWithOrganisation(CASE_REFERENCE.toString(), USER_ID_OTHER, CASE_ROLE,
+ ORGANISATION),
+ new CaseAssignedUserRoleWithOrganisation(CASE_REFERENCE.toString(), USER_ID, CASE_ROLE_OTHER,
+ ORGANISATION_OTHER),
+ new CaseAssignedUserRoleWithOrganisation(CASE_REFERENCE.toString(), USER_ID_OTHER, CASE_ROLE_OTHER,
+ ORGANISATION_OTHER),
+
+ // CASE_REFERENCE_OTHER/CASE_ID_OTHER
+ // (2 orgs with 1 user each with multiple roles >> 2 org counts incremented by 1)
+ // (however 2nd org count will not be required as existing relationship added below **)
+ new CaseAssignedUserRoleWithOrganisation(CASE_REFERENCE_OTHER.toString(), USER_ID, CASE_ROLE,
+ ORGANISATION),
+ new CaseAssignedUserRoleWithOrganisation(CASE_REFERENCE_OTHER.toString(), USER_ID, CASE_ROLE_OTHER,
+ ORGANISATION),
+ new CaseAssignedUserRoleWithOrganisation(CASE_REFERENCE_OTHER.toString(), USER_ID_OTHER, CASE_ROLE,
+ ORGANISATION_OTHER),
+ new CaseAssignedUserRoleWithOrganisation(CASE_REFERENCE_OTHER.toString(), USER_ID_OTHER,
+ CASE_ROLE_OTHER, ORGANISATION_OTHER)
+ );
+
+ }
}
diff --git a/src/test/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransactionCaseAccessGroupTest.java b/src/test/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransactionCaseAccessGroupTest.java
index d91c9fcd16..1bb6798c59 100644
--- a/src/test/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransactionCaseAccessGroupTest.java
+++ b/src/test/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransactionCaseAccessGroupTest.java
@@ -249,7 +249,7 @@ private CaseStateDefinition buildState() {
}
private Event buildEvent() {
- final Event event = anEvent().build();
+ Event event = anEvent().build();
event.setEventId(EVENT_ID);
event.setDescription(EVENT_DESC);
event.setSummary(EVENT_SUMMARY);
@@ -259,7 +259,7 @@ private Event buildEvent() {
private CaseTypeDefinition buildCaseType() {
final Version version = new Version();
version.setNumber(VERSION);
- final CaseTypeDefinition caseTypeDefinition = new CaseTypeDefinition();
+ CaseTypeDefinition caseTypeDefinition = new CaseTypeDefinition();
caseTypeDefinition.setId(CASE_TYPE_ID);
caseTypeDefinition.setVersion(version);
return caseTypeDefinition;
@@ -287,11 +287,8 @@ static HashMap buildCaseData(String fileName) throws IOExcepti
SubmitCaseTransactionCaseAccessGroupTest.class.getClassLoader()
.getResourceAsStream("tests/".concat(fileName));
- HashMap result =
- new ObjectMapper().readValue(inputStream, new TypeReference<>() {
+ return new ObjectMapper().readValue(inputStream, new TypeReference<>() {
});
-
- return result;
}
@Test
diff --git a/src/test/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransactionNewCaseTest.java b/src/test/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransactionNewCaseTest.java
new file mode 100644
index 0000000000..b7a4d35830
--- /dev/null
+++ b/src/test/java/uk/gov/hmcts/ccd/domain/service/createcase/SubmitCaseTransactionNewCaseTest.java
@@ -0,0 +1,522 @@
+package uk.gov.hmcts.ccd.domain.service.createcase;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import uk.gov.hmcts.ccd.ApplicationParams;
+import uk.gov.hmcts.ccd.config.JacksonUtils;
+import uk.gov.hmcts.ccd.data.casedetails.CaseAuditEventRepository;
+import uk.gov.hmcts.ccd.data.casedetails.CaseDetailsRepository;
+import uk.gov.hmcts.ccd.data.casedetails.SecurityClassification;
+import uk.gov.hmcts.ccd.domain.model.aggregated.IdamUser;
+import uk.gov.hmcts.ccd.domain.model.callbacks.SignificantItem;
+import uk.gov.hmcts.ccd.domain.model.callbacks.SignificantItemType;
+import uk.gov.hmcts.ccd.domain.model.definition.AccessTypeRoleDefinition;
+import uk.gov.hmcts.ccd.domain.model.definition.CaseDetails;
+import uk.gov.hmcts.ccd.domain.model.definition.CaseEventDefinition;
+import uk.gov.hmcts.ccd.domain.model.definition.CaseStateDefinition;
+import uk.gov.hmcts.ccd.domain.model.definition.CaseTypeDefinition;
+import uk.gov.hmcts.ccd.domain.model.definition.CaseAccessGroup;
+import uk.gov.hmcts.ccd.domain.model.definition.CaseAccessGroupWithId;
+import uk.gov.hmcts.ccd.domain.model.definition.Version;
+import uk.gov.hmcts.ccd.domain.model.std.Event;
+import uk.gov.hmcts.ccd.domain.service.casedataaccesscontrol.CaseDataAccessControl;
+import uk.gov.hmcts.ccd.domain.service.common.CaseAccessGroupUtils;
+import uk.gov.hmcts.ccd.domain.service.common.NewCaseUtils;
+import uk.gov.hmcts.ccd.domain.service.common.CaseTypeService;
+import uk.gov.hmcts.ccd.domain.service.common.CaseDataService;
+import uk.gov.hmcts.ccd.domain.service.common.SecurityClassificationServiceImpl;
+import uk.gov.hmcts.ccd.domain.service.common.UIDService;
+import uk.gov.hmcts.ccd.domain.service.getcasedocument.CaseDocumentService;
+import uk.gov.hmcts.ccd.domain.service.getcasedocument.CaseDocumentTimestampService;
+import uk.gov.hmcts.ccd.domain.service.message.MessageService;
+import uk.gov.hmcts.ccd.domain.service.stdapi.AboutToSubmitCallbackResponse;
+import uk.gov.hmcts.ccd.domain.service.stdapi.CallbackInvoker;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.UUID;
+
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertAll;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static uk.gov.hmcts.ccd.config.JacksonUtils.MAPPER;
+import static uk.gov.hmcts.ccd.domain.model.std.EventBuilder.anEvent;
+
+
+class SubmitCaseTransactionNewCaseTest {
+
+ private static final String EVENT_ID = "SomeEvent";
+ private static final String EVENT_NAME = "Some event";
+ private static final String EVENT_SUMMARY = "Some event summary";
+ private static final String EVENT_DESC = "Some event description";
+ private static final String CASE_TYPE_ID = "TestCaseType";
+ private static final Integer VERSION = 67;
+ private static final String IDAM_ID = "23";
+ private static final String IDAM_FNAME = "Pierre";
+ private static final String IDAM_LNAME = "Martin";
+ private static final String IDAM_EMAIL = "pmartin@hmcts.test";
+ private static final Boolean IGNORE_WARNING = Boolean.TRUE;
+ private static final String STATE_ID = "CREATED_ID";
+ private static final String STATE_NAME = "Created name";
+ private static final String CASE_UID = "1234123412341236";
+ private static final String CASE_ID = "45677";
+ public static final String DESCRIPTION = "Description";
+ public static final String URL = "http://www.yahooo.com";
+ public static final SignificantItemType DOCUMENT = SignificantItemType.DOCUMENT;
+
+ public static final String COMPLEX = "Complex";
+ public static final String COLLECTION = "Collection";
+
+ @Mock
+ private CaseDetailsRepository caseDetailsRepository;
+ @Mock
+ private CaseAuditEventRepository caseAuditEventRepository;
+ @Mock
+ private CaseTypeService caseTypeService;
+ @Mock
+ private CallbackInvoker callbackInvoker;
+ @Mock
+ private SecurityClassificationServiceImpl securityClassificationService;
+
+ @Mock
+ private CaseDetails caseDetails;
+
+ private CaseDetails inputCaseDetails;
+
+ @Mock
+ private CaseDetails savedCaseDetails;
+
+ @Mock
+ private UIDService uidService;
+
+ @Mock
+ private CaseDataAccessControl caseDataAccessControl;
+
+ @Mock
+ private CaseDocumentService caseDocumentService;
+
+ @Mock
+ private CaseDocumentTimestampService caseDocumentTimestampService;
+
+ @Mock
+ private MessageService messageService;
+
+ @Mock
+ private CaseDataService caseDataService;
+
+ @Mock
+ private ApplicationParams applicationParams;
+
+ @InjectMocks
+ private SubmitCaseTransaction submitCaseTransaction;
+ private Event event;
+ private CaseTypeDefinition caseTypeDefinition;
+ private IdamUser idamUser;
+ private CaseEventDefinition caseEventDefinition;
+ private CaseStateDefinition state;
+
+ private ObjectMapper objectMapper;
+ private CaseAccessGroupUtils caseAccessGroupUtils;
+
+ @BeforeEach
+ void setup() throws IOException {
+ MockitoAnnotations.openMocks(this);
+
+ event = buildEvent();
+ caseTypeDefinition = buildCaseType();
+ objectMapper = new ObjectMapper();
+ caseAccessGroupUtils = new CaseAccessGroupUtils(caseDataService, objectMapper);
+
+ submitCaseTransaction = new SubmitCaseTransaction(caseDetailsRepository,
+ caseAuditEventRepository,
+ caseTypeService,
+ callbackInvoker,
+ uidService,
+ securityClassificationService,
+ caseDataAccessControl,
+ messageService,
+ caseDocumentService,
+ applicationParams,
+ caseAccessGroupUtils,
+ caseDocumentTimestampService
+ );
+
+ idamUser = buildIdamUser();
+ caseEventDefinition = buildEventTrigger();
+ state = buildState();
+
+ doReturn(STATE_ID).when(savedCaseDetails).getState();
+ doReturn(state).when(caseTypeService).findState(caseTypeDefinition, STATE_ID);
+ doReturn(CASE_UID).when(uidService).generateUID();
+ doReturn(caseDetails).when(caseDocumentService).stripDocumentHashes(caseDetails);
+ doReturn(savedCaseDetails).when(caseDetailsRepository).set(caseDetails);
+ doReturn(CASE_ID).when(savedCaseDetails).getId();
+
+ objectMapper = new ObjectMapper()
+ .registerModule(new Jdk8Module())
+ .registerModule(new ParameterNamesModule(JsonCreator.Mode.PROPERTIES))
+ .registerModule(new JavaTimeModule()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
+ .enable(JsonParser.Feature.STRICT_DUPLICATE_DETECTION);
+
+ inputCaseDetails = new CaseDetails();
+ doReturn(true).when(applicationParams).getCaseGroupAccessFilteringEnabled();
+ inputCaseDetails.setCaseTypeId("SomeCaseType");
+ inputCaseDetails.setJurisdiction("SomeJurisdiction");
+ inputCaseDetails.setState("SomeState");
+
+ AboutToSubmitCallbackResponse response2 = buildResponse();
+ doReturn(inputCaseDetails).when(caseDocumentService).stripDocumentHashes(inputCaseDetails);
+ doReturn(response2).when(callbackInvoker).invokeAboutToSubmitCallback(caseEventDefinition,
+ null, inputCaseDetails, caseTypeDefinition, IGNORE_WARNING);
+
+ AccessTypeRoleDefinition accessTypeRolesDefinition = new AccessTypeRoleDefinition();
+ accessTypeRolesDefinition.setCaseTypeId(caseTypeDefinition.getId());
+ accessTypeRolesDefinition.setAccessTypeId("someAccessTypeId");
+ accessTypeRolesDefinition.setOrganisationalRoleName("someOrgProfileName");
+ accessTypeRolesDefinition.setGroupRoleName("GroupRoleName");
+ accessTypeRolesDefinition.setCaseAccessGroupIdTemplate("SomeJurisdiction:CIVIL:bulk:"
+ + "[RESPONDENT01SOLICITOR]:$ORGID$");
+ accessTypeRolesDefinition.setCaseAssignedRoleField("caseAssignedField");
+
+ List accessTypeRolesDefinitions = new ArrayList();
+ accessTypeRolesDefinitions.add(accessTypeRolesDefinition);
+
+ accessTypeRolesDefinition.setCaseTypeId(caseTypeDefinition.getId());
+ accessTypeRolesDefinition.setAccessTypeId("someAccessTypeId1");
+ accessTypeRolesDefinition.setOrganisationalRoleName("someOrgProfileName1");
+
+ AccessTypeRoleDefinition accessTypeRolesDefinition1 = new AccessTypeRoleDefinition();
+ accessTypeRolesDefinition1.setGroupRoleName("GroupRoleName1");
+ accessTypeRolesDefinition1.setCaseAccessGroupIdTemplate("SomeJurisdictionCIVIL:bulk:"
+ + "[RESPONDENT01SOLICITOR]:$ORGID$");
+ accessTypeRolesDefinition1.setCaseAssignedRoleField("caseAssignedField");
+ accessTypeRolesDefinitions.add(accessTypeRolesDefinition1);
+
+ caseTypeDefinition.setAccessTypeRoleDefinitions(accessTypeRolesDefinitions);
+
+ Map dataMap = buildCaseData("SubmitTransactionDocumentUpload.json");
+
+ inputCaseDetails.setData(dataMap);
+
+ Map dataOrganisation =
+ organisationPolicyCaseDataNewCase("OrganisationPolicyField", "caseAssignedField",
+ "\"550e8400-e29b-41d4-a716-446655440000\"",true, true);
+
+ JacksonUtils.merge(JacksonUtils.convertValue(dataOrganisation), inputCaseDetails.getData());
+
+ }
+
+ private AboutToSubmitCallbackResponse buildResponse() {
+ final AboutToSubmitCallbackResponse aboutToSubmitCallbackResponse = new AboutToSubmitCallbackResponse();
+ aboutToSubmitCallbackResponse.setState(Optional.of("somestring"));
+ final SignificantItem significantItem = new SignificantItem();
+ significantItem.setType(SignificantItemType.DOCUMENT.name());
+ significantItem.setDescription(DESCRIPTION);
+ significantItem.setUrl(URL);
+ aboutToSubmitCallbackResponse.setSignificantItem(significantItem);
+ return aboutToSubmitCallbackResponse;
+ }
+
+ private CaseStateDefinition buildState() {
+ final CaseStateDefinition caseStateDefinition = new CaseStateDefinition();
+ caseStateDefinition.setName(STATE_NAME);
+ return caseStateDefinition;
+ }
+
+ private Event buildEvent() {
+ Event anEvent = anEvent().build();
+ anEvent.setEventId(EVENT_ID);
+ anEvent.setDescription(EVENT_DESC);
+ anEvent.setSummary(EVENT_SUMMARY);
+ return anEvent;
+ }
+
+ private CaseTypeDefinition buildCaseType() {
+ final Version version = new Version();
+ version.setNumber(VERSION);
+ CaseTypeDefinition caseTypeDef = new CaseTypeDefinition();
+ caseTypeDef.setId(CASE_TYPE_ID);
+ caseTypeDef.setVersion(version);
+ return caseTypeDef;
+ }
+
+ private CaseEventDefinition buildEventTrigger() {
+ final CaseEventDefinition evnt = new CaseEventDefinition();
+ evnt.setId(EVENT_ID);
+ evnt.setName(EVENT_NAME);
+ return evnt;
+ }
+
+ private IdamUser buildIdamUser() {
+ IdamUser idamUsr = new IdamUser();
+ idamUsr.setId(IDAM_ID);
+ idamUsr.setForename(IDAM_FNAME);
+ idamUsr.setSurname(IDAM_LNAME);
+ idamUsr.setEmail(IDAM_EMAIL);
+ return idamUsr;
+ }
+
+ static HashMap buildCaseData(String fileName) throws IOException {
+ InputStream inputStream =
+ SubmitCaseTransactionNewCaseTest.class.getClassLoader()
+ .getResourceAsStream("tests/".concat(fileName));
+
+ return new ObjectMapper().readValue(inputStream, new TypeReference<>() {
+ });
+ }
+
+ @Test
+ @DisplayName("should create a case With Organisations for new case false")
+ void shouldPersistCreateCaseEventWithOrganisationNewCaseFalse() throws JsonProcessingException {
+ Map dataOrganisation =
+ organisationPolicyCaseDataNewCase("OrganisationPolicyField","caseAssignedField",
+ "\"550e8400-e29b-41d4-a716-446655440000\"", true,false);
+
+ JacksonUtils.merge(JacksonUtils.convertValue(dataOrganisation), inputCaseDetails.getData());
+
+ inputCaseDetails.setSecurityClassification(SecurityClassification.PUBLIC);
+
+ Map caseDataClassificationWithCaseAccessGroup =
+ caseAccessGroupUtils.updateCaseDataClassificationWithCaseGroupAccess(caseDetails, caseTypeDefinition);
+
+ inputCaseDetails.setDataClassification(caseDataClassificationWithCaseAccessGroup);
+
+ doReturn(inputCaseDetails).when(caseDetailsRepository).set(inputCaseDetails);
+ doReturn(state).when(caseTypeService).findState(caseTypeDefinition, "SomeState");
+ doNothing().when(caseDocumentService).attachCaseDocuments(anyString(), anyString(), anyString(), anyList());
+
+ CaseDetails caseDetailsWithSupplementryNewCase = submitCaseTransaction.submitCase(event, caseTypeDefinition,
+ idamUser, caseEventDefinition, inputCaseDetails,
+ IGNORE_WARNING, null);
+
+ verify(caseDocumentService).attachCaseDocuments(anyString(), anyString(), anyString(), anyList());
+ assertNull(caseDetailsWithSupplementryNewCase.getSupplementaryData());
+ }
+
+ @Test
+ @DisplayName("should create a case With OrganisationID, multiple organisationProfileField for "
+ + "new case false and true")
+ void shouldPersistCreateCaseEventWithOrganisationIDCaseMultipleOrganisationProfileFieldNewCase()
+ throws JsonProcessingException {
+
+ organisationPolicyMultipleCaseDataNewCase(inputCaseDetails);
+
+ doReturn(inputCaseDetails).when(caseDetailsRepository).set(inputCaseDetails);
+ doReturn(state).when(caseTypeService).findState(caseTypeDefinition, "SomeState");
+ doNothing().when(caseDocumentService).attachCaseDocuments(anyString(), anyString(), anyString(), anyList());
+
+ CaseDetails caseDetailsWithSupplementryNewCase = submitCaseTransaction.submitCase(event, caseTypeDefinition,
+ idamUser, caseEventDefinition, inputCaseDetails, IGNORE_WARNING, null);
+
+ verify(caseDocumentService).attachCaseDocuments(anyString(), anyString(), anyString(), anyList());
+ assertCaseDataSupplementry(caseDetailsWithSupplementryNewCase, "\"550e8400-e29b-41d4-a716-446655440000\"");
+ }
+
+ @Test
+ @DisplayName("should create a case With OrganisationProfileField with new case true")
+ void shouldPersistCreateCaseEvenWithOrganisationNewCaseTrue() {
+
+ String caseAccessGroupType = "Any String";
+ String caseAccessGroupID = "SomeJurisdiction:CIVIL:bulk: [RESPONDENT01SOLICITOR]:"
+ + " 550e8400-e29b-41d4-a716-446655440000";
+
+ List caseAccessGroupForUIs = new ArrayList<>();
+
+ CaseAccessGroup caseAccessGroup = CaseAccessGroup.builder().caseAccessGroupId(caseAccessGroupID)
+ .caseAccessGroupType(caseAccessGroupType).build();
+ String uuid = UUID.randomUUID().toString();
+
+ CaseAccessGroupWithId caseAccessGroupForUI = CaseAccessGroupWithId.builder()
+ .caseAccessGroup(caseAccessGroup)
+ .id(uuid).build();
+ caseAccessGroupForUIs.add(caseAccessGroupForUI);
+
+ inputCaseDetails.setSecurityClassification(SecurityClassification.PUBLIC);
+
+ Map caseDataClassificationWithCaseAccessGroup =
+ caseAccessGroupUtils.updateCaseDataClassificationWithCaseGroupAccess(caseDetails, caseTypeDefinition);
+
+ inputCaseDetails.setDataClassification(caseDataClassificationWithCaseAccessGroup);
+
+ doReturn(inputCaseDetails).when(caseDetailsRepository).set(inputCaseDetails);
+ doReturn(state).when(caseTypeService).findState(caseTypeDefinition, "SomeState");
+ doNothing().when(caseDocumentService).attachCaseDocuments(anyString(), anyString(), anyString(), anyList());
+
+ CaseDetails caseDetailsWithSupplementryNewCase = submitCaseTransaction.submitCase(event,
+ caseTypeDefinition,
+ idamUser,
+ caseEventDefinition,
+ inputCaseDetails,
+ IGNORE_WARNING,
+ null);
+
+ verify(caseDocumentService).attachCaseDocuments(anyString(), anyString(), anyString(), anyList());
+ assertCaseDataSupplementry(caseDetailsWithSupplementryNewCase, "\"550e8400-e29b-41d4-a716-446655440000\"");
+
+ }
+
+ @Test
+ @DisplayName("should create a case With OrganisationID, multiple organisationProfileField for "
+ + "new case false and true and update when new case NO for organisationProfileField")
+ void shouldPersistCreateCaseEventWithOrganisationIDCaseMultipleOrganisationProfileFieldNewCaseUpdate()
+ throws JsonProcessingException {
+
+ organisationPolicyMultipleCaseDataNewCase(inputCaseDetails);
+
+ doReturn(inputCaseDetails).when(caseDetailsRepository).set(inputCaseDetails);
+ doReturn(state).when(caseTypeService).findState(caseTypeDefinition, "SomeState");
+ doNothing().when(caseDocumentService).attachCaseDocuments(anyString(), anyString(), anyString(), anyList());
+
+ CaseDetails caseDetailsWithSupplementryNewCase = submitCaseTransaction.submitCase(event, caseTypeDefinition,
+ idamUser, caseEventDefinition, inputCaseDetails, IGNORE_WARNING, null);
+
+ verify(caseDocumentService).attachCaseDocuments(anyString(), anyString(), anyString(), anyList());
+
+ organisationPolicyMultipleCaseDataNewCaseUpdate(caseDetailsWithSupplementryNewCase);
+ CaseDetails caseDetailsWithSupplementryNewCaseUpdate =
+ submitCaseTransaction.submitCase(event, caseTypeDefinition,
+ idamUser, caseEventDefinition, caseDetailsWithSupplementryNewCase, IGNORE_WARNING, null);
+
+ assertCaseDataSupplementry(caseDetailsWithSupplementryNewCaseUpdate,
+ "\"550e8400-e29b-41d4-a716-446655440000\"");
+ }
+
+ private Map organisationPolicyCaseDataNewCase(String orgPolicyField, String role,
+ String organisationId, boolean includeNewCase,
+ boolean newCase)
+ throws JsonProcessingException {
+ JsonNode data;
+ String yesOrNo = "No";
+ if (newCase) {
+ yesOrNo = "Yes";
+ }
+
+ if (includeNewCase) {
+
+ data = MAPPER.readTree(""
+ + "{"
+ + " \"Organisation\": {"
+ + " \"OrganisationID\": " + organisationId + ","
+ + " \"OrganisationName\": \"OrganisationName1\""
+ + " },"
+ + " \"OrgPolicyReference\": null,"
+ + " \"OrgPolicyCaseAssignedRole\": \"" + role + "\","
+ + " \"newCase\": \"" + yesOrNo + "\""
+ + "}");
+ } else {
+ data = MAPPER.readTree(""
+ + "{"
+ + " \"Organisation\": {"
+ + " \"OrganisationID\": " + organisationId + ","
+ + " \"OrganisationName\": \"OrganisationName1\""
+ + " },"
+ + " \"OrgPolicyReference\": null,"
+ + " \"OrgPolicyCaseAssignedRole\": \"" + role + "\""
+ + "}");
+ }
+
+ Map result = new HashMap<>();
+ result.put(orgPolicyField, data);
+ return result;
+ }
+
+ private void organisationPolicyMultipleCaseDataNewCase(CaseDetails inputCaseDetails)
+ throws JsonProcessingException {
+
+ Map dataOrganisation =
+ organisationPolicyCaseDataNewCase("OrganisationPolicyField","caseAssignedField",
+ "\"550e8400-e29b-41d4-a716-446655440000\"", true,true);
+
+ JacksonUtils.merge(JacksonUtils.convertValue(dataOrganisation), inputCaseDetails.getData());
+
+ dataOrganisation =
+ organisationPolicyCaseDataNewCase("OrganisationPolicyField1","caseAssignedField",
+ "\"organisationA\"", false,false);
+
+ JacksonUtils.merge(JacksonUtils.convertValue(dataOrganisation), inputCaseDetails.getData());
+
+ dataOrganisation =
+ organisationPolicyCaseDataNewCase("OrganisationPolicyField2","caseAssignedField",
+ "\"organisationB\"", true,false);
+
+ JacksonUtils.merge(JacksonUtils.convertValue(dataOrganisation), inputCaseDetails.getData());
+
+ dataOrganisation =
+ organisationPolicyCaseDataNewCase("OrganisationPolicyField3","caseAssignedField",
+ "\"organisationC\"", true,true);
+
+
+ JacksonUtils.merge(JacksonUtils.convertValue(dataOrganisation), inputCaseDetails.getData());
+
+ }
+
+ private void organisationPolicyMultipleCaseDataNewCaseUpdate(CaseDetails inputCaseDetails)
+ throws JsonProcessingException {
+
+ Map dataOrganisation =
+ organisationPolicyCaseDataNewCase("OrganisationPolicyField","caseAssignedField",
+ "\"550e8400-e29b-41d4-a716-446655440000\"", true,true);
+
+ JacksonUtils.merge(JacksonUtils.convertValue(dataOrganisation), inputCaseDetails.getData());
+
+ dataOrganisation =
+ organisationPolicyCaseDataNewCase("OrganisationPolicyField1","caseAssignedField",
+ "\"organisationA\"", false,false);
+
+ JacksonUtils.merge(JacksonUtils.convertValue(dataOrganisation), inputCaseDetails.getData());
+
+ dataOrganisation =
+ organisationPolicyCaseDataNewCase("OrganisationPolicyField2","caseAssignedField",
+ "\"organisationB\"", true,false);
+
+ JacksonUtils.merge(JacksonUtils.convertValue(dataOrganisation), inputCaseDetails.getData());
+
+ dataOrganisation =
+ organisationPolicyCaseDataNewCase("OrganisationPolicyField3","caseAssignedField",
+ "\"organisationC\"", true,false);
+
+
+ JacksonUtils.merge(JacksonUtils.convertValue(dataOrganisation), inputCaseDetails.getData());
+
+ }
+
+ private void assertCaseDataSupplementry(final CaseDetails caseDetails, String organisationId) {
+ assertNotNull(caseDetails.getSupplementaryData());
+
+ JsonNode supplementryDataJsonNode = caseDetails.getSupplementaryData()
+ .get(NewCaseUtils.SUPPLEMENTRY_DATA_NEW_CASE);
+ List organizationProfiles = NewCaseUtils.findListOfOrganisationPolicyNodesForNewCase(caseDetails,
+ NewCaseUtils.CASE_NEW_YES);
+
+ assertAll("Assert CaseDetails, Data, organisationId",
+ () -> assertTrue((supplementryDataJsonNode.toString().contains(organisationId))),
+ () -> assertTrue(organizationProfiles.isEmpty())
+ );
+ }
+
+}
diff --git a/src/test/resources/sql/insert_cases_supplementary_data.sql b/src/test/resources/sql/insert_cases_supplementary_data.sql
index fc8ef3c5bf..fdcd813648 100644
--- a/src/test/resources/sql/insert_cases_supplementary_data.sql
+++ b/src/test/resources/sql/insert_cases_supplementary_data.sql
@@ -230,3 +230,42 @@ VALUES (1006, 'TestAddressBookCase', 'PROBATE', 'CaseCreated', 'PUBLIC',
}
}'
);
+
+INSERT INTO case_data (id, case_type_id, jurisdiction, state, security_classification, data, data_classification, reference, created_date, last_modified, last_state_modified_date, supplementary_data)
+VALUES (1007, 'TestAddressBookCase', 'PROBATE', 'CaseCreated', 'PUBLIC',
+ '{
+ "PersonFirstName": "Peter",
+ "PersonLastName": "Pullen",
+ "PersonAddress": {
+ "AddressLine1": "Governer House",
+ "AddressLine2": "1 Puddle Lane",
+ "AddressLine3": "London",
+ "Country": "England",
+ "Postcode": "SE1 4EE"
+ }
+ }',
+ '{
+ "PersonFirstName": "PUBLIC",
+ "PersonLastName": "PUBLIC",
+ "PersonAddress": {
+ "classification" : "PUBLIC",
+ "value" : {
+ "AddressLine1": "PUBLIC",
+ "AddressLine2": "PUBLIC",
+ "AddressLine3": "PUBLIC",
+ "Country": "PUBLIC",
+ "Postcode": "PUBLIC"
+ }
+ }
+ }',
+ '1504259907333333',
+ '2025-02-06 20:44:53.824',
+ '2025-02-06 20:44:53.824',
+ '2025-02-06 20:44:53.824',
+ '{
+ "new_case": {
+ "organisationA": true,
+ "organisationB": true
+ }
+ }'
+);