From f7d20567d8c004f7e5b256be8d0064e71547c12a Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 19 Mar 2024 13:56:44 +0000 Subject: [PATCH 001/105] Upgrade spring boot to 2.7 --- service/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index 55c7f4d1997..2277c086b22 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -17,7 +17,7 @@ plugins { id 'checkstyle' id 'jacoco' id 'io.spring.dependency-management' version '1.1.3' - id 'org.springframework.boot' version '2.5.15' + id 'org.springframework.boot' version '2.7.18' id 'com.github.ben-manes.versions' version '0.49.0' id 'org.sonarqube' version '3.5.0.2730' id 'project-report' From 54fcd177ad47d18a29680d1c232880b3b59c4a58 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 19 Mar 2024 13:58:03 +0000 Subject: [PATCH 002/105] Fix UnsatisfiedDependencyException in test by lazy loading CompoundEventChecker. --- .../gov/hmcts/reform/fpl/service/validators/EventsChecker.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/EventsChecker.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/EventsChecker.java index 16612e2ad07..fd7807d353d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/EventsChecker.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/EventsChecker.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.fpl.service.validators; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import uk.gov.hmcts.reform.fpl.enums.Event; import uk.gov.hmcts.reform.fpl.model.CaseData; @@ -65,6 +66,7 @@ public class EventsChecker { private AllocationProposalChecker allocationProposalChecker; @Autowired + @Lazy private CaseSubmissionChecker caseSubmissionChecker; @Autowired From 3abbc1579ffee9a0bedffa656561829e88034945 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 20 Mar 2024 15:23:09 +0000 Subject: [PATCH 003/105] Update version of Mockito. --- service/build.gradle | 2 +- .../gov/hmcts/reform/fpl/utils/matchers/JsonMatcher.java | 8 ++++++-- .../hmcts/reform/fpl/utils/matchers/LDUserMatcher.java | 8 ++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/service/build.gradle b/service/build.gradle index 2277c086b22..5321173f6e1 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -287,7 +287,7 @@ def versions = [ springfoxSwagger: '3.0.0', log4j : '2.21.1', pdfbox : '2.0.29', - mockito : '3.7.7', + mockito : '4.5.1', serenity : '2.6.0', pact_version : '4.1.7', junit_jupiter : '5.7.1', diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/JsonMatcher.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/JsonMatcher.java index b5fbaeccf44..b5ebe6bc592 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/JsonMatcher.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/JsonMatcher.java @@ -36,11 +36,15 @@ private String describe(Object object) { return ValuePrinter.print(object); } - public String toStringWithType() { - return "(" + wanted.getClass().getSimpleName() + ") " + describe(wanted); + public String toStringWithType(String className) { + return "(" + className + ") " + this.describe(this.wanted); } public boolean typeMatches(Object target) { return wanted != null && target != null && target.getClass() == wanted.getClass(); } + + public final Object getWanted() { + return this.wanted; + } } diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/LDUserMatcher.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/LDUserMatcher.java index f1b255e285e..11f408d41d5 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/LDUserMatcher.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/LDUserMatcher.java @@ -43,6 +43,14 @@ public boolean typeMatches(Object target) { return wanted != null && target != null && target.getClass() == wanted.getClass(); } + public final Object getWanted() { + return this.wanted; + } + + public String toStringWithType(String className) { + return "(" + className + ") " + this.describe(this.wanted); + } + public static class LDUserBuilder { private Map attrs = new HashMap<>(); From 6c8b22834373dc7f85a30ffd5b64b35ca8223711 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 20 Mar 2024 15:24:01 +0000 Subject: [PATCH 004/105] Fix tests failing because of use of extracting (change to doesNotContainKey) --- .../CaseInitiationControllerAboutToSubmitTest.java | 4 ++-- .../controllers/ChangeStateControllerAboutToStartTest.java | 2 +- .../ColleaguesToNotifyControllerAboutToStartTest.java | 2 +- .../NoticeOfChangeControllerUpdateRespondentsTest.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/CaseInitiationControllerAboutToSubmitTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/CaseInitiationControllerAboutToSubmitTest.java index 87d74e0becc..b7508120b4b 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/CaseInitiationControllerAboutToSubmitTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/CaseInitiationControllerAboutToSubmitTest.java @@ -199,8 +199,8 @@ void shouldRemoveTemporaryFields() { Map caseDetails = postAboutToSubmitEvent(caseData).getData(); - assertThat(caseDetails).extracting("outsourcingType", "outsourcingLAs", "sharingWithUsers", - "isOutsourcedCase").containsOnlyNulls(); + assertThat(caseDetails).doesNotContainKeys("outsourcingType", "outsourcingLAs", "sharingWithUsers", + "isOutsourcedCase"); } private Map orgPolicy(String id, String role) { diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ChangeStateControllerAboutToStartTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ChangeStateControllerAboutToStartTest.java index f0939804e72..818fdf4828e 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ChangeStateControllerAboutToStartTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ChangeStateControllerAboutToStartTest.java @@ -35,6 +35,6 @@ void shouldNotInitialiseMessageWhenStateIsClosed() { AboutToStartOrSubmitCallbackResponse response = postAboutToStartEvent(caseData); - assertThat(response.getData()).extracting("nextStateLabelContent").isNull(); + assertThat(response.getData()).doesNotContainKey("nextStateLabelContent"); } } diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ColleaguesToNotifyControllerAboutToStartTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ColleaguesToNotifyControllerAboutToStartTest.java index 5b893f39f42..fda8006992f 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ColleaguesToNotifyControllerAboutToStartTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ColleaguesToNotifyControllerAboutToStartTest.java @@ -112,7 +112,7 @@ void shouldThrowErrorIfNotRepresentingAnyone() { AboutToStartOrSubmitCallbackResponse callbackResponse = postAboutToStartEvent(caseData); assertThat(callbackResponse.getErrors()).contains("There is no one this user is representing on this case."); - assertThat(callbackResponse.getData()).extracting("respondentName").isNull(); + assertThat(callbackResponse.getData()).doesNotContainKey("respondentName"); assertThat(callbackResponse.getData()).extracting("colleaguesToNotify").isEqualTo(emptyList()); } } diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfChangeControllerUpdateRespondentsTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfChangeControllerUpdateRespondentsTest.java index 8599fcffb01..59780dca219 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfChangeControllerUpdateRespondentsTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfChangeControllerUpdateRespondentsTest.java @@ -69,6 +69,6 @@ void shouldClearOnComplete() { AboutToStartOrSubmitCallbackResponse resp = postAboutToSubmitEvent(caseData); - assertThat(resp.getData()).extracting("changeOrganisationRequestField").isNull(); + assertThat(resp.getData()).doesNotContainKey("changeOrganisationRequestField"); } } From b997a8d9aba6d89ff13fc840bffe177e1df2f2cb Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 21 Mar 2024 11:51:37 +0000 Subject: [PATCH 005/105] Fix two more failing tests. --- ...ploadAdditionalApplicationsMidEventControllerTest.java | 8 ++++++-- .../UploadC2DocumentsMidEventControllerTest.java | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/UploadAdditionalApplicationsMidEventControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/UploadAdditionalApplicationsMidEventControllerTest.java index 8b0f6f7623b..2aebfe64365 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/UploadAdditionalApplicationsMidEventControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/UploadAdditionalApplicationsMidEventControllerTest.java @@ -280,9 +280,13 @@ void shouldNotPopulateHearingLabelIfNotRequestingAdjournment() { .build()) .build(); - AboutToStartOrSubmitCallbackResponse response = postMidEvent(asCaseDetails(caseData), "populate-data"); + AboutToStartOrSubmitCallbackResponse response = postMidEvent(asCaseDetails(caseData), + "populate-data"); + + CaseData updatedCaseData = extractCaseData(CaseDetails.builder().data(response.getData()).build()); - assertThat(response.getData().get("temporaryC2Document")).extracting("requestedHearingToAdjourn").isNull(); + assertThat(updatedCaseData.getTemporaryC2Document()).extracting("requestedHearingToAdjourn") + .isNull(); assertThat(response.getData().get("skipPaymentPage")).isEqualTo(NO.getValue()); } diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/UploadC2DocumentsMidEventControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/UploadC2DocumentsMidEventControllerTest.java index eee3ea5eea3..0b6d7ed5ac5 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/UploadC2DocumentsMidEventControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/UploadC2DocumentsMidEventControllerTest.java @@ -7,6 +7,7 @@ import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse; import uk.gov.hmcts.reform.ccd.client.model.CaseDetails; import uk.gov.hmcts.reform.fnp.exception.FeeRegisterException; +import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.FeesData; import uk.gov.hmcts.reform.fpl.model.SupportingEvidenceBundle; import uk.gov.hmcts.reform.fpl.service.payment.FeeService; @@ -64,7 +65,9 @@ void shouldRemoveTemporaryC2DocumentForEmptyUrl() { Map.of("document", Map.of()), "c2ApplicationType", Map.of("type", "WITH_NOTICE"))) .build(), "get-fee"); - assertThat(response.getData()).extracting("temporaryC2Document").extracting("document").isNull(); + CaseData updatedCaseData = extractCaseData(CaseDetails.builder().data(response.getData()).build()); + assertThat(updatedCaseData).extracting("temporaryC2Document").extracting("document") + .isNull(); } @Test From 2efda58804a01d162b606bced05d633eb5d1751e Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 21 Mar 2024 12:06:46 +0000 Subject: [PATCH 006/105] Fix check style. --- .../hmcts/reform/fpl/utils/matchers/LDUserMatcher.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/LDUserMatcher.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/LDUserMatcher.java index 11f408d41d5..0a8ded5199d 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/LDUserMatcher.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/matchers/LDUserMatcher.java @@ -35,8 +35,8 @@ private String describe(Object object) { return ValuePrinter.print(object); } - public String toStringWithType() { - return "(" + wanted.getClass().getSimpleName() + ") " + describe(wanted); + public String toStringWithType(String className) { + return "(" + className + ") " + this.describe(this.wanted); } public boolean typeMatches(Object target) { @@ -47,10 +47,6 @@ public final Object getWanted() { return this.wanted; } - public String toStringWithType(String className) { - return "(" + className + ") " + this.describe(this.wanted); - } - public static class LDUserBuilder { private Map attrs = new HashMap<>(); From aae0961f65e322233fc56b3ff571c08283390b6b Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 21 Mar 2024 15:24:05 +0000 Subject: [PATCH 007/105] Fixing more test failures --- .../fpl/service/ChangeCaseStateServiceTest.java | 13 +++++-------- .../fpl/service/ManageDocumentServiceTest.java | 9 ++------- .../service/ManageDocumentsLAServiceTest.java | 10 ++++++---- .../fpl/service/MigrateCFVServiceTest.java | 16 ++++++++-------- .../service/NoticeOfProceedingsServiceTest.java | 10 ++++++---- 5 files changed, 27 insertions(+), 31 deletions(-) diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ChangeCaseStateServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ChangeCaseStateServiceTest.java index 2d366a7a8bc..3c9d8e16403 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ChangeCaseStateServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ChangeCaseStateServiceTest.java @@ -43,8 +43,7 @@ void shouldNotPrepareNextStateLabelWhenCurrentCaseStateIsClosed() { .build(); assertThat(changeCaseStateService.initialiseEventFields(caseData)) - .extracting("nextStateLabelContent") - .isNull(); + .doesNotContainKey("nextStateLabelContent"); } @Test @@ -70,9 +69,9 @@ void shouldRevertStateAndRemoveCasePropertiesAssociatedToClosedStateWhenRevertin Map updatedCaseData = changeCaseStateService.updateCaseState(caseData); - assertThat(updatedCaseData) - .extracting("state", "deprivationOfLiberty", "closeCaseTabField") - .containsExactly(FINAL_HEARING, null, null); + assertThat(updatedCaseData).doesNotContainKeys("deprivationOfLiberty"); + assertThat(updatedCaseData).extracting("state", "closeCaseTabField") + .containsExactly(FINAL_HEARING, null); } @ParameterizedTest @@ -95,9 +94,7 @@ void shouldNotChangeCaseStateWhenConfirmedChangeStateIsNo() { .confirmChangeState(NO.getValue()) .build(); - assertThat(changeCaseStateService.updateCaseState(caseData)) - .extracting("state") - .isNull(); + assertThat(changeCaseStateService.updateCaseState(caseData)).doesNotContainKey("state"); } @Test diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentServiceTest.java index 53fd477af21..f6e3eb9f490 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentServiceTest.java @@ -331,13 +331,8 @@ void shouldNotPopulateHearingListOrC2DocumentListWhenHearingAndC2DocumentsAreNot Map updates = underTest.baseEventData(caseData); - assertThat(updates) - .extracting(MANAGE_DOCUMENTS_HEARING_LIST_KEY, SUPPORTING_C2_LIST_KEY, MANAGE_DOCUMENT_KEY) - .containsExactly(null, null, expectedManageDocument); - - assertThat(updates).doesNotContainKeys(MANAGE_DOCUMENTS_HEARING_LIST_KEY); - assertThat(updates).doesNotContainKeys(SUPPORTING_C2_LIST_KEY); - assertThat(updates).doesNotContainKeys(RESPONDENTS_LIST_KEY); + assertThat(updates).doesNotContainKeys(MANAGE_DOCUMENTS_HEARING_LIST_KEY, SUPPORTING_C2_LIST_KEY, + RESPONDENTS_LIST_KEY); assertThat(updates).containsEntry(MANAGE_DOCUMENT_KEY, expectedManageDocument); } diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentsLAServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentsLAServiceTest.java index 6bafb1b4c5d..869c5ee7a02 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentsLAServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentsLAServiceTest.java @@ -134,9 +134,10 @@ void shouldNotPopulateHearingListOrC2DocumentListWhenHearingAndApplicationBundle Map listAndLabel = manageDocumentLAService.baseEventData(caseData); + assertThat(listAndLabel).doesNotContainKeys(HEARING_DOCUMENT_HEARING_LIST_KEY, SUPPORTING_C2_LIST_KEY); assertThat(listAndLabel) - .extracting(HEARING_DOCUMENT_HEARING_LIST_KEY, SUPPORTING_C2_LIST_KEY, MANAGE_DOCUMENT_LA_KEY) - .containsExactly(null, null, expectedManageDocument); + .extracting(MANAGE_DOCUMENT_LA_KEY) + .isEqualTo(expectedManageDocument); } @Test @@ -151,9 +152,10 @@ void shouldNotPopulateRespondentStatementListWhenRespondentsAreNotPresentOnCaseD Map listAndLabel = manageDocumentLAService.baseEventData(caseData); + assertThat(listAndLabel).doesNotContainKey(RESPONDENTS_LIST_KEY); assertThat(listAndLabel) - .extracting(RESPONDENTS_LIST_KEY, MANAGE_DOCUMENT_LA_KEY) - .containsExactly(null, expectedManageDocument); + .extracting(MANAGE_DOCUMENT_LA_KEY) + .isEqualTo(expectedManageDocument); } private C2DocumentBundle buildC2DocumentBundle(LocalDateTime dateTime) { diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCFVServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCFVServiceTest.java index fa12645b28c..bbae95d8e8c 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCFVServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCFVServiceTest.java @@ -1059,7 +1059,7 @@ void shouldMigrateNonConfidentialRespondentStatement() { Map updatedFields = underTest.migrateRespondentStatement(caseData); - assertThat(updatedFields).extracting("respondentStatements").isNull(); + assertThat(updatedFields).doesNotContainKey("respondentStatements"); assertThat(updatedFields).extracting("respStmtList").asList() .contains( element(doc1Id, RespondentStatementV2.builder() @@ -1105,7 +1105,7 @@ void shouldMigrateNonConfidentialMultipleRespondentStatements() { Map updatedFields = underTest.migrateRespondentStatement(caseData); - assertThat(updatedFields).extracting("respondentStatements").isNull(); + assertThat(updatedFields).doesNotContainKey("respondentStatements"); assertThat(updatedFields).extracting("respStmtList").asList() .contains( element(doc1Id, RespondentStatementV2.builder() @@ -1146,7 +1146,7 @@ void shouldMigrateConfidentialRespondentStatementByLA() { Map updatedFields = underTest.migrateRespondentStatement(caseData); - assertThat(updatedFields).extracting("respondentStatements").isNull(); + assertThat(updatedFields).doesNotContainKey("respondentStatements"); assertThat(updatedFields).extracting("respStmtList").asList().isEmpty(); assertThat(updatedFields).extracting("respStmtListLA").asList() .contains( @@ -1183,7 +1183,7 @@ void shouldMigrateRespondentStatementContainsConfidentialAddressByLA() { Map updatedFields = underTest.migrateRespondentStatement(caseData); - assertThat(updatedFields).extracting("respondentStatements").isNull(); + assertThat(updatedFields).doesNotContainKey("respondentStatements"); assertThat(updatedFields).extracting("respStmtList").asList().isEmpty(); assertThat(updatedFields).extracting("respStmtListLA").asList() .contains( @@ -1221,7 +1221,7 @@ void shouldMigrateConfidentialRespondentStatementByCTSC() { Map updatedFields = underTest.migrateRespondentStatement(caseData); - assertThat(updatedFields).extracting("respondentStatements").isNull(); + assertThat(updatedFields).doesNotContainKey("respondentStatements"); assertThat(updatedFields).extracting("respStmtList").asList().isEmpty(); assertThat(updatedFields).extracting("respStmtListLA").asList().isEmpty(); assertThat(updatedFields).extracting("respStmtListCTSC").asList() @@ -1260,7 +1260,7 @@ void shouldMigrateRespondentStatementContainsConfidentialAddressByCTSC() { Map updatedFields = underTest.migrateRespondentStatement(caseData); - assertThat(updatedFields).extracting("respondentStatements").isNull(); + assertThat(updatedFields).doesNotContainKey("respondentStatements"); assertThat(updatedFields).extracting("respStmtList").asList().isEmpty(); assertThat(updatedFields).extracting("respStmtListLA").asList().isEmpty(); assertThat(updatedFields).extracting("respStmtListCTSC").asList() @@ -1937,7 +1937,7 @@ void shouldRollbackMigratedSkeletonArgumentList() { .extracting("skeletonArgumentListLA").isEqualTo(List.of()); } } - + @Nested class MigrateCorrespondence { @Test @@ -2486,7 +2486,7 @@ public void shouldThrowExceptionWhenExpectedMigratedDocumentCountDoesNotMatch() )) .build() ).build(); - + assertThatThrownBy(() -> underTest.validateMigratedNumberOfDocuments(MIGRATION_ID, caseData, Map.of( "posStmtRespList", List.of(element(PositionStatementRespondent.builder() diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/NoticeOfProceedingsServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/NoticeOfProceedingsServiceTest.java index c0134d6f44a..a73b8cf335f 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/NoticeOfProceedingsServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/NoticeOfProceedingsServiceTest.java @@ -109,9 +109,10 @@ void shouldSetAllocatedJudgeLabelWhenOnlyJudgeDataExistsOnCaseData() { Map listAndLabel = noticeOfProceedingService.initNoticeOfProceeding(caseData); + assertThat(listAndLabel).doesNotContainKey("proceedingLabel"); assertThat(listAndLabel) - .extracting("proceedingLabel", "noticeOfProceedings") - .containsExactly(null, buildExpectedNoticeOfProceedingData()); + .extracting("noticeOfProceedings") + .isEqualTo(buildExpectedNoticeOfProceedingData()); } @Test @@ -122,9 +123,10 @@ void shouldSetHearingLabelWhenOnlyHearingDetailsExistOnCaseData() { Map listAndLabel = noticeOfProceedingService.initNoticeOfProceeding(caseData); + assertThat(listAndLabel).doesNotContainKey("noticeOfProceedings"); assertThat(listAndLabel) - .extracting("proceedingLabel", "noticeOfProceedings") - .containsExactly(buildExpectedHearingLabel(), null); + .extracting("proceedingLabel") + .isEqualTo(buildExpectedHearingLabel()); } @Test From c85eae5e5ef8a79ef69771c4031d577cb7dd0d73 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 21 Mar 2024 15:57:40 +0000 Subject: [PATCH 008/105] Fixing more test failures --- .../hmcts/reform/fpl/service/MigrateCaseServiceTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCaseServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCaseServiceTest.java index 6fd08bc8a38..cb1d8408cba 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCaseServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCaseServiceTest.java @@ -2379,7 +2379,7 @@ void shouldRemoveSealedCMOIfNoOrdersToBeSent() { List> expectedList = List.of(sealedCmo2); assertThat(updatedFields).extracting("sealedCMOs").isEqualTo(expectedList); - assertThat(updatedFields).extracting("ordersToBeSent").isNull(); + assertThat(updatedFields).doesNotContainKey("ordersToBeSent"); } @Test @@ -2734,9 +2734,9 @@ void shouldThrowExceptionIfNoChildWithId() { } } - @Nested + @Nested class ClearHearingOption { - + @Test void shouldClearHearingOption() { HashMap data = new HashMap<>(); @@ -2745,7 +2745,7 @@ void shouldClearHearingOption() { underTest.clearHearingOption(caseDetails); - assertThat(caseDetails.getData()).extracting("hearingOption").isNull(); + assertThat(caseDetails.getData()).doesNotContainKey("hearingOption"); } @Test From 93eec279d0801f1f217dc111b195742706d93219 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Fri, 22 Mar 2024 10:33:47 +0000 Subject: [PATCH 009/105] Upgrade spring cloud version --- service/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index 294e9eec9c0..ea505d3c159 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -464,7 +464,7 @@ pitest { dependencyManagement { imports { - mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2020.0.6' + mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2021.0.8' } } From ae18b672e554231b896a4523fd579e84abc7f119 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 26 Mar 2024 13:57:00 +0000 Subject: [PATCH 010/105] Fix failing idam tests - update response from 204 to 200 as getUserDetails returns a payload. --- service/build.gradle | 5 ++--- .../uk/gov/hmcts/reform/fpl/config/feign/IdamClientTest.java | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/service/build.gradle b/service/build.gradle index ea505d3c159..7189ac97357 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -419,9 +419,8 @@ dependencies { contractTestRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.junit_jupiter contractTestImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit_jupiter contractTestRuntimeOnly group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.8.2' - contractTestImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.4' - contractTestImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.4' - contractTestImplementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '2.2.7.RELEASE' + contractTestImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.5' + contractTestImplementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.0.3' contractTestImplementation group: 'org.springframework.cloud', name: 'spring-cloud-netflix-ribbon', version: '2.2.10.RELEASE' contractTestImplementation group: 'com.netflix.ribbon', name: 'ribbon-core', version: '2.7.18' contractTestImplementation group: 'uk.gov.hmcts.reform', name: 'core-case-data-store-client', version: '4.7.6' diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/IdamClientTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/IdamClientTest.java index 1125d944a37..c19dd1ca7eb 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/IdamClientTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/IdamClientTest.java @@ -53,7 +53,7 @@ class IdamClientTest { @Test void shouldRetryWhen5XXResponseReturned() throws IOException { when(httpClient.execute(any(), any())) - .thenReturn(response(500), response(504), response(204)); + .thenReturn(response(500), response(504), response(200)); UserDetails details = idamClient.getUserDetails("details"); @@ -75,7 +75,7 @@ void shouldReturnFeignExceptionWhenMaxRetriesReached() throws IOException { @Test void shouldNotRetryGivenSuccessfulResponse() throws IOException { when(httpClient.execute(any(), any())) - .thenReturn(response(204)); + .thenReturn(response(200)); UserDetails details = idamClient.getUserDetails("details"); From a06279bdc576f06b338c94f5b6a5434f4b4dd4d2 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 26 Mar 2024 14:16:19 +0000 Subject: [PATCH 011/105] Resolve CVE. --- service/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index 7189ac97357..4203675f05d 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -335,7 +335,7 @@ dependencies { implementation group: 'io.github.openfeign', name: 'feign-core', version: '11.2' implementation group: 'org.yaml', name: 'snakeyaml', version: '2.2' - implementation group: 'org.postgresql', name: 'postgresql', version: '42.6.0' + implementation group: 'org.postgresql', name: 'postgresql', version: '42.6.1' implementation group: 'org.flywaydb', name: 'flyway-core', version: '8.5.13' implementation group: 'io.springfox', name: 'springfox-swagger2', version: versions.springfoxSwagger From ea4fa782508f20082d6d7a31612f5de8878daaf7 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 26 Mar 2024 16:40:07 +0000 Subject: [PATCH 012/105] Add app insights connection string to preview values --- charts/fpl-case-service/values.preview.template.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/charts/fpl-case-service/values.preview.template.yaml b/charts/fpl-case-service/values.preview.template.yaml index 8e97254704b..23954219033 100644 --- a/charts/fpl-case-service/values.preview.template.yaml +++ b/charts/fpl-case-service/values.preview.template.yaml @@ -66,6 +66,9 @@ java: - ld-sdk-key - ctsc-inbox - ctsc-team-lead-inbox + - AppInsightsInstrumentationKey + - name: app-insights-connection-string + alias: app-insights-connection-string - rcj-family-high-court-inbox - court-to-court-admin-mapping From c1f4f3ff0cca090cdb4d5973c1f578d1c2ff9510 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 27 Mar 2024 09:49:06 +0000 Subject: [PATCH 013/105] Upgrade java helm chart. --- charts/fpl-case-service/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/fpl-case-service/Chart.yaml b/charts/fpl-case-service/Chart.yaml index d5b56346a98..42683a37219 100644 --- a/charts/fpl-case-service/Chart.yaml +++ b/charts/fpl-case-service/Chart.yaml @@ -1,14 +1,14 @@ name: fpl-case-service apiVersion: v2 home: https://github.com/hmcts/fpl-ccd-configuration -version: 1.12.75 +version: 1.12.76 description: FPL Case Service maintainers: - name: HMCTS Family Public Law team email: fpl-developers@HMCTS.NET dependencies: - name: java - version: 5.0.0 + version: 5.2.0 repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/' - name: ccd version: 8.0.29 From 581eb4a60323fa19522933fee43f278387bfb9f0 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 27 Mar 2024 10:29:05 +0000 Subject: [PATCH 014/105] Upgrade aac-manage-case-assignment helm chart. --- charts/fpl-case-service/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/fpl-case-service/Chart.yaml b/charts/fpl-case-service/Chart.yaml index 42683a37219..e0a812672ec 100644 --- a/charts/fpl-case-service/Chart.yaml +++ b/charts/fpl-case-service/Chart.yaml @@ -28,7 +28,7 @@ dependencies: repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/' condition: idam-pr.enabled - name: aac-manage-case-assignment - version: ~0.2.9 + version: ~0.2.13 repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/' condition: aac-manage-case-assignment.enabled - name: ccd-case-document-am-api From 61e932a100c24f57746d44898bf7f89daa3f2c9f Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 27 Mar 2024 11:20:36 +0000 Subject: [PATCH 015/105] UUpdate helm chart. --- charts/fpl-case-service/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/fpl-case-service/Chart.yaml b/charts/fpl-case-service/Chart.yaml index e0a812672ec..1451a47cf80 100644 --- a/charts/fpl-case-service/Chart.yaml +++ b/charts/fpl-case-service/Chart.yaml @@ -8,10 +8,10 @@ maintainers: email: fpl-developers@HMCTS.NET dependencies: - name: java - version: 5.2.0 + version: 5.0.0 repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/' - name: ccd - version: 8.0.29 + version: 9.0.22 repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/' tags: - fpl-ccd-stack From f734568b06d299fe4d58f31fea4976ecee9e38d5 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 27 Mar 2024 11:46:03 +0000 Subject: [PATCH 016/105] UUpdate helm chart. --- charts/fpl-case-service/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/fpl-case-service/Chart.yaml b/charts/fpl-case-service/Chart.yaml index 1451a47cf80..ace74ef4f3e 100644 --- a/charts/fpl-case-service/Chart.yaml +++ b/charts/fpl-case-service/Chart.yaml @@ -11,7 +11,7 @@ dependencies: version: 5.0.0 repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/' - name: ccd - version: 9.0.22 + version: 8.0.29 repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/' tags: - fpl-ccd-stack From bdfb5fec37abc2db7d992fffc575e00a2a32b8cb Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 27 Mar 2024 14:14:34 +0000 Subject: [PATCH 017/105] Adding fix for springfox to application.yaml --- service/src/main/resources/application.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/src/main/resources/application.yaml b/service/src/main/resources/application.yaml index 31bacd3b70d..ab0d710ba77 100644 --- a/service/src/main/resources/application.yaml +++ b/service/src/main/resources/application.yaml @@ -30,6 +30,9 @@ spring: - local - user-mappings - feature-toggle + mvc: + pathmatch: + matching-strategy: ant_path_matcher feign: client: From da0997cab56baff06d4b506e01160644d2090437 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 28 Mar 2024 09:54:15 +0000 Subject: [PATCH 018/105] Remove swaggerfox --- service/build.gradle | 4 --- .../fpl/config/SwaggerConfiguration.java | 28 ------------------- service/src/main/resources/application.yaml | 3 -- 3 files changed, 35 deletions(-) delete mode 100644 service/src/main/java/uk/gov/hmcts/reform/fpl/config/SwaggerConfiguration.java diff --git a/service/build.gradle b/service/build.gradle index 4203675f05d..f4b968e8ab7 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -284,7 +284,6 @@ repositories { def versions = [ reformLogging : '5.1.7', springBoot : springBoot.class.package.implementationVersion, - springfoxSwagger: '3.0.0', log4j : '2.21.1', pdfbox : '2.0.29', mockito : '4.5.1', @@ -338,9 +337,6 @@ dependencies { implementation group: 'org.postgresql', name: 'postgresql', version: '42.6.1' implementation group: 'org.flywaydb', name: 'flyway-core', version: '8.5.13' - implementation group: 'io.springfox', name: 'springfox-swagger2', version: versions.springfoxSwagger - implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: versions.springfoxSwagger - implementation group: 'uk.gov.hmcts.reform', name: 'properties-volume-spring-boot-starter', version: '0.1.0' implementation group: 'uk.gov.hmcts.reform', name: 'logging', version: versions.reformLogging implementation group: 'uk.gov.hmcts.reform', name: 'logging-appinsights', version: versions.reformLogging diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/SwaggerConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/SwaggerConfiguration.java deleted file mode 100644 index f72f7708fb3..00000000000 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/SwaggerConfiguration.java +++ /dev/null @@ -1,28 +0,0 @@ -package uk.gov.hmcts.reform.fpl.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; -import uk.gov.hmcts.reform.fpl.Application; - -@Profile("default") -@Configuration -@EnableSwagger2 -public class SwaggerConfiguration { - - @Bean - public Docket api() { - return new Docket(DocumentationType.SWAGGER_2) - .useDefaultResponseMessages(false) - .select() - .apis(RequestHandlerSelectors.basePackage(Application.class.getPackage().getName() + ".controllers")) - .paths(PathSelectors.any()) - .build(); - } - -} diff --git a/service/src/main/resources/application.yaml b/service/src/main/resources/application.yaml index ab0d710ba77..31bacd3b70d 100644 --- a/service/src/main/resources/application.yaml +++ b/service/src/main/resources/application.yaml @@ -30,9 +30,6 @@ spring: - local - user-mappings - feature-toggle - mvc: - pathmatch: - matching-strategy: ant_path_matcher feign: client: From 17634b411d82c3b196c345ed1f7d418e77f5d169 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 28 Mar 2024 10:19:15 +0000 Subject: [PATCH 019/105] Remove swagger annotations. --- .../hmcts/reform/fpl/controllers/AddCaseNumberController.java | 2 -- .../reform/fpl/controllers/AddGatekeepingOrderController.java | 2 -- .../uk/gov/hmcts/reform/fpl/controllers/AddNoteController.java | 2 -- .../hmcts/reform/fpl/controllers/AllocatedJudgeController.java | 2 -- .../gov/hmcts/reform/fpl/controllers/ApplicantController.java | 2 -- .../fpl/controllers/ApplicantLocalAuthorityController.java | 2 -- .../hmcts/reform/fpl/controllers/CaseDeletionController.java | 2 -- .../hmcts/reform/fpl/controllers/CaseExtensionController.java | 2 -- .../uk/gov/hmcts/reform/fpl/controllers/CaseFlagController.java | 2 -- .../hmcts/reform/fpl/controllers/CaseInitiationController.java | 2 -- .../hmcts/reform/fpl/controllers/CaseSubmissionController.java | 2 -- .../gov/hmcts/reform/fpl/controllers/CaseSummaryController.java | 2 -- .../gov/hmcts/reform/fpl/controllers/ChangeStateController.java | 2 -- .../uk/gov/hmcts/reform/fpl/controllers/ChildController.java | 2 -- .../reform/fpl/controllers/ColleaguesToNotifyController.java | 2 -- .../hmcts/reform/fpl/controllers/CourtSelectionController.java | 2 -- .../reform/fpl/controllers/EnterC1WithSupplementController.java | 2 -- .../reform/fpl/controllers/LanguageSelectionController.java | 2 -- .../fpl/controllers/ListGatekeepingHearingController.java | 2 -- .../hmcts/reform/fpl/controllers/ManageHearingsController.java | 2 -- .../reform/fpl/controllers/ManageLegalCounselController.java | 2 -- .../fpl/controllers/ManageLegalRepresentativesController.java | 2 -- .../fpl/controllers/ManageLocalAuthoritiesController.java | 2 -- .../hmcts/reform/fpl/controllers/ManageOrdersController.java | 2 -- .../fpl/controllers/ManagingOrganisationRemovalController.java | 2 -- .../hmcts/reform/fpl/controllers/MessageJudgeController.java | 2 -- .../hmcts/reform/fpl/controllers/NoticeOfChangeController.java | 2 -- .../reform/fpl/controllers/NoticeOfProceedingsController.java | 2 -- .../reform/fpl/controllers/NotifyGatekeeperController.java | 2 -- .../hmcts/reform/fpl/controllers/OrdersNeededController.java | 2 -- .../reform/fpl/controllers/OtherProceedingsController.java | 2 -- .../uk/gov/hmcts/reform/fpl/controllers/OthersController.java | 2 -- .../gov/hmcts/reform/fpl/controllers/PlacementController.java | 2 -- .../hmcts/reform/fpl/controllers/PlacementNoticeController.java | 2 -- .../reform/fpl/controllers/RecordFinalDecisionsController.java | 2 -- .../gov/hmcts/reform/fpl/controllers/RemovalToolController.java | 2 -- .../hmcts/reform/fpl/controllers/RenderDocumentsController.java | 2 -- .../reform/fpl/controllers/ReplyToMessageJudgeController.java | 2 -- .../hmcts/reform/fpl/controllers/RepresentativesController.java | 2 -- .../gov/hmcts/reform/fpl/controllers/RespondentController.java | 2 -- .../reform/fpl/controllers/ReturnApplicationController.java | 2 -- .../fpl/controllers/ReviewAdditionalApplicationController.java | 2 -- .../hmcts/reform/fpl/controllers/SendDocumentController.java | 2 -- .../reform/fpl/controllers/SendOrderReminderController.java | 2 -- .../reform/fpl/controllers/SendToGatekeeperController.java | 2 -- .../fpl/controllers/StandardDirectionsOrderController.java | 2 -- .../reform/fpl/controllers/StatementOfServiceController.java | 2 -- .../uk/gov/hmcts/reform/fpl/controllers/TaskListController.java | 2 -- .../fpl/controllers/UploadAdditionalApplicationsController.java | 2 -- .../reform/fpl/controllers/UploadC2DocumentsController.java | 2 -- .../hmcts/reform/fpl/controllers/UploadDocumentsController.java | 2 -- .../reform/fpl/controllers/UploadTranslationsController.java | 2 -- .../fpl/controllers/documents/ManageDocumentsControllerV2.java | 2 -- .../fpl/controllers/orders/ApproveDraftOrdersController.java | 2 -- .../fpl/controllers/orders/RemoveDraftOrdersController.java | 2 -- .../fpl/controllers/orders/UploadDraftOrdersController.java | 2 -- .../reform/fpl/controllers/support/MigrateCaseController.java | 2 -- .../reform/fpl/controllers/support/RoboticsController.java | 2 -- .../testingsupport/controllers/TestingSupportController.java | 2 -- 59 files changed, 118 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberController.java index 47681fde890..963af5c26e2 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -21,7 +20,6 @@ import static org.apache.commons.lang3.StringUtils.isAlphanumeric; import static org.apache.commons.lang3.StringUtils.isEmpty; -@Api @Slf4j @RestController @RequestMapping("/callback/add-case-number") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddGatekeepingOrderController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddGatekeepingOrderController.java index 4f4324771a7..6300b95cbe4 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddGatekeepingOrderController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddGatekeepingOrderController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -38,7 +37,6 @@ import static uk.gov.hmcts.reform.fpl.utils.DateFormatterHelper.DATE_TIME; import static uk.gov.hmcts.reform.fpl.utils.DateFormatterHelper.formatLocalDateTimeBaseUsingFormat; -@Api @RestController @RequestMapping("/callback/add-gatekeeping-order") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteController.java index 8371dcff9a7..5af15e9e968 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -18,7 +17,6 @@ import java.util.List; -@Api @RestController @RequestMapping("/callback/add-note") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeController.java index ffc1c7ff093..139f89feefd 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -29,7 +28,6 @@ import static uk.gov.hmcts.reform.fpl.enums.YesNo.NO; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; -@Api @Slf4j @RestController @RequestMapping("/callback/allocated-judge") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantController.java index 45dbfb97a73..15a3b07e732 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -27,7 +26,6 @@ import java.util.Optional; import java.util.stream.Collectors; -@Api @RestController @RequestMapping("/callback/enter-applicant") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantLocalAuthorityController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantLocalAuthorityController.java index 02ffd575047..7848c8a6fd4 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantLocalAuthorityController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantLocalAuthorityController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -27,7 +26,6 @@ import static uk.gov.hmcts.reform.fpl.enums.State.RETURNED; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; -@Api @RestController @RequestMapping("/callback/enter-local-authority") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseDeletionController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseDeletionController.java index a26d0304b5e..7a2e57ec617 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseDeletionController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseDeletionController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -9,7 +8,6 @@ import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest; import uk.gov.hmcts.reform.ccd.client.model.CaseDetails; -@Api @RestController @RequestMapping("/callback/case-deletion") public class CaseDeletionController extends CallbackController { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseExtensionController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseExtensionController.java index f75b959c777..ce5be297955 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseExtensionController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseExtensionController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -25,7 +24,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; -@Api @RestController @RequestMapping("/callback/case-extension") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseFlagController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseFlagController.java index 7c555f0f0a6..8c2928d88f7 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseFlagController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseFlagController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -20,7 +19,6 @@ import static uk.gov.hmcts.reform.fpl.enums.YesNo.NOT_SPECIFIED; import static uk.gov.hmcts.reform.fpl.enums.YesNo.YES; -@Api @RestController @RequestMapping("/callback/add-case-flag") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseInitiationController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseInitiationController.java index 841c7ae4c35..0e917282a52 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseInitiationController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseInitiationController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -33,7 +32,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsMap.caseDetailsMap; -@Api @Slf4j @RestController @RequestMapping("/callback/case-initiation") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseSubmissionController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseSubmissionController.java index fe573da0912..7d62dc354df 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseSubmissionController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseSubmissionController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -47,7 +46,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.isInReturnedState; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; -@Api @RestController @RequestMapping("/callback/case-submission") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseSummaryController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseSummaryController.java index 6391c798ab5..e0baff6bc36 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseSummaryController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CaseSummaryController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -10,7 +9,6 @@ import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest; import uk.gov.hmcts.reform.fpl.events.AfterSubmissionCaseDataUpdated; -@Api @RestController @RequestMapping("/callback/case-summary") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ChangeStateController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ChangeStateController.java index 4aa5fe5d409..1733462b5d9 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ChangeStateController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ChangeStateController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -17,7 +16,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; -@Api @RestController @RequestMapping("/callback/change-state") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ChildController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ChildController.java index aacdc09950b..6fef4d40b25 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ChildController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ChildController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -32,7 +31,6 @@ import static uk.gov.hmcts.reform.fpl.model.Child.expandCollection; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; -@Api @RestController @RequestMapping("/callback/enter-children") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ColleaguesToNotifyController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ColleaguesToNotifyController.java index 83bd50f0636..a03d9debbfb 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ColleaguesToNotifyController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ColleaguesToNotifyController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -25,7 +24,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsMap.caseDetailsMap; -@Api @RestController @RequestMapping("/callback/add-colleagues-to-notify") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CourtSelectionController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CourtSelectionController.java index e0e15de4a96..d23cdc8b76d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CourtSelectionController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/CourtSelectionController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -18,7 +17,6 @@ import java.util.Objects; -@Api @RestController @RequestMapping("/callback/select-court") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/EnterC1WithSupplementController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/EnterC1WithSupplementController.java index 15985282534..15ffb4844a8 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/EnterC1WithSupplementController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/EnterC1WithSupplementController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -17,7 +16,6 @@ import java.util.Optional; -@Api @RestController @RequestMapping("/callback/enter-c1-with-supplement") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/LanguageSelectionController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/LanguageSelectionController.java index c3233e4a808..97d9f824f5d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/LanguageSelectionController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/LanguageSelectionController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -13,7 +12,6 @@ import uk.gov.hmcts.reform.ccd.client.model.CaseDetails; import uk.gov.hmcts.reform.fpl.service.translation.C110ATranslationRequirementCalculator; -@Api @Slf4j @RestController @RequestMapping("/callback/language-selection") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ListGatekeepingHearingController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ListGatekeepingHearingController.java index 499633cdb8a..360ce699a5a 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ListGatekeepingHearingController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ListGatekeepingHearingController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -66,7 +65,6 @@ import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.element; import static uk.gov.hmcts.reform.fpl.utils.JudgeAndLegalAdvisorHelper.buildAllocatedJudgeLabel; -@Api @RestController @RequestMapping("/callback/list-gatekeeping-hearing") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageHearingsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageHearingsController.java index ff392013bf7..bf99edb05b6 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageHearingsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageHearingsController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -67,7 +66,6 @@ import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.element; import static uk.gov.hmcts.reform.fpl.utils.JudgeAndLegalAdvisorHelper.buildAllocatedJudgeLabel; -@Api @RestController @RequestMapping("/callback/manage-hearings") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLegalCounselController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLegalCounselController.java index 8518cc1cc8c..727c1549697 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLegalCounselController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLegalCounselController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -17,7 +16,6 @@ import java.util.List; -@Api @RestController @RequestMapping("/callback/manage-legal-counsel") @RequiredArgsConstructor diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLegalRepresentativesController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLegalRepresentativesController.java index 59b61aaa6ae..d7c580f9770 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLegalRepresentativesController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLegalRepresentativesController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -23,7 +22,6 @@ import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.unwrapElements; -@Api @RestController @RequestMapping("/callback/manage-legal-representatives") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLocalAuthoritiesController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLocalAuthoritiesController.java index ebc8523a6d3..cfb57e53bba 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLocalAuthoritiesController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageLocalAuthoritiesController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -39,7 +38,6 @@ import static uk.gov.hmcts.reform.fpl.enums.LocalAuthorityAction.TRANSFER_COURT; import static uk.gov.hmcts.reform.fpl.service.CourtLookUpService.RCJ_HIGH_COURT_CODE; -@Api @RestController @RequestMapping("/callback/manage-local-authorities") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageOrdersController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageOrdersController.java index f4ee1ae56ae..39cc4d17445 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageOrdersController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManageOrdersController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -34,7 +33,6 @@ import static org.apache.commons.io.FilenameUtils.getExtension; import static org.apache.commons.lang3.ObjectUtils.isEmpty; -@Api @RestController @RequestMapping("/callback/manage-orders") @RequiredArgsConstructor(onConstructor_ = {@Autowired}) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManagingOrganisationRemovalController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManagingOrganisationRemovalController.java index 3a5834e4754..35a7fe269a9 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManagingOrganisationRemovalController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ManagingOrganisationRemovalController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -16,7 +15,6 @@ import uk.gov.hmcts.reform.fpl.service.ManagingOrganisationService; import uk.gov.hmcts.reform.rd.model.Organisation; -@Api @RestController @RequestMapping("/callback/remove-managing-organisation") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/MessageJudgeController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/MessageJudgeController.java index 43a8d94ab0e..654907107f0 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/MessageJudgeController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/MessageJudgeController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; @@ -27,7 +26,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsMap.caseDetailsMap; -@Api @RestController @RequestMapping("/callback/message-judge") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfChangeController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfChangeController.java index aa398f657a9..fb139650adb 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfChangeController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfChangeController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -29,7 +28,6 @@ import static org.springframework.util.ObjectUtils.isEmpty; -@Api @Slf4j @RestController @RequestMapping("/callback/noc-decision") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfProceedingsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfProceedingsController.java index 7a943f52575..48b08ffb82f 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfProceedingsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfProceedingsController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -21,7 +20,6 @@ import java.util.List; import javax.validation.constraints.NotNull; -@Api @RestController @RequestMapping("/callback/notice-of-proceedings") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NotifyGatekeeperController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NotifyGatekeeperController.java index d5799142733..b0079a0a65e 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NotifyGatekeeperController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NotifyGatekeeperController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -28,7 +27,6 @@ import static uk.gov.hmcts.reform.fpl.enums.State.SUBMITTED; import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.wrapElements; -@Api @RestController @RequestMapping("/callback/notify-gatekeeper") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OrdersNeededController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OrdersNeededController.java index dd52c310bcd..49d4a0dec4f 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OrdersNeededController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OrdersNeededController.java @@ -1,7 +1,6 @@ package uk.gov.hmcts.reform.fpl.controllers; import com.google.common.collect.ImmutableList; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -29,7 +28,6 @@ import java.util.Optional; import java.util.stream.Collectors; -@Api @Slf4j @RestController @RequestMapping("/callback/orders-needed") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OtherProceedingsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OtherProceedingsController.java index 4e08923858e..4e1b17b31d0 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OtherProceedingsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OtherProceedingsController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -15,7 +14,6 @@ import static org.apache.commons.lang3.StringUtils.isBlank; -@Api @RestController @RequestMapping("callback/enter-other-proceedings") public class OtherProceedingsController extends CallbackController { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OthersController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OthersController.java index 08125240f60..2e7e48cd737 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OthersController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/OthersController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -22,7 +21,6 @@ import static java.util.Objects.isNull; import static uk.gov.hmcts.reform.fpl.enums.ConfidentialPartyType.OTHER; -@Api @RestController @RequestMapping("/callback/enter-others") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/PlacementController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/PlacementController.java index cda5b81fe83..c2aa291863d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/PlacementController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/PlacementController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -31,7 +30,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.putFields; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; -@Api @RestController @RequestMapping("/callback/placement") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/PlacementNoticeController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/PlacementNoticeController.java index 5bf96ab3854..d0ef9924305 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/PlacementNoticeController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/PlacementNoticeController.java @@ -1,7 +1,6 @@ package uk.gov.hmcts.reform.fpl.controllers; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -30,7 +29,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.putFields; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; -@Api @RestController @RequestMapping("/callback/placementNotice") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsController.java index 1929704e43e..4a4b773c0be 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -25,7 +24,6 @@ import static uk.gov.hmcts.reform.fpl.enums.State.CLOSED; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; -@Api @RestController @RequestMapping("/callback/record-final-decisions") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RemovalToolController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RemovalToolController.java index 338fc2e9d6a..0bb2f5de3be 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RemovalToolController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RemovalToolController.java @@ -1,7 +1,6 @@ package uk.gov.hmcts.reform.fpl.controllers; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -46,7 +45,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsMap.caseDetailsMap; import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.getDynamicListSelectedValue; -@Api @RestController @RequestMapping("/callback/remove-order") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RenderDocumentsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RenderDocumentsController.java index c0221301ec6..b79902cedb3 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RenderDocumentsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RenderDocumentsController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -11,7 +10,6 @@ import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest; import uk.gov.hmcts.reform.ccd.client.model.CaseDetails; -@Api @RestController @RequestMapping("/callback/render-documents") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReplyToMessageJudgeController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReplyToMessageJudgeController.java index f4c1391631c..eb1e39666ac 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReplyToMessageJudgeController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReplyToMessageJudgeController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; @@ -25,7 +24,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsMap.caseDetailsMap; -@Api @RestController @RequestMapping("/callback/reply-message-judge") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RepresentativesController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RepresentativesController.java index 1aa805fd80a..cc937fc24e4 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RepresentativesController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RepresentativesController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -23,7 +22,6 @@ import static java.util.Collections.emptyList; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; -@Api @RestController @RequestMapping("/callback/manage-representatives") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RespondentController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RespondentController.java index cda383f4bf6..558290dad96 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RespondentController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/RespondentController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -51,7 +50,6 @@ import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.nullSafeList; @Slf4j -@Api @RestController @RequestMapping("/callback/enter-respondents") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReturnApplicationController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReturnApplicationController.java index 5d73b90cdd2..ae6c9da93f7 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReturnApplicationController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReturnApplicationController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -15,7 +14,6 @@ import uk.gov.hmcts.reform.fpl.model.common.DocumentReference; import uk.gov.hmcts.reform.fpl.service.ReturnApplicationService; -@Api @RestController @RequestMapping("/callback/return-application") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReviewAdditionalApplicationController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReviewAdditionalApplicationController.java index d9bebcc965e..5afd7539452 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReviewAdditionalApplicationController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ReviewAdditionalApplicationController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -15,7 +14,6 @@ import uk.gov.hmcts.reform.fpl.model.event.ConfirmApplicationReviewedEventData; import uk.gov.hmcts.reform.fpl.service.additionalapplications.ReviewAdditionalApplicationService; -@Api @Slf4j @RestController @RequestMapping("/callback/review-additional-application") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendDocumentController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendDocumentController.java index 01fede2cb0c..f1312778c33 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendDocumentController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendDocumentController.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -33,7 +32,6 @@ */ @Deprecated -@Api @Slf4j @RestController @RequestMapping("/callback/send-document") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendOrderReminderController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendOrderReminderController.java index acda878d138..b368bb21488 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendOrderReminderController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendOrderReminderController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -22,7 +21,6 @@ import static uk.gov.hmcts.reform.fpl.enums.YesNo.YES; -@Api @Slf4j @RestController @RequestMapping("/callback/send-order-reminder") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendToGatekeeperController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendToGatekeeperController.java index 634d7859e7d..4ad73ed658a 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendToGatekeeperController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/SendToGatekeeperController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -13,7 +12,6 @@ import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.service.StandardDirectionsService; -@Api @RestController @RequestMapping("/callback/send-to-gatekeeper") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/StandardDirectionsOrderController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/StandardDirectionsOrderController.java index a88adc61ae2..7221ac93cfa 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/StandardDirectionsOrderController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/StandardDirectionsOrderController.java @@ -1,7 +1,6 @@ package uk.gov.hmcts.reform.fpl.controllers; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -62,7 +61,6 @@ import static uk.gov.hmcts.reform.fpl.utils.JudgeAndLegalAdvisorHelper.removeAllocatedJudgeProperties; // TODO: 03/09/2020 refactor logic into sdo service -@Api @RestController @RequestMapping("/callback/draft-standard-directions") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/StatementOfServiceController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/StatementOfServiceController.java index 5d9d3e581dc..12d361ca61b 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/StatementOfServiceController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/StatementOfServiceController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -15,7 +14,6 @@ import uk.gov.hmcts.reform.fpl.service.StatementOfServiceService; import uk.gov.hmcts.reform.idam.client.IdamClient; -@Api @RestController @RequestMapping("/callback/statement-of-service") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/TaskListController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/TaskListController.java index 14e15e3b49a..a254309bff1 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/TaskListController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/TaskListController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -15,7 +14,6 @@ import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsMap.caseDetailsMap; -@Api @RestController @RequestMapping("/callback/update-task-list") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadAdditionalApplicationsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadAdditionalApplicationsController.java index c7fd583a46b..445864e6f19 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadAdditionalApplicationsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadAdditionalApplicationsController.java @@ -1,7 +1,6 @@ package uk.gov.hmcts.reform.fpl.controllers; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -58,7 +57,6 @@ import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.findElement; import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.getDynamicListSelectedValue; -@Api @Slf4j @RestController @RequestMapping("/callback/upload-additional-applications") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadC2DocumentsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadC2DocumentsController.java index b67f2c7b9a2..394145887c7 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadC2DocumentsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadC2DocumentsController.java @@ -1,7 +1,6 @@ package uk.gov.hmcts.reform.fpl.controllers; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -38,7 +37,6 @@ import static uk.gov.hmcts.reform.fpl.enums.YesNo.NO; import static uk.gov.hmcts.reform.fpl.enums.YesNo.YES; -@Api @Slf4j @RestController @RequestMapping("/callback/upload-c2") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadDocumentsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadDocumentsController.java index 3290adb804f..04b4ca8e1f2 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadDocumentsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadDocumentsController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -24,7 +23,6 @@ import static org.apache.commons.lang3.ObjectUtils.isNotEmpty; -@Api @RestController @RequestMapping("/callback/upload-documents") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadTranslationsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadTranslationsController.java index 276370eb490..32ef02de9f1 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadTranslationsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/UploadTranslationsController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -16,7 +15,6 @@ import uk.gov.hmcts.reform.fpl.model.interfaces.TranslatableItem; import uk.gov.hmcts.reform.fpl.service.translations.TranslatableItemService; -@Api @RestController @RequestMapping("/callback/upload-translations") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/documents/ManageDocumentsControllerV2.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/documents/ManageDocumentsControllerV2.java index 72aa44fa669..ba2443d005f 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/documents/ManageDocumentsControllerV2.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/documents/ManageDocumentsControllerV2.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers.documents; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -38,7 +37,6 @@ import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.element; import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.unwrapElements; -@Api @RestController @RequestMapping("/callback/manage-documentsv2") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/ApproveDraftOrdersController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/ApproveDraftOrdersController.java index 5f6dbaa7647..7554477d7c6 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/ApproveDraftOrdersController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/ApproveDraftOrdersController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers.orders; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -29,7 +28,6 @@ import static uk.gov.hmcts.reform.fpl.model.event.ReviewDraftOrdersData.reviewDecisionFields; import static uk.gov.hmcts.reform.fpl.model.event.ReviewDraftOrdersData.transientFields; -@Api @RestController @RequestMapping("/callback/approve-draft-orders") @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/RemoveDraftOrdersController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/RemoveDraftOrdersController.java index 00473f07526..bd31e952893 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/RemoveDraftOrdersController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/RemoveDraftOrdersController.java @@ -1,7 +1,6 @@ package uk.gov.hmcts.reform.fpl.controllers.orders; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -30,7 +29,6 @@ import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.asDynamicList; import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.getDynamicListSelectedValue; -@Api @RestController @RequestMapping("/callback/remove-draft-orders") @RequiredArgsConstructor(onConstructor_ = {@Autowired}) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/UploadDraftOrdersController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/UploadDraftOrdersController.java index ce0dc14113a..8b251f6faff 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/UploadDraftOrdersController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/orders/UploadDraftOrdersController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers.orders; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -39,7 +38,6 @@ import static uk.gov.hmcts.reform.fpl.enums.HearingOrderType.DRAFT_CMO; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.removeTemporaryFields; -@Api @RestController @RequestMapping("/callback/upload-draft-orders") @RequiredArgsConstructor(onConstructor_ = {@Autowired}) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/support/MigrateCaseController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/support/MigrateCaseController.java index 01d988446eb..b1fb09fd24c 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/support/MigrateCaseController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/support/MigrateCaseController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers.support; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -35,7 +34,6 @@ import static uk.gov.hmcts.reform.fpl.enums.JudgeCaseRole.ALLOCATED_JUDGE; import static uk.gov.hmcts.reform.fpl.enums.LegalAdviserRole.ALLOCATED_LEGAL_ADVISER; -@Api @Slf4j @RestController @RequestMapping("/callback/migrate-case") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/support/RoboticsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/support/RoboticsController.java index 34845d0a80e..ce79195b218 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/support/RoboticsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/support/RoboticsController.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.fpl.controllers.support; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -22,7 +21,6 @@ import static uk.gov.hmcts.reform.fpl.enums.State.DELETED; import static uk.gov.hmcts.reform.fpl.enums.State.OPEN; -@Api @RestController @RequiredArgsConstructor(onConstructor = @__(@Autowired)) public class RoboticsController { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/testingsupport/controllers/TestingSupportController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/testingsupport/controllers/TestingSupportController.java index 4686774be04..9f2b279d396 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/testingsupport/controllers/TestingSupportController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/testingsupport/controllers/TestingSupportController.java @@ -1,7 +1,6 @@ package uk.gov.hmcts.reform.fpl.testingsupport.controllers; import feign.FeignException; -import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -55,7 +54,6 @@ import static uk.gov.hmcts.reform.fpl.CaseDefinitionConstants.CASE_TYPE; import static uk.gov.hmcts.reform.fpl.CaseDefinitionConstants.JURISDICTION; -@Api @Slf4j @RestController @RequiredArgsConstructor(onConstructor = @__(@Autowired)) From c0e51fcce65b427025645a819b73765228c4f901 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 4 Apr 2024 16:21:58 +0100 Subject: [PATCH 020/105] Removing app insights addition. --- charts/fpl-case-service/values.preview.template.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/charts/fpl-case-service/values.preview.template.yaml b/charts/fpl-case-service/values.preview.template.yaml index 23954219033..8e97254704b 100644 --- a/charts/fpl-case-service/values.preview.template.yaml +++ b/charts/fpl-case-service/values.preview.template.yaml @@ -66,9 +66,6 @@ java: - ld-sdk-key - ctsc-inbox - ctsc-team-lead-inbox - - AppInsightsInstrumentationKey - - name: app-insights-connection-string - alias: app-insights-connection-string - rcj-family-high-court-inbox - court-to-court-admin-mapping From 7c7b8f05cf4719c2a21c2988da764445b8ef56cb Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 4 Apr 2024 16:49:19 +0100 Subject: [PATCH 021/105] Removing a couple of empty files --- .../hmcts/reform/fpl/service/ManageDocumentsLAServiceTest.java | 0 .../uk/gov/hmcts/reform/fpl/service/MigrateCFVServiceTest.java | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentsLAServiceTest.java delete mode 100644 service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCFVServiceTest.java diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentsLAServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ManageDocumentsLAServiceTest.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCFVServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/MigrateCFVServiceTest.java deleted file mode 100644 index e69de29bb2d..00000000000 From b3f800850f333c7c39f3f557a39870a35fe64558 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 9 Apr 2024 15:34:35 +0100 Subject: [PATCH 022/105] Add logging for post url to debug e2e tests. --- playwright-e2e/utils/api-helper.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/playwright-e2e/utils/api-helper.ts b/playwright-e2e/utils/api-helper.ts index b53ca63b0ee..ab265bfb33f 100644 --- a/playwright-e2e/utils/api-helper.ts +++ b/playwright-e2e/utils/api-helper.ts @@ -62,6 +62,7 @@ export class Apihelp { caseData.caseData.dateAndTimeSubmitted = dateTime.slice(0, -1); let data = lodash.template(JSON.stringify(caseData))(docParameter); let postURL = `${urlConfig.serviceUrl}/testing-support/case/populate/${caseID}`; + console.log("Submitting request to postURL " + postURL); try { let res = await this.apiRequest(postURL, systemUpdateUser, 'post', data); } catch (error) { From 5873275cc1fb13cbfd8a3b68ae3a4f6cefee4fbc Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 9 Apr 2024 16:36:16 +0100 Subject: [PATCH 023/105] Remove / in urls --- playwright-e2e/utils/api-helper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playwright-e2e/utils/api-helper.ts b/playwright-e2e/utils/api-helper.ts index ab265bfb33f..2d31fde5ee3 100644 --- a/playwright-e2e/utils/api-helper.ts +++ b/playwright-e2e/utils/api-helper.ts @@ -15,7 +15,7 @@ export class Apihelp { 'Content-Type': 'application/x-www-form-urlencoded', }, }; - let url = `${urlConfig.idamUrl}/loginUser?username=${user.email}&password=${user.password}`; + let url = `${urlConfig.idamUrl}loginUser?username=${user.email}&password=${user.password}`; return await axios.post(url, qs.stringify(axiosConfig)); } catch (error) { if (axios.isAxiosError(error)) { @@ -30,7 +30,7 @@ export class Apihelp { async createCase(caseName = 'e2e UI Test', user: { email: string, password: string }) { let res: object; - const url = `${urlConfig.serviceUrl}/testing-support/case/create`; + const url = `${urlConfig.serviceUrl}testing-support/case/create`; const data = { caseName: caseName, }; From 788ce7675b40c94868891d8884393bf6d3375014 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 9 Apr 2024 17:03:18 +0100 Subject: [PATCH 024/105] Remove / in urls --- playwright-e2e/utils/api-helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playwright-e2e/utils/api-helper.ts b/playwright-e2e/utils/api-helper.ts index 2d31fde5ee3..58c00191813 100644 --- a/playwright-e2e/utils/api-helper.ts +++ b/playwright-e2e/utils/api-helper.ts @@ -47,7 +47,7 @@ export class Apihelp { async updateCase(caseName = 'e2e Test', caseID: string, caseData: {} | undefined) { //This can be moved to before test hook to as same document URL will be used for all test data //replace the documents placeholder with docuemnt url - let docDetail = await this.apiRequest(urlConfig.serviceUrl + '/testing-support/test-document', systemUpdateUser); + let docDetail = await this.apiRequest(urlConfig.serviceUrl + 'testing-support/test-document', systemUpdateUser); let docParameter = { TEST_DOCUMENT_URL: docDetail.document_url, TEST_DOCUMENT_BINARY_URL: docDetail.document_binary_url From 21c11991a45f56f1aa1ed128264f0871d773212a Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 10 Apr 2024 12:21:29 +0100 Subject: [PATCH 025/105] Revert "Remove / in urls" This reverts commit 788ce7675b40c94868891d8884393bf6d3375014. --- playwright-e2e/utils/api-helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playwright-e2e/utils/api-helper.ts b/playwright-e2e/utils/api-helper.ts index 58c00191813..2d31fde5ee3 100644 --- a/playwright-e2e/utils/api-helper.ts +++ b/playwright-e2e/utils/api-helper.ts @@ -47,7 +47,7 @@ export class Apihelp { async updateCase(caseName = 'e2e Test', caseID: string, caseData: {} | undefined) { //This can be moved to before test hook to as same document URL will be used for all test data //replace the documents placeholder with docuemnt url - let docDetail = await this.apiRequest(urlConfig.serviceUrl + 'testing-support/test-document', systemUpdateUser); + let docDetail = await this.apiRequest(urlConfig.serviceUrl + '/testing-support/test-document', systemUpdateUser); let docParameter = { TEST_DOCUMENT_URL: docDetail.document_url, TEST_DOCUMENT_BINARY_URL: docDetail.document_binary_url From 080af39d0d816bc5b5eebea84a669393ba60f201 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 10 Apr 2024 12:21:29 +0100 Subject: [PATCH 026/105] Revert "Remove / in urls" This reverts commit 5873275cc1fb13cbfd8a3b68ae3a4f6cefee4fbc. --- playwright-e2e/utils/api-helper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playwright-e2e/utils/api-helper.ts b/playwright-e2e/utils/api-helper.ts index 2d31fde5ee3..ab265bfb33f 100644 --- a/playwright-e2e/utils/api-helper.ts +++ b/playwright-e2e/utils/api-helper.ts @@ -15,7 +15,7 @@ export class Apihelp { 'Content-Type': 'application/x-www-form-urlencoded', }, }; - let url = `${urlConfig.idamUrl}loginUser?username=${user.email}&password=${user.password}`; + let url = `${urlConfig.idamUrl}/loginUser?username=${user.email}&password=${user.password}`; return await axios.post(url, qs.stringify(axiosConfig)); } catch (error) { if (axios.isAxiosError(error)) { @@ -30,7 +30,7 @@ export class Apihelp { async createCase(caseName = 'e2e UI Test', user: { email: string, password: string }) { let res: object; - const url = `${urlConfig.serviceUrl}testing-support/case/create`; + const url = `${urlConfig.serviceUrl}/testing-support/case/create`; const data = { caseName: caseName, }; From 1ea49269df0d19a31952a41a5baab905af4f02e0 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 10 Apr 2024 12:23:27 +0100 Subject: [PATCH 027/105] Remove / in urls --- Jenkinsfile_CNP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index 796906f36c7..a46834f22a7 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -198,8 +198,8 @@ withPipeline(type, product, component) { before('fullFunctionalTest:preview'){ yarnBuilder.yarn('yarn-update') yarnBuilder.yarn('install-dependencies') - env.AAT_IDAM_URL = "https://idam-api.aat.platform.hmcts.net/" - env.AAT_SERVICE_URL = "https://fpl-case-service-pr-${CHANGE_ID}.preview.platform.hmcts.net/" + env.AAT_IDAM_URL = "https://idam-api.aat.platform.hmcts.net" + env.AAT_SERVICE_URL = "https://fpl-case-service-pr-${CHANGE_ID}.preview.platform.hmcts.net" env.FE_BASE_URL = "https://xui-fpl-case-service-pr-${CHANGE_ID}.preview.platform.hmcts.net/" env.SWANSEA_ORG_ID = "62LYJRF" env.MOCKED_PAYMENTS = false From 74ce14a130ad2f1f3108ff4652a1c96196be8f11 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 10 Apr 2024 16:05:23 +0100 Subject: [PATCH 028/105] Removing a couple of unnecessary changes --- charts/fpl-case-service/Chart.yaml | 4 ++-- playwright-e2e/utils/api-helper.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/charts/fpl-case-service/Chart.yaml b/charts/fpl-case-service/Chart.yaml index ace74ef4f3e..d5b56346a98 100644 --- a/charts/fpl-case-service/Chart.yaml +++ b/charts/fpl-case-service/Chart.yaml @@ -1,7 +1,7 @@ name: fpl-case-service apiVersion: v2 home: https://github.com/hmcts/fpl-ccd-configuration -version: 1.12.76 +version: 1.12.75 description: FPL Case Service maintainers: - name: HMCTS Family Public Law team @@ -28,7 +28,7 @@ dependencies: repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/' condition: idam-pr.enabled - name: aac-manage-case-assignment - version: ~0.2.13 + version: ~0.2.9 repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/' condition: aac-manage-case-assignment.enabled - name: ccd-case-document-am-api diff --git a/playwright-e2e/utils/api-helper.ts b/playwright-e2e/utils/api-helper.ts index ab265bfb33f..b53ca63b0ee 100644 --- a/playwright-e2e/utils/api-helper.ts +++ b/playwright-e2e/utils/api-helper.ts @@ -62,7 +62,6 @@ export class Apihelp { caseData.caseData.dateAndTimeSubmitted = dateTime.slice(0, -1); let data = lodash.template(JSON.stringify(caseData))(docParameter); let postURL = `${urlConfig.serviceUrl}/testing-support/case/populate/${caseID}`; - console.log("Submitting request to postURL " + postURL); try { let res = await this.apiRequest(postURL, systemUpdateUser, 'post', data); } catch (error) { From f3847a96efd99da6112f7a2ef762fb595d126500 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 09:54:24 +0100 Subject: [PATCH 029/105] Move from javax to jakarta library. --- .../reform/fpl/AdminManagesOrdersApiTests.java | 6 +++--- .../reform/fpl/config/AsyncConfiguration.java | 2 +- .../fpl/config/SystemUserRoleAssignment.java | 2 +- .../config/cafcass/CafcassEmailConfiguration.java | 2 +- .../reform/fpl/config/scheduler/JobFactory.java | 2 +- .../reform/fpl/config/scheduler/JobScheduler.java | 3 +-- .../fpl/controllers/ResourceExceptionHandler.java | 2 +- .../uk/gov/hmcts/reform/fpl/model/Address.java | 4 ++-- .../uk/gov/hmcts/reform/fpl/model/Allocation.java | 2 +- .../uk/gov/hmcts/reform/fpl/model/Applicant.java | 4 ++-- .../gov/hmcts/reform/fpl/model/ApplicantParty.java | 6 +++--- .../uk/gov/hmcts/reform/fpl/model/CaseData.java | 14 +++++++------- .../gov/hmcts/reform/fpl/model/CaseDataParent.java | 4 ++-- .../java/uk/gov/hmcts/reform/fpl/model/Child.java | 5 ++--- .../gov/hmcts/reform/fpl/model/ChildExtension.java | 2 +- .../uk/gov/hmcts/reform/fpl/model/ChildParty.java | 9 +++++---- .../uk/gov/hmcts/reform/fpl/model/Grounds.java | 6 +++--- .../fpl/model/GroundsForChildAssessmentOrder.java | 2 +- .../fpl/model/GroundsForChildRecoveryOrder.java | 5 +++-- .../fpl/model/GroundsForContactWithChild.java | 2 +- .../gov/hmcts/reform/fpl/model/GroundsForEPO.java | 6 +++--- .../model/GroundsForEducationSupervisionOrder.java | 2 +- .../model/GroundsForRefuseContactWithChild.java | 2 +- .../model/GroundsForSecureAccommodationOrder.java | 6 +++--- .../uk/gov/hmcts/reform/fpl/model/Hearing.java | 2 +- .../gov/hmcts/reform/fpl/model/HearingBooking.java | 2 +- .../uk/gov/hmcts/reform/fpl/model/Respondent.java | 5 ++--- .../hmcts/reform/fpl/model/RespondentParty.java | 4 ++-- .../reform/fpl/model/RespondentSolicitor.java | 2 +- .../uk/gov/hmcts/reform/fpl/model/Solicitor.java | 4 ++-- .../hmcts/reform/fpl/model/common/Document.java | 2 +- .../gov/hmcts/reform/fpl/model/common/Element.java | 4 ++-- .../reform/fpl/model/common/EmailAddress.java | 4 ++-- .../gov/hmcts/reform/fpl/model/common/Party.java | 3 +-- .../hmcts/reform/fpl/model/common/Telephone.java | 2 +- .../RecordChildrenFinalDecisionsEventData.java | 2 +- .../fpl/model/order/generated/InterimEndDate.java | 2 +- .../reform/fpl/request/CacheAwareRequestData.java | 2 +- .../reform/fpl/service/OrderValidationService.java | 4 ++-- .../reform/fpl/service/ValidateGroupService.java | 4 ++-- .../reform/fpl/service/email/EmailService.java | 4 ++-- .../fpl/service/validators/DocumentsChecker.java | 2 +- .../fpl/service/validators/EventsChecker.java | 2 +- .../fpl/service/validators/GroundsChecker.java | 2 +- .../fpl/service/validators/PropertiesChecker.java | 6 +++--- .../validation/interfaces/HasAttachedDocument.java | 4 ++-- .../validation/interfaces/HasContactDirection.java | 5 ++--- .../interfaces/HasDocumentsIncludedInSwet.java | 4 ++-- .../fpl/validation/interfaces/HasGender.java | 4 ++-- .../interfaces/HasTelephoneOrMobile.java | 5 ++--- .../validation/interfaces/IsStateMigratable.java | 4 ++-- .../validation/interfaces/IsValidHearingEdit.java | 4 ++-- .../validation/interfaces/epo/HasEPOAddress.java | 4 ++-- .../fpl/validation/interfaces/epo/HasEPOType.java | 4 ++-- .../interfaces/epo/HasEnteredEPOExcluded.java | 4 ++-- .../validation/interfaces/time/EPOTimeRange.java | 4 ++-- .../interfaces/time/HasEndDateAfterStartDate.java | 4 ++-- .../interfaces/time/HasFutureEndDate.java | 4 ++-- .../time/HasHearingEndDateAfterStartDate.java | 4 ++-- .../interfaces/time/HasTimeNotMidnight.java | 4 ++-- .../interfaces/time/PastOrPresentDate.java | 4 ++-- .../interfaces/time/TimeNotMidnight.java | 4 ++-- .../validators/HasContactDirectionValidator.java | 5 ++--- .../validation/validators/HasGenderValidator.java | 5 ++--- .../validators/HasTelephoneOrMobileValidator.java | 5 ++--- .../validators/IsStateMigratableValidator.java | 5 ++--- .../validators/IsValidHearingEditValidator.java | 5 ++--- .../documents/HasAttachedDocumentValidator.java | 5 ++--- .../HasDocumentsIncludedInSwetValidator.java | 4 ++-- .../validators/epo/HasEPOAddressValidator.java | 7 +++---- .../validators/epo/HasEPOTypeValidator.java | 5 ++--- .../epo/HasEnteredEPOExcludedValidator.java | 7 +++---- .../validators/time/EPOTimeRangeValidator.java | 4 ++-- .../time/HasEndDateAfterStartDateValidator.java | 5 ++--- .../validators/time/HasFutureEndDateValidator.java | 4 ++-- .../HasHearingEndDateAfterStartDateValidator.java | 4 ++-- .../time/HasTimeNotMidnightValidator.java | 4 ++-- .../time/PastOrPresentDateValidator.java | 4 ++-- .../validators/time/TimeNotMidnightValidator.java | 4 ++-- .../hmcts/reform/fpl/request/RequestDataTest.java | 2 +- .../hmcts/reform/fpl/service/EmailServiceTest.java | 3 +-- .../fpl/service/OrderValidationServiceTest.java | 2 +- .../fpl/service/ValidateGroupServiceTest.java | 4 ++-- .../reform/fpl/utils/FixedTimeConfiguration.java | 4 ++-- .../fpl/validation/AbstractValidationTest.java | 4 ++-- .../HasAttachedDocumentValidatorTest.java | 4 ++-- .../HasDocumentsIncludedInSwetValidatorTest.java | 4 ++-- ...sHearingEndDateAfterStartDateValidatorTest.java | 4 ++-- 88 files changed, 166 insertions(+), 181 deletions(-) diff --git a/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/AdminManagesOrdersApiTests.java b/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/AdminManagesOrdersApiTests.java index 30cc635c17c..3d6bc419f87 100644 --- a/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/AdminManagesOrdersApiTests.java +++ b/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/AdminManagesOrdersApiTests.java @@ -1,7 +1,10 @@ package uk.gov.hmcts.reform.fpl; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; + import uk.gov.hmcts.reform.fpl.enums.C29ActionsPermitted; import uk.gov.hmcts.reform.fpl.enums.EnglandOffices; import uk.gov.hmcts.reform.fpl.enums.PlacedUnderOrder; @@ -15,8 +18,6 @@ import java.time.LocalDateTime; import java.util.List; import java.util.Map; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; @@ -25,7 +26,6 @@ import static uk.gov.hmcts.reform.fpl.enums.orders.ManageOrdersEndDateType.NUMBER_OF_MONTHS; import static uk.gov.hmcts.reform.fpl.model.order.Order.valueOf; import static uk.gov.hmcts.reform.fpl.utils.CaseDetailsHelper.formatCCDCaseNumber; - import static uk.gov.hmcts.reform.fpl.utils.DateFormatterHelper.DATE; import static uk.gov.hmcts.reform.fpl.utils.DateFormatterHelper.DATE_TIME; import static uk.gov.hmcts.reform.fpl.utils.DateFormatterHelper.DATE_TIME_AT; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/AsyncConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/AsyncConfiguration.java index 5e90d0c6314..1248a205480 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/AsyncConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/AsyncConfiguration.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.config; +import jakarta.annotation.Nonnull; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; @@ -16,7 +17,6 @@ import java.lang.reflect.Method; import java.util.concurrent.Executor; -import javax.annotation.Nonnull; @Slf4j @Configuration diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/SystemUserRoleAssignment.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/SystemUserRoleAssignment.java index 74bf0a9e922..a771e5ac6c6 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/SystemUserRoleAssignment.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/SystemUserRoleAssignment.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.config; +import jakarta.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -7,7 +8,6 @@ import org.springframework.stereotype.Component; import uk.gov.hmcts.reform.fpl.service.RoleAssignmentService; -import javax.annotation.PostConstruct; @Slf4j @Component diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/cafcass/CafcassEmailConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/cafcass/CafcassEmailConfiguration.java index a31c888d7c5..f83ea74e3ab 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/cafcass/CafcassEmailConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/cafcass/CafcassEmailConfiguration.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.config.cafcass; +import jakarta.validation.constraints.NotNull; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Data; @@ -9,7 +10,6 @@ import org.springframework.context.annotation.Configuration; import java.util.Map; -import javax.validation.constraints.NotNull; @Data @Configuration diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/scheduler/JobFactory.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/scheduler/JobFactory.java index 76d23391766..a53559bdcad 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/scheduler/JobFactory.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/scheduler/JobFactory.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.config.scheduler; +import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import org.quartz.spi.TriggerFiredBundle; import org.springframework.beans.factory.annotation.Autowired; @@ -9,7 +10,6 @@ import org.springframework.scheduling.quartz.SpringBeanJobFactory; import org.springframework.stereotype.Component; -import javax.validation.constraints.NotNull; /** * Enables DI in classes bootstrapped by quartz. diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/scheduler/JobScheduler.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/scheduler/JobScheduler.java index 5a2a3366c01..a4a79c3a119 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/scheduler/JobScheduler.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/scheduler/JobScheduler.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.config.scheduler; +import jakarta.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.quartz.JobDetail; @@ -12,8 +13,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; - import static org.quartz.CronScheduleBuilder.cronSchedule; import static org.quartz.JobBuilder.newJob; import static org.quartz.TriggerBuilder.newTrigger; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ResourceExceptionHandler.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ResourceExceptionHandler.java index 63510ad6427..c707aee594e 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ResourceExceptionHandler.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/ResourceExceptionHandler.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.fpl.controllers; import com.google.common.collect.ImmutableList; +import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -17,7 +18,6 @@ import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; @Slf4j @ControllerAdvice diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Address.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Address.java index 4931b96cb4e..0e866c2c940 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Address.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Address.java @@ -6,14 +6,14 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableList; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.groups.Default; import lombok.Builder; import lombok.Data; import org.apache.commons.lang3.StringUtils; import uk.gov.hmcts.reform.fpl.validation.groups.epoordergroup.EPOAddressGroup; import java.util.stream.Collectors; -import javax.validation.constraints.NotBlank; -import javax.validation.groups.Default; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Allocation.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Allocation.java index f0d8adfeb85..9ef46bd7744 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Allocation.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Allocation.java @@ -1,10 +1,10 @@ package uk.gov.hmcts.reform.fpl.model; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import javax.validation.constraints.NotBlank; @Data @Builder(toBuilder = true) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Applicant.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Applicant.java index 4984e5337f5..db0e5b5090f 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Applicant.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Applicant.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.model; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; @Data @Builder(toBuilder = true) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ApplicantParty.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ApplicantParty.java index ab3445f22aa..bd003b8ef4e 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ApplicantParty.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ApplicantParty.java @@ -1,6 +1,9 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonInclude; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; @@ -14,9 +17,6 @@ import uk.gov.hmcts.reform.fpl.validation.interfaces.HasTelephoneOrMobile; import java.time.LocalDate; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; @Data @EqualsAndHashCode(callSuper = true) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/CaseData.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/CaseData.java index d11f7718a01..50d5532f7e0 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/CaseData.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/CaseData.java @@ -3,6 +3,13 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonUnwrapped; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Future; +import jakarta.validation.constraints.FutureOrPresent; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.PastOrPresent; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; @@ -118,13 +125,6 @@ import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.validation.Valid; -import javax.validation.constraints.Future; -import javax.validation.constraints.FutureOrPresent; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.PastOrPresent; import static java.time.temporal.ChronoUnit.DAYS; import static java.util.Collections.emptyList; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/CaseDataParent.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/CaseDataParent.java index aa1c583f92b..95aa96d3155 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/CaseDataParent.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/CaseDataParent.java @@ -1,6 +1,8 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonSubTypes; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.experimental.SuperBuilder; import lombok.extern.jackson.Jacksonized; @@ -10,8 +12,6 @@ import uk.gov.hmcts.reform.fpl.validation.groups.SecureAccommodationGroup; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; @JsonSubTypes({ @JsonSubTypes.Type(value = CaseData.class) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Child.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Child.java index 0cd3cc4f1d4..b249042401a 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Child.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Child.java @@ -2,6 +2,8 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -12,9 +14,6 @@ import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - import static java.util.UUID.randomUUID; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ChildExtension.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ChildExtension.java index 5be42d9cc83..f86a0479fe5 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ChildExtension.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ChildExtension.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonInclude; +import jakarta.validation.constraints.FutureOrPresent; import lombok.Builder; import lombok.Value; import lombok.extern.jackson.Jacksonized; @@ -10,7 +11,6 @@ import java.time.LocalDate; import java.util.UUID; -import javax.validation.constraints.FutureOrPresent; import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ChildParty.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ChildParty.java index 806c1f8fc90..947a7a2b9e5 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ChildParty.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ChildParty.java @@ -1,6 +1,10 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonInclude; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.PastOrPresent; +import jakarta.validation.groups.Default; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; @@ -14,10 +18,7 @@ import uk.gov.hmcts.reform.fpl.validation.interfaces.HasGender; import java.time.LocalDate; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.PastOrPresent; -import javax.validation.groups.Default; + @Data @EqualsAndHashCode(callSuper = true) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Grounds.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Grounds.java index aa3104964a0..ee4773f2484 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Grounds.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Grounds.java @@ -1,14 +1,14 @@ package uk.gov.hmcts.reform.fpl.model; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import java.util.List; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; @Data @Builder(toBuilder = true) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForChildAssessmentOrder.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForChildAssessmentOrder.java index bfb1fb70cfd..2a801e7625d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForChildAssessmentOrder.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForChildAssessmentOrder.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonCreator; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import javax.validation.constraints.NotBlank; @Data @Builder diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForChildRecoveryOrder.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForChildRecoveryOrder.java index 2ab9305db7e..01261604306 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForChildRecoveryOrder.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForChildRecoveryOrder.java @@ -1,14 +1,15 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonCreator; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import uk.gov.hmcts.reform.fpl.enums.ChildRecoveryOrderGround; import java.util.List; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; + @Data @Builder diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForContactWithChild.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForContactWithChild.java index 880651191ca..8fb30c56e49 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForContactWithChild.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForContactWithChild.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonCreator; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import javax.validation.constraints.NotBlank; @Data @Builder diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForEPO.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForEPO.java index 3b73165480c..bca1d6eae5b 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForEPO.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForEPO.java @@ -1,15 +1,15 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonCreator; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import uk.gov.hmcts.reform.fpl.validation.groups.EPOGroup; import java.util.List; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; @Data @Builder diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForEducationSupervisionOrder.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForEducationSupervisionOrder.java index c4e4d8fbd33..309f6062491 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForEducationSupervisionOrder.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForEducationSupervisionOrder.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonCreator; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import javax.validation.constraints.NotBlank; @Data @Builder diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForRefuseContactWithChild.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForRefuseContactWithChild.java index 9e23c0957b7..22d8c441a46 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForRefuseContactWithChild.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForRefuseContactWithChild.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonCreator; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import javax.validation.constraints.NotBlank; @Data @Builder diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForSecureAccommodationOrder.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForSecureAccommodationOrder.java index e29b8c37201..8b30b4c532f 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForSecureAccommodationOrder.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/GroundsForSecureAccommodationOrder.java @@ -1,6 +1,9 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonCreator; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -8,9 +11,6 @@ import uk.gov.hmcts.reform.fpl.validation.groups.SecureAccommodationGroup; import java.util.List; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; @Data @Builder diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Hearing.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Hearing.java index eeb452356e8..65fd50aa38d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Hearing.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Hearing.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import javax.validation.constraints.NotBlank; @Data @Builder diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/HearingBooking.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/HearingBooking.java index 3c48803d2cd..d705488b711 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/HearingBooking.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/HearingBooking.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonIgnore; +import jakarta.validation.constraints.Future; import lombok.Builder; import lombok.Data; import lombok.extern.jackson.Jacksonized; @@ -27,7 +28,6 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import javax.validation.constraints.Future; import static java.lang.String.format; import static java.util.Collections.emptyList; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Respondent.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Respondent.java index abc03549acc..4a1c028464c 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Respondent.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Respondent.java @@ -2,6 +2,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.Builder; import lombok.Data; import lombok.extern.jackson.Jacksonized; @@ -17,9 +19,6 @@ import java.util.List; import java.util.UUID; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - import static java.util.UUID.randomUUID; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; import static org.apache.commons.lang3.ObjectUtils.isNotEmpty; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/RespondentParty.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/RespondentParty.java index 0c6849e9a7c..bf89d28282e 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/RespondentParty.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/RespondentParty.java @@ -3,6 +3,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.groups.Default; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; @@ -15,8 +17,6 @@ import uk.gov.hmcts.reform.fpl.validation.groups.SealedSDOGroup; import java.time.LocalDate; -import javax.validation.constraints.NotBlank; -import javax.validation.groups.Default; @Data @EqualsAndHashCode(callSuper = true) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/RespondentSolicitor.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/RespondentSolicitor.java index a3c2410178a..9fc0fd2e9e9 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/RespondentSolicitor.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/RespondentSolicitor.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonIgnore; +import jakarta.validation.Valid; import lombok.Builder; import lombok.Data; import lombok.extern.jackson.Jacksonized; @@ -9,7 +10,6 @@ import uk.gov.hmcts.reform.fpl.model.common.Telephone; import java.util.List; -import javax.validation.Valid; import static org.apache.commons.lang3.StringUtils.defaultString; import static org.apache.commons.lang3.StringUtils.isNotEmpty; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Solicitor.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Solicitor.java index d80e9b67717..a865e6300c1 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Solicitor.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Solicitor.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.model; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import javax.validation.constraints.Email; -import javax.validation.constraints.NotBlank; @Data @Builder(toBuilder = true) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Document.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Document.java index 3093fd30bec..1999ff2d000 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Document.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Document.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.model.common; +import jakarta.validation.constraints.NotBlank; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.SuperBuilder; @@ -7,7 +8,6 @@ import uk.gov.hmcts.reform.fpl.validation.interfaces.HasAttachedDocument; import java.time.LocalDateTime; -import javax.validation.constraints.NotBlank; @EqualsAndHashCode(callSuper = true) @Data diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Element.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Element.java index bb96e5f7ed1..5ed96f001c4 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Element.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Element.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.model.common; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import java.util.UUID; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; @Data @Builder(toBuilder = true) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/EmailAddress.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/EmailAddress.java index d7d459b39c0..cb7ff98dff2 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/EmailAddress.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/EmailAddress.java @@ -1,12 +1,12 @@ package uk.gov.hmcts.reform.fpl.model.common; import com.fasterxml.jackson.annotation.JsonInclude; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import javax.validation.constraints.Email; -import javax.validation.constraints.NotBlank; @Data @Builder diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Party.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Party.java index fd072e7e1ba..caaa2b33ae8 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Party.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Party.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; +import jakarta.validation.Valid; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -11,8 +12,6 @@ import java.time.LocalDate; -import javax.validation.Valid; - import static org.apache.commons.lang3.StringUtils.defaultString; @Data diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Telephone.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Telephone.java index 96e6dd8f5e9..ea81b8eac73 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Telephone.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/common/Telephone.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.model.common; import com.fasterxml.jackson.annotation.JsonInclude; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import javax.validation.constraints.NotBlank; @Data @Builder(toBuilder = true) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/event/RecordChildrenFinalDecisionsEventData.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/event/RecordChildrenFinalDecisionsEventData.java index 91ae6e7d279..e182205fa43 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/event/RecordChildrenFinalDecisionsEventData.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/event/RecordChildrenFinalDecisionsEventData.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; +import jakarta.validation.constraints.PastOrPresent; import lombok.Builder; import lombok.Value; import lombok.extern.jackson.Jacksonized; @@ -13,7 +14,6 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import javax.validation.constraints.PastOrPresent; import static org.apache.commons.lang3.reflect.FieldUtils.getFieldsListWithAnnotation; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/order/generated/InterimEndDate.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/order/generated/InterimEndDate.java index 53d674c0221..edef5730024 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/order/generated/InterimEndDate.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/order/generated/InterimEndDate.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.model.order.generated; +import jakarta.validation.constraints.Future; import lombok.Builder; import lombok.Data; import uk.gov.hmcts.reform.fpl.enums.ccd.fixedlists.InterimEndDateType; @@ -9,7 +10,6 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.util.Optional; -import javax.validation.constraints.Future; @Data @Builder diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/request/CacheAwareRequestData.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/request/CacheAwareRequestData.java index aa3064226ee..eef182f751a 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/request/CacheAwareRequestData.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/request/CacheAwareRequestData.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.request; +import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Primary; @@ -9,7 +10,6 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.servlet.http.HttpServletRequest; import static java.util.Collections.emptySet; import static org.apache.commons.lang3.StringUtils.isBlank; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/OrderValidationService.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/OrderValidationService.java index 1638608918e..6075435d683 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/OrderValidationService.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/OrderValidationService.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.service; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validator; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -8,8 +10,6 @@ import uk.gov.hmcts.reform.fpl.validation.groups.SealedSDOGroup; import java.util.List; -import javax.validation.ConstraintViolation; -import javax.validation.Validator; import static java.util.Collections.emptyList; import static java.util.stream.Collectors.toList; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/ValidateGroupService.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/ValidateGroupService.java index 7248842753f..ac7661bb95d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/ValidateGroupService.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/ValidateGroupService.java @@ -1,12 +1,12 @@ package uk.gov.hmcts.reform.fpl.service; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.stream.Collectors; -import javax.validation.ConstraintViolation; -import javax.validation.Validator; @Service public class ValidateGroupService { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/EmailService.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/EmailService.java index 076d08fdad6..d70a9ff07b3 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/EmailService.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/EmailService.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.service.email; +import jakarta.mail.MessagingException; +import jakarta.mail.internet.MimeMessage; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.MailException; @@ -10,8 +12,6 @@ import uk.gov.hmcts.reform.fpl.model.email.EmailAttachment; import uk.gov.hmcts.reform.fpl.model.email.EmailData; -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; @Service @RequiredArgsConstructor(onConstructor = @__(@Autowired)) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/DocumentsChecker.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/DocumentsChecker.java index 1003a7fbaa3..4d21e153769 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/DocumentsChecker.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/DocumentsChecker.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.service.validators; +import jakarta.validation.groups.Default; import org.springframework.stereotype.Component; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.validation.groups.UploadDocumentsGroup; import java.util.List; -import javax.validation.groups.Default; import static uk.gov.hmcts.reform.fpl.service.validators.EventCheckerHelper.anyNonEmpty; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/EventsChecker.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/EventsChecker.java index fd7807d353d..9ed9734a29f 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/EventsChecker.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/EventsChecker.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.service.validators; +import jakarta.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -9,7 +10,6 @@ import java.util.EnumMap; import java.util.List; -import javax.annotation.PostConstruct; import static java.util.Collections.emptyList; import static java.util.Optional.ofNullable; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/GroundsChecker.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/GroundsChecker.java index 378bfb25645..6e404a694c3 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/GroundsChecker.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/GroundsChecker.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.service.validators; +import jakarta.validation.groups.Default; import org.springframework.stereotype.Component; import uk.gov.hmcts.reform.fpl.enums.OrderType; import uk.gov.hmcts.reform.fpl.model.CaseData; @@ -14,7 +15,6 @@ import uk.gov.hmcts.reform.fpl.validation.groups.SecureAccommodationGroup; import java.util.List; -import javax.validation.groups.Default; import static org.apache.commons.lang3.ObjectUtils.isNotEmpty; import static uk.gov.hmcts.reform.fpl.model.tasklist.TaskState.COMPLETED_FINISHED; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/PropertiesChecker.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/PropertiesChecker.java index d670abd4259..a7af19c5b38 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/PropertiesChecker.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/validators/PropertiesChecker.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.service.validators; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Path; import org.springframework.beans.factory.annotation.Autowired; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.CaseDataParent; @@ -10,8 +12,6 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.validation.ConstraintViolation; -import javax.validation.Path; import static java.util.stream.Collectors.toList; @@ -24,7 +24,7 @@ public abstract class PropertiesChecker implements EventChecker { .collect(toList()); @Autowired - private javax.validation.Validator validator; + private jakarta.validation.Validator validator; public List validate(CaseData caseData, List propertiesToBeValidated, Class... groups) { checkProperties(propertiesToBeValidated); diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasAttachedDocument.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasAttachedDocument.java index d8250885340..19b6dfd7b29 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasAttachedDocument.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasAttachedDocument.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.documents.HasAttachedDocumentValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasContactDirection.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasContactDirection.java index b361328d543..d28a0826d98 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasContactDirection.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasContactDirection.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.HasContactDirectionValidator; import java.lang.annotation.ElementType; @@ -7,9 +9,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; - @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Constraint(validatedBy = { HasContactDirectionValidator.class }) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasDocumentsIncludedInSwet.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasDocumentsIncludedInSwet.java index c9873a4112a..87af275217c 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasDocumentsIncludedInSwet.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasDocumentsIncludedInSwet.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.documents.HasDocumentsIncludedInSwetValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasGender.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasGender.java index e4647c52d32..d53297bc5e7 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasGender.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasGender.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.HasGenderValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasTelephoneOrMobile.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasTelephoneOrMobile.java index 69ea61aa64a..6b7319ee1e8 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasTelephoneOrMobile.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/HasTelephoneOrMobile.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.HasTelephoneOrMobileValidator; import java.lang.annotation.ElementType; @@ -7,9 +9,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; - @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Constraint(validatedBy = { HasTelephoneOrMobileValidator.class }) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsStateMigratable.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsStateMigratable.java index f2b7e60877d..f52775f032c 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsStateMigratable.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsStateMigratable.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.IsStateMigratableValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsValidHearingEdit.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsValidHearingEdit.java index 2aa0fad8628..452f9613706 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsValidHearingEdit.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsValidHearingEdit.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.IsValidHearingEditValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEPOAddress.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEPOAddress.java index 52b9599eba5..a638940286a 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEPOAddress.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEPOAddress.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces.epo; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.epo.HasEPOAddressValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEPOType.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEPOType.java index 28eb38ce55a..3c1a851bcc3 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEPOType.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEPOType.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces.epo; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.epo.HasEPOTypeValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEnteredEPOExcluded.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEnteredEPOExcluded.java index 200b4868297..0509553a554 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEnteredEPOExcluded.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/epo/HasEnteredEPOExcluded.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces.epo; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.epo.HasEnteredEPOExcludedValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/EPOTimeRange.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/EPOTimeRange.java index 60b06c92463..e1aa050494f 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/EPOTimeRange.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/EPOTimeRange.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces.time; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.time.EPOTimeRangeValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; import static java.time.temporal.ChronoUnit.SECONDS; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasEndDateAfterStartDate.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasEndDateAfterStartDate.java index 718aac0f63d..062786e18fc 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasEndDateAfterStartDate.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasEndDateAfterStartDate.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces.time; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.time.HasEndDateAfterStartDateValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasFutureEndDate.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasFutureEndDate.java index 82cc07a375f..f68a2b3982b 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasFutureEndDate.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasFutureEndDate.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces.time; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.time.HasFutureEndDateValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasHearingEndDateAfterStartDate.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasHearingEndDateAfterStartDate.java index 82bc23e8873..d1d99c91655 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasHearingEndDateAfterStartDate.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasHearingEndDateAfterStartDate.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces.time; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.time.HasHearingEndDateAfterStartDateValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasTimeNotMidnight.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasTimeNotMidnight.java index b24951835ac..f4f50e4251a 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasTimeNotMidnight.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/HasTimeNotMidnight.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces.time; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.time.HasTimeNotMidnightValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/PastOrPresentDate.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/PastOrPresentDate.java index b1e194b3789..b5aab8b55a5 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/PastOrPresentDate.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/PastOrPresentDate.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces.time; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.time.PastOrPresentDateValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/TimeNotMidnight.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/TimeNotMidnight.java index be75f558068..c5e257a5ee6 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/TimeNotMidnight.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/time/TimeNotMidnight.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.interfaces.time; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import uk.gov.hmcts.reform.fpl.validation.validators.time.TimeNotMidnightValidator; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasContactDirectionValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasContactDirectionValidator.java index f3ad2a61a0a..39840cd1dc1 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasContactDirectionValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasContactDirectionValidator.java @@ -1,12 +1,11 @@ package uk.gov.hmcts.reform.fpl.validation.validators; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; import uk.gov.hmcts.reform.fpl.model.interfaces.TelephoneContacts; import uk.gov.hmcts.reform.fpl.validation.interfaces.HasContactDirection; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - public class HasContactDirectionValidator implements ConstraintValidator { @Override public boolean isValid(TelephoneContacts telephoneContacts, ConstraintValidatorContext constraintValidatorContext) { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasGenderValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasGenderValidator.java index ba6bcb34eb8..e12f5218e50 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasGenderValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasGenderValidator.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.validation.validators; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; import uk.gov.hmcts.reform.fpl.enums.ChildGender; import uk.gov.hmcts.reform.fpl.model.ChildParty; @@ -7,9 +9,6 @@ import java.util.Optional; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - import static uk.gov.hmcts.reform.fpl.enums.ChildGender.OTHER; public class HasGenderValidator implements ConstraintValidator { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasTelephoneOrMobileValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasTelephoneOrMobileValidator.java index d0d8955049a..243d4dac398 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasTelephoneOrMobileValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/HasTelephoneOrMobileValidator.java @@ -1,12 +1,11 @@ package uk.gov.hmcts.reform.fpl.validation.validators; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; import uk.gov.hmcts.reform.fpl.model.interfaces.TelephoneContacts; import uk.gov.hmcts.reform.fpl.validation.interfaces.HasTelephoneOrMobile; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - public class HasTelephoneOrMobileValidator implements ConstraintValidator { @Override public boolean isValid(TelephoneContacts telephoneContacts, ConstraintValidatorContext constraintValidatorContext) { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsStateMigratableValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsStateMigratableValidator.java index ce1c3f4cc6e..f68f394171e 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsStateMigratableValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsStateMigratableValidator.java @@ -1,13 +1,12 @@ package uk.gov.hmcts.reform.fpl.validation.validators; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.Child; import uk.gov.hmcts.reform.fpl.model.common.Element; import uk.gov.hmcts.reform.fpl.validation.interfaces.IsStateMigratable; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - import static uk.gov.hmcts.reform.fpl.enums.State.CLOSED; public class IsStateMigratableValidator implements ConstraintValidator { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsValidHearingEditValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsValidHearingEditValidator.java index ec1bb2feeb7..9faa85eb395 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsValidHearingEditValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsValidHearingEditValidator.java @@ -1,11 +1,10 @@ package uk.gov.hmcts.reform.fpl.validation.validators; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.validation.interfaces.IsValidHearingEdit; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - import static org.apache.commons.lang3.ObjectUtils.isEmpty; import static uk.gov.hmcts.reform.fpl.enums.HearingOptions.ADJOURN_HEARING; import static uk.gov.hmcts.reform.fpl.enums.HearingOptions.EDIT_FUTURE_HEARING; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasAttachedDocumentValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasAttachedDocumentValidator.java index f33e8aa78e4..7ae3b79d0fe 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasAttachedDocumentValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasAttachedDocumentValidator.java @@ -1,11 +1,10 @@ package uk.gov.hmcts.reform.fpl.validation.validators.documents; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.model.common.Document; import uk.gov.hmcts.reform.fpl.validation.interfaces.HasAttachedDocument; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - import static uk.gov.hmcts.reform.fpl.enums.DocumentStatus.ATTACHED; import static uk.gov.hmcts.reform.fpl.utils.DocumentsHelper.hasDocumentStatusOf; import static uk.gov.hmcts.reform.fpl.utils.DocumentsHelper.hasDocumentUploaded; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasDocumentsIncludedInSwetValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasDocumentsIncludedInSwetValidator.java index fdbb5145016..f95b8256533 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasDocumentsIncludedInSwetValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasDocumentsIncludedInSwetValidator.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.validation.validators.documents; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.common.Document; import uk.gov.hmcts.reform.fpl.validation.interfaces.HasDocumentsIncludedInSwet; @@ -7,8 +9,6 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; import static uk.gov.hmcts.reform.fpl.enums.DocumentStatus.ATTACHED; import static uk.gov.hmcts.reform.fpl.enums.DocumentStatus.INCLUDED_IN_SWET; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEPOAddressValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEPOAddressValidator.java index c538f766018..487cb266d8d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEPOAddressValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEPOAddressValidator.java @@ -1,13 +1,12 @@ package uk.gov.hmcts.reform.fpl.validation.validators.epo; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.model.Address; import uk.gov.hmcts.reform.fpl.model.Orders; import uk.gov.hmcts.reform.fpl.validation.interfaces.epo.HasEPOAddress; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - -import static org.apache.logging.log4j.util.Strings.isEmpty; +import static org.apache.commons.lang3.StringUtils.isEmpty; import static uk.gov.hmcts.reform.fpl.enums.EPOType.PREVENT_REMOVAL; public class HasEPOAddressValidator implements ConstraintValidator { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEPOTypeValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEPOTypeValidator.java index 4a05b209121..25b5f42b7c2 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEPOTypeValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEPOTypeValidator.java @@ -1,11 +1,10 @@ package uk.gov.hmcts.reform.fpl.validation.validators.epo; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.model.Orders; import uk.gov.hmcts.reform.fpl.validation.interfaces.epo.HasEPOType; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - import static java.util.Objects.isNull; public class HasEPOTypeValidator implements ConstraintValidator { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEnteredEPOExcludedValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEnteredEPOExcludedValidator.java index 8e101743868..1a90f3c08ff 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEnteredEPOExcludedValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/epo/HasEnteredEPOExcludedValidator.java @@ -1,13 +1,12 @@ package uk.gov.hmcts.reform.fpl.validation.validators.epo; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.model.Orders; import uk.gov.hmcts.reform.fpl.validation.interfaces.epo.HasEnteredEPOExcluded; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - import static java.util.Objects.isNull; -import static org.apache.logging.log4j.util.Strings.isEmpty; +import static org.apache.commons.lang3.StringUtils.isEmpty; import static uk.gov.hmcts.reform.fpl.config.utils.EmergencyProtectionOrderDirectionsType.EXCLUSION_REQUIREMENT; public class HasEnteredEPOExcludedValidator implements ConstraintValidator { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/EPOTimeRangeValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/EPOTimeRangeValidator.java index ded4c0f2972..62346f30780 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/EPOTimeRangeValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/EPOTimeRangeValidator.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.validators.time; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import org.springframework.stereotype.Component; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.validation.interfaces.time.EPOTimeRange; import uk.gov.hmcts.reform.fpl.validation.interfaces.time.TimeDifference; import java.time.LocalDateTime; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; @Component public class EPOTimeRangeValidator implements ConstraintValidator { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasEndDateAfterStartDateValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasEndDateAfterStartDateValidator.java index ce5d742e327..99654cf4a48 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasEndDateAfterStartDateValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasEndDateAfterStartDateValidator.java @@ -1,11 +1,10 @@ package uk.gov.hmcts.reform.fpl.validation.validators.time; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.model.HearingBooking; import uk.gov.hmcts.reform.fpl.validation.interfaces.time.HasEndDateAfterStartDate; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - public class HasEndDateAfterStartDateValidator implements ConstraintValidator { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasFutureEndDateValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasFutureEndDateValidator.java index bd4c3a66192..c47f9b5a89d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasFutureEndDateValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasFutureEndDateValidator.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.validation.validators.time; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.validation.interfaces.time.HasFutureEndDate; import java.time.LocalDateTime; import java.util.Optional; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; public class HasFutureEndDateValidator implements ConstraintValidator { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasHearingEndDateAfterStartDateValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasHearingEndDateAfterStartDateValidator.java index 27bf0c219dc..ef7dccf17d7 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasHearingEndDateAfterStartDateValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasHearingEndDateAfterStartDateValidator.java @@ -1,10 +1,10 @@ package uk.gov.hmcts.reform.fpl.validation.validators.time; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.validation.interfaces.time.HasHearingEndDateAfterStartDate; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; public class HasHearingEndDateAfterStartDateValidator implements ConstraintValidator { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasTimeNotMidnightValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasTimeNotMidnightValidator.java index cfe4e8d3dd6..0f5ab546a01 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasTimeNotMidnightValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasTimeNotMidnightValidator.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.validation.validators.time; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.validation.interfaces.time.HasTimeNotMidnight; import java.time.LocalDateTime; import java.time.LocalTime; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; public class HasTimeNotMidnightValidator implements ConstraintValidator { private static final LocalTime MIDNIGHT = LocalTime.of(0, 0, 0); diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/PastOrPresentDateValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/PastOrPresentDateValidator.java index 6cbc5707020..d1736d4be80 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/PastOrPresentDateValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/PastOrPresentDateValidator.java @@ -1,13 +1,13 @@ package uk.gov.hmcts.reform.fpl.validation.validators.time; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import uk.gov.hmcts.reform.fpl.service.time.Time; import uk.gov.hmcts.reform.fpl.validation.interfaces.time.PastOrPresentDate; import java.time.LocalDateTime; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; @RequiredArgsConstructor(onConstructor = @__(@Autowired)) public class PastOrPresentDateValidator implements ConstraintValidator { diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/TimeNotMidnightValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/TimeNotMidnightValidator.java index 9a98754deac..6dc74f6bdfd 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/TimeNotMidnightValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/time/TimeNotMidnightValidator.java @@ -1,11 +1,11 @@ package uk.gov.hmcts.reform.fpl.validation.validators.time; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.gov.hmcts.reform.fpl.validation.interfaces.time.TimeNotMidnight; import java.time.LocalDateTime; import java.time.LocalTime; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; public class TimeNotMidnightValidator implements ConstraintValidator { private static final LocalTime MIDNIGHT = LocalTime.of(0, 0, 0); diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/request/RequestDataTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/request/RequestDataTest.java index 8c6a19a45fb..78a58178002 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/request/RequestDataTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/request/RequestDataTest.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.request; +import jakarta.servlet.http.HttpServletRequest; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; @@ -10,7 +11,6 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.Set; -import javax.servlet.http.HttpServletRequest; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.verifyNoInteractions; diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/EmailServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/EmailServiceTest.java index d1373c09990..291e7943e60 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/EmailServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/EmailServiceTest.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.service; +import jakarta.mail.internet.MimeMessage; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -11,8 +12,6 @@ import uk.gov.hmcts.reform.fpl.model.email.EmailData; import uk.gov.hmcts.reform.fpl.service.email.EmailService; -import javax.mail.internet.MimeMessage; - import static java.lang.String.join; import static java.util.Set.of; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/OrderValidationServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/OrderValidationServiceTest.java index 667ff81b14a..e65b3e6d1b8 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/OrderValidationServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/OrderValidationServiceTest.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.service; +import jakarta.validation.Validator; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; @@ -24,7 +25,6 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; -import javax.validation.Validator; import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; import static org.mockito.ArgumentMatchers.any; diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ValidateGroupServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ValidateGroupServiceTest.java index 807b37d2f83..dc2311236a4 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ValidateGroupServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/ValidateGroupServiceTest.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.fpl.service; import com.google.common.collect.ImmutableList; +import jakarta.validation.Validation; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -17,7 +18,6 @@ import java.time.LocalTime; import java.util.List; import java.util.UUID; -import javax.validation.Validation; import static org.assertj.core.api.Assertions.assertThat; @@ -26,7 +26,7 @@ class ValidateGroupServiceTest { private ValidateGroupService validateGroupService; @BeforeEach() - private void setup() { + public void setup() { validateGroupService = new ValidateGroupService(Validation .buildDefaultValidatorFactory() .getValidator()); diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/FixedTimeConfiguration.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/FixedTimeConfiguration.java index 12437cdd607..98f9e83e759 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/FixedTimeConfiguration.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/FixedTimeConfiguration.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.utils; +import jakarta.validation.ClockProvider; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -11,7 +12,6 @@ import java.time.Clock; import java.time.LocalDateTime; import java.time.ZonedDateTime; -import javax.validation.ClockProvider; @Configuration @Import(TestConfiguration.class) @@ -37,7 +37,7 @@ public Time fixedDateTime(LocalDateTime fixed) { public LocalValidatorFactoryBean localValidatorFactoryBean() { return new LocalValidatorFactoryBean() { @Override - protected void postProcessConfiguration(javax.validation.Configuration configuration) { + protected void postProcessConfiguration(jakarta.validation.Configuration configuration) { configuration.clockProvider(fixedClockProvider()); } }; diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/AbstractValidationTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/AbstractValidationTest.java index 5aa31c91efd..f43b43db842 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/AbstractValidationTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/AbstractValidationTest.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.validation; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validator; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; @@ -7,8 +9,6 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import java.util.List; -import javax.validation.ConstraintViolation; -import javax.validation.Validator; import static java.util.stream.Collectors.toList; diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasAttachedDocumentValidatorTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasAttachedDocumentValidatorTest.java index e308631c920..4feea3a9cf2 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasAttachedDocumentValidatorTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasAttachedDocumentValidatorTest.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.validation.validators.documents; +import jakarta.validation.Validation; +import jakarta.validation.Validator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -9,8 +11,6 @@ import uk.gov.hmcts.reform.fpl.validation.groups.UploadDocumentsGroup; import java.util.List; -import javax.validation.Validation; -import javax.validation.Validator; import static org.assertj.core.api.Assertions.assertThat; import static uk.gov.hmcts.reform.fpl.enums.DocumentStatus.ATTACHED; diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasDocumentsIncludedInSwetValidatorTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasDocumentsIncludedInSwetValidatorTest.java index a8e2d88edb9..4e25173496e 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasDocumentsIncludedInSwetValidatorTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/documents/HasDocumentsIncludedInSwetValidatorTest.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.validation.validators.documents; +import jakarta.validation.Validation; +import jakarta.validation.Validator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -13,8 +15,6 @@ import java.util.List; import java.util.Optional; -import javax.validation.Validation; -import javax.validation.Validator; import static org.assertj.core.api.Assertions.assertThat; import static uk.gov.hmcts.reform.fpl.enums.DocumentStatus.ATTACHED; diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasHearingEndDateAfterStartDateValidatorTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasHearingEndDateAfterStartDateValidatorTest.java index 65c2a9bc4fa..10b1958cf28 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasHearingEndDateAfterStartDateValidatorTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/validation/validators/time/HasHearingEndDateAfterStartDateValidatorTest.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.validation.validators.time; +import jakarta.validation.Validation; +import jakarta.validation.Validator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; @@ -13,8 +15,6 @@ import java.time.LocalDateTime; import java.util.List; import java.util.stream.Stream; -import javax.validation.Validation; -import javax.validation.Validator; import static org.assertj.core.api.Assertions.assertThat; From 781f17043a9d1dc1e8551c344393862f55f60dea Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 09:55:36 +0100 Subject: [PATCH 030/105] Upgrade checkstyle.xml --- config/checkstyle/checkstyle.xml | 62 ++++++++++++-------------------- 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index dd3240c6656..9536a15d0b1 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -1,7 +1,7 @@ + "-//Puppy Crawl//DTD Check Configuration 1.3//EN" + "http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd"> + + - - - - - + + - - - + - + - + - + @@ -185,32 +176,23 @@ - + - - - - - - + - + - + @@ -220,22 +202,17 @@ - + - + - - - @@ -249,5 +226,10 @@ + + + + + From 0f448f3044b86535506ce9cec6ac7eeb0caf3e50 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 09:57:34 +0100 Subject: [PATCH 031/105] Update spring boot and gradle dependencies --- service/build.gradle | 86 +++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 37 deletions(-) diff --git a/service/build.gradle b/service/build.gradle index 31cda08f43a..dd23a44ac55 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -17,9 +17,9 @@ plugins { id 'checkstyle' id 'jacoco' id 'io.spring.dependency-management' version '1.1.3' - id 'org.springframework.boot' version '2.7.18' - id 'com.github.ben-manes.versions' version '0.49.0' - id 'org.sonarqube' version '3.5.0.2730' + id 'org.springframework.boot' version '3.2.4' + id 'com.github.ben-manes.versions' version '0.51.0' + id 'org.sonarqube' version '5.0.0.4638' id 'project-report' id 'idea' id 'info.solidsoft.pitest' version '1.15.0' @@ -225,17 +225,17 @@ task highLevelDataSetup(type: JavaExec, description: 'High level data step mock checkstyle { maxWarnings = 0 - toolVersion = "8.25" + toolVersion = "10.14.0" // need to set configDirectory to rootDir otherwise submodule will use submodule/config/checkstyle - configDirectory.set(file("$rootDir/config/checkstyle")) + getConfigDirectory().set(new File(rootDir, 'config/checkstyle')) } jacocoTestReport { executionData(test, integration) reports { - xml.required = true - csv.required = false - xml.destination = file("${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml") + xml.getRequired().set(true) + csv.getRequired().set(false) + xml.outputLocation = file("${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml") } } @@ -284,13 +284,14 @@ repositories { def versions = [ reformLogging : '5.1.7', springBoot : springBoot.class.package.implementationVersion, - log4j : '2.21.1', + log4j : '2.23.1', + jackson : '2.15.4', pdfbox : '2.0.29', - mockito : '4.5.1', - serenity : '2.6.0', + mockito : '5.2.0', + serenity : '4.1.6', pact_version : '4.1.7', - junit_jupiter : '5.7.1', - lombok : '1.18.30', + junit_jupiter : '5.10.2', + lombok : '1.18.32', pitest : '1.15.0', gradlePitest : '1.3.0', sonarPitest : '0.5' @@ -309,30 +310,29 @@ dependencies { implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail' - implementation group: 'org.springframework.security', name: 'spring-security-config', version: '5.8.8' - implementation group: 'org.springframework.security', name: 'spring-security-oauth2-resource-server', version: '5.8.8' - implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose', version: '5.8.8' - implementation group: 'org.springframework.security', name: 'spring-security-core', version: '5.8.8' - implementation group: 'org.springframework.security', name: 'spring-security-crypto', version: '5.8.8' - implementation group: 'org.springframework.security', name: 'spring-security-web', version: '5.8.8' - implementation group: 'org.springframework.security', name: 'spring-security-oauth2-core', version: '5.8.8' + implementation group: 'org.springframework.security', name: 'spring-security-config', version: '6.2.3' + implementation group: 'org.springframework.security', name: 'spring-security-oauth2-resource-server', version: '6.2.3' + implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose', version: '6.2.3' + implementation group: 'org.springframework.security', name: 'spring-security-core', version: '6.2.3' + implementation group: 'org.springframework.security', name: 'spring-security-crypto', version: '6.2.3' + implementation group: 'org.springframework.security', name: 'spring-security-web', version: '6.2.3' + implementation group: 'org.springframework.security', name: 'spring-security-oauth2-core', version: '6.2.3' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-logging', version: '2.7.18' - implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix', version: '2.2.10.RELEASE' implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: versions.log4j implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: versions.log4j implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: versions.pdfbox implementation group: 'org.bitbucket.b_c', name: 'jose4j', version: '0.9.6' - implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13' - implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.13' + implementation group: 'org.apache.httpcomponents.client5', name: 'httpclient5', version:'5.2.3' implementation group: 'org.apache.commons', name: 'commons-text', version: '1.11.0' implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.10.0' + implementation 'org.apache.commons:commons-lang3:3.12.0' implementation group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '3.1.8' implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '5.10.9' - implementation group: 'io.github.openfeign', name: 'feign-core', version: '11.2' + implementation group: 'io.github.openfeign', name: 'feign-core', version: '13.2' implementation group: 'org.yaml', name: 'snakeyaml', version: '2.2' implementation group: 'org.postgresql', name: 'postgresql', version: '42.6.1' implementation group: 'org.flywaydb', name: 'flyway-core', version: '8.5.13' @@ -342,18 +342,16 @@ dependencies { implementation group: 'uk.gov.hmcts.reform', name: 'logging-appinsights', version: versions.reformLogging implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5' implementation group: 'uk.gov.hmcts.reform', name: 'idam-client', version: '2.0.0' - implementation group: 'uk.gov.hmcts.reform', name: 'document-management-client', version: '7.0.0' + implementation group: 'com.github.hmcts', name: 'document-management-client', version: '7.0.1' implementation group: 'uk.gov.hmcts.reform', name: 'core-case-data-store-client', version: '4.7.6' implementation group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: '4.0.0' - implementation group: 'uk.gov.hmcts.reform.auth', name: 'auth-checker-lib', version: '2.1.4' - implementation group: 'com.github.hmcts', name: 'send-letter-client', version: '3.0.16' - implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: '3.17.3-RELEASE' - implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: '9.0.83' - implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '9.0.83' + implementation group: 'com.github.hmcts', name: 'auth-checker-lib', version: '3.0.0' + implementation group: 'com.github.hmcts', name: 'send-letter-client', version: '4.0.4' + implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: '5.0.1-RELEASE' implementation group: 'com.github.hmcts', name: 'ccd-case-document-am-client', version: '1.7.3' - implementation group: 'com.google.guava', name: 'guava', version: '32.1.3-jre' + implementation group: 'com.google.guava', name: 'guava', version: '33.1.0-jre' implementation group: 'commons-io', name: 'commons-io', version: '2.15.0' implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' @@ -364,6 +362,8 @@ dependencies { implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail' + implementation 'jakarta.servlet:jakarta.servlet-api:5.0.0' + testImplementation group: 'org.pitest', name: 'pitest', version: '1.15.3' testImplementation group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.15.0' testImplementation group: 'org.pitest', name: 'pitest-junit5-plugin', version: '1.2.1' @@ -394,6 +394,8 @@ dependencies { functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-junit', version: versions.serenity functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: versions.serenity functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-spring', version: versions.serenity + functionalTestImplementation group: 'io.rest-assured', name: 'rest-assured' + functionalTestImplementation group: 'net.javacrumbs.json-unit', name: 'json-unit-assertj', version: '3.2.7' functionalTestCompileOnly group: 'org.projectlombok', name: 'lombok', version: versions.lombok functionalTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok functionalTestImplementation sourceSets.main.runtimeClasspath @@ -414,11 +416,11 @@ dependencies { contractTestImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit_jupiter contractTestRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.junit_jupiter contractTestImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit_jupiter - contractTestRuntimeOnly group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.8.2' - contractTestImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.5' - contractTestImplementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.0.3' - contractTestImplementation group: 'org.springframework.cloud', name: 'spring-cloud-netflix-ribbon', version: '2.2.10.RELEASE' - contractTestImplementation group: 'com.netflix.ribbon', name: 'ribbon-core', version: '2.7.18' + contractTestRuntimeOnly group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.10.2' + contractTestImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: versions.jackson + contractTestImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: versions.jackson + contractTestImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: versions.jackson + contractTestImplementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.1.1' contractTestImplementation group: 'uk.gov.hmcts.reform', name: 'core-case-data-store-client', version: '4.7.6' contractTestImplementation group: 'com.google.guava', name: 'guava', version: '30.1.1-jre' } @@ -459,7 +461,7 @@ pitest { dependencyManagement { imports { - mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2021.0.8' + mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2023.0.1' } } @@ -512,3 +514,13 @@ bootWithCCD { environment 'MANAGE_CASE_S2S_AUTHORISED_SERVICES', 'ccd_gw,xui_webapp,ccd_data,fpl_case_service' } } + +configurations { + all { + exclude group: 'org.slf4j', module: 'slf4j-nop' + exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j' + exclude group: 'org.apache.logging.log4j', module: 'log4j-api' + exclude group: 'org.apache.logging.log4j', module: 'log4j-core' + + } +} From 0a254843d8297ec7a1deabb70d0f9ed52c74cc11 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:00:27 +0100 Subject: [PATCH 032/105] Update apache library and some more changes from javax to jakarta --- .../reform/fpl/controllers/NoticeOfProceedingsController.java | 2 +- .../src/main/java/uk/gov/hmcts/reform/fpl/model/Orders.java | 4 ++-- .../uk/gov/hmcts/reform/fpl/service/PbaNumberService.java | 2 +- .../uk/gov/hmcts/reform/fpl/service/RespondentService.java | 2 +- .../hmcts/reform/fpl/service/cmo/ReviewDecisionValidator.java | 2 +- .../service/email/content/JudicialMessageContentProvider.java | 2 +- .../email/content/JudicialMessageReplyContentProvider.java | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfProceedingsController.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfProceedingsController.java index 48b08ffb82f..63ba3e3b856 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfProceedingsController.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/controllers/NoticeOfProceedingsController.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.fpl.controllers; +import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -18,7 +19,6 @@ import uk.gov.hmcts.reform.fpl.validation.groups.NoticeOfProceedingsGroup; import java.util.List; -import javax.validation.constraints.NotNull; @RestController @RequestMapping("/callback/notice-of-proceedings") diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Orders.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Orders.java index 63ebd76143e..6fcfa21bba0 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Orders.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/Orders.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.reform.fpl.model; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.Builder; import lombok.Data; import lombok.extern.jackson.Jacksonized; @@ -16,8 +18,6 @@ import uk.gov.hmcts.reform.fpl.validation.interfaces.epo.HasEnteredEPOExcluded; import java.util.List; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import static org.apache.commons.lang3.ObjectUtils.isNotEmpty; import static uk.gov.hmcts.reform.fpl.enums.OrderType.CHILD_ASSESSMENT_ORDER; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/PbaNumberService.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/PbaNumberService.java index ce076e507bd..c5a1660544b 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/PbaNumberService.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/PbaNumberService.java @@ -15,7 +15,7 @@ import java.util.stream.Collectors; import static java.util.stream.Collectors.toList; -import static org.apache.logging.log4j.util.Strings.isEmpty; +import static org.apache.commons.lang3.StringUtils.isEmpty; import static uk.gov.hmcts.reform.fpl.utils.PbaNumberHelper.getNonEmptyPbaNumber; import static uk.gov.hmcts.reform.fpl.utils.PbaNumberHelper.getNonEmptyPbaNumbers; import static uk.gov.hmcts.reform.fpl.utils.PbaNumberHelper.getPBAPaymentWithNonEmptyPbaNumber; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/RespondentService.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/RespondentService.java index 84f8dc1fc8f..c5fad3a78e0 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/RespondentService.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/RespondentService.java @@ -1,7 +1,7 @@ package uk.gov.hmcts.reform.fpl.service; import lombok.RequiredArgsConstructor; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import uk.gov.hmcts.reform.ccd.model.ChangeOrganisationRequest; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/cmo/ReviewDecisionValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/cmo/ReviewDecisionValidator.java index 2efaa2b1b07..fbbddb7be4d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/cmo/ReviewDecisionValidator.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/cmo/ReviewDecisionValidator.java @@ -6,7 +6,7 @@ import java.util.List; import static java.util.Collections.emptyList; -import static org.apache.logging.log4j.util.Strings.isBlank; +import static org.apache.commons.lang3.StringUtils.isBlank; import static uk.gov.hmcts.reform.fpl.enums.CMOReviewOutcome.JUDGE_AMENDS_DRAFT; import static uk.gov.hmcts.reform.fpl.enums.CMOReviewOutcome.JUDGE_REQUESTED_CHANGES; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/content/JudicialMessageContentProvider.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/content/JudicialMessageContentProvider.java index 8dd23bf3404..64c7d33197b 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/content/JudicialMessageContentProvider.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/content/JudicialMessageContentProvider.java @@ -10,7 +10,7 @@ import uk.gov.hmcts.reform.fpl.service.time.Time; import uk.gov.hmcts.reform.fpl.utils.EmailNotificationHelper; -import static org.apache.logging.log4j.util.Strings.isNotEmpty; +import static org.apache.commons.lang3.StringUtils.isNotEmpty; import static uk.gov.hmcts.reform.fpl.enums.TabUrlAnchor.JUDICIAL_MESSAGES; import static uk.gov.hmcts.reform.fpl.enums.YesNo.NO; import static uk.gov.hmcts.reform.fpl.enums.YesNo.YES; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/content/JudicialMessageReplyContentProvider.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/content/JudicialMessageReplyContentProvider.java index bd287a31475..2108194a66d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/content/JudicialMessageReplyContentProvider.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/email/content/JudicialMessageReplyContentProvider.java @@ -10,7 +10,7 @@ import uk.gov.hmcts.reform.fpl.service.time.Time; import uk.gov.hmcts.reform.fpl.utils.EmailNotificationHelper; -import static org.apache.logging.log4j.util.Strings.isNotEmpty; +import static org.apache.commons.lang3.StringUtils.isNotEmpty; import static uk.gov.hmcts.reform.fpl.enums.TabUrlAnchor.JUDICIAL_MESSAGES; import static uk.gov.hmcts.reform.fpl.enums.YesNo.NO; import static uk.gov.hmcts.reform.fpl.enums.YesNo.YES; From 3515efa6a141827b979c9dc70e52025d43eaa3de Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:23:01 +0100 Subject: [PATCH 033/105] Upgrade spring security to use new filter chain --- .../fpl/config/CustomRetryListener.java | 27 ++++++ .../fpl/config/HttpClientConfiguration.java | 25 +++--- .../config/feign/codec/IdamErrorDecoder.java | 4 +- .../security/SecurityConfiguration.java | 90 ++++++++++--------- .../feign/codec/IdamErrorDecoderTest.java | 4 +- .../gov/hmcts/reform/fpl/utils/FixedTime.java | 2 + 6 files changed, 95 insertions(+), 57 deletions(-) create mode 100644 service/src/main/java/uk/gov/hmcts/reform/fpl/config/CustomRetryListener.java diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/CustomRetryListener.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/CustomRetryListener.java new file mode 100644 index 00000000000..d277d7251fb --- /dev/null +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/CustomRetryListener.java @@ -0,0 +1,27 @@ +package uk.gov.hmcts.reform.fpl.config; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.retry.RetryCallback; +import org.springframework.retry.RetryContext; +import org.springframework.retry.RetryListener; +import org.springframework.stereotype.Component; + +import static java.util.Optional.ofNullable; + +@Component +@Slf4j +public class CustomRetryListener implements RetryListener { + + @Override + public void onError(RetryContext context, RetryCallback callback, + Throwable throwable) { + log.warn("{} - attempt {} failed.", getOperationName(context), context.getRetryCount()); + } + + private String getOperationName(RetryContext context) { + return ofNullable(context.getAttribute("context.name")) + .map(Object::toString) + .orElse("Operation"); + } + +} diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java index 8ee933d3c2a..cc65ab02a9f 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java @@ -1,8 +1,10 @@ package uk.gov.hmcts.reform.fpl.config; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.core5.util.Timeout; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; @@ -14,23 +16,22 @@ public class HttpClientConfiguration { @Bean public RestTemplate restTemplate() { RestTemplate restTemplate = new RestTemplate(); - restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(getHttpClient())); + restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(userTokenParserHttpClient())); return restTemplate; } - private CloseableHttpClient getHttpClient() { - int timeout = 10000; + @Bean + @Qualifier("userTokenParserHttpClient") + public CloseableHttpClient userTokenParserHttpClient() { RequestConfig config = RequestConfig.custom() - .setConnectTimeout(timeout) - .setConnectionRequestTimeout(timeout) - .setSocketTimeout(timeout) + .setConnectTimeout(Timeout.ofMilliseconds(10000)) + .setConnectionRequestTimeout(Timeout.ofMilliseconds(10000)) + .setResponseTimeout(Timeout.ofMilliseconds(10000)) .build(); - return HttpClientBuilder - .create() + return HttpClients.custom() .useSystemProperties() .setDefaultRequestConfig(config) .build(); } - } diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java index 8da481e3837..56184b32bbc 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java @@ -5,6 +5,8 @@ import feign.codec.ErrorDecoder; import org.springframework.http.HttpStatus; +import java.util.Date; + public class IdamErrorDecoder implements ErrorDecoder { private final ErrorDecoder defaultDecoder; @@ -31,7 +33,7 @@ public Exception decode(String methodKey, Response response) { response.reason(), response.request().httpMethod(), exception, - null, + (Date) null, response.request() ); } diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java index cc535120949..3b16d419ccd 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java @@ -1,70 +1,76 @@ package uk.gov.hmcts.reform.fpl.config.security; +import jakarta.servlet.Filter; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; import org.springframework.http.HttpMethod; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; -import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer; +import org.springframework.security.oauth2.jwt.JwtDecoder; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import uk.gov.hmcts.reform.auth.checker.core.RequestAuthorizer; import uk.gov.hmcts.reform.auth.checker.core.user.User; import uk.gov.hmcts.reform.auth.checker.spring.useronly.AuthCheckerUserOnlyFilter; @Configuration +@EnableWebSecurity @SuppressWarnings("java:S1118") public class SecurityConfiguration { - @Configuration + private final RequestAuthorizer userRequestAuthorizer; + + private final AuthenticationManager authenticationManager; + + public SecurityConfiguration( + RequestAuthorizer userRequestAuthorizer, + AuthenticationManager authenticationManager + ) { + this.userRequestAuthorizer = userRequestAuthorizer; + this.authenticationManager = authenticationManager; + } + + @Bean @ConditionalOnProperty(value = "spring.security.enabled", havingValue = "true") - static class SecurityConfigurationWithUserTokenValidator extends WebSecurityConfigurerAdapter { - @Override - protected void configure(HttpSecurity http) throws Exception { - http - .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt) - .authorizeRequests() - .antMatchers("/callback/**") - .authenticated(); - } + public SecurityFilterChain securityFilterChainWithJwt(HttpSecurity http, JwtDecoder jwtDecoder) throws Exception { + http + .oauth2ResourceServer(oauth2 -> oauth2 + .jwt(jwt -> jwt.decoder(jwtDecoder))) + .authorizeRequests() + .requestMatchers("/callback/**") + .authenticated(); + return http.build(); } - @Configuration + @Bean @ConditionalOnProperty(value = "spring.security.enabled", havingValue = "false", matchIfMissing = true) - static class DefaultSecurityConfiguration extends WebSecurityConfigurerAdapter { - @Override - protected void configure(HttpSecurity http) throws Exception { - http - .csrf(AbstractHttpConfigurer::disable) - .authorizeRequests() - .anyRequest() - .permitAll(); - } + public SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception { + http + .csrf(AbstractHttpConfigurer::disable) + .authorizeRequests(auth -> auth + .anyRequest().permitAll()); + return http.build(); } @Order(2) - @Configuration - static class RoboticsSecurityConfiguration extends WebSecurityConfigurerAdapter { - private AuthCheckerUserOnlyFilter authCheckerUserOnlyFilter; - - public RoboticsSecurityConfiguration(RequestAuthorizer userRequestAuthorizer, - AuthenticationManager authenticationManager) { - authCheckerUserOnlyFilter = new AuthCheckerUserOnlyFilter<>(userRequestAuthorizer); - authCheckerUserOnlyFilter.setAuthenticationManager(authenticationManager); - } + @Bean + public SecurityFilterChain roboticsSecurityFilterChain(HttpSecurity http) throws Exception { + AuthCheckerUserOnlyFilter authCheckerUserOnlyFilter = + new AuthCheckerUserOnlyFilter<>(userRequestAuthorizer); + authCheckerUserOnlyFilter.setAuthenticationManager(authenticationManager); - @Override - protected void configure(HttpSecurity http) throws Exception { - http.requestMatchers() - .antMatchers(HttpMethod.POST, "/sendRPAEmailByID/*", "/support/**/*") - .and() - .addFilter(authCheckerUserOnlyFilter) - .csrf(AbstractHttpConfigurer::disable) - .authorizeRequests() - .anyRequest() - .authenticated(); - } + http + .authorizeRequests(authorize -> authorize + .requestMatchers(HttpMethod.POST, "/sendRPAEmailByID/*", "/support/**/*") + .authenticated()) + .csrf(csrf -> csrf.disable()) + .addFilter(authCheckerUserOnlyFilter); + return http.build(); } } diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java index e14674f0031..3735198a120 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java @@ -28,7 +28,7 @@ class IdamErrorDecoderTest { private static final int STATUS_NOT_5XX = 404; private static final Exception NON_RETRYABLE_EXCEPTION = new Exception(); - private static final Exception RETRYABLE_EXCEPTION = new RetryableException(500, "", null, null, REQUEST); + private static final Exception RETRYABLE_EXCEPTION = new RetryableException(500, "", null, (Long) null, REQUEST); private static final String EMPTY_METHOD_KEY = ""; @@ -58,7 +58,7 @@ void shouldReturnNewRetryableErrorWhen500ResponseStatus() { Exception decodedException = idamErrorDecoder.decode(EMPTY_METHOD_KEY, response); RetryableException expectedException = new RetryableException( - STATUS_5XX, EMPTY_REASON, GET, NON_RETRYABLE_EXCEPTION, null, REQUEST + STATUS_5XX, EMPTY_REASON, GET, NON_RETRYABLE_EXCEPTION, (Long) null, REQUEST ); assertThat(decodedException).usingRecursiveComparison().isEqualTo(expectedException); diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/FixedTime.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/FixedTime.java index b3e01cf6634..700b70cd709 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/FixedTime.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/utils/FixedTime.java @@ -1,9 +1,11 @@ package uk.gov.hmcts.reform.fpl.utils; +import org.springframework.stereotype.Component; import uk.gov.hmcts.reform.fpl.service.time.Time; import java.time.LocalDateTime; +@Component public class FixedTime implements Time { private final LocalDateTime fixed; From 364d67eb8bfa7d07f35f51dc5fba5203d438db44 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:25:12 +0100 Subject: [PATCH 034/105] Spring security upgrade further changes --- .../reform/fpl/config/RetryListener.java | 28 ---------------- .../security/AuthCheckerConfiguration.java | 33 ++++++++++--------- 2 files changed, 17 insertions(+), 44 deletions(-) delete mode 100644 service/src/main/java/uk/gov/hmcts/reform/fpl/config/RetryListener.java diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/RetryListener.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/RetryListener.java deleted file mode 100644 index 2c19602a467..00000000000 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/RetryListener.java +++ /dev/null @@ -1,28 +0,0 @@ -package uk.gov.hmcts.reform.fpl.config; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.retry.RetryCallback; -import org.springframework.retry.RetryContext; -import org.springframework.retry.listener.RetryListenerSupport; -import org.springframework.stereotype.Component; - -import static java.util.Optional.ofNullable; - -@Component -@Slf4j -public class RetryListener extends RetryListenerSupport { - - @Override - public void onError(RetryContext context, RetryCallback callback, - Throwable throwable) { - log.warn("{} - attempt {} failed.", getOperationName(context), context.getRetryCount()); - super.onError(context, callback, throwable); - } - - private String getOperationName(RetryContext context) { - return ofNullable(context.getAttribute("context.name")) - .map(Object::toString) - .orElse("Operation"); - } - -} diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/AuthCheckerConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/AuthCheckerConfiguration.java index dbb7700fc83..dd5463d97c9 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/AuthCheckerConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/AuthCheckerConfiguration.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.fpl.config.security; import com.google.common.collect.ImmutableSet; +import jakarta.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; import org.apache.http.client.HttpClient; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; @@ -8,6 +9,7 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -25,7 +27,6 @@ import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; -import javax.servlet.http.HttpServletRequest; @Slf4j @Configuration @@ -49,35 +50,35 @@ public Function> userIdExtractor() { return any -> Optional.empty(); } - @Bean(name = {"userTokenParserHttpClient"}) + @Bean @ConditionalOnProperty( - value = "ssl.verification.enable", - havingValue = "false", - matchIfMissing = true) - public HttpClient userTokenParserHttpClient() - throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException { + value = "ssl.verification.enable", + havingValue = "false", + matchIfMissing = true) + public HttpClient customUserTokenParserHttpClient() + throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException { HttpClientBuilder httpClientBuilder = HttpClients.custom() - .disableCookieManagement() - .disableAuthCaching() - .useSystemProperties(); + .disableCookieManagement() + .disableAuthCaching() + .useSystemProperties(); TrustStrategy acceptingTrustStrategy = (chain, authType) -> true; - // ignore Sonar's weak hostname verifier as we are deliberately disabling SSL verification HostnameVerifier allowAllHostnameVerifier = (hostName, session) -> true; // NOSONAR SSLContext sslContextWithoutValidation = SSLContexts.custom() - .loadTrustMaterial(null, acceptingTrustStrategy) - .build(); + .loadTrustMaterial(null, acceptingTrustStrategy) + .build(); SSLConnectionSocketFactory allowAllSslSocketFactory = new SSLConnectionSocketFactory( - sslContextWithoutValidation, - allowAllHostnameVerifier); + sslContextWithoutValidation, + allowAllHostnameVerifier); httpClientBuilder.setSSLSocketFactory(allowAllSslSocketFactory); - // also disable SSL valiation for plain java httpurlconnection + // also disable SSL validation for plain java HttpsURLConnection HttpsURLConnection.setDefaultHostnameVerifier(allowAllHostnameVerifier); HttpsURLConnection.setDefaultSSLSocketFactory(sslContextWithoutValidation.getSocketFactory()); return httpClientBuilder.build(); } + } From 5566cb82954ca9ce5b19642b055327ce75c1890b Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:26:11 +0100 Subject: [PATCH 035/105] Update application yaml formatting. --- .../resources/application-docmosis-template-test.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service/src/integrationTest/resources/application-docmosis-template-test.yaml b/service/src/integrationTest/resources/application-docmosis-template-test.yaml index 88ce558fa5b..18894c1c18f 100644 --- a/service/src/integrationTest/resources/application-docmosis-template-test.yaml +++ b/service/src/integrationTest/resources/application-docmosis-template-test.yaml @@ -1,5 +1,7 @@ spring: - profiles: docmosis-template-test + config: + activate: + on-profile: docmosis-template-test integration-test: docmosis: From 8891678c5ec4d4b12af34ea18674ee73e6abdab2 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:27:32 +0100 Subject: [PATCH 036/105] Update to use io.restassured.http.ContentType --- .../gov/hmcts/reform/fpl/service/CaseService.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/service/CaseService.java b/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/service/CaseService.java index 0b8057ba8cc..e3b0da08e82 100644 --- a/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/service/CaseService.java +++ b/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/service/CaseService.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.fpl.service; import com.fasterxml.jackson.databind.ObjectMapper; +import io.restassured.http.ContentType; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.serenitybdd.rest.SerenityRest; @@ -19,7 +20,6 @@ import java.util.Optional; import java.util.function.Predicate; -import static com.gargoylesoftware.htmlunit.util.MimeType.APPLICATION_JSON; import static java.lang.String.format; import static java.net.HttpURLConnection.HTTP_OK; import static org.apache.commons.lang3.ObjectUtils.isNotEmpty; @@ -45,7 +45,7 @@ public boolean hasCaseAccess(User user, CaseData caseData) { int status = SerenityRest .given() .headers(authenticationService.getAuthorizationHeaders(user)) - .contentType(APPLICATION_JSON) + .contentType(ContentType.JSON) .get("/testing-support/case/" + caseData.getId()) .thenReturn() .statusCode(); @@ -64,7 +64,7 @@ public CaseData createCase(CaseData caseData, User user) { CaseDetails caseDetails = SerenityRest .given() .headers(authenticationService.getAuthorizationHeaders(user)) - .contentType(APPLICATION_JSON) + .contentType(ContentType.JSON) .body(Map.of()) .post("/testing-support/case/create") .then() @@ -81,7 +81,7 @@ public CaseData createCase(CaseData caseData, User user) { if (populateData) { SerenityRest .given() - .contentType(APPLICATION_JSON) + .contentType(ContentType.JSON) .headers(authenticationService.getAuthorizationHeaders(user)) .body(Map.of("state", Optional.ofNullable(caseData.getState()) .map(State::getValue) @@ -100,7 +100,7 @@ public CallbackResponse callback(CaseData caseData, User user, String callback) AboutToStartOrSubmitCallbackResponse response = SerenityRest .given() .headers(authenticationService.getAuthorizationHeaders(user)) - .contentType(APPLICATION_JSON) + .contentType(ContentType.JSON) .body(toCallbackRequest(caseData)) .post(callback) .then() @@ -122,7 +122,7 @@ public void submittedCallback(CaseData caseData, CaseData caseDataBefore, User u SerenityRest .given() .headers(authenticationService.getAuthorizationHeaders(user)) - .contentType(APPLICATION_JSON) + .contentType(ContentType.JSON) .body(toCallbackRequest(caseData, caseDataBefore)) .post(callback) .then() @@ -133,7 +133,7 @@ private CaseData getCase(Long id, User user) { CaseDetails caseDetails = SerenityRest .given() .headers(authenticationService.getAuthorizationHeaders(user)) - .contentType(APPLICATION_JSON) + .contentType(ContentType.JSON) .body(Map.of()) .get("/testing-support/case/" + id) .then() From 48316a627007bb6b0f9effec229f808364bdc6ac Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:27:56 +0100 Subject: [PATCH 037/105] Use of EnableCircuitBreaker no longer required --- .../hmcts/reform/fpl/config/CircuitBreakerConfiguration.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/CircuitBreakerConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/CircuitBreakerConfiguration.java index 083a3605966..6ee74066ad4 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/CircuitBreakerConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/CircuitBreakerConfiguration.java @@ -1,11 +1,9 @@ package uk.gov.hmcts.reform.fpl.config; -import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @Profile("default") @Configuration -@EnableCircuitBreaker public class CircuitBreakerConfiguration { } From 9f1814fd3dbbf735fb3c84e324754b5dfb9a5beb Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:29:47 +0100 Subject: [PATCH 038/105] Update to use ChronoZonedDateTime --- .../hmcts/reform/fpl/jobs/UndeliveredEmailsFinder.java | 6 +++++- .../reform/fpl/jobs/UndeliveredEmailsFinderTest.java | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinder.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinder.java index a8de0bc57aa..38d8123f0bd 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinder.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinder.java @@ -14,6 +14,9 @@ import uk.gov.service.notify.NotificationClient; import uk.gov.service.notify.NotificationList; +import java.time.Instant; +import java.time.ZoneId; +import java.time.chrono.ChronoZonedDateTime; import java.util.List; import static java.util.stream.Collectors.toList; @@ -35,7 +38,8 @@ public void execute(JobExecutionContext jobExecutionContext) { log.info("Job '{}' started", jobName); try { - DateTime reportFrom = DateTime.now().minusDays(REPORT_PERIOD_IN_DAYS); + ChronoZonedDateTime reportFrom = Instant.ofEpochMilli(DateTime.now().minusDays(REPORT_PERIOD_IN_DAYS) + .getMillis()).atZone(ZoneId.systemDefault()); NotificationList undeliveredEmailsReport = notifications.getNotifications("failed", "email", null, null); diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinderTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinderTest.java index b60153ee0e2..6abda538f24 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinderTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinderTest.java @@ -21,6 +21,7 @@ import uk.gov.service.notify.NotificationClient; import uk.gov.service.notify.NotificationList; +import java.time.ZonedDateTime; import java.util.List; import java.util.Optional; @@ -77,12 +78,12 @@ void init() throws Exception { void shouldEmitUndeliveredEmailsFoundEvent() { when(notificationList.getNotifications()).thenReturn(List.of(notification1, notification2)); - when(notification1.getCompletedAt()).thenReturn(Optional.of(DateTime.now().minusHours(23))); + when(notification1.getCompletedAt()).thenReturn(Optional.of(ZonedDateTime.now().minusHours(23))); when(notification1.getEmailAddress()).thenReturn(Optional.of("test@test.com")); when(notification1.getSubject()).thenReturn(Optional.of("Subject")); when(notification1.getReference()).thenReturn(Optional.of("Reference")); - when(notification2.getCompletedAt()).thenReturn(Optional.of(DateTime.now().minusHours(10))); + when(notification2.getCompletedAt()).thenReturn(Optional.of(ZonedDateTime.now().minusHours(10))); when(notification2.getEmailAddress()).thenReturn(Optional.of("test2@test.com")); when(notification2.getSubject()).thenReturn(Optional.of("Subject 2")); when(notification2.getReference()).thenReturn(Optional.of("Reference 2")); @@ -109,7 +110,7 @@ void shouldEmitUndeliveredEmailsFoundEvent() { void shouldEmitUndeliveredEmailsFoundEventWhenEmailFailedWithinLastDay() { when(notificationList.getNotifications()).thenReturn(List.of(notification1)); - when(notification1.getCompletedAt()).thenReturn(Optional.of(DateTime.now().minusDays(1).plusHours(1))); + when(notification1.getCompletedAt()).thenReturn(Optional.of(ZonedDateTime.now().minusDays(1).plusHours(1))); when(notification1.getEmailAddress()).thenReturn(Optional.of("test@test.com")); when(notification1.getSubject()).thenReturn(Optional.of("Subject")); when(notification1.getReference()).thenReturn(Optional.of("Reference")); @@ -129,7 +130,7 @@ void shouldEmitUndeliveredEmailsFoundEventWhenEmailFailedWithinLastDay() { void shouldIgnoreEmailsThatFailedEarlierThanDayAgo() { when(notificationList.getNotifications()).thenReturn(List.of(notification1)); - when(notification1.getCompletedAt()).thenReturn(Optional.of(DateTime.now().minusDays(1).minusHours(1))); + when(notification1.getCompletedAt()).thenReturn(Optional.of(ZonedDateTime.now().minusDays(1).minusHours(1))); underTest.execute(jobExecutionContext); From e983cdbd251ad090ca6b16185924d3ff76c83454 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:30:35 +0100 Subject: [PATCH 039/105] Update Application.java as @ComponentScan no longer required. --- .../main/java/uk/gov/hmcts/reform/fpl/Application.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java index fb5c5ff1975..24fd91f1fe3 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java @@ -4,24 +4,23 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.context.annotation.ComponentScan; import org.springframework.retry.annotation.EnableRetry; import org.springframework.scheduling.annotation.EnableAsync; -@SpringBootApplication +@SpringBootApplication(scanBasePackages = "uk.gov.hmcts.reform.fpl") @EnableFeignClients(basePackages = { "uk.gov.hmcts.reform.idam.client", "uk.gov.hmcts.reform.rd.client", "uk.gov.hmcts.reform.fnp.client", "uk.gov.hmcts.reform.calendar.client", "uk.gov.hmcts.reform.aac.client", - "uk.gov.hmcts.reform.am.client" + "uk.gov.hmcts.reform.am.client", + "uk.gov.hmcts.reform.ccd.client" }) -@ComponentScan @EnableRetry @EnableAsync @EnableCaching -@SuppressWarnings("HideUtilityClassConstructor") // Spring needs a constructor, its not a utility class +@SuppressWarnings("HideUtilityClassConstructor") // Spring needs a constructor, it's not a utility class public class Application { public static void main(final String[] args) { From f631ddeecd3082549f0b14dad6a8910d6951fa82 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:31:00 +0100 Subject: [PATCH 040/105] @ConstructorBinding no longer required. --- .../functionalTest/java/uk/gov/hmcts/reform/fpl/model/User.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/model/User.java b/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/model/User.java index 941e9edeeb8..20561b1228c 100644 --- a/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/model/User.java +++ b/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/model/User.java @@ -1,10 +1,8 @@ package uk.gov.hmcts.reform.fpl.model; import lombok.Data; -import org.springframework.boot.context.properties.ConstructorBinding; @Data -@ConstructorBinding public class User { private final String name; From e217174e9c2aa9dd7c55ab36494abe278d2afcf5 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:33:13 +0100 Subject: [PATCH 041/105] Update test to use @SpringBootTest instead of @WebMVCTest --- .../ApplicantSubmittedControllerTest.java | 47 ++++++++++++++++--- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantSubmittedControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantSubmittedControllerTest.java index 808273d4c9e..649ed2c2337 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantSubmittedControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantSubmittedControllerTest.java @@ -1,13 +1,22 @@ package uk.gov.hmcts.reform.fpl.controllers; import org.junit.jupiter.api.Test; -import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.security.test.context.support.WithMockUser; +import uk.gov.hmcts.reform.ccd.client.CoreCaseDataApi; import uk.gov.hmcts.reform.fpl.enums.State; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.Solicitor; +import uk.gov.hmcts.reform.fpl.request.RequestData; +import uk.gov.hmcts.reform.fpl.service.OrganisationService; +import uk.gov.hmcts.reform.fpl.service.SystemUserService; +import uk.gov.hmcts.reform.fpl.service.ValidateEmailService; +import uk.gov.hmcts.reform.fpl.service.ccd.CCDConcurrencyHelper; import uk.gov.hmcts.reform.fpl.service.ccd.CoreCaseDataService; +import uk.gov.hmcts.reform.fpl.service.PbaNumberService; +import uk.gov.hmcts.reform.rd.client.OrganisationApi; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -15,12 +24,36 @@ import static org.mockito.Mockito.verify; import static uk.gov.hmcts.reform.fpl.Constants.LOCAL_AUTHORITY_1_CODE; -@WebMvcTest(ApplicantController.class) -@OverrideAutoConfiguration(enabled = true) +@SpringBootTest +@AutoConfigureMockMvc class ApplicantSubmittedControllerTest extends AbstractCallbackTest { private static final long CASE_ID = 12323L; + @MockBean + private PbaNumberService pbaNumberService; + + @MockBean + private OrganisationService organisationService; + + @MockBean + private ValidateEmailService validateEmailService; + + @MockBean + private OrganisationApi organisationApi; + + @MockBean + private CoreCaseDataApi coreCaseDataApi; + + @MockBean + private RequestData requestData; + + @MockBean + private SystemUserService systemUserService; + + @MockBean + private CCDConcurrencyHelper concurrencyHelper; + @MockBean private CoreCaseDataService coreCaseDataService; @@ -28,9 +61,9 @@ class ApplicantSubmittedControllerTest extends AbstractCallbackTest { super("enter-applicant"); } + @WithMockUser @Test - void shouldUpdateTaskListAndSummary() { - + void shouldUpdateTaskListAndSummary() throws Exception { final CaseData caseData = CaseData.builder() .id(CASE_ID) .state(State.OPEN) @@ -47,6 +80,6 @@ void shouldUpdateTaskListAndSummary() { verify(coreCaseDataService, timeout(ASYNC_METHOD_CALL_TIMEOUT)).performPostSubmitCallback(eq(CASE_ID), eq("internal-update-case-summary"), any()); - } + } From 1bdaab10b0d668ce3a89939720b7f41b3dcb09ad Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:36:06 +0100 Subject: [PATCH 042/105] Update RetryableException arguments for tests --- .../uk/gov/hmcts/reform/fpl/service/ScenarioService.java | 4 ++-- .../controllers/RepresentativeMidEventControllerTest.java | 3 ++- .../uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java | 3 ++- .../gov/hmcts/reform/fpl/service/payment/FeeServiceTest.java | 5 +++-- .../hmcts/reform/fpl/service/payment/PaymentClientTest.java | 3 ++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/service/ScenarioService.java b/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/service/ScenarioService.java index f6dd4ea3c81..bacfb913107 100644 --- a/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/service/ScenarioService.java +++ b/service/src/functionalTest/java/uk/gov/hmcts/reform/fpl/service/ScenarioService.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.fpl.service; import com.fasterxml.jackson.databind.ObjectMapper; +import io.restassured.http.ContentType; import lombok.RequiredArgsConstructor; import net.serenitybdd.rest.SerenityRest; import org.springframework.beans.factory.annotation.Autowired; @@ -11,7 +12,6 @@ import java.io.IOException; import java.io.UncheckedIOException; -import static com.gargoylesoftware.htmlunit.util.MimeType.APPLICATION_JSON; import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.apache.commons.lang3.StringUtils.isNotEmpty; import static org.skyscreamer.jsonassert.JSONAssert.assertEquals; @@ -40,7 +40,7 @@ public String executeScenario(Scenario scenario) { .given() .headers(authenticationService.getAuthorizationHeaders(testConfiguration.getUsers() .get(scenario.getRequest().getUser()))) - .contentType(APPLICATION_JSON) + .contentType(ContentType.JSON) .body(scenario.getRequest().getDataAsString()) .post(scenario.getRequest().getUri()) .then() diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RepresentativeMidEventControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RepresentativeMidEventControllerTest.java index 64f192375a0..74c63551796 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RepresentativeMidEventControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RepresentativeMidEventControllerTest.java @@ -16,6 +16,7 @@ import uk.gov.hmcts.reform.rd.client.OrganisationApi; import uk.gov.hmcts.reform.rd.model.OrganisationUser; +import java.util.Collections; import java.util.Map; import static feign.Request.HttpMethod.GET; @@ -63,7 +64,7 @@ void shouldValidateRepresentativeAccountExistenceAndReturnValidationErrors() { given(organisationApi.findUserByEmail(USER_AUTH_TOKEN, SERVICE_AUTH_TOKEN, representativeEmail)) .willThrow(new FeignException.NotFound("User not found", Request.create(GET, "", Map.of(), new byte[]{}, UTF_8), - new byte[]{})); + new byte[]{}, Collections.emptyMap())); AboutToStartOrSubmitCallbackResponse callbackResponse = postMidEvent(caseDetails); diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java index 53ae78d53b5..ef01791fb0b 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java @@ -5,6 +5,7 @@ import feign.RetryableException; import org.junit.jupiter.api.Test; +import java.util.Collections; import java.util.Map; import static feign.Request.HttpMethod.GET; @@ -18,7 +19,7 @@ class FPLRetryerTest { private static final byte[] EMPTY_BODY = {}; private static final Request REQUEST = Request.create(GET, EMPTY, Map.of(), EMPTY_BODY, UTF_8, null); private static final RetryableException EXCEPTION = new RetryableException( - 500, "", GET, new FeignException.InternalServerError("test", REQUEST, EMPTY_BODY), null, REQUEST + 500, "", GET, new FeignException.InternalServerError("test", REQUEST, EMPTY_BODY, Collections.emptyMap()), (Long) null, REQUEST ); @Test diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/FeeServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/FeeServiceTest.java index e1192efd8be..7572df9424e 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/FeeServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/FeeServiceTest.java @@ -26,6 +26,7 @@ import uk.gov.hmcts.reform.fpl.testbeans.TestFeeConfig; import java.math.BigDecimal; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; @@ -101,7 +102,7 @@ void shouldGetAFeeResponseWhenGivenAPopulated() { void shouldPropagateExceptionWhenThereIsAnErrorInTheResponse() { when(feesRegisterApi.findFee(anyString(), anyString(), anyString(), anyString(), anyString(), anyString())) .thenThrow(new FeignException.BadRequest( - "", Request.create(GET, EMPTY, Map.of(), new byte[]{}, UTF_8, null), new byte[]{}) + "", Request.create(GET, EMPTY, Map.of(), new byte[]{}, UTF_8, null), new byte[]{}, Collections.emptyMap()) ); List feeTypes = List.of(CARE_ORDER); @@ -198,7 +199,7 @@ void setup() { void shouldPropagateExceptionWhenThereIsAnErrorInTheResponse() { when(feesRegisterApi.findFee(anyString(), anyString(), anyString(), anyString(), anyString(), anyString())) .thenThrow(new FeignException.BadRequest( - "", Request.create(GET, EMPTY, Map.of(), new byte[]{}, UTF_8, null), new byte[]{}) + "", Request.create(GET, EMPTY, Map.of(), new byte[]{}, UTF_8, null), new byte[]{}, Collections.emptyMap()) ); Orders orders = Orders.builder() diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/PaymentClientTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/PaymentClientTest.java index 3e4f3f47aa2..4e49ea44a41 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/PaymentClientTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/PaymentClientTest.java @@ -18,6 +18,7 @@ import uk.gov.hmcts.reform.fpl.request.RequestData; import java.math.BigDecimal; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -123,7 +124,7 @@ void shouldReturnPaymentsApiExceptionOnFeignException() { when(paymentApi.createCreditAccountPayment(any(), any(), any())).thenThrow( new FeignException.UnprocessableEntity("", Request.create(GET, "", Map.of(), new byte[]{}, UTF_8, null), - responseBodyContent.getBytes())); + responseBodyContent.getBytes(), Collections.emptyMap())); assertThatThrownBy(() -> paymentClient.callPaymentsApi(paymentRequest)) .isInstanceOf(PaymentsApiException.class) From 89dabf1063b86fe3735c8b9affe33de64da75988 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 15 May 2024 10:37:53 +0100 Subject: [PATCH 043/105] Fix @WebMVCTest tests by adding mock beans and @WithMockUser annotations. --- .../fpl/controllers/AbstractCallbackTest.java | 56 ++++++++++++++++++ ...CaseNumberControllerAboutToSubmitTest.java | 3 + .../AddCaseNumberControllerSubmittedTest.java | 32 +++++++++- .../AddNoteAboutToSubmitControllerTest.java | 15 +++++ ...ocatedJudgeControllerAboutToStartTest.java | 21 +++++++ ...catedJudgeControllerAboutToSubmitTest.java | 25 ++++++++ .../AllocatedJudgeControllerMidEventTest.java | 22 +++++++ .../ApplicantAboutToStartControllerTest.java | 30 ++++++++-- .../ApplicantMidEventControllerTest.java | 20 +++++++ ...yGatekeeperControllerAboutToStartTest.java | 10 ++++ ...alDecisionsControllerAboutToStartTest.java | 38 ++++++++++++ ...ollerChangeFromOtherAboutToSubmitTest.java | 58 +++++++++++++++++++ 12 files changed, 322 insertions(+), 8 deletions(-) diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java index 712cf419773..368eb94baf7 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java @@ -1,7 +1,13 @@ package uk.gov.hmcts.reform.fpl.controllers; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.BeforeEach; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; @@ -9,18 +15,29 @@ import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest; import uk.gov.hmcts.reform.ccd.client.model.CaseDetails; import uk.gov.hmcts.reform.ccd.client.model.SubmittedCallbackResponse; +import uk.gov.hmcts.reform.fpl.config.SystemUpdateUserConfiguration; import uk.gov.hmcts.reform.fpl.enums.State; +import uk.gov.hmcts.reform.fpl.logging.HeaderInformationExtractor; import uk.gov.hmcts.reform.fpl.model.CaseData; +import uk.gov.hmcts.reform.fpl.service.CaseConverter; +import uk.gov.hmcts.reform.fpl.service.EventService; +import uk.gov.hmcts.reform.fpl.service.time.Time; +import uk.gov.hmcts.reform.fpl.testingsupport.DynamicListHelper; +import java.time.LocalDateTime; import java.util.Map; import java.util.Optional; import static org.apache.http.HttpStatus.SC_OK; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; +import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static uk.gov.hmcts.reform.fpl.service.CaseConverter.MAP_TYPE; import static uk.gov.hmcts.reform.fpl.utils.ResourceReader.readBytes; +@Import({EventService.class}) public abstract class AbstractCallbackTest extends AbstractTest { @Autowired @@ -29,8 +46,46 @@ public abstract class AbstractCallbackTest extends AbstractTest { private final String eventName; private final String eventId; + @MockBean + protected Time time; + + @MockBean + protected CaseConverter caseConverter; + + @MockBean + protected SystemUpdateUserConfiguration systemUpdateUserConfiguration; + + @MockBean + protected DynamicListHelper dynamicListHelper; + + @MockBean + protected HeaderInformationExtractor headerInformationExtractor; + + @Autowired + protected ObjectMapper objectMapper; + protected static final long ASYNC_METHOD_CALL_TIMEOUT = 10000; + @BeforeEach + void setUp() { + when(caseConverter.convert(any(CaseDetails.class))).thenAnswer(new Answer() { + @Override + public CaseData answer(InvocationOnMock invocation) throws Throwable { + CaseDetails details = invocation.getArgument(0); + if (details == null) { + return null; + } + CaseData caseData = objectMapper.convertValue(details.getData(), CaseData.class); + return caseData.toBuilder() + .state(State.tryFromValue(details.getState()).orElse(null)) + .id(details.getId()) + .build(); + } + }); + + when(time.now()).thenReturn(LocalDateTime.now()); + } + protected AbstractCallbackTest(String eventName) { this.eventName = eventName; this.eventId = eventName; @@ -288,6 +343,7 @@ private T postEvent(String path, byte[] data, int expectedStatus, Class r try { MvcResult response = mockMvc .perform(post(path) + .with(csrf()) .header("authorization", USER_AUTH_TOKEN) .header("user-id", USER_ID) .header("user-roles", String.join(",", userRoles)) diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerAboutToSubmitTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerAboutToSubmitTest.java index 5968886016c..cc9aefe0079 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerAboutToSubmitTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerAboutToSubmitTest.java @@ -3,6 +3,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse; import uk.gov.hmcts.reform.fpl.model.CaseData; @@ -16,6 +17,7 @@ class AddCaseNumberControllerAboutToSubmitTest extends AbstractCallbackTest { super("add-case-number"); } + @WithMockUser @Test void aboutToSubmitShouldReturnErrorWhenFamilyManCaseNumberNotAlphanumeric() { CaseData caseData = CaseData.builder() @@ -27,6 +29,7 @@ void aboutToSubmitShouldReturnErrorWhenFamilyManCaseNumberNotAlphanumeric() { assertThat(callbackResponse.getErrors()).containsExactly("Enter a valid FamilyMan case number"); } + @WithMockUser @Test void aboutToSubmitShouldNotReturnErrorWhenFamilyManCaseNumberAlphanumeric() { final String expectedFamilyManCaseNumber = "ALPHANUM3RIC"; diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerSubmittedTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerSubmittedTest.java index 33f30ce0c55..d02efee20ff 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerSubmittedTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerSubmittedTest.java @@ -1,27 +1,38 @@ package uk.gov.hmcts.reform.fpl.controllers; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Spy; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.annotation.Import; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest; import uk.gov.hmcts.reform.ccd.client.model.CaseDetails; +import uk.gov.hmcts.reform.fpl.CallbackRequestLogger; +import uk.gov.hmcts.reform.fpl.config.robotics.RoboticsEmailConfiguration; +import uk.gov.hmcts.reform.fpl.logging.HeaderInformationExtractor; import uk.gov.hmcts.reform.fpl.model.email.EmailData; +import uk.gov.hmcts.reform.fpl.service.CourtService; import uk.gov.hmcts.reform.fpl.service.email.EmailService; +import uk.gov.hmcts.reform.fpl.service.robotics.RoboticsDataService; +import uk.gov.hmcts.reform.fpl.service.robotics.RoboticsNotificationService; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import static uk.gov.hmcts.reform.fpl.utils.CoreCaseDataStoreLoader.populatedCaseDetails; @WebMvcTest(AddCaseNumberController.class) @OverrideAutoConfiguration(enabled = true) +@Import({HeaderInformationExtractor.class, CallbackRequestLogger.class, RoboticsNotificationService.class, + RoboticsDataService.class, RoboticsNotificationService.class}) class AddCaseNumberControllerSubmittedTest extends AbstractCallbackTest { AddCaseNumberControllerSubmittedTest() { @@ -34,9 +45,25 @@ class AddCaseNumberControllerSubmittedTest extends AbstractCallbackTest { @MockBean private EmailService emailService; - @Spy + @MockBean private ApplicationEventPublisher applicationEventPublisher; + @MockBean + private CourtService courtService; + + @MockBean + private RoboticsEmailConfiguration roboticsEmailConfiguration; + + @BeforeEach + void setUp() { + super.setUp(); + + when(roboticsEmailConfiguration.getSender()).thenReturn("sender@example.com"); + when(roboticsEmailConfiguration.getRecipient()).thenReturn("FamilyPublicLaw+robotics-test@gmail.com"); + } + + + @WithMockUser @Test void shouldSendNotificationToRoboticsWhenCaseNumberAdded() { CaseDetails caseDetailsBefore = buildCaseWithNumber(""); @@ -49,6 +76,7 @@ void shouldSendNotificationToRoboticsWhenCaseNumberAdded() { assertThat(email.getValue().getRecipient()).isEqualTo("FamilyPublicLaw+robotics-test@gmail.com"); } + @WithMockUser @Test void shouldNotSendNotificationToRoboticsWhenCaseNumberUpdated() { CaseDetails caseDetailsBefore = buildCaseWithNumber("CASE1"); diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteAboutToSubmitControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteAboutToSubmitControllerTest.java index d32e9a33faa..a7717404bd6 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteAboutToSubmitControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteAboutToSubmitControllerTest.java @@ -4,28 +4,43 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.CaseNote; import uk.gov.hmcts.reform.fpl.model.common.Element; +import uk.gov.hmcts.reform.fpl.request.RequestData; +import uk.gov.hmcts.reform.fpl.service.CaseNoteService; +import uk.gov.hmcts.reform.idam.client.models.UserInfo; import java.time.LocalDate; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.wrapElements; @WebMvcTest(AddNoteController.class) @OverrideAutoConfiguration(enabled = true) +@Import({CaseNoteService.class}) class AddNoteAboutToSubmitControllerTest extends AbstractCallbackTest { + @MockBean + private RequestData requestData; + AddNoteAboutToSubmitControllerTest() { super("add-note"); } @BeforeEach void setup() { + super.setUp(); givenCurrentUserWithName("John Smith"); + given(idamClient.getUserInfo(any())).willReturn(UserInfo.builder().name("John Smith").build()); } + @WithMockUser @Test void shouldAddCaseNoteToList() { CaseNote caseNote = caseNote(LocalDate.of(2019, 11, 12), "John Doe", "Existing note"); diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerAboutToStartTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerAboutToStartTest.java index 7854880e8f4..e2f6e024745 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerAboutToStartTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerAboutToStartTest.java @@ -4,17 +4,25 @@ import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse; import uk.gov.hmcts.reform.fpl.config.rd.JudicialUsersConfiguration; import uk.gov.hmcts.reform.fpl.config.rd.LegalAdviserUsersConfiguration; import uk.gov.hmcts.reform.fpl.enums.YesNo; import uk.gov.hmcts.reform.fpl.model.CaseData; +import uk.gov.hmcts.reform.fpl.service.ElinksService; +import uk.gov.hmcts.reform.fpl.service.JudicialService; +import uk.gov.hmcts.reform.fpl.service.RoleAssignmentService; +import uk.gov.hmcts.reform.fpl.service.SystemUserService; +import uk.gov.hmcts.reform.fpl.service.ValidateEmailService; import uk.gov.hmcts.reform.rd.client.JudicialApi; import static org.assertj.core.api.Assertions.assertThat; @WebMvcTest(AllocatedJudgeController.class) @OverrideAutoConfiguration(enabled = true) +@Import({JudicialService.class}) class AllocatedJudgeControllerAboutToStartTest extends AbstractCallbackTest { AllocatedJudgeControllerAboutToStartTest() { @@ -30,6 +38,19 @@ class AllocatedJudgeControllerAboutToStartTest extends AbstractCallbackTest { @MockBean private LegalAdviserUsersConfiguration legalAdviserUsersConfiguration; + @MockBean + private SystemUserService systemUserService; + + @MockBean + private RoleAssignmentService roleAssignmentService; + + @MockBean + private ValidateEmailService validateEmailService; + + @MockBean + private ElinksService elinksService; + + @WithMockUser @Test void shouldSetEnterManuallyDefaultToNo() { CaseData caseData = CaseData.builder() diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerAboutToSubmitTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerAboutToSubmitTest.java index c8a6de6a202..bcdeab5bbe8 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerAboutToSubmitTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerAboutToSubmitTest.java @@ -4,6 +4,8 @@ import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse; import uk.gov.hmcts.reform.fpl.config.rd.JudicialUsersConfiguration; import uk.gov.hmcts.reform.fpl.config.rd.LegalAdviserUsersConfiguration; @@ -12,6 +14,11 @@ import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.Judge; import uk.gov.hmcts.reform.fpl.model.JudicialUser; +import uk.gov.hmcts.reform.fpl.service.ElinksService; +import uk.gov.hmcts.reform.fpl.service.JudicialService; +import uk.gov.hmcts.reform.fpl.service.RoleAssignmentService; +import uk.gov.hmcts.reform.fpl.service.SystemUserService; +import uk.gov.hmcts.reform.fpl.service.ValidateEmailService; import uk.gov.hmcts.reform.rd.client.JudicialApi; import java.util.Optional; @@ -21,6 +28,7 @@ @WebMvcTest(AllocatedJudgeController.class) @OverrideAutoConfiguration(enabled = true) +@Import({JudicialService.class}) class AllocatedJudgeControllerAboutToSubmitTest extends AbstractCallbackTest { AllocatedJudgeControllerAboutToSubmitTest() { @@ -36,6 +44,19 @@ class AllocatedJudgeControllerAboutToSubmitTest extends AbstractCallbackTest { @MockBean private LegalAdviserUsersConfiguration legalAdviserUsersConfiguration; + @MockBean + private SystemUserService systemUserService; + + @MockBean + private RoleAssignmentService roleAssignmentService; + + @MockBean + private ValidateEmailService validateEmailService; + + @MockBean + private ElinksService elinksService; + + @WithMockUser @Test void shouldAddExtraInfoIfInMapping() { when(legalAdviserUsersConfiguration.getLegalAdviserUUID("test@test.com")) @@ -56,6 +77,7 @@ void shouldAddExtraInfoIfInMapping() { assertThat(after.getAllocatedJudge().getJudgeJudicialUser().getIdamId()).isEqualTo("1234"); } + @WithMockUser @Test void shouldErrorIfNoJudgeAndNotEnteringManually() { CaseData caseData = CaseData.builder() @@ -69,6 +91,7 @@ void shouldErrorIfNoJudgeAndNotEnteringManually() { .containsExactly("You must search for a judge or enter their details manually"); } + @WithMockUser @Test void shouldErrorIfNoJudgeFoundInJrd() { CaseData caseData = CaseData.builder() @@ -82,6 +105,7 @@ void shouldErrorIfNoJudgeFoundInJrd() { .containsExactly("Could not fetch Judge details from JRD, please try again in a few minutes."); } + @WithMockUser @Test void shouldClearLastNameIfMagistrates() { Judge judge = Judge.builder() @@ -103,6 +127,7 @@ void shouldClearLastNameIfMagistrates() { .isEqualTo(judge.toBuilder().judgeLastName(null).build()); } + @WithMockUser @Test void shouldClearFullNameIfNotMagistrates() { Judge judge = Judge.builder() diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerMidEventTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerMidEventTest.java index 6cf9149c8e7..2c441a7d59a 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerMidEventTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AllocatedJudgeControllerMidEventTest.java @@ -4,6 +4,8 @@ import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse; import uk.gov.hmcts.reform.fpl.config.rd.JudicialUsersConfiguration; import uk.gov.hmcts.reform.fpl.config.rd.LegalAdviserUsersConfiguration; @@ -12,6 +14,11 @@ import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.Judge; import uk.gov.hmcts.reform.fpl.model.JudicialUser; +import uk.gov.hmcts.reform.fpl.service.ElinksService; +import uk.gov.hmcts.reform.fpl.service.JudicialService; +import uk.gov.hmcts.reform.fpl.service.RoleAssignmentService; +import uk.gov.hmcts.reform.fpl.service.SystemUserService; +import uk.gov.hmcts.reform.fpl.service.ValidateEmailService; import uk.gov.hmcts.reform.rd.client.JudicialApi; import uk.gov.hmcts.reform.rd.model.JudicialUserProfile; @@ -24,6 +31,7 @@ @WebMvcTest(AllocatedJudgeController.class) @OverrideAutoConfiguration(enabled = true) +@Import({JudicialService.class, ValidateEmailService.class}) class AllocatedJudgeControllerMidEventTest extends AbstractCallbackTest { AllocatedJudgeControllerMidEventTest() { @@ -39,6 +47,17 @@ class AllocatedJudgeControllerMidEventTest extends AbstractCallbackTest { @MockBean private LegalAdviserUsersConfiguration legalAdviserUsersConfiguration; + @MockBean + private SystemUserService systemUserService; + + @MockBean + private RoleAssignmentService roleAssignmentService; + + @MockBean + private ElinksService elinksService; + + + @WithMockUser @Test void shouldNotReturnAValidationErrorWhenJudgePersonalCodeAdded() { given(jrdApi.findUsers(any(), any(), anyInt(), any(), any())).willReturn(List.of(JudicialUserProfile.builder() @@ -55,6 +74,7 @@ void shouldNotReturnAValidationErrorWhenJudgePersonalCodeAdded() { assertThat((callbackResponse.getErrors())).isNull(); } + @WithMockUser @Test void shouldNotReturnAValidationErrorWhenJudgeEnteredManually() { CaseData caseData = CaseData.builder() @@ -70,6 +90,7 @@ void shouldNotReturnAValidationErrorWhenJudgeEnteredManually() { assertThat((callbackResponse.getErrors())).isNull(); } + @WithMockUser @Test void shouldReturnAValidationErrorWhenNoPersonalCode() { CaseData caseData = CaseData.builder() @@ -84,6 +105,7 @@ void shouldReturnAValidationErrorWhenNoPersonalCode() { "You must search for a judge or enter their details manually"); } + @WithMockUser @Test void shouldReturnAValidationErrorWhenEnterManuallyAndInvalidEmail() { CaseData caseData = CaseData.builder() diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantAboutToStartControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantAboutToStartControllerTest.java index 4ce6ba11348..c91245aa33b 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantAboutToStartControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantAboutToStartControllerTest.java @@ -5,34 +5,51 @@ import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.model.OrganisationPolicy; import uk.gov.hmcts.reform.fpl.model.Address; import uk.gov.hmcts.reform.fpl.model.Applicant; import uk.gov.hmcts.reform.fpl.model.ApplicantParty; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.common.Element; +import uk.gov.hmcts.reform.fpl.service.ApplicantService; +import uk.gov.hmcts.reform.fpl.service.OrganisationService; +import uk.gov.hmcts.reform.fpl.service.PbaNumberService; +import uk.gov.hmcts.reform.fpl.service.ValidateEmailService; import uk.gov.hmcts.reform.rd.client.OrganisationApi; import uk.gov.hmcts.reform.rd.model.ContactInformation; import uk.gov.hmcts.reform.rd.model.Organisation; import java.util.List; +import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; import static uk.gov.hmcts.reform.ccd.model.OrganisationPolicy.organisationPolicy; import static uk.gov.hmcts.reform.fpl.enums.CaseRole.LAMANAGING; import static uk.gov.hmcts.reform.fpl.enums.CaseRole.LASOLICITOR; -import static uk.gov.hmcts.reform.fpl.handlers.NotificationEventHandlerTestData.AUTH_TOKEN; import static uk.gov.hmcts.reform.fpl.utils.CoreCaseDataStoreLoader.emptyCaseDetails; @WebMvcTest(ApplicantController.class) @OverrideAutoConfiguration(enabled = true) +@Import({ApplicantService.class}) class ApplicantAboutToStartControllerTest extends AbstractCallbackTest { private static final Organisation POPULATED_ORGANISATION = buildOrganisation(); private static final Organisation EMPTY_ORGANISATION = Organisation.builder().build(); private static final String ORGANISATION_ID = "ORGSA"; + @MockBean + private PbaNumberService pbaNumberService; + + @MockBean + private OrganisationService organisationService; + + @MockBean + private ValidateEmailService validateEmailService; + @MockBean private OrganisationApi organisationApi; @@ -42,10 +59,12 @@ class ApplicantAboutToStartControllerTest extends AbstractCallbackTest { @BeforeEach void setup() { + super.setUp(); givenSystemUser(); givenFplService(); } + @WithMockUser @Test void shouldPrepopulateApplicantDataWhenNoApplicantExists() { @@ -66,11 +85,10 @@ void shouldPrepopulateApplicantDataWhenNoApplicantExists() { .containsExactly(expectedApplicant); } + @WithMockUser @Test void shouldAddOrganisationDetailsToApplicantWhenOrganisationExists() { - - given(organisationApi.findUserOrganisation(USER_AUTH_TOKEN, SERVICE_AUTH_TOKEN)) - .willReturn(POPULATED_ORGANISATION); + given(organisationService.findOrganisation()).willReturn(Optional.of(POPULATED_ORGANISATION)); CaseData returnedCaseData = extractCaseData(postAboutToStartEvent(emptyCaseDetails())); @@ -86,10 +104,10 @@ void shouldAddOrganisationDetailsToApplicantWhenOrganisationExists() { .containsExactly(expectedApplicant); } + @WithMockUser @Test void shouldAddManagedOrganisationDetailsToApplicant() { - given(organisationApi.findOrganisation(AUTH_TOKEN, SERVICE_AUTH_TOKEN, ORGANISATION_ID)) - .willReturn(POPULATED_ORGANISATION); + given(organisationService.findOrganisation(any())).willReturn(Optional.of(POPULATED_ORGANISATION)); OrganisationPolicy outsourcingPolicy = organisationPolicy("ORGEXT", null, LAMANAGING); diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantMidEventControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantMidEventControllerTest.java index cade6a5a00d..3b2e7d5bb8f 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantMidEventControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantMidEventControllerTest.java @@ -5,25 +5,40 @@ import org.junit.jupiter.params.provider.ValueSource; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse; import uk.gov.hmcts.reform.fpl.model.Applicant; import uk.gov.hmcts.reform.fpl.model.ApplicantParty; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.Solicitor; import uk.gov.hmcts.reform.fpl.model.common.EmailAddress; +import uk.gov.hmcts.reform.fpl.service.ApplicantService; +import uk.gov.hmcts.reform.fpl.service.OrganisationService; +import uk.gov.hmcts.reform.fpl.service.PbaNumberService; +import uk.gov.hmcts.reform.fpl.service.ValidateEmailService; import static org.assertj.core.api.Assertions.assertThat; import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.wrapElements; @WebMvcTest(ApplicantController.class) @OverrideAutoConfiguration(enabled = true) +@Import({PbaNumberService.class, ValidateEmailService.class}) class ApplicantMidEventControllerTest extends AbstractCallbackTest { private static final String ERROR_MESSAGE = "Payment by account (PBA) number must include 7 numbers"; + @MockBean + private ApplicantService applicantService; + + @MockBean + private OrganisationService organisationService; + ApplicantMidEventControllerTest() { super("enter-applicant"); } + @WithMockUser @ParameterizedTest @ValueSource(strings = {"1234567", "pba1234567", "PBA1234567"}) void shouldReturnNoErrorsWhenValidPbaNumber(String input) { @@ -38,6 +53,7 @@ void shouldReturnNoErrorsWhenValidPbaNumber(String input) { assertThat(caseData.getApplicants().get(0).getValue().getParty().getPbaNumber()).isEqualTo("PBA1234567"); } + @WithMockUser @ParameterizedTest @ValueSource(strings = {" ", "\t", "\n", "123", "12345678"}) void shouldReturnErrorsWhenThereIsInvalidPbaNumber(String input) { @@ -48,6 +64,7 @@ void shouldReturnErrorsWhenThereIsInvalidPbaNumber(String input) { assertThat(callbackResponse.getErrors()).contains(ERROR_MESSAGE); } + @WithMockUser @Test void shouldReturnNoErrorsWhenThereIsNewApplicantAndPbaNumberIsNull() { CaseData caseData = CaseData.builder() @@ -66,6 +83,7 @@ void shouldReturnNoErrorsWhenThereIsNewApplicantAndPbaNumberIsNull() { assertThat(callbackResponse.getErrors()).isNull(); } + @WithMockUser @Test void shouldReturnErrorsWhenApplicantAndSolicitorEmailsAreInvalid() { CaseData caseData = CaseData.builder() @@ -86,6 +104,7 @@ void shouldReturnErrorsWhenApplicantAndSolicitorEmailsAreInvalid() { "Solicitor: Enter an email address in the correct format, for example name@example.com"); } + @WithMockUser @Test void shouldNotReturnErrorsWhenApplicantAndSolicitorEmailsAreValid() { CaseData caseData = CaseData.builder() @@ -101,6 +120,7 @@ void shouldNotReturnErrorsWhenApplicantAndSolicitorEmailsAreValid() { assertThat(callbackResponse.getErrors()).isNull(); } + @WithMockUser @Test void shouldReturnErrorsWhenSolicitorEmailsIsNull() { CaseData caseData = CaseData.builder() diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/NotifyGatekeeperControllerAboutToStartTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/NotifyGatekeeperControllerAboutToStartTest.java index 54ab568c89c..38be200c3a7 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/NotifyGatekeeperControllerAboutToStartTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/NotifyGatekeeperControllerAboutToStartTest.java @@ -3,13 +3,16 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse; import uk.gov.hmcts.reform.ccd.client.model.CaseDetails; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.ReturnApplication; import uk.gov.hmcts.reform.fpl.model.common.Element; import uk.gov.hmcts.reform.fpl.model.common.EmailAddress; +import uk.gov.hmcts.reform.fpl.service.ValidateEmailService; import uk.gov.hmcts.reform.fpl.service.ValidateGroupService; import java.util.List; @@ -31,6 +34,9 @@ class NotifyGatekeeperControllerAboutToStartTest extends AbstractCallbackTest { private static final String SUBMITTED = "Submitted"; private static final String GATEKEEPING = "Gatekeeping"; + @MockBean + protected ValidateEmailService validateEmailService; + @SpyBean private ValidateGroupService validateGroupService; @@ -38,6 +44,7 @@ class NotifyGatekeeperControllerAboutToStartTest extends AbstractCallbackTest { super("notify-gatekeeper"); } + @WithMockUser @Test void shouldReturnErrorsWhenFamilymanNumberIsNotProvided() { AboutToStartOrSubmitCallbackResponse callbackResponse = postAboutToStartEvent(caseDetails( @@ -46,6 +53,7 @@ void shouldReturnErrorsWhenFamilymanNumberIsNotProvided() { assertThat(callbackResponse.getErrors()).containsExactly("Enter Familyman case number"); } + @WithMockUser @Test void shouldNotValidateFamilymanNumberWhenInGatekeepingState() { postAboutToStartEvent(caseDetails(INVALID_FAMILY_MAN_NUMBER, GATEKEEPING)); @@ -53,6 +61,7 @@ void shouldNotValidateFamilymanNumberWhenInGatekeepingState() { verify(validateGroupService, never()).validateGroup(any(), any()); } + @WithMockUser @Test void shouldResetGateKeeperEmailCollection() { AboutToStartOrSubmitCallbackResponse callbackResponse = postAboutToStartEvent(caseDetails( @@ -65,6 +74,7 @@ void shouldResetGateKeeperEmailCollection() { assertThat(gateKeeperEmailAddresses.get(0).getValue().getEmail()).isEqualTo(""); } + @WithMockUser @Test void shouldResetReturnedApplicationProperties() { AboutToStartOrSubmitCallbackResponse callbackResponse = postAboutToStartEvent(caseDetails( diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsControllerAboutToStartTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsControllerAboutToStartTest.java index 3df8f483a46..bac87ac8320 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsControllerAboutToStartTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsControllerAboutToStartTest.java @@ -3,10 +3,23 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Bean; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse; +import uk.gov.hmcts.reform.fpl.components.OptionCountBuilder; import uk.gov.hmcts.reform.fpl.model.CaseData; +import uk.gov.hmcts.reform.fpl.service.ChildrenService; +import uk.gov.hmcts.reform.fpl.service.RecordFinalDecisionsService; + +import java.util.Collections; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.Mockito.when; @WebMvcTest(RecordFinalDecisionsController.class) @OverrideAutoConfiguration(enabled = true) @@ -16,9 +29,34 @@ class RecordFinalDecisionsControllerAboutToStartTest extends AbstractCallbackTes super("record-final-decisions"); } + @MockBean + private ChildrenService childrenService; + + @MockBean + private OptionCountBuilder optionCountBuilder; + + @Test + void testContextLoads() { + assertNotNull(childrenService, "ChildrenService should be injected and not null"); + } + + @TestConfiguration + static class RecordFinalDecisionsTestConfig { + @Bean + public RecordFinalDecisionsService recordFinalDecisionsService(ChildrenService childrenService, OptionCountBuilder optionCountBuilder) { + return new RecordFinalDecisionsService(childrenService, optionCountBuilder); + } + } + + + @WithMockUser @Test void shouldPrePopulateFields() { CaseData caseData = CaseData.builder().build(); + + when(childrenService.getRemainingChildren(any())).thenReturn(Collections.emptyList()); + when(childrenService.getChildrenLabel(any(), anyBoolean())).thenReturn("Joe Bloggs"); + AboutToStartOrSubmitCallbackResponse response = postAboutToStartEvent(caseData); assertThat(response.getData()).containsKeys("childSelector", "children_label", "close_case_label"); diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RespondentControllerChangeFromOtherAboutToSubmitTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RespondentControllerChangeFromOtherAboutToSubmitTest.java index 5d75b139378..09bea4e9111 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RespondentControllerChangeFromOtherAboutToSubmitTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RespondentControllerChangeFromOtherAboutToSubmitTest.java @@ -7,6 +7,8 @@ import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; +import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse; import uk.gov.hmcts.reform.fpl.enums.UserRole; import uk.gov.hmcts.reform.fpl.model.CaseData; @@ -16,6 +18,22 @@ import uk.gov.hmcts.reform.fpl.model.Respondent; import uk.gov.hmcts.reform.fpl.model.common.Element; import uk.gov.hmcts.reform.fpl.request.RequestData; +import uk.gov.hmcts.reform.fpl.service.CaseService; +import uk.gov.hmcts.reform.fpl.service.ConfidentialDetailsService; +import uk.gov.hmcts.reform.fpl.service.NoticeOfChangeService; +import uk.gov.hmcts.reform.fpl.service.OrganisationService; +import uk.gov.hmcts.reform.fpl.service.OthersService; +import uk.gov.hmcts.reform.fpl.service.RepresentativeCaseRoleService; +import uk.gov.hmcts.reform.fpl.service.RepresentativeService; +import uk.gov.hmcts.reform.fpl.service.RespondentAfterSubmissionRepresentationService; +import uk.gov.hmcts.reform.fpl.service.RespondentService; +import uk.gov.hmcts.reform.fpl.service.UserService; +import uk.gov.hmcts.reform.fpl.service.ValidateEmailService; +import uk.gov.hmcts.reform.fpl.service.legalcounsel.RepresentableLegalCounselUpdater; +import uk.gov.hmcts.reform.fpl.service.noc.NoticeOfChangeFieldPopulator; +import uk.gov.hmcts.reform.fpl.service.others.OthersListGenerator; +import uk.gov.hmcts.reform.fpl.service.representative.ChangeOfRepresentationService; +import uk.gov.hmcts.reform.fpl.service.respondent.RespondentValidator; import uk.gov.hmcts.reform.fpl.utils.ElementUtils; import java.util.ArrayList; @@ -49,11 +67,44 @@ @WebMvcTest(RespondentController.class) @OverrideAutoConfiguration(enabled = true) +@Import({OthersService.class, ConfidentialDetailsService.class, RespondentService.class, + RespondentAfterSubmissionRepresentationService.class, RepresentableLegalCounselUpdater.class, + RepresentativeService.class}) class RespondentControllerChangeFromOtherAboutToSubmitTest extends AbstractCallbackTest { @MockBean private RequestData requestData; + @MockBean + private OthersListGenerator othersListGenerator; + + @MockBean + private CaseService caseService; + + @MockBean + private RepresentativeCaseRoleService representativeCaseRoleService; + + @MockBean + private ValidateEmailService validateEmailService; + + @MockBean + private ChangeOfRepresentationService changeOfRepresentationService; + + @MockBean + private NoticeOfChangeFieldPopulator noticeOfChangeFieldPopulator; + + @MockBean + private RespondentValidator respondentValidator; + + @MockBean + private NoticeOfChangeService noticeOfChangeService; + + @MockBean + private OrganisationService organisationService; + + @MockBean + private UserService userService; + RespondentControllerChangeFromOtherAboutToSubmitTest() { super("enter-respondents/change-from-other"); } @@ -77,6 +128,7 @@ public static Stream othersToRespondentParam() { return builder.build(); } + @WithMockUser @ParameterizedTest @MethodSource("othersToRespondentParam") void shouldConvertOthersToRespondent(int selectedOtherSeq, int numberOfAdditionalOther, @@ -111,6 +163,7 @@ void shouldConvertOthersToRespondent(int selectedOtherSeq, int numberOfAdditiona assertThat(responseCaseData.findRespondent(numberOfRespondent)).contains(transformedRespondent); } + @WithMockUser @ParameterizedTest @MethodSource("othersToRespondentParam") void shouldConvertOthersWithHiddenDetailsToRespondentWhereNoConfidentialRespondent( @@ -159,6 +212,7 @@ void shouldConvertOthersWithHiddenDetailsToRespondentWhereNoConfidentialResponde .contains(prepareExpectedTransformedConfidentialRespondent()); } + @WithMockUser @ParameterizedTest @MethodSource("othersToRespondentParam") void shouldConvertConfidentialOthersToConfidentialRespondentAndNoMoreConfidentialOthers( @@ -224,6 +278,7 @@ void shouldConvertConfidentialOthersToConfidentialRespondentAndNoMoreConfidentia .contains(prepareExpectedExistingConfidentialRespondent(numberOfRespondent - 1)); } + @WithMockUser @ParameterizedTest @MethodSource("othersToRespondentParam") void shouldConvertConfidentialOthersToConfidentialRespondentAndRetainConfidentialOthers( @@ -290,6 +345,7 @@ void shouldConvertConfidentialOthersToConfidentialRespondentAndRetainConfidentia .contains(prepareExpectedExistingConfidentialRespondent(numberOfRespondent - 1)); } + @WithMockUser @ParameterizedTest @MethodSource("othersToRespondentParam") void shouldConvertOthersWithRepresentativeToRespondent( @@ -345,6 +401,7 @@ void shouldConvertOthersWithRepresentativeToRespondent( .contains(resolveRespondentRepresentativeRole(numberOfRespondent + 1)); } + @WithMockUser @ParameterizedTest @MethodSource("othersToRespondentParam") void shouldConvertOthersWithRepresentativesToRespondent( @@ -439,6 +496,7 @@ void shouldConvertOthersWithRepresentativesToRespondent( } } + @WithMockUser @ParameterizedTest @MethodSource("othersToRespondentParam") void shouldConvertConfidentialOthersWithRepresentativesToRespondent( From 9dc178d220644ca60ed461b99cb75a6731166dfb Mon Sep 17 00:00:00 2001 From: "Chak Shing, Lo" Date: Thu, 16 May 2024 16:51:21 +0100 Subject: [PATCH 044/105] fix WebMvcTest base class for spring 3 --- service/build.gradle | 2 +- .../fpl/controllers/AbstractCallbackTest.java | 55 ------------------- .../reform/fpl/controllers/AbstractTest.java | 18 ++++++ .../AddCaseNumberControllerSubmittedTest.java | 32 +---------- .../AddNoteAboutToSubmitControllerTest.java | 15 ----- .../ApplicantAboutToStartControllerTest.java | 30 ++-------- .../fpl/controllers/RootControllerTest.java | 4 +- .../TestingSupportControllerTest.java | 14 ++++- .../fpl/jobs/UndeliveredEmailsFinder.java | 6 +- .../fpl/jobs/UndeliveredEmailsFinderTest.java | 9 ++- 10 files changed, 45 insertions(+), 140 deletions(-) diff --git a/service/build.gradle b/service/build.gradle index dd23a44ac55..84774fd6d15 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -347,7 +347,7 @@ dependencies { implementation group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: '4.0.0' implementation group: 'com.github.hmcts', name: 'auth-checker-lib', version: '3.0.0' implementation group: 'com.github.hmcts', name: 'send-letter-client', version: '4.0.4' - implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: '5.0.1-RELEASE' + implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: '3.17.3-RELEASE' implementation group: 'com.github.hmcts', name: 'ccd-case-document-am-client', version: '1.7.3' diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java index 368eb94baf7..2684946392f 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java @@ -1,13 +1,7 @@ package uk.gov.hmcts.reform.fpl.controllers; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.jupiter.api.BeforeEach; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; @@ -15,29 +9,19 @@ import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest; import uk.gov.hmcts.reform.ccd.client.model.CaseDetails; import uk.gov.hmcts.reform.ccd.client.model.SubmittedCallbackResponse; -import uk.gov.hmcts.reform.fpl.config.SystemUpdateUserConfiguration; import uk.gov.hmcts.reform.fpl.enums.State; -import uk.gov.hmcts.reform.fpl.logging.HeaderInformationExtractor; import uk.gov.hmcts.reform.fpl.model.CaseData; -import uk.gov.hmcts.reform.fpl.service.CaseConverter; -import uk.gov.hmcts.reform.fpl.service.EventService; -import uk.gov.hmcts.reform.fpl.service.time.Time; -import uk.gov.hmcts.reform.fpl.testingsupport.DynamicListHelper; -import java.time.LocalDateTime; import java.util.Map; import java.util.Optional; import static org.apache.http.HttpStatus.SC_OK; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static uk.gov.hmcts.reform.fpl.service.CaseConverter.MAP_TYPE; import static uk.gov.hmcts.reform.fpl.utils.ResourceReader.readBytes; -@Import({EventService.class}) public abstract class AbstractCallbackTest extends AbstractTest { @Autowired @@ -45,47 +29,8 @@ public abstract class AbstractCallbackTest extends AbstractTest { private final String eventName; private final String eventId; - - @MockBean - protected Time time; - - @MockBean - protected CaseConverter caseConverter; - - @MockBean - protected SystemUpdateUserConfiguration systemUpdateUserConfiguration; - - @MockBean - protected DynamicListHelper dynamicListHelper; - - @MockBean - protected HeaderInformationExtractor headerInformationExtractor; - - @Autowired - protected ObjectMapper objectMapper; - protected static final long ASYNC_METHOD_CALL_TIMEOUT = 10000; - @BeforeEach - void setUp() { - when(caseConverter.convert(any(CaseDetails.class))).thenAnswer(new Answer() { - @Override - public CaseData answer(InvocationOnMock invocation) throws Throwable { - CaseDetails details = invocation.getArgument(0); - if (details == null) { - return null; - } - CaseData caseData = objectMapper.convertValue(details.getData(), CaseData.class); - return caseData.toBuilder() - .state(State.tryFromValue(details.getState()).orElse(null)) - .id(details.getId()) - .build(); - } - }); - - when(time.now()).thenReturn(LocalDateTime.now()); - } - protected AbstractCallbackTest(String eventName) { this.eventName = eventName; this.eventId = eventName; diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractTest.java index 22a88441a1d..dde83f330df 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractTest.java @@ -4,12 +4,17 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.test.context.ActiveProfiles; import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; import uk.gov.hmcts.reform.ccd.client.CaseAccessDataStoreApi; import uk.gov.hmcts.reform.ccd.client.CoreCaseDataApiV2; +import uk.gov.hmcts.reform.ccd.document.am.feign.CaseDocumentClientApi; import uk.gov.hmcts.reform.ccd.model.CaseAssignedUserRole; import uk.gov.hmcts.reform.ccd.model.CaseAssignedUserRolesResource; +import uk.gov.hmcts.reform.document.DocumentDownloadClientApi; +import uk.gov.hmcts.reform.document.DocumentMetadataDownloadClientApi; +import uk.gov.hmcts.reform.document.DocumentUploadClientApi; import uk.gov.hmcts.reform.fpl.config.SystemUpdateUserConfiguration; import uk.gov.hmcts.reform.fpl.enums.CaseRole; import uk.gov.hmcts.reform.fpl.model.CaseData; @@ -34,6 +39,7 @@ import static org.mockito.BDDMockito.given; @ActiveProfiles("integration-test") +@ComponentScan(basePackages = "uk.gov.hmcts.reform.fpl", lazyInit = true) public abstract class AbstractTest { protected static final String USER_AUTH_TOKEN = "Bearer token"; @@ -65,6 +71,18 @@ public abstract class AbstractTest { @MockBean protected CoreCaseDataApiV2 coreCaseDataApi; + @MockBean + protected DocumentUploadClientApi documentUploadClientApi; + + @MockBean + protected DocumentDownloadClientApi documentDownloadClientApi; + + @MockBean + protected DocumentMetadataDownloadClientApi documentMetadataDownloadClientApi; + + @MockBean + protected CaseDocumentClientApi caseDocumentClientApi; + @Autowired protected DynamicListHelper dynamicLists; diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerSubmittedTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerSubmittedTest.java index d02efee20ff..33f30ce0c55 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerSubmittedTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddCaseNumberControllerSubmittedTest.java @@ -1,38 +1,27 @@ package uk.gov.hmcts.reform.fpl.controllers; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; +import org.mockito.Spy; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.ApplicationEventPublisher; -import org.springframework.context.annotation.Import; -import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest; import uk.gov.hmcts.reform.ccd.client.model.CaseDetails; -import uk.gov.hmcts.reform.fpl.CallbackRequestLogger; -import uk.gov.hmcts.reform.fpl.config.robotics.RoboticsEmailConfiguration; -import uk.gov.hmcts.reform.fpl.logging.HeaderInformationExtractor; import uk.gov.hmcts.reform.fpl.model.email.EmailData; -import uk.gov.hmcts.reform.fpl.service.CourtService; import uk.gov.hmcts.reform.fpl.service.email.EmailService; -import uk.gov.hmcts.reform.fpl.service.robotics.RoboticsDataService; -import uk.gov.hmcts.reform.fpl.service.robotics.RoboticsNotificationService; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import static uk.gov.hmcts.reform.fpl.utils.CoreCaseDataStoreLoader.populatedCaseDetails; @WebMvcTest(AddCaseNumberController.class) @OverrideAutoConfiguration(enabled = true) -@Import({HeaderInformationExtractor.class, CallbackRequestLogger.class, RoboticsNotificationService.class, - RoboticsDataService.class, RoboticsNotificationService.class}) class AddCaseNumberControllerSubmittedTest extends AbstractCallbackTest { AddCaseNumberControllerSubmittedTest() { @@ -45,25 +34,9 @@ class AddCaseNumberControllerSubmittedTest extends AbstractCallbackTest { @MockBean private EmailService emailService; - @MockBean + @Spy private ApplicationEventPublisher applicationEventPublisher; - @MockBean - private CourtService courtService; - - @MockBean - private RoboticsEmailConfiguration roboticsEmailConfiguration; - - @BeforeEach - void setUp() { - super.setUp(); - - when(roboticsEmailConfiguration.getSender()).thenReturn("sender@example.com"); - when(roboticsEmailConfiguration.getRecipient()).thenReturn("FamilyPublicLaw+robotics-test@gmail.com"); - } - - - @WithMockUser @Test void shouldSendNotificationToRoboticsWhenCaseNumberAdded() { CaseDetails caseDetailsBefore = buildCaseWithNumber(""); @@ -76,7 +49,6 @@ void shouldSendNotificationToRoboticsWhenCaseNumberAdded() { assertThat(email.getValue().getRecipient()).isEqualTo("FamilyPublicLaw+robotics-test@gmail.com"); } - @WithMockUser @Test void shouldNotSendNotificationToRoboticsWhenCaseNumberUpdated() { CaseDetails caseDetailsBefore = buildCaseWithNumber("CASE1"); diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteAboutToSubmitControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteAboutToSubmitControllerTest.java index a7717404bd6..d32e9a33faa 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteAboutToSubmitControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AddNoteAboutToSubmitControllerTest.java @@ -4,43 +4,28 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.CaseNote; import uk.gov.hmcts.reform.fpl.model.common.Element; -import uk.gov.hmcts.reform.fpl.request.RequestData; -import uk.gov.hmcts.reform.fpl.service.CaseNoteService; -import uk.gov.hmcts.reform.idam.client.models.UserInfo; import java.time.LocalDate; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; import static uk.gov.hmcts.reform.fpl.utils.ElementUtils.wrapElements; @WebMvcTest(AddNoteController.class) @OverrideAutoConfiguration(enabled = true) -@Import({CaseNoteService.class}) class AddNoteAboutToSubmitControllerTest extends AbstractCallbackTest { - @MockBean - private RequestData requestData; - AddNoteAboutToSubmitControllerTest() { super("add-note"); } @BeforeEach void setup() { - super.setUp(); givenCurrentUserWithName("John Smith"); - given(idamClient.getUserInfo(any())).willReturn(UserInfo.builder().name("John Smith").build()); } - @WithMockUser @Test void shouldAddCaseNoteToList() { CaseNote caseNote = caseNote(LocalDate.of(2019, 11, 12), "John Doe", "Existing note"); diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantAboutToStartControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantAboutToStartControllerTest.java index c91245aa33b..4ce6ba11348 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantAboutToStartControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ApplicantAboutToStartControllerTest.java @@ -5,51 +5,34 @@ import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.security.test.context.support.WithMockUser; import uk.gov.hmcts.reform.ccd.model.OrganisationPolicy; import uk.gov.hmcts.reform.fpl.model.Address; import uk.gov.hmcts.reform.fpl.model.Applicant; import uk.gov.hmcts.reform.fpl.model.ApplicantParty; import uk.gov.hmcts.reform.fpl.model.CaseData; import uk.gov.hmcts.reform.fpl.model.common.Element; -import uk.gov.hmcts.reform.fpl.service.ApplicantService; -import uk.gov.hmcts.reform.fpl.service.OrganisationService; -import uk.gov.hmcts.reform.fpl.service.PbaNumberService; -import uk.gov.hmcts.reform.fpl.service.ValidateEmailService; import uk.gov.hmcts.reform.rd.client.OrganisationApi; import uk.gov.hmcts.reform.rd.model.ContactInformation; import uk.gov.hmcts.reform.rd.model.Organisation; import java.util.List; -import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; import static uk.gov.hmcts.reform.ccd.model.OrganisationPolicy.organisationPolicy; import static uk.gov.hmcts.reform.fpl.enums.CaseRole.LAMANAGING; import static uk.gov.hmcts.reform.fpl.enums.CaseRole.LASOLICITOR; +import static uk.gov.hmcts.reform.fpl.handlers.NotificationEventHandlerTestData.AUTH_TOKEN; import static uk.gov.hmcts.reform.fpl.utils.CoreCaseDataStoreLoader.emptyCaseDetails; @WebMvcTest(ApplicantController.class) @OverrideAutoConfiguration(enabled = true) -@Import({ApplicantService.class}) class ApplicantAboutToStartControllerTest extends AbstractCallbackTest { private static final Organisation POPULATED_ORGANISATION = buildOrganisation(); private static final Organisation EMPTY_ORGANISATION = Organisation.builder().build(); private static final String ORGANISATION_ID = "ORGSA"; - @MockBean - private PbaNumberService pbaNumberService; - - @MockBean - private OrganisationService organisationService; - - @MockBean - private ValidateEmailService validateEmailService; - @MockBean private OrganisationApi organisationApi; @@ -59,12 +42,10 @@ class ApplicantAboutToStartControllerTest extends AbstractCallbackTest { @BeforeEach void setup() { - super.setUp(); givenSystemUser(); givenFplService(); } - @WithMockUser @Test void shouldPrepopulateApplicantDataWhenNoApplicantExists() { @@ -85,10 +66,11 @@ void shouldPrepopulateApplicantDataWhenNoApplicantExists() { .containsExactly(expectedApplicant); } - @WithMockUser @Test void shouldAddOrganisationDetailsToApplicantWhenOrganisationExists() { - given(organisationService.findOrganisation()).willReturn(Optional.of(POPULATED_ORGANISATION)); + + given(organisationApi.findUserOrganisation(USER_AUTH_TOKEN, SERVICE_AUTH_TOKEN)) + .willReturn(POPULATED_ORGANISATION); CaseData returnedCaseData = extractCaseData(postAboutToStartEvent(emptyCaseDetails())); @@ -104,10 +86,10 @@ void shouldAddOrganisationDetailsToApplicantWhenOrganisationExists() { .containsExactly(expectedApplicant); } - @WithMockUser @Test void shouldAddManagedOrganisationDetailsToApplicant() { - given(organisationService.findOrganisation(any())).willReturn(Optional.of(POPULATED_ORGANISATION)); + given(organisationApi.findOrganisation(AUTH_TOKEN, SERVICE_AUTH_TOKEN, ORGANISATION_ID)) + .willReturn(POPULATED_ORGANISATION); OrganisationPolicy outsourcingPolicy = organisationPolicy("ORGEXT", null, LAMANAGING); diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RootControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RootControllerTest.java index ad067b9bb7e..6a7cfa36298 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RootControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RootControllerTest.java @@ -4,7 +4,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; @@ -12,10 +11,9 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@ActiveProfiles("integration-test") @WebMvcTest(RootController.class) @OverrideAutoConfiguration(enabled = true) -class RootControllerTest { +class RootControllerTest extends AbstractTest { @Autowired private MockMvc mockMvc; diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/TestingSupportControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/TestingSupportControllerTest.java index 0334e98e8da..18c8fe867a6 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/TestingSupportControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/TestingSupportControllerTest.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.fpl.controllers; import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.servlet.ServletException; import org.json.JSONObject; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -11,12 +12,12 @@ import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.http.MediaType; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; -import org.springframework.web.util.NestedServletException; import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; import uk.gov.hmcts.reform.ccd.client.CoreCaseDataApi; import uk.gov.hmcts.reform.ccd.client.CoreCaseDataApiV2; @@ -25,6 +26,7 @@ import uk.gov.hmcts.reform.ccd.client.model.Event; import uk.gov.hmcts.reform.ccd.client.model.StartEventResponse; import uk.gov.hmcts.reform.ccd.document.am.feign.CaseDocumentClientApi; +import uk.gov.hmcts.reform.document.DocumentDownloadClientApi; import uk.gov.hmcts.reform.document.DocumentUploadClientApi; import uk.gov.hmcts.reform.document.domain.UploadResponse; import uk.gov.hmcts.reform.document.utils.InMemoryMultipartFile; @@ -34,6 +36,7 @@ import uk.gov.hmcts.reform.fpl.service.ccd.CoreCaseDataService; import uk.gov.hmcts.reform.fpl.testingsupport.controllers.TestingSupportController; import uk.gov.hmcts.reform.fpl.utils.ResourceReader; +import uk.gov.hmcts.reform.idam.client.IdamClient; import java.util.List; import java.util.Map; @@ -56,6 +59,7 @@ @ActiveProfiles("integration-test") @WebMvcTest(TestingSupportController.class) +@ComponentScan(basePackages = "uk.gov.hmcts.reform.fpl", lazyInit = true) @OverrideAutoConfiguration(enabled = true) class TestingSupportControllerTest { @@ -97,6 +101,12 @@ class TestingSupportControllerTest { @MockBean private DocumentUploadClientApi uploadClient; + @MockBean + protected IdamClient idamClient; + + @MockBean + protected DocumentDownloadClientApi documentDownloadClientApi; + @BeforeEach void init() { when(requestData.authorisation()).thenReturn(USER_AUTH_TOKEN); @@ -106,7 +116,7 @@ void init() { @Test void shouldThrowExceptionForInvalidState() { - Exception thrownException = assertThrows(NestedServletException.class, + Exception thrownException = assertThrows(ServletException.class, () -> makePostRequest(POPULATE_CASE_PATH, Map.of("state", "NOT_A_REAL_STATE"))); assertThat(thrownException.getMessage()).contains("Unable to map NOT_A_REAL_STATE to a case state"); diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinder.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinder.java index 38d8123f0bd..a8de0bc57aa 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinder.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinder.java @@ -14,9 +14,6 @@ import uk.gov.service.notify.NotificationClient; import uk.gov.service.notify.NotificationList; -import java.time.Instant; -import java.time.ZoneId; -import java.time.chrono.ChronoZonedDateTime; import java.util.List; import static java.util.stream.Collectors.toList; @@ -38,8 +35,7 @@ public void execute(JobExecutionContext jobExecutionContext) { log.info("Job '{}' started", jobName); try { - ChronoZonedDateTime reportFrom = Instant.ofEpochMilli(DateTime.now().minusDays(REPORT_PERIOD_IN_DAYS) - .getMillis()).atZone(ZoneId.systemDefault()); + DateTime reportFrom = DateTime.now().minusDays(REPORT_PERIOD_IN_DAYS); NotificationList undeliveredEmailsReport = notifications.getNotifications("failed", "email", null, null); diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinderTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinderTest.java index 6abda538f24..b60153ee0e2 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinderTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/jobs/UndeliveredEmailsFinderTest.java @@ -21,7 +21,6 @@ import uk.gov.service.notify.NotificationClient; import uk.gov.service.notify.NotificationList; -import java.time.ZonedDateTime; import java.util.List; import java.util.Optional; @@ -78,12 +77,12 @@ void init() throws Exception { void shouldEmitUndeliveredEmailsFoundEvent() { when(notificationList.getNotifications()).thenReturn(List.of(notification1, notification2)); - when(notification1.getCompletedAt()).thenReturn(Optional.of(ZonedDateTime.now().minusHours(23))); + when(notification1.getCompletedAt()).thenReturn(Optional.of(DateTime.now().minusHours(23))); when(notification1.getEmailAddress()).thenReturn(Optional.of("test@test.com")); when(notification1.getSubject()).thenReturn(Optional.of("Subject")); when(notification1.getReference()).thenReturn(Optional.of("Reference")); - when(notification2.getCompletedAt()).thenReturn(Optional.of(ZonedDateTime.now().minusHours(10))); + when(notification2.getCompletedAt()).thenReturn(Optional.of(DateTime.now().minusHours(10))); when(notification2.getEmailAddress()).thenReturn(Optional.of("test2@test.com")); when(notification2.getSubject()).thenReturn(Optional.of("Subject 2")); when(notification2.getReference()).thenReturn(Optional.of("Reference 2")); @@ -110,7 +109,7 @@ void shouldEmitUndeliveredEmailsFoundEvent() { void shouldEmitUndeliveredEmailsFoundEventWhenEmailFailedWithinLastDay() { when(notificationList.getNotifications()).thenReturn(List.of(notification1)); - when(notification1.getCompletedAt()).thenReturn(Optional.of(ZonedDateTime.now().minusDays(1).plusHours(1))); + when(notification1.getCompletedAt()).thenReturn(Optional.of(DateTime.now().minusDays(1).plusHours(1))); when(notification1.getEmailAddress()).thenReturn(Optional.of("test@test.com")); when(notification1.getSubject()).thenReturn(Optional.of("Subject")); when(notification1.getReference()).thenReturn(Optional.of("Reference")); @@ -130,7 +129,7 @@ void shouldEmitUndeliveredEmailsFoundEventWhenEmailFailedWithinLastDay() { void shouldIgnoreEmailsThatFailedEarlierThanDayAgo() { when(notificationList.getNotifications()).thenReturn(List.of(notification1)); - when(notification1.getCompletedAt()).thenReturn(Optional.of(ZonedDateTime.now().minusDays(1).minusHours(1))); + when(notification1.getCompletedAt()).thenReturn(Optional.of(DateTime.now().minusDays(1).minusHours(1))); underTest.execute(jobExecutionContext); From 19956f593a427f89add09d20e6f2b4544cba2b5e Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Fri, 17 May 2024 11:14:49 +0100 Subject: [PATCH 045/105] Fix check style. --- config/checkstyle/checkstyle.xml | 2 +- ...alDecisionsControllerAboutToStartTest.java | 3 +- .../hmcts/reform/fnp/model/fee/FeeType.java | 1 + .../security/AuthCheckerConfiguration.java | 1 - .../security/SecurityConfiguration.java | 3 -- .../reform/fpl/model/cafcass/CafcassData.java | 1 + .../fpl/config/feign/FPLRetryerTest.java | 3 +- .../CafcassNotificationServiceTest.java | 31 +++++++------------ .../fpl/service/payment/FeeServiceTest.java | 6 ++-- 9 files changed, 23 insertions(+), 28 deletions(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 9536a15d0b1..ef31bb0ea31 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -176,7 +176,7 @@ - + diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsControllerAboutToStartTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsControllerAboutToStartTest.java index bac87ac8320..2ed8f3e9dac 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsControllerAboutToStartTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/RecordFinalDecisionsControllerAboutToStartTest.java @@ -43,7 +43,8 @@ void testContextLoads() { @TestConfiguration static class RecordFinalDecisionsTestConfig { @Bean - public RecordFinalDecisionsService recordFinalDecisionsService(ChildrenService childrenService, OptionCountBuilder optionCountBuilder) { + public RecordFinalDecisionsService recordFinalDecisionsService(ChildrenService childrenService, + OptionCountBuilder optionCountBuilder) { return new RecordFinalDecisionsService(childrenService, optionCountBuilder); } } diff --git a/service/src/main/java/uk/gov/hmcts/reform/fnp/model/fee/FeeType.java b/service/src/main/java/uk/gov/hmcts/reform/fnp/model/fee/FeeType.java index ee8b1aacc3d..bff48c77b68 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fnp/model/fee/FeeType.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fnp/model/fee/FeeType.java @@ -63,6 +63,7 @@ public enum FeeType { CHILD_RECOVERY_ORDER; private static final Map orderToFeeMap; + static { orderToFeeMap = new HashMap<>(); orderToFeeMap.put(OrderType.CARE_ORDER, CARE_ORDER); diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/AuthCheckerConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/AuthCheckerConfiguration.java index dd5463d97c9..48868d7cab9 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/AuthCheckerConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/AuthCheckerConfiguration.java @@ -9,7 +9,6 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java index 3b16d419ccd..9f67afbb04a 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java @@ -1,7 +1,5 @@ package uk.gov.hmcts.reform.fpl.config.security; -import jakarta.servlet.Filter; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -13,7 +11,6 @@ import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import uk.gov.hmcts.reform.auth.checker.core.RequestAuthorizer; import uk.gov.hmcts.reform.auth.checker.core.user.User; import uk.gov.hmcts.reform.auth.checker.spring.useronly.AuthCheckerUserOnlyFilter; diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/cafcass/CafcassData.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/cafcass/CafcassData.java index 4c1c22c69a7..9307ed6ec79 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/cafcass/CafcassData.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/cafcass/CafcassData.java @@ -8,6 +8,7 @@ @JsonInclude(JsonInclude.Include.NON_NULL) public interface CafcassData { String SAME_DAY = "same day"; + default String getDocumentName() { throw new UnsupportedOperationException(); } diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java index ef01791fb0b..755561c7f05 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java @@ -19,7 +19,8 @@ class FPLRetryerTest { private static final byte[] EMPTY_BODY = {}; private static final Request REQUEST = Request.create(GET, EMPTY, Map.of(), EMPTY_BODY, UTF_8, null); private static final RetryableException EXCEPTION = new RetryableException( - 500, "", GET, new FeignException.InternalServerError("test", REQUEST, EMPTY_BODY, Collections.emptyMap()), (Long) null, REQUEST + 500, "", GET, new FeignException.InternalServerError("test", REQUEST, EMPTY_BODY, + Collections.emptyMap()), (Long) null, REQUEST ); @Test diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/cafcass/CafcassNotificationServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/cafcass/CafcassNotificationServiceTest.java index 466f752de38..0ec2b887d61 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/cafcass/CafcassNotificationServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/cafcass/CafcassNotificationServiceTest.java @@ -159,8 +159,7 @@ void setUp() { } @ParameterizedTest - @CsvSource({"true, William|FM1234|12345|ORDER|18/05/2022", - "false, Court Ref. FM1234.- new order"}) + @CsvSource({"true, William|FM1234|12345|ORDER|18/05/2022", "false, Court Ref. FM1234.- new order"}) void shouldNotifyOrderRequest(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForOrder()).thenReturn(RECIPIENT_EMAIL); @@ -193,8 +192,7 @@ void shouldNotifyOrderRequest(boolean flag, String subject) { } @ParameterizedTest - @CsvSource({"true, William|FM1234|12345|ORDER|16/05/2022 10:30|18/05/2022", - "false, Court Ref. FM1234.- new order"}) + @CsvSource({"true, William|FM1234|12345|ORDER|16/05/2022 10:30|18/05/2022", "false, Court Ref. FM1234.- new order"}) void shouldNotifyOrderRequestWithHearingSelected(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForOrder()).thenReturn(RECIPIENT_EMAIL); @@ -233,7 +231,7 @@ void shouldNotifyOrderRequestWithHearingSelected(boolean flag, String subject) { @ParameterizedTest @CsvSource({"true, William|FM1234|12345|APPLICATION", - "false, 'Urgent application – same day hearing, Oliver Wright'"}) + "false, 'Urgent application – same day hearing, Oliver Wright'"}) void shouldNotifyUrgentNewApplicationRequest(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForNewApplication()).thenReturn(RECIPIENT_EMAIL); @@ -280,8 +278,7 @@ void shouldNotifyUrgentNewApplicationRequest(boolean flag, String subject) { } @ParameterizedTest - @CsvSource({"true, William|FM1234|12345|APPLICATION", - "false, 'Application received, Oliver Wright'"}) + @CsvSource({"true, William|FM1234|12345|APPLICATION","false, 'Application received, Oliver Wright'"}) void shouldNotifyNewApplicationRequestWhenNoTimeFramePresent(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForNewApplication()).thenReturn(RECIPIENT_EMAIL); @@ -326,7 +323,7 @@ void shouldNotifyNewApplicationRequestWhenNoTimeFramePresent(boolean flag, Strin @ParameterizedTest @CsvSource({"true, William|FM1234|12345|APPLICATION", - "false, 'Application received – hearing within 7 days, Oliver Wright'"}) + "false, 'Application received – hearing within 7 days, Oliver Wright'"}) void shouldNotifyNonUrgentNewApplicationRequest(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForNewApplication()).thenReturn(RECIPIENT_EMAIL); @@ -370,8 +367,7 @@ void shouldNotifyNonUrgentNewApplicationRequest(boolean flag, String subject) { } @ParameterizedTest - @CsvSource({"true, William|FM1234|12345|BUNDLE", - "false, 'Court Ref. FM1234.- new court bundle'"}) + @CsvSource({"true, William|FM1234|12345|BUNDLE", "false, 'Court Ref. FM1234.- new court bundle'"}) void shouldNotifyCourtBundle(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForCourtBundle()).thenReturn(RECIPIENT_EMAIL); @@ -404,7 +400,7 @@ void shouldNotifyCourtBundle(boolean flag, String subject) { @ParameterizedTest @CsvSource({"true, William|FM1234|12345|REPORTING TO COURT", - "false, 'Court Ref. FM1234.- Further documents for main application'"}) + "false, 'Court Ref. FM1234.- Further documents for main application'"}) void shouldNotifyNewDocument(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForNewDocument()).thenReturn(RECIPIENT_EMAIL); @@ -441,7 +437,7 @@ void shouldNotifyNewDocument(boolean flag, String subject) { @ParameterizedTest @CsvSource({"true, William|FM1234|12345|COURT PAPER", - "false, 'Court Ref. FM1234.- Further documents for main application'"}) + "false, 'Court Ref. FM1234.- Further documents for main application'"}) void shouldNotifyDuplicateNewDocumentsAreUploaded(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForNewDocument()).thenReturn(RECIPIENT_EMAIL); @@ -485,8 +481,7 @@ void shouldNotifyDuplicateNewDocumentsAreUploaded(boolean flag, String subject) } @ParameterizedTest - @CsvSource({"true, William|FM1234|12345|EXPERT", - "false, 'Court Ref. FM1234.- additional documents'"}) + @CsvSource({"true, William|FM1234|12345|EXPERT","false, 'Court Ref. FM1234.- additional documents'"}) void shouldNotifyAdditionalDocument(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForAdditionlDocument()).thenReturn(RECIPIENT_EMAIL); @@ -519,8 +514,7 @@ void shouldNotifyAdditionalDocument(boolean flag, String subject) { } @ParameterizedTest - @CsvSource({"true, 'Court Ref. FM1234.- '", - "false, 'Court Ref. FM1234.- '"}) + @CsvSource({"true, 'Court Ref. FM1234.- '", "false, 'Court Ref. FM1234.- '"}) void shouldNotifyAdditionalDocumentWithBlankSujbectWhenNoDocumentsPresent(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForAdditionlDocument()).thenReturn(RECIPIENT_EMAIL); @@ -545,7 +539,7 @@ void shouldNotifyAdditionalDocumentWithBlankSujbectWhenNoDocumentsPresent(boolea @ParameterizedTest @CsvSource({"true, William|FM1234|12345|ORDER|20/04/2050 11:30", - "false, 'Court Ref. FM1234.- New case management hearing Oliver Wright - notice of hearing'"}) + "false, 'Court Ref. FM1234.- New case management hearing Oliver Wright - notice of hearing'"}) void shouldNotifyNoficeOfHearing(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); when(configuration.getRecipientForNoticeOfHearing()).thenReturn(RECIPIENT_EMAIL); @@ -695,8 +689,7 @@ void shouldNotifyChangeOfAddressOfRespondents() { } @ParameterizedTest - @CsvSource({"true, William|FM1234|12345|EXPERT", - "false, 'Court Ref. FM1234.- additional documents'"}) + @CsvSource({"true, William|FM1234|12345|EXPERT", "false, 'Court Ref. FM1234.- additional documents'"}) void shouldNotifyWithAttachmentAndLinkWhenThereIsSmallAndLargeDocs(boolean flag, String subject) { when(featureToggleService.isCafcassSubjectCategorised()).thenReturn(flag); String caseLink = "http://localhost:8080/cases/case-details/200"; diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/FeeServiceTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/FeeServiceTest.java index 7572df9424e..1f0ba8354ea 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/FeeServiceTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/payment/FeeServiceTest.java @@ -102,7 +102,8 @@ void shouldGetAFeeResponseWhenGivenAPopulated() { void shouldPropagateExceptionWhenThereIsAnErrorInTheResponse() { when(feesRegisterApi.findFee(anyString(), anyString(), anyString(), anyString(), anyString(), anyString())) .thenThrow(new FeignException.BadRequest( - "", Request.create(GET, EMPTY, Map.of(), new byte[]{}, UTF_8, null), new byte[]{}, Collections.emptyMap()) + "", Request.create(GET, EMPTY, Map.of(), new byte[]{}, UTF_8, null), + new byte[]{}, Collections.emptyMap()) ); List feeTypes = List.of(CARE_ORDER); @@ -199,7 +200,8 @@ void setup() { void shouldPropagateExceptionWhenThereIsAnErrorInTheResponse() { when(feesRegisterApi.findFee(anyString(), anyString(), anyString(), anyString(), anyString(), anyString())) .thenThrow(new FeignException.BadRequest( - "", Request.create(GET, EMPTY, Map.of(), new byte[]{}, UTF_8, null), new byte[]{}, Collections.emptyMap()) + "", Request.create(GET, EMPTY, Map.of(), new byte[]{}, UTF_8, null), + new byte[]{}, Collections.emptyMap()) ); Orders orders = Orders.builder() From b4d0097aed4820a930e0c8a887f06b9e38b2924f Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Mon, 20 May 2024 14:29:36 +0100 Subject: [PATCH 046/105] add logback imports --- service/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index 84774fd6d15..c67a6996433 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -322,6 +322,8 @@ dependencies { implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: versions.log4j implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: versions.pdfbox implementation group: 'org.bitbucket.b_c', name: 'jose4j', version: '0.9.6' + implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13' + implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.13' implementation group: 'org.apache.httpcomponents.client5', name: 'httpclient5', version:'5.2.3' implementation group: 'org.apache.commons', name: 'commons-text', version: '1.11.0' @@ -521,6 +523,5 @@ configurations { exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j' exclude group: 'org.apache.logging.log4j', module: 'log4j-api' exclude group: 'org.apache.logging.log4j', module: 'log4j-core' - } } From 02fbe32609ae010c626d2956e8c0c7b8c849e9fd Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 22 May 2024 17:01:39 +0100 Subject: [PATCH 047/105] Upgrade fortify-client - needed to fix issue with conflicting definition of LoggerFactory --- service/build.gradle | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/service/build.gradle b/service/build.gradle index c67a6996433..7df4d19ff1e 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -16,7 +16,7 @@ plugins { id 'application' id 'checkstyle' id 'jacoco' - id 'io.spring.dependency-management' version '1.1.3' + id 'io.spring.dependency-management' version '1.1.5' id 'org.springframework.boot' version '3.2.4' id 'com.github.ben-manes.versions' version '0.51.0' id 'org.sonarqube' version '5.0.0.4638' @@ -285,6 +285,7 @@ def versions = [ reformLogging : '5.1.7', springBoot : springBoot.class.package.implementationVersion, log4j : '2.23.1', + logbackVersion : '1.5.6', jackson : '2.15.4', pdfbox : '2.0.29', mockito : '5.2.0', @@ -317,13 +318,8 @@ dependencies { implementation group: 'org.springframework.security', name: 'spring-security-crypto', version: '6.2.3' implementation group: 'org.springframework.security', name: 'spring-security-web', version: '6.2.3' implementation group: 'org.springframework.security', name: 'spring-security-oauth2-core', version: '6.2.3' - implementation group: 'org.springframework.boot', name: 'spring-boot-starter-logging', version: '2.7.18' - implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: versions.log4j - implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: versions.log4j implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: versions.pdfbox implementation group: 'org.bitbucket.b_c', name: 'jose4j', version: '0.9.6' - implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13' - implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.13' implementation group: 'org.apache.httpcomponents.client5', name: 'httpclient5', version:'5.2.3' implementation group: 'org.apache.commons', name: 'commons-text', version: '1.11.0' @@ -366,6 +362,14 @@ dependencies { implementation 'jakarta.servlet:jakarta.servlet-api:5.0.0' + implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: '6.1.4' + + implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: versions.log4j + implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: versions.log4j + implementation group: 'ch.qos.logback', name: 'logback-classic', version: versions.logbackVersion + implementation group: 'ch.qos.logback', name: 'logback-core', version: versions.logbackVersion + + testImplementation group: 'org.pitest', name: 'pitest', version: '1.15.3' testImplementation group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.15.0' testImplementation group: 'org.pitest', name: 'pitest-junit5-plugin', version: '1.2.1' @@ -389,8 +393,9 @@ dependencies { testImplementation group: 'org.mockito', name: 'mockito-inline', version: versions.mockito // Fortify client for Fortify scans - testImplementation 'com.github.hmcts:fortify-client:1.2.0:all' + testImplementation 'com.github.hmcts:fortify-client:1.4.1' + testImplementation 'org.springframework.boot:spring-boot-starter-test' functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-core', version: versions.serenity functionalTestImplementation group: 'net.serenity-bdd', name: 'serenity-junit', version: versions.serenity @@ -516,12 +521,3 @@ bootWithCCD { environment 'MANAGE_CASE_S2S_AUTHORISED_SERVICES', 'ccd_gw,xui_webapp,ccd_data,fpl_case_service' } } - -configurations { - all { - exclude group: 'org.slf4j', module: 'slf4j-nop' - exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j' - exclude group: 'org.apache.logging.log4j', module: 'log4j-api' - exclude group: 'org.apache.logging.log4j', module: 'log4j-core' - } -} From 039a28f5e63477681b2d2f47a30eec6ba7f9377c Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 23 May 2024 10:30:30 +0100 Subject: [PATCH 048/105] Fix test failures. --- .../removeorder/DraftCMORemovalActionTest.java | 11 +++++------ .../removeorder/DraftOrderRemovalActionTest.java | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/removeorder/DraftCMORemovalActionTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/removeorder/DraftCMORemovalActionTest.java index 8b87f9d181d..afc6f2fd24c 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/removeorder/DraftCMORemovalActionTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/removeorder/DraftCMORemovalActionTest.java @@ -532,9 +532,8 @@ void shouldThrowAnExceptionIfHearingOrderBundleContainingRemovedCMOCannotBeFound .build()); assertThatThrownBy(() -> underTest.remove(caseData, caseDetailsMap, TO_REMOVE_ORDER_ID, draftCMO)) - .usingRecursiveComparison() - .isEqualTo(new IllegalStateException(format("Failed to find hearing order bundle that contains order %s", - TO_REMOVE_ORDER_ID))); + .isInstanceOf(IllegalStateException.class) + .hasMessage(format("Failed to find hearing order bundle that contains order %s", TO_REMOVE_ORDER_ID)); } @Test @@ -549,9 +548,9 @@ void shouldThrowAnExceptionIfDraftUploadedCMOContainingRemovedCMOCannotBeFound() CaseDetailsMap caseDetailsMap = caseDetailsMap(CaseDetails.builder().data(Map.of()).build()); assertThatThrownBy(() -> underTest.remove(caseData, caseDetailsMap, TO_REMOVE_ORDER_ID, draftCMO)) - .usingRecursiveComparison() - .isEqualTo(new IllegalStateException(format("Failed to find hearing order that contains order %s", - TO_REMOVE_ORDER_ID))); + .isInstanceOf(IllegalStateException.class) + .hasMessage(format("Failed to find hearing order that contains order %s", + TO_REMOVE_ORDER_ID)); } @Test diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/removeorder/DraftOrderRemovalActionTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/removeorder/DraftOrderRemovalActionTest.java index aa1abe50f48..30f3eaa5144 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/removeorder/DraftOrderRemovalActionTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/removeorder/DraftOrderRemovalActionTest.java @@ -113,9 +113,9 @@ void shouldThrowAnExceptionIfHearingOrderBundleContainingDraftOrderToRemoveCanno .build()); assertThatThrownBy(() -> underTest.remove(caseData, caseDetailsMap, ORDER_TO_REMOVE_ID, draftOrder.getValue())) - .usingRecursiveComparison() - .isEqualTo(new IllegalStateException(format("Failed to find hearing order bundle that contains order %s", - ORDER_TO_REMOVE_ID))); + .isInstanceOf(IllegalStateException.class) + .hasMessage(format("Failed to find hearing order bundle that contains order %s", + ORDER_TO_REMOVE_ID)); } @Test From 3447d56d82d95615e80d40c2edeeb3279b549010 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 23 May 2024 14:06:20 +0100 Subject: [PATCH 049/105] Remove redundant @Qualifier for quality gate checks. --- .../uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java | 1 - 1 file changed, 1 deletion(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java index cc65ab02a9f..a40c64837ce 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java @@ -21,7 +21,6 @@ public RestTemplate restTemplate() { } @Bean - @Qualifier("userTokenParserHttpClient") public CloseableHttpClient userTokenParserHttpClient() { RequestConfig config = RequestConfig.custom() .setConnectTimeout(Timeout.ofMilliseconds(10000)) From 3280a0c1579dcb3e4cf18ee47ff9f45f6fe0ffb8 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 23 May 2024 14:17:59 +0100 Subject: [PATCH 050/105] Remove usused import. --- .../uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java | 1 - 1 file changed, 1 deletion(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java index a40c64837ce..9940b6ce9bc 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/HttpClientConfiguration.java @@ -4,7 +4,6 @@ import org.apache.hc.client5.http.impl.classic.HttpClients; import org.apache.hc.client5.http.config.RequestConfig; import org.apache.hc.core5.util.Timeout; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; From e298f0e5ebe2f5003e5e86d4b827e83774ba53c4 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 28 May 2024 14:35:36 +0100 Subject: [PATCH 051/105] Add RD properties to fix failing pact tests. --- .../ReferenceDataOrganisationalExternalUsersConsumerTest.java | 3 ++- .../ReferenceDataOrganisationalInternalUsersConsumerTest.java | 3 ++- .../ReferenceDataProfessionalExternalUsersConsumerTest.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataOrganisationalExternalUsersConsumerTest.java b/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataOrganisationalExternalUsersConsumerTest.java index 6edd6608681..64d2a10f5b9 100644 --- a/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataOrganisationalExternalUsersConsumerTest.java +++ b/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataOrganisationalExternalUsersConsumerTest.java @@ -15,7 +15,8 @@ @PactTestFor(providerName = "referenceData_organisationalExternalUsers", port = "8892") @TestPropertySource( - properties = "rd_professional.api.url=localhost:8892") + properties = {"rd_professional.api.url=localhost:8892", "rd_judicial.api.url=localhost:8893", + "rd_staff.api.url=localhost:8894"}) public class ReferenceDataOrganisationalExternalUsersConsumerTest extends ReferenceDataConsumerTestBase { diff --git a/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataOrganisationalInternalUsersConsumerTest.java b/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataOrganisationalInternalUsersConsumerTest.java index 13888707e63..b268d3a7279 100644 --- a/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataOrganisationalInternalUsersConsumerTest.java +++ b/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataOrganisationalInternalUsersConsumerTest.java @@ -15,7 +15,8 @@ @PactTestFor(providerName = "referenceData_organisationalInternal", port = "8894") @TestPropertySource( - properties = "rd_professional.api.url=localhost:8894") + properties = {"rd_professional.api.url=localhost:8894", "rd_judicial.api.url=localhost:8895", + "rd_staff.api.url=localhost:8896"}) public class ReferenceDataOrganisationalInternalUsersConsumerTest extends ReferenceDataConsumerTestBase { @Pact(provider = "referenceData_organisationalInternal", consumer = "fpl_ccdConfiguration") diff --git a/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataProfessionalExternalUsersConsumerTest.java b/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataProfessionalExternalUsersConsumerTest.java index 87216abee2f..3fa5508e60b 100644 --- a/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataProfessionalExternalUsersConsumerTest.java +++ b/service/src/contractTest/java/uk/gov/hmcts/reform/rd/client/ReferenceDataProfessionalExternalUsersConsumerTest.java @@ -19,7 +19,8 @@ @PactTestFor(providerName = "referenceData_professionalExternalUsers", port = "8892") @TestPropertySource( - properties = "rd_professional.api.url=localhost:8892") + properties = {"rd_professional.api.url=localhost:8892", "rd_judicial.api.url=localhost:8893", + "rd_staff.api.url=localhost:8894"}) public class ReferenceDataProfessionalExternalUsersConsumerTest extends ReferenceDataConsumerTestBase { private static final String USER_EMAIL = "UserEmail"; From 1c25bc8392a1b41df44055f0e95170b2c07bc152 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 28 May 2024 15:23:20 +0100 Subject: [PATCH 052/105] Update main.tf to latest version on master --- infrastructure/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/main.tf b/infrastructure/main.tf index 26d7aad2fe0..558c2673ea6 100644 --- a/infrastructure/main.tf +++ b/infrastructure/main.tf @@ -2,11 +2,11 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "3.97.1" + version = "3.103.1" } azuread = { source = "hashicorp/azuread" - version = "2.47.0" + version = "2.49.1" } } } From 1876274c08be15bba5ee69faa393f5e50941d861 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 29 May 2024 11:30:30 +0100 Subject: [PATCH 053/105] FIx StringUtils import --- .../uk/gov/hmcts/reform/fpl/model/ConfidentialOrderBundle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ConfidentialOrderBundle.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ConfidentialOrderBundle.java index 4eca72396ec..3a1d2bc0c70 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ConfidentialOrderBundle.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/model/ConfidentialOrderBundle.java @@ -1,7 +1,7 @@ package uk.gov.hmcts.reform.fpl.model; import com.fasterxml.jackson.annotation.JsonIgnore; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import uk.gov.hmcts.reform.fpl.model.common.Element; import java.lang.reflect.InvocationTargetException; From 23ba4e7453e6af3041fc17e4f29aa952b11b46a3 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 29 May 2024 11:56:07 +0100 Subject: [PATCH 054/105] Remove IsStateMigratable (already removed in master) --- .../interfaces/IsStateMigratable.java | 20 -------------- .../IsStateMigratableValidator.java | 27 ------------------- 2 files changed, 47 deletions(-) delete mode 100644 service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsStateMigratable.java delete mode 100644 service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsStateMigratableValidator.java diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsStateMigratable.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsStateMigratable.java deleted file mode 100644 index f52775f032c..00000000000 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/interfaces/IsStateMigratable.java +++ /dev/null @@ -1,20 +0,0 @@ -package uk.gov.hmcts.reform.fpl.validation.interfaces; - -import jakarta.validation.Constraint; -import jakarta.validation.Payload; -import uk.gov.hmcts.reform.fpl.validation.validators.IsStateMigratableValidator; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Constraint(validatedBy = { IsStateMigratableValidator.class }) -public @interface IsStateMigratable { - String message() default "Final orders have been issued in this case. You must remove the relevant orders before" - + " changing the case state."; - Class[] groups() default {}; - Class[] payload() default {}; -} diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsStateMigratableValidator.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsStateMigratableValidator.java deleted file mode 100644 index f68f394171e..00000000000 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/validation/validators/IsStateMigratableValidator.java +++ /dev/null @@ -1,27 +0,0 @@ -package uk.gov.hmcts.reform.fpl.validation.validators; - -import jakarta.validation.ConstraintValidator; -import jakarta.validation.ConstraintValidatorContext; -import uk.gov.hmcts.reform.fpl.model.CaseData; -import uk.gov.hmcts.reform.fpl.model.Child; -import uk.gov.hmcts.reform.fpl.model.common.Element; -import uk.gov.hmcts.reform.fpl.validation.interfaces.IsStateMigratable; - -import static uk.gov.hmcts.reform.fpl.enums.State.CLOSED; - -public class IsStateMigratableValidator implements ConstraintValidator { - @Override - public boolean isValid(CaseData caseData, ConstraintValidatorContext constraintValidatorContext) { - if (CLOSED.equals(caseData.getState()) && caseData.getChildren1() != null) { - return caseData.getChildren1().stream() - .map(Element::getValue) - .noneMatch(this::hasFinalFields); - } - - return true; - } - - private boolean hasFinalFields(Child child) { - return child.getFinalOrderIssuedType() != null || "Yes".equals(child.getFinalOrderIssued()); - } -} From c55521d52c73c463eabb5263e066e9e364412ed7 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 29 May 2024 13:52:57 +0100 Subject: [PATCH 055/105] Add reference to authorisation feign client. --- service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java index 24fd91f1fe3..4c97eb53673 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java @@ -15,7 +15,8 @@ "uk.gov.hmcts.reform.calendar.client", "uk.gov.hmcts.reform.aac.client", "uk.gov.hmcts.reform.am.client", - "uk.gov.hmcts.reform.ccd.client" + "uk.gov.hmcts.reform.ccd.client", + "uk.gov.hmcts.reform.authorisation" }) @EnableRetry @EnableAsync From 74ba7e07129e994c82c9bfca934173af03bb9a9a Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 29 May 2024 15:47:28 +0100 Subject: [PATCH 056/105] Add idamclient to component scan and upgrade its version. --- service/build.gradle | 2 +- .../src/main/java/uk/gov/hmcts/reform/fpl/Application.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/service/build.gradle b/service/build.gradle index 3c6b80c5339..4c3e47d404f 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -339,7 +339,7 @@ dependencies { implementation group: 'uk.gov.hmcts.reform', name: 'logging', version: versions.reformLogging implementation group: 'uk.gov.hmcts.reform', name: 'logging-appinsights', version: versions.reformLogging implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5' - implementation group: 'uk.gov.hmcts.reform', name: 'idam-client', version: '2.0.0' + implementation group: 'uk.gov.hmcts.reform', name: 'idam-client', version: '3.0.3' implementation group: 'com.github.hmcts', name: 'document-management-client', version: '7.0.1' implementation group: 'uk.gov.hmcts.reform', name: 'core-case-data-store-client', version: '4.7.6' implementation group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: '4.0.0' diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java index 4c97eb53673..39d4914f88e 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java @@ -7,7 +7,7 @@ import org.springframework.retry.annotation.EnableRetry; import org.springframework.scheduling.annotation.EnableAsync; -@SpringBootApplication(scanBasePackages = "uk.gov.hmcts.reform.fpl") +@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl", "uk.gov.hmcts.reform.idam.client"}) @EnableFeignClients(basePackages = { "uk.gov.hmcts.reform.idam.client", "uk.gov.hmcts.reform.rd.client", @@ -16,7 +16,8 @@ "uk.gov.hmcts.reform.aac.client", "uk.gov.hmcts.reform.am.client", "uk.gov.hmcts.reform.ccd.client", - "uk.gov.hmcts.reform.authorisation" + "uk.gov.hmcts.reform.authorisation", + "uk.gov.hmcts.reform.document" }) @EnableRetry @EnableAsync From fd3230c2fc9b579655b77e3f5c4fa5780ceceff1 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 29 May 2024 15:50:39 +0100 Subject: [PATCH 057/105] Revert idam upgrade. --- service/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index 4c3e47d404f..3c6b80c5339 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -339,7 +339,7 @@ dependencies { implementation group: 'uk.gov.hmcts.reform', name: 'logging', version: versions.reformLogging implementation group: 'uk.gov.hmcts.reform', name: 'logging-appinsights', version: versions.reformLogging implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5' - implementation group: 'uk.gov.hmcts.reform', name: 'idam-client', version: '3.0.3' + implementation group: 'uk.gov.hmcts.reform', name: 'idam-client', version: '2.0.0' implementation group: 'com.github.hmcts', name: 'document-management-client', version: '7.0.1' implementation group: 'uk.gov.hmcts.reform', name: 'core-case-data-store-client', version: '4.7.6' implementation group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: '4.0.0' From 462dbed3e06bcd939b18a7cd72e8790f042de7ac Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 29 May 2024 16:27:05 +0100 Subject: [PATCH 058/105] Add feign client path --- service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java index 39d4914f88e..2ab445a3b3e 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java @@ -17,7 +17,8 @@ "uk.gov.hmcts.reform.am.client", "uk.gov.hmcts.reform.ccd.client", "uk.gov.hmcts.reform.authorisation", - "uk.gov.hmcts.reform.document" + "uk.gov.hmcts.reform.document", + "uk.gov.hmcts.reform.ccd.document.am" }) @EnableRetry @EnableAsync From 57a8bdc49bb3179907343fb12225e5eee1342e02 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 30 May 2024 11:16:09 +0100 Subject: [PATCH 059/105] Adding back @ComponentScan notification to check if this fixes pipeline. --- .../uk/gov/hmcts/reform/fpl/Application.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java index 2ab445a3b3e..907b0a7ac29 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java @@ -4,10 +4,31 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.ComponentScan; import org.springframework.retry.annotation.EnableRetry; import org.springframework.scheduling.annotation.EnableAsync; -@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl", "uk.gov.hmcts.reform.idam.client"}) +//@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl", "uk.gov.hmcts.reform.idam.client", +// "uk.gov.hmcts.reform.document"}) +//@EnableFeignClients(basePackages = { +// "uk.gov.hmcts.reform.idam.client", +// "uk.gov.hmcts.reform.rd.client", +// "uk.gov.hmcts.reform.fnp.client", +// "uk.gov.hmcts.reform.calendar.client", +// "uk.gov.hmcts.reform.aac.client", +// "uk.gov.hmcts.reform.am.client", +// "uk.gov.hmcts.reform.ccd.client", +// "uk.gov.hmcts.reform.authorisation", +// "uk.gov.hmcts.reform.document", +// "uk.gov.hmcts.reform.ccd.document" +//}) +//@EnableRetry +//@EnableAsync +//@EnableCaching + + + +@SpringBootApplication @EnableFeignClients(basePackages = { "uk.gov.hmcts.reform.idam.client", "uk.gov.hmcts.reform.rd.client", @@ -18,8 +39,9 @@ "uk.gov.hmcts.reform.ccd.client", "uk.gov.hmcts.reform.authorisation", "uk.gov.hmcts.reform.document", - "uk.gov.hmcts.reform.ccd.document.am" + "uk.gov.hmcts.reform.ccd.document" }) +@ComponentScan @EnableRetry @EnableAsync @EnableCaching From 5bad4e5aec2cc0ee3dfe992e9583a83da5839d4f Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 30 May 2024 16:04:42 +0100 Subject: [PATCH 060/105] Update list of base packages to scan. --- .../uk/gov/hmcts/reform/fpl/Application.java | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java index 907b0a7ac29..b4293098139 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java @@ -4,31 +4,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.context.annotation.ComponentScan; import org.springframework.retry.annotation.EnableRetry; import org.springframework.scheduling.annotation.EnableAsync; -//@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl", "uk.gov.hmcts.reform.idam.client", -// "uk.gov.hmcts.reform.document"}) -//@EnableFeignClients(basePackages = { -// "uk.gov.hmcts.reform.idam.client", -// "uk.gov.hmcts.reform.rd.client", -// "uk.gov.hmcts.reform.fnp.client", -// "uk.gov.hmcts.reform.calendar.client", -// "uk.gov.hmcts.reform.aac.client", -// "uk.gov.hmcts.reform.am.client", -// "uk.gov.hmcts.reform.ccd.client", -// "uk.gov.hmcts.reform.authorisation", -// "uk.gov.hmcts.reform.document", -// "uk.gov.hmcts.reform.ccd.document" -//}) -//@EnableRetry -//@EnableAsync -//@EnableCaching - - - -@SpringBootApplication +@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl", "uk.gov.hmcts.reform.idam.client", + "uk.gov.hmcts.reform.document"}) @EnableFeignClients(basePackages = { "uk.gov.hmcts.reform.idam.client", "uk.gov.hmcts.reform.rd.client", @@ -41,7 +21,6 @@ "uk.gov.hmcts.reform.document", "uk.gov.hmcts.reform.ccd.document" }) -@ComponentScan @EnableRetry @EnableAsync @EnableCaching From f0ff0d96097ceda5983a437d65961ab026404cf6 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 30 May 2024 16:39:21 +0100 Subject: [PATCH 061/105] Fixing failing test --- .../src/main/java/uk/gov/hmcts/reform/fpl/Application.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java index b4293098139..39d4914f88e 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java @@ -7,8 +7,7 @@ import org.springframework.retry.annotation.EnableRetry; import org.springframework.scheduling.annotation.EnableAsync; -@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl", "uk.gov.hmcts.reform.idam.client", - "uk.gov.hmcts.reform.document"}) +@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl", "uk.gov.hmcts.reform.idam.client"}) @EnableFeignClients(basePackages = { "uk.gov.hmcts.reform.idam.client", "uk.gov.hmcts.reform.rd.client", @@ -18,8 +17,7 @@ "uk.gov.hmcts.reform.am.client", "uk.gov.hmcts.reform.ccd.client", "uk.gov.hmcts.reform.authorisation", - "uk.gov.hmcts.reform.document", - "uk.gov.hmcts.reform.ccd.document" + "uk.gov.hmcts.reform.document" }) @EnableRetry @EnableAsync From ce1d60e44820296c726b69228ee6a9a4ff6ecd4e Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 30 May 2024 17:04:38 +0100 Subject: [PATCH 062/105] Update base packages for component scan --- service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java index 39d4914f88e..2ab445a3b3e 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java @@ -17,7 +17,8 @@ "uk.gov.hmcts.reform.am.client", "uk.gov.hmcts.reform.ccd.client", "uk.gov.hmcts.reform.authorisation", - "uk.gov.hmcts.reform.document" + "uk.gov.hmcts.reform.document", + "uk.gov.hmcts.reform.ccd.document.am" }) @EnableRetry @EnableAsync From 5eb549cfae4b5ba098c8dad8fbd6bccb3ba00e18 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Fri, 31 May 2024 09:24:29 +0100 Subject: [PATCH 063/105] Update base packages for component scan --- service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java index 2ab445a3b3e..7b9f0d1d69d 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java @@ -7,7 +7,8 @@ import org.springframework.retry.annotation.EnableRetry; import org.springframework.scheduling.annotation.EnableAsync; -@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl", "uk.gov.hmcts.reform.idam.client"}) +@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl", "uk.gov.hmcts.reform.idam.client", + "uk.gov.hmcts.reform.document"}) @EnableFeignClients(basePackages = { "uk.gov.hmcts.reform.idam.client", "uk.gov.hmcts.reform.rd.client", From e74be00780e3d077bb1ddba89710a99b607dff4b Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Fri, 31 May 2024 11:03:33 +0100 Subject: [PATCH 064/105] Update base packages for component scan --- .../main/java/uk/gov/hmcts/reform/fpl/Application.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java index 7b9f0d1d69d..3967c362944 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/Application.java @@ -6,9 +6,11 @@ import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.retry.annotation.EnableRetry; import org.springframework.scheduling.annotation.EnableAsync; +import uk.gov.hmcts.reform.document.DocumentUploadClientApi; +import uk.gov.hmcts.reform.idam.client.IdamClient; -@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl", "uk.gov.hmcts.reform.idam.client", - "uk.gov.hmcts.reform.document"}) +@SpringBootApplication(scanBasePackages = {"uk.gov.hmcts.reform.fpl"}, + scanBasePackageClasses = {DocumentUploadClientApi.class, IdamClient.class}) @EnableFeignClients(basePackages = { "uk.gov.hmcts.reform.idam.client", "uk.gov.hmcts.reform.rd.client", @@ -18,9 +20,7 @@ "uk.gov.hmcts.reform.am.client", "uk.gov.hmcts.reform.ccd.client", "uk.gov.hmcts.reform.authorisation", - "uk.gov.hmcts.reform.document", - "uk.gov.hmcts.reform.ccd.document.am" -}) + "uk.gov.hmcts.reform.ccd.document.am.feign"}) @EnableRetry @EnableAsync @EnableCaching From 3fcef1dbe3bf2edb17c545cc64645ce5d024dff3 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Mon, 3 Jun 2024 11:56:13 +0100 Subject: [PATCH 065/105] Dummy commit. --- e2e/tests/smoke_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/tests/smoke_test.js b/e2e/tests/smoke_test.js index b139122842a..fa5766c674a 100644 --- a/e2e/tests/smoke_test.js +++ b/e2e/tests/smoke_test.js @@ -6,7 +6,7 @@ const output = require('codeceptjs').output; Feature('Smoke tests @smoke-tests @fixed'); Scenario( - 'Sign in as local authority and create a case', + 'Sign in as Local Authority and create a case', async ({ I, caseListPage }) => { output.print('Smoke test triggered'); await I.goToPage(config.baseUrl, config.newSwanseaLocalAuthorityUserOne); From 03e356ac607bcfc9ea1ad254e5c595dd49c3b44b Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Mon, 10 Jun 2024 12:26:40 +0100 Subject: [PATCH 066/105] Tidy up build.gradle --- service/build.gradle | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/service/build.gradle b/service/build.gradle index 3c6b80c5339..a4083262d4a 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -23,7 +23,7 @@ plugins { id 'project-report' id 'idea' id 'info.solidsoft.pitest' version '1.15.0' - id 'com.github.hmcts.rse-cft-lib' version '0.19.1236' + id 'com.github.hmcts.rse-cft-lib' version '0.19.1253' } apply plugin: 'org.springframework.boot' @@ -306,21 +306,15 @@ dependencies { implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-quartz' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator' + implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop' implementation group: 'org.springframework.retry', name: 'spring-retry' + implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose', version: '6.2.3' + implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail' - implementation group: 'org.springframework.security', name: 'spring-security-config', version: '6.2.3' - implementation group: 'org.springframework.security', name: 'spring-security-oauth2-resource-server', version: '6.2.3' - implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose', version: '6.2.3' - implementation group: 'org.springframework.security', name: 'spring-security-core', version: '6.2.3' - implementation group: 'org.springframework.security', name: 'spring-security-crypto', version: '6.2.3' - implementation group: 'org.springframework.security', name: 'spring-security-web', version: '6.2.3' - implementation group: 'org.springframework.security', name: 'spring-security-oauth2-core', version: '6.2.3' implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: versions.pdfbox - implementation group: 'org.bitbucket.b_c', name: 'jose4j', version: '0.9.6' - implementation group: 'org.apache.httpcomponents.client5', name: 'httpclient5', version:'5.2.3' implementation group: 'org.apache.commons', name: 'commons-text', version: '1.11.0' implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.10.0' @@ -330,16 +324,13 @@ dependencies { implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '5.10.9' - implementation group: 'io.github.openfeign', name: 'feign-core', version: '13.2' - implementation group: 'org.yaml', name: 'snakeyaml', version: '2.2' - implementation group: 'org.postgresql', name: 'postgresql', version: '42.7.3' implementation group: 'org.flywaydb', name: 'flyway-core', version: '8.5.13' implementation group: 'uk.gov.hmcts.reform', name: 'properties-volume-spring-boot-starter', version: '0.1.0' implementation group: 'uk.gov.hmcts.reform', name: 'logging', version: versions.reformLogging implementation group: 'uk.gov.hmcts.reform', name: 'logging-appinsights', version: versions.reformLogging implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5' - implementation group: 'uk.gov.hmcts.reform', name: 'idam-client', version: '2.0.0' + implementation group: 'com.github.hmcts', name: 'idam-java-client', version: '3.0.3' implementation group: 'com.github.hmcts', name: 'document-management-client', version: '7.0.1' implementation group: 'uk.gov.hmcts.reform', name: 'core-case-data-store-client', version: '4.7.6' implementation group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: '4.0.0' @@ -350,19 +341,9 @@ dependencies { implementation group: 'com.github.hmcts', name: 'ccd-case-document-am-client', version: '1.7.3' implementation group: 'com.google.guava', name: 'guava', version: '33.1.0-jre' - implementation group: 'commons-io', name: 'commons-io', version: '2.16.1' - - implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-joda', version: '2.17.1' - implementation group: 'net.minidev', name: 'json-smart', version: '2.5.1' - - implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail' - - testImplementation group: 'org.pitest', name: 'pitest', version: '1.16.1' - implementation 'jakarta.servlet:jakarta.servlet-api:5.0.0' - implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: '6.1.4' implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: versions.log4j From d05b0e118e10d3566e762b497159bd8e364f20ea Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Mon, 10 Jun 2024 14:40:44 +0100 Subject: [PATCH 067/105] Add back dependency to fix security issue. --- service/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/service/build.gradle b/service/build.gradle index a4083262d4a..a75261f2d37 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -314,6 +314,7 @@ dependencies { implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail' + implementation group: 'org.bitbucket.b_c', name: 'jose4j', version: '0.9.6' implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: versions.pdfbox implementation group: 'org.apache.commons', name: 'commons-text', version: '1.11.0' From ca19ea1f1ddb7e67b218300ef9d225110e69ebd3 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Mon, 10 Jun 2024 15:22:05 +0100 Subject: [PATCH 068/105] Add back dependency to fix missing JWTDecoder bean --- service/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/service/build.gradle b/service/build.gradle index a75261f2d37..445074707f5 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -310,6 +310,7 @@ dependencies { implementation group: 'org.springframework.retry', name: 'spring-retry' implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose', version: '6.2.3' + implementation group: 'org.springframework.security', name: 'spring-security-oauth2-resource-server', version: '6.2.3' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail' From 7853e02b5fc24b39ae16111c802acfb3051e3a6e Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 11 Jun 2024 12:06:24 +0100 Subject: [PATCH 069/105] Upgrade to latest cftlib version for spring boot 3 compatibility. --- service/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index 445074707f5..ddcca77e259 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -23,7 +23,7 @@ plugins { id 'project-report' id 'idea' id 'info.solidsoft.pitest' version '1.15.0' - id 'com.github.hmcts.rse-cft-lib' version '0.19.1253' + id 'com.github.hmcts.rse-cft-lib' version '0.19.1262' } apply plugin: 'org.springframework.boot' From 7eb4f25698738946a3e166adb5dc72a163206242 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 11 Jun 2024 12:39:00 +0100 Subject: [PATCH 070/105] Exclude android json to avoid library conflict --- service/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/build.gradle b/service/build.gradle index ddcca77e259..6bbf4c6703d 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -505,3 +505,7 @@ bootWithCCD { environment 'MANAGE_CASE_S2S_AUTHORISED_SERVICES', 'ccd_gw,xui_webapp,ccd_data,fpl_case_service' } } + +configurations.all { + exclude group: 'com.vaadin.external.google', module: 'android-json' +} From e74db43c8b91e6ee7f362a6df5f526be8fa51193 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 13 Jun 2024 15:43:42 +0100 Subject: [PATCH 071/105] Resolve issue with functional tests. --- .../hmcts/reform/fpl/config/security/SecurityConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java index 8eba6a15eb3..858150fa4c7 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java @@ -63,7 +63,7 @@ public SecurityFilterChain roboticsSecurityFilterChain(HttpSecurity http) throws http .authorizeRequests(authorize -> authorize - .requestMatchers(HttpMethod.POST, "/sendRPAEmailByID/*", "/support/**/*") + .requestMatchers(HttpMethod.POST, "/sendRPAEmailByID/*", "/support/**") .authenticated()) .csrf(csrf -> csrf.disable()) .addFilter(authCheckerUserOnlyFilter); From b53faca73fe9ecad920f5651e69822911f16b813 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Mon, 17 Jun 2024 16:16:20 +0100 Subject: [PATCH 072/105] Update to use jakarta rather than javax for Resource --- .../gov/hmcts/reform/fpl/service/ccd/CoreCaseDataService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/ccd/CoreCaseDataService.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/ccd/CoreCaseDataService.java index d94722c128a..7d4eb22e3fd 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/service/ccd/CoreCaseDataService.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/service/ccd/CoreCaseDataService.java @@ -18,7 +18,7 @@ import uk.gov.hmcts.reform.fpl.service.SystemUserService; import uk.gov.hmcts.reform.fpl.utils.elasticsearch.MatchQuery; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import java.util.HashMap; import java.util.Map; import java.util.function.Function; From 10ee50d0602acec8aeb0d25302e7ac38519bcd8a Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 19 Jun 2024 11:19:54 +0100 Subject: [PATCH 073/105] Restore pdfbox version --- service/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index 6bbf4c6703d..c5d91d7af4b 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -287,7 +287,7 @@ def versions = [ log4j : '2.23.1', logbackVersion : '1.5.6', jackson : '2.15.4', - pdfbox : '2.0.29', + pdfbox : '2.0.31', mockito : '5.2.0', serenity : '4.1.6', pact_version : '4.1.7', From f9d6eeb02b0216571a984d49bbe54e68ddf02e7b Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Fri, 21 Jun 2024 15:16:39 +0100 Subject: [PATCH 074/105] Upgrade flywaydb version --- service/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index c5d91d7af4b..6c83d2f6e05 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -326,7 +326,7 @@ dependencies { implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '5.10.9' - implementation group: 'org.flywaydb', name: 'flyway-core', version: '8.5.13' + implementation group: 'org.flywaydb', name: 'flyway-core', version: '10.15.0' implementation group: 'uk.gov.hmcts.reform', name: 'properties-volume-spring-boot-starter', version: '0.1.0' implementation group: 'uk.gov.hmcts.reform', name: 'logging', version: versions.reformLogging From 5a3ce92026cce2deb5aca1d845c53395f01d93bb Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 26 Jun 2024 14:49:53 +0100 Subject: [PATCH 075/105] Dummy change --- e2e/tests/smoke_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/tests/smoke_test.js b/e2e/tests/smoke_test.js index fa5766c674a..0d55e518b81 100644 --- a/e2e/tests/smoke_test.js +++ b/e2e/tests/smoke_test.js @@ -8,7 +8,7 @@ Feature('Smoke tests @smoke-tests @fixed'); Scenario( 'Sign in as Local Authority and create a case', async ({ I, caseListPage }) => { - output.print('Smoke test triggered'); + output.print('Smoke test triggered NOW'); await I.goToPage(config.baseUrl, config.newSwanseaLocalAuthorityUserOne); const caseName = `Smoke test case (${moment().format('YYYY-MM-DD HH:MM')})`; const caseId = await I.createCaseSmokeTest( From 9b38331aaa18c246b6bc5e74a4e3231482862066 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 27 Jun 2024 15:30:15 +0100 Subject: [PATCH 076/105] Increase app insights agent version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6a14b01688d..909a3c9db6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG APP_INSIGHTS_AGENT_VERSION=3.4.12 +ARG APP_INSIGHTS_AGENT_VERSION=3.5.2 FROM hmctspublic.azurecr.io/base/java:17-distroless From 10b8de51fea13a8ae488c68ecef1f5b5d8bdcd31 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 27 Jun 2024 15:43:07 +0100 Subject: [PATCH 077/105] Increase app insights agent version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 909a3c9db6f..71617861649 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG APP_INSIGHTS_AGENT_VERSION=3.5.2 -FROM hmctspublic.azurecr.io/base/java:17-distroless +FROM hmctspublic.azurecr.io/base/java:21-distroless EXPOSE 4000 USER hmcts From 5fccec0e924941f67598c5630934d37025504d07 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 27 Jun 2024 16:28:06 +0100 Subject: [PATCH 078/105] Add app insights libraries --- service/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/build.gradle b/service/build.gradle index 6c83d2f6e05..ca58eb5a408 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -353,6 +353,8 @@ dependencies { implementation group: 'ch.qos.logback', name: 'logback-classic', version: versions.logbackVersion implementation group: 'ch.qos.logback', name: 'logback-core', version: versions.logbackVersion + implementation group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '3.4.12' + implementation group: 'com.microsoft.azure', name: 'applicationinsights-web', version: '3.4.12' testImplementation group: 'org.pitest', name: 'pitest', version: '1.15.3' testImplementation group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.15.0' @@ -389,6 +391,7 @@ dependencies { functionalTestImplementation group: 'net.javacrumbs.json-unit', name: 'json-unit-assertj', version: '3.2.7' functionalTestCompileOnly group: 'org.projectlombok', name: 'lombok', version: versions.lombok functionalTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok + functionalTestImplementation sourceSets.main.runtimeClasspath functionalTestImplementation sourceSets.test.runtimeClasspath From d3819e6035efc51a4776abf706806d4167ae90de Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Fri, 28 Jun 2024 13:54:50 +0100 Subject: [PATCH 079/105] Undo increase app insights agent --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 71617861649..6a14b01688d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -ARG APP_INSIGHTS_AGENT_VERSION=3.5.2 +ARG APP_INSIGHTS_AGENT_VERSION=3.4.12 -FROM hmctspublic.azurecr.io/base/java:21-distroless +FROM hmctspublic.azurecr.io/base/java:17-distroless EXPOSE 4000 USER hmcts From 1682bf3988730fedd3aa7d89053299bac899b48e Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Fri, 28 Jun 2024 14:21:14 +0100 Subject: [PATCH 080/105] Fix incorrect import for Map.of --- .../gov/hmcts/reform/fpl/service/CaseConverterTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/CaseConverterTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/CaseConverterTest.java index aee2d36c408..4e775fb3461 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/service/CaseConverterTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/service/CaseConverterTest.java @@ -19,7 +19,7 @@ import java.util.Map; -import static com.microsoft.applicationinsights.core.dependencies.google.common.collect.ImmutableMap.of; +import static java.util.Map.of; import static org.apache.commons.lang3.RandomUtils.nextLong; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -43,7 +43,7 @@ class CaseConverterTest { void shouldConvertCaseDetailsToCaseDataAndSetIdAndState(State state) { final CaseDetails caseDetails = CaseDetails .builder() - .data(Map.of()) + .data(of()) .id(nextLong()) .state(state.getValue()) .build(); @@ -72,7 +72,7 @@ void shouldConvertCaseDetailsToCaseDataAndSetIdAndState(State state) { void shouldConvertCaseDetailsToCaseDataAndDontSetStateIfNotRecognised(String state) { final CaseDetails caseDetails = CaseDetails .builder() - .data(Map.of()) + .data(of()) .id(nextLong()) .state(state) .build(); @@ -138,7 +138,7 @@ void shouldReturnNullIfConvertedObjectIsNull() { @Test void shouldConvertArbitraryObject() { - Map objectToBeConverted = Map.of("caseName", "name"); + Map objectToBeConverted = of("caseName", "name"); CaseData expectedConvertedObject = CaseData.builder() .caseName("name") From 93dac042f1848a4368f9c25cb8459dfacdfa0802 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Fri, 28 Jun 2024 14:26:03 +0100 Subject: [PATCH 081/105] Fix SC_OK dependency --- .../reform/fpl/controllers/TestingSupportControllerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/TestingSupportControllerTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/TestingSupportControllerTest.java index 1caef5f0f38..c012b61f57d 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/TestingSupportControllerTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/TestingSupportControllerTest.java @@ -41,7 +41,7 @@ import java.util.UUID; import java.util.stream.Stream; -import static com.microsoft.applicationinsights.core.dependencies.http.HttpStatus.SC_OK; +import static jakarta.servlet.http.HttpServletResponse.SC_OK; import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; From 91754e338bba56eff6685d839156ab9b57bd935c Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Fri, 28 Jun 2024 15:08:29 +0100 Subject: [PATCH 082/105] Remove AppInsightsInstrumentationKey --- charts/fpl-case-service/values.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/charts/fpl-case-service/values.yaml b/charts/fpl-case-service/values.yaml index ee08d6c8942..68520248aac 100644 --- a/charts/fpl-case-service/values.yaml +++ b/charts/fpl-case-service/values.yaml @@ -80,9 +80,7 @@ java: - ld-sdk-key - ctsc-inbox - ctsc-team-lead-inbox - - AppInsightsInstrumentationKey - - name: app-insights-connection-string - alias: app-insights-connection-string + - app-insights-connection-string - scheduler-db-password-v15 - rcj-family-high-court-inbox - court-to-court-admin-mapping From 6f1a424ca23d28ef5f70fdb9bcef9c37e3ea4426 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 2 Jul 2024 14:22:01 +0100 Subject: [PATCH 083/105] Add postgres package to see if that resolves pipeline issues. --- charts/fpl-case-service/values.yaml | 4 +++- service/build.gradle | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/charts/fpl-case-service/values.yaml b/charts/fpl-case-service/values.yaml index 68520248aac..ee08d6c8942 100644 --- a/charts/fpl-case-service/values.yaml +++ b/charts/fpl-case-service/values.yaml @@ -80,7 +80,9 @@ java: - ld-sdk-key - ctsc-inbox - ctsc-team-lead-inbox - - app-insights-connection-string + - AppInsightsInstrumentationKey + - name: app-insights-connection-string + alias: app-insights-connection-string - scheduler-db-password-v15 - rcj-family-high-court-inbox - court-to-court-admin-mapping diff --git a/service/build.gradle b/service/build.gradle index ca58eb5a408..d9c614d245a 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -356,6 +356,8 @@ dependencies { implementation group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '3.4.12' implementation group: 'com.microsoft.azure', name: 'applicationinsights-web', version: '3.4.12' + implementation 'org.postgresql:postgresql:42.7.3' + testImplementation group: 'org.pitest', name: 'pitest', version: '1.15.3' testImplementation group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.15.0' testImplementation group: 'org.pitest', name: 'pitest-junit5-plugin', version: '1.2.1' From 2691bdfa0de6f967998c7a083078a11bb32e0adc Mon Sep 17 00:00:00 2001 From: "Chak Shing, Lo" Date: Wed, 3 Jul 2024 11:32:11 +0100 Subject: [PATCH 084/105] fix ManageHearingsControllerVacatedSubmittedTest --- .../ManageHearingsControllerVacatedSubmittedTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ManageHearingsControllerVacatedSubmittedTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ManageHearingsControllerVacatedSubmittedTest.java index 8ec71b948c6..9d983611e0f 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ManageHearingsControllerVacatedSubmittedTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/ManageHearingsControllerVacatedSubmittedTest.java @@ -65,7 +65,7 @@ void shouldTriggerSendNoticeOfHearingVacatedEventWhenNotBeingRelisted() { postSubmittedEvent(caseDetails); - verify(eventPublisher, times(3)).publishEvent(sendNoticeOfHearingVacatedCaptor.capture()); + verify(eventPublisher, times(1)).publishEvent(sendNoticeOfHearingVacatedCaptor.capture()); SendNoticeOfHearingVacated actualSendNoticeOfHearingVacated = sendNoticeOfHearingVacatedCaptor.getValue(); assertThat(actualSendNoticeOfHearingVacated.getVacatedHearing()).isEqualTo(hearingVacated); @@ -101,7 +101,7 @@ void shouldTriggerSendNoticeOfHearingVacatedEventWhenBeingRelisted() { postSubmittedEvent(caseDetails); - verify(eventPublisher, times(4)).publishEvent(sendNoticeOfHearingVacatedCaptor.capture()); + verify(eventPublisher, times(1)).publishEvent(sendNoticeOfHearingVacatedCaptor.capture()); SendNoticeOfHearingVacated actualSendNoticeOfHearingVacated = sendNoticeOfHearingVacatedCaptor.getValue(); assertThat(actualSendNoticeOfHearingVacated.getVacatedHearing()).isEqualTo(hearingVacated); From 58f6d9ed813d9bd9a11b6bf9a92f7c5bec7bf9f5 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 4 Jul 2024 13:57:03 +0100 Subject: [PATCH 085/105] Add postres package for flyway. --- service/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index aa6fad54a58..c675df6ec58 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -322,7 +322,8 @@ dependencies { implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '5.10.9' - implementation group: 'org.flywaydb', name: 'flyway-core', version: '10.15.0' + implementation group: 'org.flywaydb', name: 'flyway-core', version: '10.15.2' + implementation group: 'org.flywaydb', name: 'flyway-database-postgresql' implementation group: 'uk.gov.hmcts.reform', name: 'properties-volume-spring-boot-starter', version: '0.1.0' implementation group: 'uk.gov.hmcts.reform', name: 'logging', version: versions.reformLogging From 80d541732691b6fbeb520557d1b8bd4e5f78fa09 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 4 Jul 2024 14:09:05 +0100 Subject: [PATCH 086/105] Add version --- service/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index c675df6ec58..269fa7f4636 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -323,7 +323,7 @@ dependencies { implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '5.10.9' implementation group: 'org.flywaydb', name: 'flyway-core', version: '10.15.2' - implementation group: 'org.flywaydb', name: 'flyway-database-postgresql' + implementation group: 'org.flywaydb', name: 'flyway-database-postgresql', version: '10.15.2' implementation group: 'uk.gov.hmcts.reform', name: 'properties-volume-spring-boot-starter', version: '0.1.0' implementation group: 'uk.gov.hmcts.reform', name: 'logging', version: versions.reformLogging From cee2a32a2b0bd89673f03d86db1216d28a643faa Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Fri, 5 Jul 2024 15:58:03 +0100 Subject: [PATCH 087/105] Remove alias for app-insights-connection-string as identical to dependency name. --- charts/fpl-case-service/values.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/charts/fpl-case-service/values.yaml b/charts/fpl-case-service/values.yaml index ee08d6c8942..fc35d014637 100644 --- a/charts/fpl-case-service/values.yaml +++ b/charts/fpl-case-service/values.yaml @@ -81,8 +81,7 @@ java: - ctsc-inbox - ctsc-team-lead-inbox - AppInsightsInstrumentationKey - - name: app-insights-connection-string - alias: app-insights-connection-string + - app-insights-connection-string - scheduler-db-password-v15 - rcj-family-high-court-inbox - court-to-court-admin-mapping From ded7c5f3550c79d5f34438d8c4d9c80892a270a4 Mon Sep 17 00:00:00 2001 From: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 14:58:59 +0000 Subject: [PATCH 088/105] Bumping chart version/ fixing aliases --- charts/fpl-case-service/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/fpl-case-service/Chart.yaml b/charts/fpl-case-service/Chart.yaml index 37a897d26e3..0de9affbf34 100644 --- a/charts/fpl-case-service/Chart.yaml +++ b/charts/fpl-case-service/Chart.yaml @@ -1,7 +1,7 @@ name: fpl-case-service apiVersion: v2 home: https://github.com/hmcts/fpl-ccd-configuration -version: 1.12.77 +version: 1.12.78 description: FPL Case Service maintainers: - name: HMCTS Family Public Law team From 3aab79fbc85318cf07d16d4ca5fddd41182075a2 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 9 Jul 2024 16:30:05 +0100 Subject: [PATCH 089/105] Dummy change to re-trigger pipeline. --- e2e/tests/smoke_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/tests/smoke_test.js b/e2e/tests/smoke_test.js index 0d55e518b81..23c8f0668cc 100644 --- a/e2e/tests/smoke_test.js +++ b/e2e/tests/smoke_test.js @@ -8,7 +8,7 @@ Feature('Smoke tests @smoke-tests @fixed'); Scenario( 'Sign in as Local Authority and create a case', async ({ I, caseListPage }) => { - output.print('Smoke test triggered NOW'); + output.print('Smoke test triggered AGAIN'); await I.goToPage(config.baseUrl, config.newSwanseaLocalAuthorityUserOne); const caseName = `Smoke test case (${moment().format('YYYY-MM-DD HH:MM')})`; const caseId = await I.createCaseSmokeTest( From 28ea8ac40f8119553f3f16dfd6d6339bd0184e11 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 10 Jul 2024 09:28:12 +0100 Subject: [PATCH 090/105] Dummy change to re-trigger pipeline. --- e2e/tests/smoke_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/tests/smoke_test.js b/e2e/tests/smoke_test.js index 23c8f0668cc..0d55e518b81 100644 --- a/e2e/tests/smoke_test.js +++ b/e2e/tests/smoke_test.js @@ -8,7 +8,7 @@ Feature('Smoke tests @smoke-tests @fixed'); Scenario( 'Sign in as Local Authority and create a case', async ({ I, caseListPage }) => { - output.print('Smoke test triggered AGAIN'); + output.print('Smoke test triggered NOW'); await I.goToPage(config.baseUrl, config.newSwanseaLocalAuthorityUserOne); const caseName = `Smoke test case (${moment().format('YYYY-MM-DD HH:MM')})`; const caseId = await I.createCaseSmokeTest( From 4fe17f558debeb12efb7a6dc42a226e4a0989144 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 10 Jul 2024 16:08:47 +0100 Subject: [PATCH 091/105] Re-add gradle version upgrade. --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c7d437bbb47..20db9ad5c95 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 39e54f7f7a70da648adc15187943b34cac5dc1a1 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 10 Jul 2024 16:24:08 +0100 Subject: [PATCH 092/105] Re-add gradle version upgrade. --- gradle/wrapper/gradle-wrapper.properties | 3 ++- gradlew | 31 ++++++++++++++---------- gradlew.bat | 20 +++++++-------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 20db9ad5c95..a4413138c96 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d65c..b740cf13397 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85beec..7101f8e4676 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail From d4e6ed454b7a99db6e58a8dfded1113523536f06 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 11 Jul 2024 09:13:00 +0100 Subject: [PATCH 093/105] Revert "Re-add gradle version upgrade." This reverts commit 39e54f7f7a70da648adc15187943b34cac5dc1a1. --- gradle/wrapper/gradle-wrapper.properties | 3 +-- gradlew | 31 ++++++++++-------------- gradlew.bat | 20 +++++++-------- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4413138c96..20db9ad5c95 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 -validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index b740cf13397..65dcd68d65c 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,8 +83,10 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -131,13 +133,10 @@ location of your Java installation." fi else JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi fi # Increase the maximum file descriptors if we can. @@ -145,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -198,15 +197,11 @@ if "$cygwin" || "$msys" ; then done fi - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 7101f8e4676..6689b85beec 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. goto fail From 0f629280a42022d8e04380ef28e1230f100712c7 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Thu, 11 Jul 2024 09:14:48 +0100 Subject: [PATCH 094/105] Revert increasing gradle version --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 20db9ad5c95..c7d437bbb47 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 8644e25e6dd82daa20396ff3b7cc5e8cafba845e Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 6 Aug 2024 15:01:03 +0100 Subject: [PATCH 095/105] Increase apache commons version in line with what's in prod. --- service/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/build.gradle b/service/build.gradle index d921d7ee739..570e5fa6712 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -314,8 +314,8 @@ dependencies { implementation group: 'org.bitbucket.b_c', name: 'jose4j', version: '0.9.6' implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: versions.pdfbox - implementation group: 'org.apache.commons', name: 'commons-text', version: '1.11.0' - implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.10.0' + implementation group: 'org.apache.commons', name: 'commons-text', version: '1.12.0' + implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.11.0' implementation 'org.apache.commons:commons-lang3:3.12.0' implementation group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '3.1.8' From d315d388ba44ac9132e945da21e4b089331cae44 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 6 Aug 2024 15:02:41 +0100 Subject: [PATCH 096/105] Increase pitest version in line with what's in prod. --- service/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/build.gradle b/service/build.gradle index 570e5fa6712..96a1836d1ec 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -354,7 +354,7 @@ dependencies { implementation 'org.postgresql:postgresql:42.7.3' - testImplementation group: 'org.pitest', name: 'pitest', version: '1.15.3' + testImplementation group: 'org.pitest', name: 'pitest', version: '1.16.1' testImplementation group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.15.0' testImplementation group: 'org.pitest', name: 'pitest-junit5-plugin', version: '1.2.1' From 1d4a313a6954b0f9804306800c6ece15346c84ee Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 6 Aug 2024 17:07:44 +0100 Subject: [PATCH 097/105] Remove redundant csrf check in tests --- .../gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java index 2684946392f..99b8bcb5a59 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java @@ -288,7 +288,6 @@ private T postEvent(String path, byte[] data, int expectedStatus, Class r try { MvcResult response = mockMvc .perform(post(path) - .with(csrf()) .header("authorization", USER_AUTH_TOKEN) .header("user-id", USER_ID) .header("user-roles", String.join(",", userRoles)) From 480d45dd96808fd3eefad18f1a598afbc06f873a Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 6 Aug 2024 17:21:30 +0100 Subject: [PATCH 098/105] Remove unused import --- .../gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java index 99b8bcb5a59..31e28f21ca3 100644 --- a/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java +++ b/service/src/integrationTest/java/uk/gov/hmcts/reform/fpl/controllers/AbstractCallbackTest.java @@ -16,7 +16,6 @@ import java.util.Optional; import static org.apache.http.HttpStatus.SC_OK; -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static uk.gov.hmcts.reform.fpl.service.CaseConverter.MAP_TYPE; From 9817db76f337876c1c87713e7c2e937266d26604 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 7 Aug 2024 14:56:20 +0100 Subject: [PATCH 099/105] Remove null castings --- .../hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java | 2 +- .../uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java | 2 +- .../reform/fpl/config/feign/codec/IdamErrorDecoderTest.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java index 56184b32bbc..f0e10d118c3 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java @@ -33,7 +33,7 @@ public Exception decode(String methodKey, Response response) { response.reason(), response.request().httpMethod(), exception, - (Date) null, + 0l, response.request() ); } diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java index 755561c7f05..88117705b0b 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java @@ -20,7 +20,7 @@ class FPLRetryerTest { private static final Request REQUEST = Request.create(GET, EMPTY, Map.of(), EMPTY_BODY, UTF_8, null); private static final RetryableException EXCEPTION = new RetryableException( 500, "", GET, new FeignException.InternalServerError("test", REQUEST, EMPTY_BODY, - Collections.emptyMap()), (Long) null, REQUEST + Collections.emptyMap()), 0l, REQUEST ); @Test diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java index 3735198a120..7ee8bdde295 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java @@ -28,7 +28,7 @@ class IdamErrorDecoderTest { private static final int STATUS_NOT_5XX = 404; private static final Exception NON_RETRYABLE_EXCEPTION = new Exception(); - private static final Exception RETRYABLE_EXCEPTION = new RetryableException(500, "", null, (Long) null, REQUEST); + private static final Exception RETRYABLE_EXCEPTION = new RetryableException(500, "", null, 0l, REQUEST); private static final String EMPTY_METHOD_KEY = ""; @@ -58,7 +58,7 @@ void shouldReturnNewRetryableErrorWhen500ResponseStatus() { Exception decodedException = idamErrorDecoder.decode(EMPTY_METHOD_KEY, response); RetryableException expectedException = new RetryableException( - STATUS_5XX, EMPTY_REASON, GET, NON_RETRYABLE_EXCEPTION, (Long) null, REQUEST + STATUS_5XX, EMPTY_REASON, GET, NON_RETRYABLE_EXCEPTION, 0l, REQUEST ); assertThat(decodedException).usingRecursiveComparison().isEqualTo(expectedException); From 01e327b8734cf87b4a666248cb1303cc33e27ef1 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 7 Aug 2024 15:17:11 +0100 Subject: [PATCH 100/105] Remove unused import --- .../hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java index f0e10d118c3..b3d423f11fc 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java @@ -5,8 +5,6 @@ import feign.codec.ErrorDecoder; import org.springframework.http.HttpStatus; -import java.util.Date; - public class IdamErrorDecoder implements ErrorDecoder { private final ErrorDecoder defaultDecoder; From 27b160380406fe9fabe74fed072225623953fae1 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 7 Aug 2024 15:55:37 +0100 Subject: [PATCH 101/105] Fix checkstyle --- .../hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java | 2 +- .../uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java | 2 +- .../reform/fpl/config/feign/codec/IdamErrorDecoderTest.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java index b3d423f11fc..fec1bbaaa2e 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoder.java @@ -31,7 +31,7 @@ public Exception decode(String methodKey, Response response) { response.reason(), response.request().httpMethod(), exception, - 0l, + 0L, response.request() ); } diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java index 88117705b0b..3126e635fad 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/FPLRetryerTest.java @@ -20,7 +20,7 @@ class FPLRetryerTest { private static final Request REQUEST = Request.create(GET, EMPTY, Map.of(), EMPTY_BODY, UTF_8, null); private static final RetryableException EXCEPTION = new RetryableException( 500, "", GET, new FeignException.InternalServerError("test", REQUEST, EMPTY_BODY, - Collections.emptyMap()), 0l, REQUEST + Collections.emptyMap()), 0L, REQUEST ); @Test diff --git a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java index 7ee8bdde295..da474f0f46d 100644 --- a/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java +++ b/service/src/test/java/uk/gov/hmcts/reform/fpl/config/feign/codec/IdamErrorDecoderTest.java @@ -28,7 +28,7 @@ class IdamErrorDecoderTest { private static final int STATUS_NOT_5XX = 404; private static final Exception NON_RETRYABLE_EXCEPTION = new Exception(); - private static final Exception RETRYABLE_EXCEPTION = new RetryableException(500, "", null, 0l, REQUEST); + private static final Exception RETRYABLE_EXCEPTION = new RetryableException(500, "", null, 0L, REQUEST); private static final String EMPTY_METHOD_KEY = ""; @@ -58,7 +58,7 @@ void shouldReturnNewRetryableErrorWhen500ResponseStatus() { Exception decodedException = idamErrorDecoder.decode(EMPTY_METHOD_KEY, response); RetryableException expectedException = new RetryableException( - STATUS_5XX, EMPTY_REASON, GET, NON_RETRYABLE_EXCEPTION, 0l, REQUEST + STATUS_5XX, EMPTY_REASON, GET, NON_RETRYABLE_EXCEPTION, 0L, REQUEST ); assertThat(decodedException).usingRecursiveComparison().isEqualTo(expectedException); From db1f8459201f921f46046bf5e89ed67be2360509 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Tue, 17 Sep 2024 10:27:27 +0100 Subject: [PATCH 102/105] Remove suppressions --- config/owasp/suppressions.xml | 36 +---------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/config/owasp/suppressions.xml b/config/owasp/suppressions.xml index 22ad2047a21..5aecb747a23 100644 --- a/config/owasp/suppressions.xml +++ b/config/owasp/suppressions.xml @@ -1,38 +1,4 @@ - - - ^pkg:maven/org.json/json@.*$ - CVE-2022-45688 - - - - ^pkg:maven/org.json/json@.*$ - CVE-2023-5072 - - - - ^pkg:maven/org.quartz-scheduler/quartz@.*$ - CVE-2023-39017 - - - - ^pkg:maven/com\.fasterxml\.jackson\.core/jackson\-databind@.*$ - CVE-2023-35116 - - - - ^pkg:maven/org.bouncycastle/bcprov-jdk15on@.*$ - CVE-2023-33202 - + From 241533b6461b262850b753ee8db7b623afb0df9a Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 18 Sep 2024 11:34:09 +0100 Subject: [PATCH 103/105] Fix robotics filter chain from getting applied on all requests. --- .../reform/fpl/config/security/SecurityConfiguration.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java index 858150fa4c7..d19c3268476 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java @@ -64,7 +64,9 @@ public SecurityFilterChain roboticsSecurityFilterChain(HttpSecurity http) throws http .authorizeRequests(authorize -> authorize .requestMatchers(HttpMethod.POST, "/sendRPAEmailByID/*", "/support/**") - .authenticated()) + .authenticated() + .anyRequest() + .permitAll()) .csrf(csrf -> csrf.disable()) .addFilter(authCheckerUserOnlyFilter); From 0cf60f225273e4a426f6b0d3b6a99f44ac1aa1eb Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 18 Sep 2024 11:42:39 +0100 Subject: [PATCH 104/105] Reinstate suppressions --- config/owasp/suppressions.xml | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/config/owasp/suppressions.xml b/config/owasp/suppressions.xml index 5aecb747a23..22ad2047a21 100644 --- a/config/owasp/suppressions.xml +++ b/config/owasp/suppressions.xml @@ -1,4 +1,38 @@ - + + + ^pkg:maven/org.json/json@.*$ + CVE-2022-45688 + + + + ^pkg:maven/org.json/json@.*$ + CVE-2023-5072 + + + + ^pkg:maven/org.quartz-scheduler/quartz@.*$ + CVE-2023-39017 + + + + ^pkg:maven/com\.fasterxml\.jackson\.core/jackson\-databind@.*$ + CVE-2023-35116 + + + + ^pkg:maven/org.bouncycastle/bcprov-jdk15on@.*$ + CVE-2023-33202 + From fd3ee811faf1b8e20dce8c4deb70e1f600999117 Mon Sep 17 00:00:00 2001 From: jamesrferguson1 Date: Wed, 18 Sep 2024 14:23:33 +0100 Subject: [PATCH 105/105] Add securityMatcher to restrict roboticsSecurityFilterChain to those paths only --- .../reform/fpl/config/security/SecurityConfiguration.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java index d19c3268476..fd5c9c7d3f0 100644 --- a/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java +++ b/service/src/main/java/uk/gov/hmcts/reform/fpl/config/security/SecurityConfiguration.java @@ -62,11 +62,10 @@ public SecurityFilterChain roboticsSecurityFilterChain(HttpSecurity http) throws authCheckerUserOnlyFilter.setAuthenticationManager(authenticationManager); http + .securityMatcher("/sendRPAEmailByID/**", "/support/**") .authorizeRequests(authorize -> authorize .requestMatchers(HttpMethod.POST, "/sendRPAEmailByID/*", "/support/**") - .authenticated() - .anyRequest() - .permitAll()) + .authenticated()) .csrf(csrf -> csrf.disable()) .addFilter(authCheckerUserOnlyFilter);