From 23f02c32d92718fb2637e93a5ccbcf8533b3b71e Mon Sep 17 00:00:00 2001 From: Joseph Rogerson Date: Fri, 12 May 2023 15:48:54 +0100 Subject: [PATCH 1/4] HOCS-6449: Add logs for when adding additional correspondents fails --- .../ho/hocs/domain/queue/migration/MigrationService.java | 6 ++++-- .../ho/hocs/domain/repositories/entities/Status.java | 1 + .../hocs/domain/queue/migration/MigrationServiceTest.java | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationService.java b/src/main/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationService.java index 64c1d86a..2c565bf1 100644 --- a/src/main/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationService.java +++ b/src/main/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationService.java @@ -185,7 +185,7 @@ CreateMigrationCorrespondentRequest composeMigrationCorrespondentRequest( MigrationData migrationData ) { MigrationComplaintCorrespondent primaryCorrespondent = getPrimaryCorrespondent(migrationData.getPrimaryCorrespondent()); - List additionalCorrespondents = getAdditionalCorrespondents(migrationData.getAdditionalCorrespondents()); + List additionalCorrespondents = getAdditionalCorrespondents(caseId, migrationData.getAdditionalCorrespondents()); return new CreateMigrationCorrespondentRequest( caseId, @@ -223,7 +223,7 @@ public MigrationComplaintCorrespondent getPrimaryCorrespondent(LinkedHashMap cor return primaryCorrespondent; } - public List getAdditionalCorrespondents(Optional correspondentJson) { + public List getAdditionalCorrespondents(UUID caseId, Optional correspondentJson) { try { List additionalCorrespondents = objectMapper.convertValue( objectMapper.readValue(correspondentJson.get(), JSONArray.class), @@ -232,6 +232,8 @@ public List getAdditionalCorrespondents(Optiona ); return additionalCorrespondents; } catch (Exception e) { + log.info("Failed to create additional correspondents for case id {}", caseId); + messageLogService.updateStatus(requestData.getCorrelationId(), Status.CASE_ADDITIONAL_CORRESPONDENTS_FAILED); return Collections.emptyList(); } } diff --git a/src/main/java/uk/gov/digital/ho/hocs/domain/repositories/entities/Status.java b/src/main/java/uk/gov/digital/ho/hocs/domain/repositories/entities/Status.java index cdc2ebed..492023b6 100644 --- a/src/main/java/uk/gov/digital/ho/hocs/domain/repositories/entities/Status.java +++ b/src/main/java/uk/gov/digital/ho/hocs/domain/repositories/entities/Status.java @@ -3,6 +3,7 @@ public enum Status { CASE_CORRESPONDENTS_FAILED, CASE_CORRESPONDENTS_HANDLED, + CASE_ADDITIONAL_CORRESPONDENTS_FAILED, CASE_CREATED, CASE_CREATION_FAILED, CASE_DOCUMENT_CREATED, diff --git a/src/test/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationServiceTest.java b/src/test/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationServiceTest.java index 712f7a73..f13af555 100644 --- a/src/test/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationServiceTest.java +++ b/src/test/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationServiceTest.java @@ -90,6 +90,7 @@ public void setUp() { migrationData.getPrimaryCorrespondent()); List additionalCorrespondents = migrationService.getAdditionalCorrespondents( + UUID.randomUUID(), migrationData.getAdditionalCorrespondents()); caseAttachment = new ArrayList<>(); @@ -229,6 +230,7 @@ public void shouldContainNoAdditionalCorrespondents() { List migrationComplaintCorrespondents = migrationService.getAdditionalCorrespondents( + UUID.randomUUID(), migrationData.getAdditionalCorrespondents()); assertTrue(migrationComplaintCorrespondents.isEmpty()); From 226e2c14f66ade249c4987c2d93baabca2b47ef0 Mon Sep 17 00:00:00 2001 From: Joseph Rogerson Date: Mon, 15 May 2023 11:03:01 +0100 Subject: [PATCH 2/4] HOCS-6449: Change log level to error --- .../ho/hocs/domain/queue/migration/MigrationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationService.java b/src/main/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationService.java index 2c565bf1..38166924 100644 --- a/src/main/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationService.java +++ b/src/main/java/uk/gov/digital/ho/hocs/domain/queue/migration/MigrationService.java @@ -232,7 +232,7 @@ public List getAdditionalCorrespondents(UUID ca ); return additionalCorrespondents; } catch (Exception e) { - log.info("Failed to create additional correspondents for case id {}", caseId); + log.error("Failed to create additional correspondents for case id {}", caseId); messageLogService.updateStatus(requestData.getCorrelationId(), Status.CASE_ADDITIONAL_CORRESPONDENTS_FAILED); return Collections.emptyList(); } From 8094056a9530641e477a0fc1ba4b258b89196d78 Mon Sep 17 00:00:00 2001 From: Joseph Rogerson Date: Wed, 6 Mar 2024 16:19:09 +0000 Subject: [PATCH 3/4] HOCS-6604: Run workflows on hotfix branches --- .github/workflows/anchore-scan.yml | 2 +- .github/workflows/codeql-analysis.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/anchore-scan.yml b/.github/workflows/anchore-scan.yml index dd66eec8..e8d7741e 100644 --- a/.github/workflows/anchore-scan.yml +++ b/.github/workflows/anchore-scan.yml @@ -2,7 +2,7 @@ name: "Anchore Scan" on: push: - branches: [ main ] + branches: [ main, 'hotfix/**' ] pull_request: types: [ labeled, opened, reopened, synchronize ] schedule: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index efa8eef2..255aa243 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,9 +2,9 @@ name: "CodeQL Scan" on: push: - branches: [ main ] + branches: [ main, 'hotfix/**' ] pull_request: - branches: [ main ] + branches: [ main, 'hotfix/**' ] schedule: - cron: '45 12 * * 1' From 66740551c95df9a7938f1f944eacd4e617823e29 Mon Sep 17 00:00:00 2001 From: Joseph Rogerson Date: Wed, 6 Mar 2024 16:29:41 +0000 Subject: [PATCH 4/4] Hotfix test --- .../java/uk/gov/digital/ho/hocs/CaseCreatorApplication.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/digital/ho/hocs/CaseCreatorApplication.java b/src/main/java/uk/gov/digital/ho/hocs/CaseCreatorApplication.java index bdb13ccd..e4c82cee 100644 --- a/src/main/java/uk/gov/digital/ho/hocs/CaseCreatorApplication.java +++ b/src/main/java/uk/gov/digital/ho/hocs/CaseCreatorApplication.java @@ -5,7 +5,7 @@ @SpringBootApplication public class CaseCreatorApplication { - + //test public static void main(String[] args) { SpringApplication.run(CaseCreatorApplication.class, args); }