Skip to content

Commit

Permalink
Merge branch 'master' into DMP-4651
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Edwards-cgi authored Jan 31, 2025
2 parents d494900 + a333a7b commit 07b3716
Show file tree
Hide file tree
Showing 201 changed files with 1,883 additions and 851 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ARG must be before all "FROM"s
# renovate: datasource=github-releases depName=microsoft/ApplicationInsights-Java
ARG APP_INSIGHTS_AGENT_VERSION=3.6.2
ARG APP_INSIGHTS_AGENT_VERSION=3.7.0

FROM openjdk:21-jdk-slim-bullseye AS build-env
WORKDIR /usr/local/bin
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ is dependent, such as database servers, web services etc.
| Profile | Config Location | Purpose | External Components |
|------------------|----------------------------------------------------------------|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `local` | `src/main/resources/application-local.yaml` | For running the application locally as a docker compose stack with `docker-compose-local.yml`. | Provided as needed by `docker-compose-local.yml`. No external connectivity permitted outside the network boundary of the stack. |
| `intTest` | `src/integrationTest/resources/application-intTest.yaml` | For running integration tests under `src/integrationTest`. | No interaction required or permitted, all external calls are mocked via embedded wiremock (for HTTP requests), an embedded database (for db queries) or `@MockBeans` for anything else. Spring Security is explicitly disabled. |
| `intTest` | `src/integrationTest/resources/application-intTest.yaml` | For running integration tests under `src/integrationTest`. | No interaction required or permitted, all external calls are mocked via embedded wiremock (for HTTP requests), an embedded database (for db queries) or `@MockitoBean` for anything else. Spring Security is explicitly disabled. |
| `functionalTest` | `src/functionalTest/resources/application-functionalTest.yaml` | For running functional tests under `src/functionalTest`. | Functional tests execute API calls against the application deployed in the PR environment. That application is deployed with the `dev` profile (see below). |
| `dev` | `src/main/resources/application-dev.yaml` | For running the application in the Pull Request (dev) environment. | Interaction permitted with "real" components, which may be services deployed to a test environment. |
Expand Down
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
dependencies {
classpath("org.flywaydb:flyway-database-postgresql:10.22.0")
classpath("org.flywaydb:flyway-database-postgresql:11.3.0")
}
}

