diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index 670e772df6..a45e84f955 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-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 definitionStoreDevelopPr = "PR-1534" // This doesn't change frequently, but when it does, only change this value. +def dataStoreApiDevelopPr = "PR-2543" // 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 6229a075d1..ebe803b906 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,6 @@ def versions = [ ext['spring-security.version'] = '5.7.11' 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.26.2-prerelease-CCD-5329' diff --git a/charts/ccd-data-store-api/values.preview.template.yaml b/charts/ccd-data-store-api/values.preview.template.yaml index 157cad95f4..5058a88121 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-1529-java/ + DEFINITION_STORE_HOST: http://ccd-definition-store-api-pr-1534-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-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 index 69fee7676e..e1c9cfd651 100644 --- 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 @@ -62,7 +62,7 @@ }, "supplementary_data" : { "new_case" : { - "orgID1" : "true" + "orgID1" : true } } } 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 index edbc233e91..ead37075c2 100644 --- 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 @@ -62,7 +62,7 @@ "supplementary_data": { "new_case": { - "orgID1": "true" + "orgID1": true } }, "after_submit_callback_response": 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 index ee81a8fa2c..e9b5116415 100644 --- 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 @@ -100,8 +100,8 @@ "supplementary_data": { "new_case": { - "orgID1" : "true", - "orgID3" : "true" + "orgID1" : true, + "orgID3" : true } }, "after_submit_callback_response": 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 index e77eeadfe9..f46951e6d1 100644 --- 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 @@ -62,7 +62,7 @@ "supplementary_data": { "new_case": [ { - "orgID1" : "true" + "orgID1" : true } ] }, 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 index c93f4a09dc..13877bfe67 100644 --- 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 @@ -111,8 +111,8 @@ "supplementary_data": { "new_case": { - "orgID1" : "true", - "orgID3" : "true" + "orgID1" : true, + "orgID3" : true } }, "after_submit_callback_response": 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 index bbfb572f27..fd9448716e 100644 --- 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 @@ -72,7 +72,7 @@ "data_classification" : { }, "supplementary_data" : { "new_case" : { - "orgID1" : "true" + "orgID1" : true } }, "after_submit_callback_response" : null, 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 index b85e8c808f..7732cabf78 100644 --- 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 @@ -62,7 +62,7 @@ }, "supplementary_data" : { "new_case" : { - "orgID1" : "true" + "orgID1" : true } } } diff --git a/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/F-143.feature b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/F-143.feature new file mode 100644 index 0000000000..db36f9ab98 --- /dev/null +++ b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/F-143.feature @@ -0,0 +1,53 @@ +@F-143 @elasticsearch +Feature: F-143 Additional new cases supplementary data property returned by ES Search APIs + + Background: Load test data for the scenario + Given an appropriate test context as detailed in the test data source + And a case that has just been created as in [F-143_CreateCasePreRequisiteCaseworker] + And a successful call [to add supplementary data for the case] as in [F-143_Add_Supplementary_Data] + And a wait time of [5] seconds [to allow for Logstash to index the case just created], + And a user with [a valid profile] + + @S-143.1 #AC03 + Scenario: internal search api usecase request does not return supplementary data by default + Given the request [is configured to search for the previously created case], + And the request [does not explicitly request supplementary_data] + And the request [is using the query parameter use_case=orgcases], + And a request is prepared with appropriate values, + When it is submitted to call the [Internal Elastic Search Endpoint] operation of [CCD Data Store Elastic Search API], + Then the response [contains the previously created case], + Then the response [contains supplementary data], + And the response has all other details as expected. + + @S-143.2 #AC01 + Scenario: internal search api usecase request does return supplementary data when requested in the request + Given the request [is configured to search for the previously created case], + And the request [is configured to request supplementary_data] + And the request [is using the query parameter use_case=orgcases], + And a request is prepared with appropriate values, + When it is submitted to call the [Internal Elastic Search Endpoint] operation of [CCD Data Store Elastic Search API], + Then the response [contains the previously created case], + Then the response [contains supplementary data], + And the response has all other details as expected. + + @S-143.3 #AC04 + Scenario: external search api can request sub selection of supplementary data + Given a user with [a valid profile] + When the request [is configured to search for the previously created case], + And the request [requests a subsection of the supplementary data] + And a request is prepared with appropriate values, + And it is submitted to call the [External Elastic Search Endpoint] operation of [CCD Data Store Elastic Search API], + Then the response [contains the previously created case], + Then the response [contains the specified sub section of supplementary data], + And the response has all other details as expected. + + @S-143.4 #AC01 + Scenario: external search api can request New cases from supplementary data where new case value is true + Given a user with [a valid profile] + When the request [is configured to search for the previously created case], + And the request [requests a subsection of the supplementary data] + And a request is prepared with appropriate values, + And it is submitted to call the [External Elastic Search Endpoint] operation of [CCD Data Store Elastic Search API], + Then the response [contains the previously created case], + Then the response [contains the specified sub section of supplementary data], + And the response has all other details as expected. diff --git a/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/F-143_Add_Supplementary_Data.td.json b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/F-143_Add_Supplementary_Data.td.json new file mode 100644 index 0000000000..05b642d53f --- /dev/null +++ b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/F-143_Add_Supplementary_Data.td.json @@ -0,0 +1,35 @@ +{ + "_guid_": "F-143_Add_Supplementary_Data", + "title": "Update Supplementary Data Base", + "productName": "CCD Data Store", + "operationName": "Update Supplementary Data", + "method": "POST", + "uri": "/cases/{caseId}/supplementary-data", + "specs": ["to add supplementary data for the case"], + "users": { + "invokingUser": { + "_extends_": "BeftaCaseworkerCaa" + } + }, + "request": { + "_extends_": "Common_Request", + "pathVariables": { + "caseId": "${[scenarioContext][parentContext][childContexts][F-143_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}" + }, + "body": { + "supplementary_data_updates": { + "$set": { + "new_case.orgID1": true + } + } + } + }, + "expectedResponse": { + "_extends_": "Common_200_Response", + "body": { + "supplementary_data": { + "new_case.orgID1": true + } + } + } +} diff --git a/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/F-143_CreateCasePreRequisiteCaseworker.td.json b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/F-143_CreateCasePreRequisiteCaseworker.td.json new file mode 100644 index 0000000000..8aa198d638 --- /dev/null +++ b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/F-143_CreateCasePreRequisiteCaseworker.td.json @@ -0,0 +1,70 @@ +{ + "_guid_": "F-143_CreateCasePreRequisiteCaseworker", + "_extends_": "Case_Creation_Data_Base", + "specs": [ + "to create a case", + "As a prerequisite" + ], + + "prerequisites" : [ { + "Token_Creation": "S-143_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-143 - supplementary_data new case in ES Search API/S-143.1.td.json b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.1.td.json new file mode 100644 index 0000000000..a645dde1a9 --- /dev/null +++ b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.1.td.json @@ -0,0 +1,124 @@ +{ + "_guid_": "S-143.1", + "productName": "CCD Data Store Elastic Search API", + "operationName": "Internal Elastic Search Endpoint", + "method": "POST", + "uri": "/internal/searchCases", + "user" : { + "_extends_": "BeftaMasterCaseworker" + }, + "specs": [ + "a valid profile", + "is configured to search for the previously created case", + "does not explicitly request supplementary_data", + "is using the query parameter use_case=orgcases", + "contains the previously created case", + "contains supplementary data" + ], + "request": { + "_extends_": "Common_Request", + "queryParams": { + "ctid": "FT_NewCaseSupplementry", + "use_case": "ORGCASES" + }, + "body": { + "native_es_query": { + "query": { + "match": { + "reference": "${[scenarioContext][childContexts][F-143_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}" + } + } + } + } + }, + + "expectedResponse": { + "_extends_": "Common_200_Response", + "body": { + "headers": [ + { + "__ordering__": "ordered" + }, + { + "metadata": { + "jurisdiction": "BEFTA_MASTER", + "case_type_id": "FT_NewCaseSupplementry" + }, + "fields": [ + { + "__operator__": "equivalent", + "__ordering__": "unordered", + "__elementId__": "label" + }, + { + "label": "`FixedList` orgcases", + "order": 1, + "metadata": false, + "case_field_id": "FixedListField", + "case_field_type": { + "id": "FixedList-FixedListType", + "type": "FixedList", + "min": null, + "max": null, + "regular_expression": null, + "fixed_list_items": [{ + "code" : "VALUE4", + "label" : "Value 4", + "order" : null + }, + { + "code": "VALUE3", + "label": "Value 3", + "order": null + }, + { + "code": "VALUE2", + "label": "Value 2", + "order": null + }, + { + "code": "VALUE1", + "label": "Value 1", + "order": null + } + ], + "complex_fields": [], + "collection_field_type": null + }, + "display_context_parameter": null + } + ], + "cases": "[[ANYTHING_PRESENT]]" + } + ], + "cases": [ + { + "fields": { + "[JURISDICTION]": "BEFTA_MASTER", + "[LAST_STATE_MODIFIED_DATE]" : "[[ANYTHING_PRESENT]]", + "[CREATED_DATE]": "[[ANYTHING_PRESENT]]", + "[CASE_REFERENCE]": "${[scenarioContext][customValues][caseIdAsStringFrom_F-143_CreateCasePreRequisiteCaseworker]}", + "[STATE]": "CaseCreated", + "[SECURITY_CLASSIFICATION]": "PUBLIC", + "[CASE_TYPE]": "FT_NewCaseSupplementry", + "[LAST_MODIFIED_DATE]": "[[ANYTHING_PRESENT]]" + }, + "case_id": "${[scenarioContext][customValues][caseIdAsStringFrom_F-143_CreateCasePreRequisiteCaseworker]}", + "fields_formatted": { + "[JURISDICTION]": "BEFTA_MASTER", + "[LAST_STATE_MODIFIED_DATE]" : "[[ANYTHING_PRESENT]]", + "[CREATED_DATE]": "[[ANYTHING_PRESENT]]", + "[CASE_REFERENCE]": "${[scenarioContext][customValues][caseIdAsStringFrom_F-143_CreateCasePreRequisiteCaseworker]}", + "[STATE]": "CaseCreated", + "[SECURITY_CLASSIFICATION]": "PUBLIC", + "[CASE_TYPE]": "FT_NewCaseSupplementry", + "[LAST_MODIFIED_DATE]": "[[ANYTHING_PRESENT]]" + }, + "supplementary_data" : null + } + ], + "total": 1 + } + + } +} diff --git a/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.2.td.json b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.2.td.json new file mode 100644 index 0000000000..18895d9a86 --- /dev/null +++ b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.2.td.json @@ -0,0 +1,129 @@ +{ + "_guid_": "S-143.2", + "productName": "CCD Data Store Elastic Search API", + "operationName": "Internal Elastic Search Endpoint", + "method": "POST", + "uri": "/internal/searchCases", + "user" : { + "_extends_": "BeftaMasterCaseworker" + }, + "specs": [ + "a valid profile", + "is configured to search for the previously created case", + "is configured to request supplementary_data", + "is using the query parameter use_case=orgcases", + "contains the previously created case", + "contains supplementary data" + ], + "request": { + "_extends_": "Common_Request", + "queryParams": { + "ctid": "FT_NewCaseSupplementry", + "use_case": "ORGCASES" + }, + "body": { + "native_es_query": { + "query": { + "match": { + "reference": "${[scenarioContext][childContexts][F-143_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}" + } + } + }, + "supplementary_data" : ["new_case.*"] + } + }, + + "expectedResponse": { + "_extends_": "Common_200_Response", + "body": { + "headers": [ + { + "__ordering__": "ordered" + }, + { + "metadata": { + "jurisdiction": "BEFTA_MASTER", + "case_type_id": "FT_NewCaseSupplementry" + }, + "fields": [ + { + "__operator__": "equivalent", + "__ordering__": "unordered", + "__elementId__": "label" + }, + { + "label": "`FixedList` orgcases", + "order": 1, + "metadata": false, + "case_field_id": "FixedListField", + "case_field_type": { + "id": "FixedList-FixedListType", + "type": "FixedList", + "min": null, + "max": null, + "regular_expression": null, + "fixed_list_items": [{ + "code" : "VALUE4", + "label" : "Value 4", + "order" : null + }, + { + "code": "VALUE3", + "label": "Value 3", + "order": null + }, + { + "code": "VALUE2", + "label": "Value 2", + "order": null + }, + { + "code": "VALUE1", + "label": "Value 1", + "order": null + } + ], + "complex_fields": [], + "collection_field_type": null + }, + "display_context_parameter": null + } + ], + "cases": "[[ANYTHING_PRESENT]]" + } + ], + "cases": [ + { + "fields": { + "[JURISDICTION]": "BEFTA_MASTER", + "[LAST_STATE_MODIFIED_DATE]" : "[[ANYTHING_PRESENT]]", + "[CREATED_DATE]": "[[ANYTHING_PRESENT]]", + "[CASE_REFERENCE]": "${[scenarioContext][customValues][caseIdAsStringFrom_F-143_CreateCasePreRequisiteCaseworker]}", + "[STATE]": "CaseCreated", + "[SECURITY_CLASSIFICATION]": "PUBLIC", + "[CASE_TYPE]": "FT_NewCaseSupplementry", + "[LAST_MODIFIED_DATE]": "[[ANYTHING_PRESENT]]" + }, + "case_id": "${[scenarioContext][customValues][caseIdAsStringFrom_F-143_CreateCasePreRequisiteCaseworker]}", + "fields_formatted": { + "[JURISDICTION]": "BEFTA_MASTER", + "[LAST_STATE_MODIFIED_DATE]" : "[[ANYTHING_PRESENT]]", + "[CREATED_DATE]": "[[ANYTHING_PRESENT]]", + "[CASE_REFERENCE]": "${[scenarioContext][customValues][caseIdAsStringFrom_F-143_CreateCasePreRequisiteCaseworker]}", + "[STATE]": "CaseCreated", + "[SECURITY_CLASSIFICATION]": "PUBLIC", + "[CASE_TYPE]": "FT_NewCaseSupplementry", + "[LAST_MODIFIED_DATE]": "[[ANYTHING_PRESENT]]" + }, + "supplementary_data" : { + "new_case" : { + "orgID1" : true + } + } + } + ], + "total": 1 + } + + } +} diff --git a/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.3.td.json b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.3.td.json new file mode 100644 index 0000000000..044fd00259 --- /dev/null +++ b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.3.td.json @@ -0,0 +1,83 @@ +{ + "_guid_": "S-143.3", + "title": "External Elastic Search Endpoint", + "productName": "CCD Data Store Elastic Search API", + "operationName": "External Elastic Search Endpoint", + "method": "POST", + "uri": "/searchCases", + "specs": [ + "a valid profile", + "is configured to search for the previously created case", + "requests a subsection of the supplementary data", + "does not explicitly request supplementary_data", + "contains the previously created case", + "contains the specified sub section of supplementary data", + "contains supplementary data" + ], + "user" : { + "_extends_": "BeftaMasterCaseworker" + }, + "request": { + "_extends_": "Common_Request", + "queryParams": { + "ctid": "FT_NewCaseSupplementry" + }, + "body": { + "native_es_query" : { + "query": { + "match": { + "reference": "${[scenarioContext][childContexts][F-143_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}" + } + } + }, + "supplementary_data" : ["new_case.orgID1"] + } + }, + + "expectedResponse": { + "_extends_": "Common_200_Response", + "body": { + "total": 1, + "cases": [{ + "id": "${[scenarioContext][customValues][caseIdAsIntegerFrom_F-143_CreateCasePreRequisiteCaseworker]}", + "jurisdiction": "BEFTA_MASTER", + "state": "CaseCreated", + "version": null, + "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" + } + } + }, + "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, + "data_classification": "[[ANYTHING_PRESENT]]", + "supplementary_data" : { + "new_case" : { + "orgID1" : true + } + } + }], + "case_types_results" : [{ + "total" : 1, + "case_type_id" : "FT_NewCaseSupplementry" + }] + } + } +} diff --git a/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.4.td.json b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.4.td.json new file mode 100644 index 0000000000..18be57c9b3 --- /dev/null +++ b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143.4.td.json @@ -0,0 +1,83 @@ +{ + "_guid_": "S-143.4", + "title": "External Elastic Search Endpoint", + "productName": "CCD Data Store Elastic Search API", + "operationName": "External Elastic Search Endpoint", + "method": "POST", + "uri": "/searchCases", + "specs": [ + "a valid profile", + "is configured to search for the previously created case", + "requests a subsection of the supplementary data", + "does not explicitly request supplementary_data", + "contains the previously created case", + "contains the specified sub section of supplementary data", + "contains supplementary data" + ], + "user" : { + "_extends_": "BeftaMasterCaseworker" + }, + "request": { + "_extends_": "Common_Request", + "queryParams": { + "ctid": "FT_NewCaseSupplementry" + }, + "body": { + "native_es_query" : { + "query": { + "match": { + "reference": "${[scenarioContext][childContexts][F-143_CreateCasePreRequisiteCaseworker][testData][actualResponse][body][id]}" + } + } + }, + "supplementary_data" : ["new_case.orgID1", "true"] + } + }, + + "expectedResponse": { + "_extends_": "Common_200_Response", + "body": { + "total": 1, + "cases": [{ + "id": "${[scenarioContext][customValues][caseIdAsIntegerFrom_F-143_CreateCasePreRequisiteCaseworker]}", + "jurisdiction": "BEFTA_MASTER", + "state": "CaseCreated", + "version": null, + "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" + } + } + }, + "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, + "data_classification": "[[ANYTHING_PRESENT]]", + "supplementary_data" : { + "new_case" : { + "orgID1" : true + } + } + }], + "case_types_results" : [{ + "total" : 1, + "case_type_id" : "FT_NewCaseSupplementry" + }] + } + } +} diff --git a/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143_GetCreateToken.td.json b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143_GetCreateToken.td.json new file mode 100644 index 0000000000..99750c9db8 --- /dev/null +++ b/src/aat/resources/features/F-143 - supplementary_data new case in ES Search API/S-143_GetCreateToken.td.json @@ -0,0 +1,28 @@ +{ + "_guid_": "S-143_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-143a - supplementary_data multiple new case in ES Search API/F-143a.feature b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/F-143a.feature new file mode 100644 index 0000000000..178e26f553 --- /dev/null +++ b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/F-143a.feature @@ -0,0 +1,31 @@ +@F-143a @elasticsearch +Feature: F-143a Additional new cases supplementary data property returned by ES Search APIs + + Background: Load test data for the scenario + + Given an appropriate test context as detailed in the test data source + And a case that has just been created as in [F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs] + And a successful call [to add supplementary data for the case] as in [F-143a_Add_Supplementary_Data_Multiple_Orgs] + And a wait time of [5] seconds [to allow for Logstash to index the case just created], + And a user with [a valid profile] + + @S-143a.1 #AC01 + Scenario: external search api returns multiple new case orgs supplementary data by default + Given the request [is configured to search for the previously created case], + And the request [requests a subsection of the supplementary data] + And a request is prepared with appropriate values, + When it is submitted to call the [External Elastic Search Endpoint] operation of [CCD Data Store Elastic Search API], + Then the response [contains the previously created case], + Then the response [contains supplementary data], + Then the response [contains the specified sub section of new_case of supplementary data], + And the response has all other details as expected. + + @S-143a.2 #AC04 + Scenario: internal search api returns multiple new case orgs supplementary data by default + Given the request [is configured to search for the previously created case], + And the request [is configured to request supplementary_data] + And a request is prepared with appropriate values, + When it is submitted to call the [Internal Elastic Search Endpoint] operation of [CCD Data Store Elastic Search API], + Then the response [contains the previously created case], + Then the response [contains supplementary data], + And the response has all other details as expected. diff --git a/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/F-143a_Add_Supplementary_Data_Multiple_Orgs.td.json b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/F-143a_Add_Supplementary_Data_Multiple_Orgs.td.json new file mode 100644 index 0000000000..7d82786868 --- /dev/null +++ b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/F-143a_Add_Supplementary_Data_Multiple_Orgs.td.json @@ -0,0 +1,37 @@ +{ + "_guid_": "F-143a_Add_Supplementary_Data_Multiple_Orgs", + "title": "Update Supplementary Data Base", + "productName": "CCD Data Store", + "operationName": "Update Supplementary Data", + "method": "POST", + "uri": "/cases/{caseId}/supplementary-data", + "specs": ["to add supplementary data for the case"], + "users": { + "invokingUser": { + "_extends_": "BeftaCaseworkerCaa" + } + }, + "request": { + "_extends_": "Common_Request", + "pathVariables": { + "caseId": "${[scenarioContext][parentContext][childContexts][F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs][testData][actualResponse][body][id]}" + }, + "body": { + "supplementary_data_updates": { + "$set": { + "new_case.orgID1": true, + "new_case.orgID3": true + } + } + } + }, + "expectedResponse": { + "_extends_": "Common_200_Response", + "body": { + "supplementary_data": { + "new_case.orgID1": true, + "new_case.orgID3": true + } + } + } +} diff --git a/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs.td.json b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs.td.json new file mode 100644 index 0000000000..456bf59203 --- /dev/null +++ b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs.td.json @@ -0,0 +1,109 @@ +{ + "_guid_": "F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs", + "_extends_": "Case_Creation_Data_Base", + "specs": [ + "to create a case", + "As a prerequisite" + ], + + "prerequisites" : [ { + "Token_Creation": "S-143a_GetCreateToken" + } + ], + + "users": { + "invokingUser": { + "_extends_": "BeftaMasterCaseworker" + } + }, + "request": { + "pathVariables": { + "jid": "BEFTA_MASTER", + "ctid": "FT_NewCaseSupplementry" + }, + "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": "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" + } + }, + "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 + } + } + } + } +} diff --git a/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/S-143a.1.td.json b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/S-143a.1.td.json new file mode 100644 index 0000000000..ac92ee28e4 --- /dev/null +++ b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/S-143a.1.td.json @@ -0,0 +1,97 @@ +{ + "_guid_": "S-143a.1", + "title": "External Elastic Search Endpoint", + "productName": "CCD Data Store Elastic Search API", + "operationName": "External Elastic Search Endpoint", + "method": "POST", + "uri": "/searchCases", + "specs": [ + "a valid profile", + "is configured to search for the previously created case", + "requests a subsection of the supplementary data", + "does not explicitly request supplementary_data", + "contains the previously created case", + "contains the specified sub section of new_case of supplementary data", + "contains supplementary data" + ], + "user" : { + "_extends_": "BeftaMasterCaseworker" + }, + "request": { + "_extends_": "Common_Request", + "queryParams": { + "ctid": "FT_NewCaseSupplementry" + }, + "body": { + "native_es_query" : { + "query": { + "match": { + "reference": "${[scenarioContext][childContexts][F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs][testData][actualResponse][body][id]}" + } + } + }, + "supplementary_data" : ["new_case.*"] + } + }, + + "expectedResponse": { + "_extends_": "Common_200_Response", + "body": { + "total": 1, + "cases": [{ + "id": "${[scenarioContext][customValues][caseIdAsIntegerFrom_F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs]}", + "jurisdiction": "BEFTA_MASTER", + "state": "CaseCreated", + "version": null, + "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" + } + }, + "OrganisationPolicyField5" : { + "Organisation" : { + "OrganisationID" : "orgID2a", + "OrganisationName" : "orgName2a" + } + }, + "OrganisationPolicyField4" : { + "Organisation" : { + "OrganisationID" : "orgID2", + "OrganisationName" : "orgName2" + } + }, + "OrganisationPolicyField3" : { + "Organisation" : { + "OrganisationID" : "orgID3", + "OrganisationName" : "orgName3" + } + } + }, + "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, + "data_classification": "[[ANYTHING_PRESENT]]" + }], + "case_types_results" : [{ + "total" : 1, + "case_type_id" : "FT_NewCaseSupplementry" + }] + } + } +} diff --git a/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/S-143a.2.td.json b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/S-143a.2.td.json new file mode 100644 index 0000000000..7fe3509d04 --- /dev/null +++ b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/S-143a.2.td.json @@ -0,0 +1,130 @@ +{ + "_guid_": "S-143a.2", + "productName": "CCD Data Store Elastic Search API", + "operationName": "Internal Elastic Search Endpoint", + "method": "POST", + "uri": "/internal/searchCases", + "user" : { + "_extends_": "BeftaMasterCaseworker" + }, + "specs": [ + "a valid profile", + "is configured to search for the previously created case", + "is configured to request supplementary_data", + "is using the query parameter use_case=orgcases", + "contains the previously created case", + "contains supplementary data" + ], + "request": { + "_extends_": "Common_Request", + "queryParams": { + "ctid": "FT_NewCaseSupplementry", + "use_case": "ORGCASES" + }, + "body": { + "native_es_query": { + "query": { + "match": { + "reference": "${[scenarioContext][childContexts][F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs][testData][actualResponse][body][id]}" + } + } + }, + "supplementary_data" : ["new_case.*"] + } + }, + + "expectedResponse": { + "_extends_": "Common_200_Response", + "body": { + "headers": [ + { + "__ordering__": "ordered" + }, + { + "metadata": { + "jurisdiction": "BEFTA_MASTER", + "case_type_id": "FT_NewCaseSupplementry" + }, + "fields": [ + { + "__operator__": "equivalent", + "__ordering__": "unordered", + "__elementId__": "label" + }, + { + "label": "`FixedList` orgcases", + "order": 1, + "metadata": false, + "case_field_id": "FixedListField", + "case_field_type": { + "id": "FixedList-FixedListType", + "type": "FixedList", + "min": null, + "max": null, + "regular_expression": null, + "fixed_list_items": [{ + "code" : "VALUE4", + "label" : "Value 4", + "order" : null + }, + { + "code": "VALUE3", + "label": "Value 3", + "order": null + }, + { + "code": "VALUE2", + "label": "Value 2", + "order": null + }, + { + "code": "VALUE1", + "label": "Value 1", + "order": null + } + ], + "complex_fields": [], + "collection_field_type": null + }, + "display_context_parameter": null + } + ], + "cases": "[[ANYTHING_PRESENT]]" + } + ], + "cases": [ + { + "fields": { + "[JURISDICTION]": "BEFTA_MASTER", + "[LAST_STATE_MODIFIED_DATE]" : "[[ANYTHING_PRESENT]]", + "[CREATED_DATE]": "[[ANYTHING_PRESENT]]", + "[CASE_REFERENCE]": "${[scenarioContext][customValues][caseIdAsStringFrom_F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs]}", + "[STATE]": "CaseCreated", + "[SECURITY_CLASSIFICATION]": "PUBLIC", + "[CASE_TYPE]": "FT_NewCaseSupplementry", + "[LAST_MODIFIED_DATE]": "[[ANYTHING_PRESENT]]" + }, + "case_id": "${[scenarioContext][customValues][caseIdAsStringFrom_F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs]}", + "fields_formatted": { + "[JURISDICTION]": "BEFTA_MASTER", + "[LAST_STATE_MODIFIED_DATE]" : "[[ANYTHING_PRESENT]]", + "[CREATED_DATE]": "[[ANYTHING_PRESENT]]", + "[CASE_REFERENCE]": "${[scenarioContext][customValues][caseIdAsStringFrom_F-143a_CreateCasePreRequisiteCaseworker_Multiple_Orgs]}", + "[STATE]": "CaseCreated", + "[SECURITY_CLASSIFICATION]": "PUBLIC", + "[CASE_TYPE]": "FT_NewCaseSupplementry", + "[LAST_MODIFIED_DATE]": "[[ANYTHING_PRESENT]]" + }, + "supplementary_data" : { + "new_case" : { + "orgID1" : true, + "orgID3" : true + } + } + } + ], + "total": 1 + } + + } +} diff --git a/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/S-143a_GetCreateToken.td.json b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/S-143a_GetCreateToken.td.json new file mode 100644 index 0000000000..2091b3ca5f --- /dev/null +++ b/src/aat/resources/features/F-143a - supplementary_data multiple new case in ES Search API/S-143a_GetCreateToken.td.json @@ -0,0 +1,28 @@ +{ + "_guid_": "S-143a_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/main/java/uk/gov/hmcts/ccd/domain/service/common/NewCaseUtils.java b/src/main/java/uk/gov/hmcts/ccd/domain/service/common/NewCaseUtils.java index b4193e1469..53f45d7fba 100644 --- 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 @@ -35,7 +35,8 @@ public static void setupSupplementryDataWithNewCase(CaseDetails caseDetailsAfter CASE_NEW_YES); // Update case supplementary data - NewCaseUtils.updateCaseSupplementaryData(caseDetailsAfterCallbackWithoutHashes, organizationProfilesYes); + + updateCaseNewCaseSupplementaryData(caseDetailsAfterCallbackWithoutHashes, organizationProfilesYes); // Clear organizationProfiles newCase attributes from case data NewCaseUtils.clearNewCaseAttributes(organizationProfilesYes); @@ -65,14 +66,15 @@ public static List findListOfOrganisationPolicyNodesForNewCase(CaseDet return orgPolicyNewCaseNodes; } - private static void updateCaseSupplementaryData(CaseDetails caseDetails, List organizationProfiles) { + private static void updateCaseNewCaseSupplementaryData(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()); + orgNode.put(orgIdentifier, Boolean.TRUE); } }