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' 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); } 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..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 @@ -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.error("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());