Expand All @@ -11,13 +11,13 @@ plugins {
id 'jacoco'
id 'idea'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.springframework.boot' version '3.3.5'
id 'org.springframework.boot' version '3.4.2'
id 'org.owasp.dependencycheck' version '11.1.1'
id 'com.github.ben-manes.versions' version '0.52.0'
id 'org.sonarqube' version '6.0.1.5171'
id "io.freefair.lombok" version "8.12"
id "org.openapi.generator" version "7.11.0"
id "org.flywaydb.flyway" version "10.22.0"
id "org.flywaydb.flyway" version "11.3.0"
id 'maven-publish'
id("com.dorongold.task-tree") version "4.0.0"
}
Expand Down Expand Up @@ -417,8 +417,8 @@ dependencies {
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation 'org.zalando:problem-spring-web-starter:0.29.1'

implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.6.0'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.1.4'
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.8.3'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.2.0'
implementation 'org.springframework.retry:spring-retry:2.0.11'

implementation 'net.javacrumbs.shedlock:shedlock-spring:6.2.0'
Expand All @@ -438,12 +438,12 @@ dependencies {
implementation 'com.azure:azure-storage-blob'

implementation group: 'io.rest-assured', name: 'rest-assured'
implementation group: 'org.flywaydb', name: 'flyway-core', version: '10.22.0'
implementation group: 'org.flywaydb', name: 'flyway-database-postgresql', version: '10.22.0'
implementation group: 'org.flywaydb', name: 'flyway-core', version: '11.3.0'
implementation group: 'org.flywaydb', name: 'flyway-database-postgresql', version: '11.3.0'
implementation group: 'io.hypersistence', name: 'hypersistence-utils-hibernate-63', version: '3.9.0'

//database
implementation 'org.postgresql:postgresql:42.7.4'
implementation 'org.postgresql:postgresql:42.7.5'

implementation 'uk.gov.service.notify:notifications-java-client:5.2.1-RELEASE'

Expand All @@ -469,13 +469,13 @@ dependencies {

testImplementation 'org.testcontainers:postgresql:1.20.4'
testImplementation 'com.h2database:h2:2.3.232'
testImplementation group: 'org.postgresql', name: 'postgresql', version: '42.7.4'
testImplementation group: 'org.postgresql', name: 'postgresql', version: '42.7.5'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-contract-stub-runner', version: '4.1.5'
testImplementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-contract-stub-runner', version: '4.2.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
testImplementation group: 'io.projectreactor', name: 'reactor-test', version: '3.7.2'
testImplementation 'org.springframework.security:spring-security-test:6.4.2'
Expand Down
1 change: 1 addition & 0 deletions infrastructure/prod.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pgsqlSku = "GP_Standard_D8ds_v5"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.azure.core.util.BinaryData;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
Expand All @@ -11,6 +12,7 @@
import org.springframework.test.context.ActiveProfiles;
import uk.gov.hmcts.darts.common.datamanagement.component.impl.DownloadResponseMetaData;
import uk.gov.hmcts.darts.common.exception.AzureDeleteBlobException;
import uk.gov.hmcts.darts.common.exception.DartsException;
import uk.gov.hmcts.darts.dets.service.impl.DetsApiServiceImpl;
import uk.gov.hmcts.darts.testutil.ArmTestUtil;

Expand All @@ -20,12 +22,14 @@
import java.util.UUID;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

@SpringBootTest
@ActiveProfiles({"dev", "h2db"})
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
@ExtendWith(MockitoExtension.class)
@Slf4j
class DetsDataManagementServiceTest {

private static final String TEST_BINARY_STRING = "Test String to be converted to binary!";
Expand Down Expand Up @@ -82,5 +86,16 @@ void copyDetsBlobDataToArm() throws AzureDeleteBlobException {

}

@Test
void copyNonExistingDetsBlobDataToArm() throws AzureDeleteBlobException {
var uuid = UUID.randomUUID();

String filename = String.format("functional_test_%s", UUID.randomUUID());
String blobPathAndName = armSubmissionDropZone + filename;
assertThrows(DartsException.class,
() -> dataManagementService.copyDetsBlobDataToArm(uuid.toString(), blobPathAndName));

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import org.junit.jupiter.api.TestInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import uk.gov.hmcts.darts.authorisation.component.UserIdentity;
Expand Down Expand Up @@ -41,19 +41,19 @@ class TestSupportControllerTest extends IntegrationBase {
private static final String ENDPOINT_URL = "/functional-tests";
@Autowired
private transient MockMvc mockMvc;
@MockBean
@MockitoBean
private UserIdentity mockUserIdentity;
@MockBean
@MockitoBean
private BankHolidaysService mockBankHolidaysService;

@MockBean
@MockitoBean
private UserAccountEntity mockUserAccountEntity;

@MockBean
@MockitoBean
private SecurityGroupEntity mockSecurityGroupEntity;
@MockBean
@MockitoBean
private CourthouseEntity courthouseEntity;
@SpyBean
@MockitoSpyBean
private AuditActivityRepository auditActivityRepository;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.core.io.Resource;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import uk.gov.hmcts.darts.common.datamanagement.api.DataManagementFacade;
Expand Down Expand Up @@ -46,7 +46,7 @@ class AnnotationGetTest extends IntegrationBase {

@Mock
private DownloadResponseMetaData downloadResponseMetaData;
@MockBean
@MockitoBean
private DataManagementFacade dataManagementFacade;
@Autowired
private MockMvc mockMvc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import uk.gov.hmcts.darts.arm.client.ArmRpoClient;
import uk.gov.hmcts.darts.arm.exception.ArmRpoException;
import uk.gov.hmcts.darts.common.entity.ArmRpoExecutionDetailEntity;
Expand Down Expand Up @@ -50,7 +50,7 @@ class StubbedArmRpoDownloadProductionIntTest extends PostgresIntegrationBase {
@Autowired
private ArmAutomatedTaskRepository armAutomatedTaskRepository;

@MockBean
@MockitoBean
private ArmRpoClient armRpoClient;

private ArmRpoExecutionDetailEntity armRpoExecutionDetailEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean;
import uk.gov.hmcts.darts.arm.config.ArmDataManagementConfiguration;
import uk.gov.hmcts.darts.arm.model.ArchiveRecord;
import uk.gov.hmcts.darts.arm.model.batch.ArmBatchItem;
Expand Down Expand Up @@ -62,9 +62,9 @@ class DataStoreToArmHelperIntTest extends IntegrationBase {
private static final LocalDateTime HEARING_DATE = LocalDateTime.of(2023, 9, 26, 10, 0, 0);
private MediaEntity savedMedia;

@MockBean
@MockitoBean
private UserIdentity userIdentity;
@SpyBean
@MockitoSpyBean
private ArmDataManagementConfiguration armDataManagementConfiguration;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import uk.gov.hmcts.darts.arm.client.ArmRpoClient;
import uk.gov.hmcts.darts.arm.client.model.rpo.ArmAsyncSearchResponse;
import uk.gov.hmcts.darts.arm.exception.ArmRpoException;
Expand All @@ -22,7 +22,7 @@

class ArmRpoApiAddAsyncSearchIntTest extends PostgresIntegrationBase {

@MockBean
@MockitoBean
private ArmRpoClient armRpoClient;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import uk.gov.hmcts.darts.arm.client.ArmRpoClient;
import uk.gov.hmcts.darts.arm.client.model.rpo.CreateExportBasedOnSearchResultsTableResponse;
import uk.gov.hmcts.darts.arm.model.rpo.MasterIndexFieldByRecordClassSchema;
Expand All @@ -25,7 +25,7 @@ class ArmRpoApiCreateExportBasedOnSearchResultsTableIntTest extends PostgresInte

private static final String PRODUCTION_NAME = "DARTS_RPO_2024-08-13";

@MockBean
@MockitoBean
private ArmRpoClient armRpoClient;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import feign.FeignException;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import uk.gov.hmcts.darts.arm.client.ArmRpoClient;
import uk.gov.hmcts.darts.arm.exception.ArmRpoException;
import uk.gov.hmcts.darts.common.entity.ArmRpoExecutionDetailEntity;
Expand All @@ -29,7 +29,7 @@
@SuppressWarnings("PMD.CloseResource")
class ArmRpoApiDownloadProductionIntTest extends IntegrationBase {

@MockBean
@MockitoBean
private ArmRpoClient armRpoClient;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import uk.gov.hmcts.darts.arm.client.ArmRpoClient;
import uk.gov.hmcts.darts.arm.client.model.rpo.ExtendedProductionsByMatterResponse;
import uk.gov.hmcts.darts.arm.config.ArmApiConfigurationProperties;
Expand All @@ -24,10 +24,10 @@ class ArmRpoApiGetExtendedProductionsByMatterIntTest extends IntegrationBase {

private static final String PRODUCTION_NAME = "DARTS_RPO_2024-08-13";
public static final String END_PRODUCTION_TIME = "2025-01-16T12:30:09.9129726+00:00";
@MockBean
@MockitoBean
private ArmRpoClient armRpoClient;

@MockBean
@MockitoBean
private ArmApiConfigurationProperties armApiConfigurationProperties;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import uk.gov.hmcts.darts.arm.client.ArmRpoClient;
import uk.gov.hmcts.darts.arm.client.model.rpo.ExtendedSearchesByMatterResponse;
import uk.gov.hmcts.darts.arm.config.ArmApiConfigurationProperties;
Expand All @@ -23,10 +23,10 @@ class ArmRpoApiGetExtendedSearchesByMatterIntTest extends IntegrationBase {
private static final String SEARCH_ID = "8271f101-8c14-4c41-8865-edc5d8baed99";
private static final String PRODUCTION_NAME = "DARTS_RPO_2024-08-13";

@MockBean
@MockitoBean
private ArmRpoClient armRpoClient;

@MockBean
@MockitoBean
private ArmApiConfigurationProperties armApiConfigurationProperties;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import feign.FeignException;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import uk.gov.hmcts.darts.arm.client.ArmRpoClient;
import uk.gov.hmcts.darts.arm.client.model.rpo.IndexesByMatterIdResponse;
import uk.gov.hmcts.darts.arm.exception.ArmRpoException;
Expand All @@ -25,7 +25,7 @@
import static org.mockito.Mockito.when;

class ArmRpoApiGetIndexesByMatterIdIntTest extends IntegrationBase {
@MockBean
@MockitoBean
private ArmRpoClient armRpoClient;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import uk.gov.hmcts.darts.arm.client.ArmRpoClient;
import uk.gov.hmcts.darts.arm.client.model.rpo.ProductionOutputFilesRequest;
import uk.gov.hmcts.darts.arm.client.model.rpo.ProductionOutputFilesResponse;
Expand All @@ -29,7 +29,7 @@
@SuppressWarnings("checkstyle:linelength")
class ArmRpoApiGetProductionOutputFilesIntTest extends PostgresIntegrationBase {

@MockBean
@MockitoBean
private ArmRpoClient armRpoClient;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import feign.FeignException;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import uk.gov.hmcts.darts.arm.client.ArmRpoClient;
import uk.gov.hmcts.darts.arm.client.model.rpo.RemoveProductionResponse;
import uk.gov.hmcts.darts.arm.exception.ArmRpoException;
Expand All @@ -22,7 +22,7 @@

class ArmRpoApiRemoveProductionIntTest extends IntegrationBase {

@MockBean
@MockitoBean
private ArmRpoClient armRpoClient;

@Autowired
Expand Down
Loading

0 comments on commit 07b3716

Please sign in to comment.