From e72046636c721afe8d17cde9283f2ec8682fb00f Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Mon, 25 Nov 2024 14:36:26 +0000 Subject: [PATCH 1/4] upgrade to springboot 3.4 --- batch-boot-jpa-sample/docker/docker-compose.yml | 2 +- batch-boot-jpa-sample/pom.xml | 6 +++--- .../java/com/example/bootbatchjpa/config/BatchConfig.java | 3 ++- .../example/bootbatchjpa/common/TestContainersConfig.java | 2 +- .../bootbatchjpa/repository/SchemaValidationTest.java | 8 +++----- .../web/controllers/CustomerControllerIT.java | 2 +- .../web/controllers/CustomerControllerTest.java | 4 ++-- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/batch-boot-jpa-sample/docker/docker-compose.yml b/batch-boot-jpa-sample/docker/docker-compose.yml index 39118e356..d6c33d152 100644 --- a/batch-boot-jpa-sample/docker/docker-compose.yml +++ b/batch-boot-jpa-sample/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.8' services: postgresqldb: - image: postgres:16.6-alpine + image: postgres:17.2-alpine hostname: postgresqldb extra_hosts: [ 'host.docker.internal:host-gateway' ] environment: diff --git a/batch-boot-jpa-sample/pom.xml b/batch-boot-jpa-sample/pom.xml index b5f051361..d79d2b250 100644 --- a/batch-boot-jpa-sample/pom.xml +++ b/batch-boot-jpa-sample/pom.xml @@ -7,7 +7,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.6 + 3.4.0 com.example.bootbatchjpa @@ -22,7 +22,7 @@ 21 5.0.2 - 2.6.0 + 2.7.0 ${project.build.directory}/test-results 2.43.0 @@ -242,7 +242,7 @@ - 1.22.0 + 1.24.0 diff --git a/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/BatchConfig.java b/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/BatchConfig.java index b954454da..a3b876b84 100644 --- a/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/BatchConfig.java +++ b/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/BatchConfig.java @@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.lang.NonNull; import org.springframework.transaction.PlatformTransactionManager; @Configuration(proxyBeanMethods = false) @@ -94,7 +95,7 @@ JpaPagingItemReader jpaPagingItemReader( } @Override - public void afterJob(JobExecution jobExecution) { + public void afterJob(@NonNull JobExecution jobExecution) { if (jobExecution.getStatus() == BatchStatus.COMPLETED) { log.info("BATCH JOB COMPLETED SUCCESSFULLY"); } diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/TestContainersConfig.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/TestContainersConfig.java index d2b6b923b..a372135ee 100644 --- a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/TestContainersConfig.java +++ b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/TestContainersConfig.java @@ -8,5 +8,5 @@ public interface TestContainersConfig { @ServiceConnection PostgreSQLContainer postgreSQLContainer = - new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("16.4-alpine")); + new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("17.2-alpine")); } diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/SchemaValidationTest.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/SchemaValidationTest.java index ace772ed2..cc9d24d8e 100644 --- a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/SchemaValidationTest.java +++ b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/SchemaValidationTest.java @@ -7,15 +7,13 @@ import javax.sql.DataSource; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.testcontainers.context.ImportTestcontainers; -@DataJpaTest( - properties = { - "spring.jpa.hibernate.ddl-auto=validate", - "spring.test.database.replace=none" - }) +@DataJpaTest(properties = {"spring.jpa.hibernate.ddl-auto=validate"}) @ImportTestcontainers(TestContainersConfig.class) +@AutoConfigureTestDatabase class SchemaValidationTest { @Autowired private DataSource dataSource; diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java index e5a4df57d..981d3c3b7 100644 --- a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java +++ b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java @@ -39,7 +39,7 @@ void setUp() { field(Customer.class, "gender"), gen -> gen.oneOf("male", "female")) .create(); - customerList = customerRepository.saveAll(customerList); + customerList = customerRepository.saveAllAndFlush(customerList); } @Test diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerTest.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerTest.java index 22cc0c9fd..4b4120632 100644 --- a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerTest.java +++ b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerTest.java @@ -26,11 +26,11 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.http.MediaType; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; @WebMvcTest(controllers = CustomerController.class) @@ -39,7 +39,7 @@ class CustomerControllerTest { @Autowired private MockMvc mockMvc; - @MockBean private CustomerService customerService; + @MockitoBean private CustomerService customerService; @Autowired private ObjectMapper objectMapper; From b9bc0301c17df6d8bc7993aff42606fcdba93a47 Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Mon, 25 Nov 2024 14:55:32 +0000 Subject: [PATCH 2/4] attempt to fix --- .../main/java/com/example/bootbatchjpa/config/Initializer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/Initializer.java b/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/Initializer.java index 3479a7832..12cd9e128 100644 --- a/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/Initializer.java +++ b/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/Initializer.java @@ -31,7 +31,7 @@ public void run(String... args) { field(Customer.class, "gender"), gen -> gen.oneOf("male", "female")) .create(); log.info("Saving Customers of size :{}", customerList.size()); - customerList = customerRepository.saveAll(customerList); + customerList = customerRepository.saveAllAndFlush(customerList); log.info("Inserted customers of size :{}", customerList.size()); } } From 9b979cd08c12f3dbd25f2add02fac21c3840db5d Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Thu, 12 Dec 2024 11:26:24 +0000 Subject: [PATCH 3/4] fix and polish --- batch-boot-jpa-sample/docker/docker-compose.yml | 5 +++++ batch-boot-jpa-sample/pom.xml | 2 +- .../{Application.java => BatchApplication.java} | 4 ++-- .../bootbatchjpa/config/BatchConfig.java | 8 ++++++-- .../bootbatchjpa/config/Initializer.java | 3 ++- .../example/bootbatchjpa/TestApplication.java | 15 --------------- .../bootbatchjpa/TestBatchApplication.java | 11 +++++++++++ .../common/AbstractIntegrationTest.java | 3 +-- .../bootbatchjpa/common/ContainersConfig.java | 17 +++++++++++++++++ .../common/TestContainersConfig.java | 12 ------------ ...Test.java => InnerSchemaValidationTest.java} | 6 +++--- .../web/controllers/CustomerControllerIT.java | 2 +- .../com/example/rest/proxy/TestApplication.java | 2 +- .../example/rest/template/TestApplication.java | 2 +- 14 files changed, 51 insertions(+), 41 deletions(-) rename batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/{Application.java => BatchApplication.java} (82%) delete mode 100644 batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/TestApplication.java create mode 100644 batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/TestBatchApplication.java create mode 100644 batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/ContainersConfig.java delete mode 100644 batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/TestContainersConfig.java rename batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/{SchemaValidationTest.java => InnerSchemaValidationTest.java} (79%) diff --git a/batch-boot-jpa-sample/docker/docker-compose.yml b/batch-boot-jpa-sample/docker/docker-compose.yml index d6c33d152..807d34441 100644 --- a/batch-boot-jpa-sample/docker/docker-compose.yml +++ b/batch-boot-jpa-sample/docker/docker-compose.yml @@ -9,6 +9,11 @@ services: - POSTGRES_USER=appuser - POSTGRES_PASSWORD=secret - POSTGRES_DB=appdb + healthcheck: + test: ["CMD-SHELL", "pg_isready -U appuser -d appdb"] + interval: 10s + timeout: 5s + retries: 5 ports: - "5432:5432" networks: diff --git a/batch-boot-jpa-sample/pom.xml b/batch-boot-jpa-sample/pom.xml index c6e79d337..37babaf43 100644 --- a/batch-boot-jpa-sample/pom.xml +++ b/batch-boot-jpa-sample/pom.xml @@ -243,7 +243,7 @@ - 1.24.0 + 1.25.0 diff --git a/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/Application.java b/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/BatchApplication.java similarity index 82% rename from batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/Application.java rename to batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/BatchApplication.java index cacb8a503..56d5ee4e3 100644 --- a/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/Application.java +++ b/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/BatchApplication.java @@ -7,9 +7,9 @@ @SpringBootApplication @EnableConfigurationProperties({ApplicationProperties.class}) -public class Application { +public class BatchApplication { public static void main(String[] args) { - SpringApplication.run(Application.class, args); + SpringApplication.run(BatchApplication.class, args); } } diff --git a/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/BatchConfig.java b/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/BatchConfig.java index a3b876b84..8d149949b 100644 --- a/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/BatchConfig.java +++ b/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/BatchConfig.java @@ -9,7 +9,12 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.batch.core.*; +import org.springframework.batch.core.BatchStatus; +import org.springframework.batch.core.Job; +import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobExecutionListener; +import org.springframework.batch.core.JobParameters; +import org.springframework.batch.core.Step; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; import org.springframework.batch.core.configuration.annotation.StepScope; import org.springframework.batch.core.job.builder.JobBuilder; @@ -60,7 +65,6 @@ Job allCustomersJob( .start(step) .incrementer(new RunIdIncrementer()) .listener(this) - .start(step) .build(); } diff --git a/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/Initializer.java b/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/Initializer.java index 12cd9e128..c7a9ec70d 100644 --- a/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/Initializer.java +++ b/batch-boot-jpa-sample/src/main/java/com/example/bootbatchjpa/config/Initializer.java @@ -27,11 +27,12 @@ public void run(String... args) { List customerList = Instancio.ofList(Customer.class) .size(1000) + .ignore(field(Customer.class, "id")) .generate( field(Customer.class, "gender"), gen -> gen.oneOf("male", "female")) .create(); log.info("Saving Customers of size :{}", customerList.size()); - customerList = customerRepository.saveAllAndFlush(customerList); + customerList = customerRepository.saveAll(customerList); log.info("Inserted customers of size :{}", customerList.size()); } } diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/TestApplication.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/TestApplication.java deleted file mode 100644 index 014923f7c..000000000 --- a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/TestApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.bootbatchjpa; - -import com.example.bootbatchjpa.common.TestContainersConfig; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.test.context.TestConfiguration; -import org.springframework.boot.testcontainers.context.ImportTestcontainers; - -@TestConfiguration(proxyBeanMethods = false) -@ImportTestcontainers(TestContainersConfig.class) -public class TestApplication { - - public static void main(String[] args) { - SpringApplication.from(Application::main).with(TestApplication.class).run(args); - } -} diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/TestBatchApplication.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/TestBatchApplication.java new file mode 100644 index 000000000..25f98a5d2 --- /dev/null +++ b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/TestBatchApplication.java @@ -0,0 +1,11 @@ +package com.example.bootbatchjpa; + +import com.example.bootbatchjpa.common.ContainersConfig; +import org.springframework.boot.SpringApplication; + +public class TestBatchApplication { + + public static void main(String[] args) { + SpringApplication.from(BatchApplication::main).with(ContainersConfig.class).run(args); + } +} diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/AbstractIntegrationTest.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/AbstractIntegrationTest.java index daa6a1746..e6e8eafd6 100644 --- a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/AbstractIntegrationTest.java +++ b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/AbstractIntegrationTest.java @@ -3,7 +3,6 @@ import static com.example.bootbatchjpa.utils.AppConstants.PROFILE_TEST; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; -import com.example.bootbatchjpa.TestApplication; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -14,7 +13,7 @@ @ActiveProfiles({PROFILE_TEST}) @SpringBootTest( webEnvironment = RANDOM_PORT, - classes = {TestApplication.class}) + classes = {ContainersConfig.class}) @AutoConfigureMockMvc public abstract class AbstractIntegrationTest { diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/ContainersConfig.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/ContainersConfig.java new file mode 100644 index 000000000..9b6d97457 --- /dev/null +++ b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/ContainersConfig.java @@ -0,0 +1,17 @@ +package com.example.bootbatchjpa.common; + +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.boot.testcontainers.service.connection.ServiceConnection; +import org.springframework.context.annotation.Bean; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.utility.DockerImageName; + +@TestConfiguration(proxyBeanMethods = false) +public class ContainersConfig { + + @Bean + @ServiceConnection + PostgreSQLContainer postgreSQLContainer() { + return new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("17.2-alpine")); + } +} diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/TestContainersConfig.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/TestContainersConfig.java deleted file mode 100644 index a372135ee..000000000 --- a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/common/TestContainersConfig.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.example.bootbatchjpa.common; - -import org.springframework.boot.testcontainers.service.connection.ServiceConnection; -import org.testcontainers.containers.PostgreSQLContainer; -import org.testcontainers.utility.DockerImageName; - -public interface TestContainersConfig { - - @ServiceConnection - PostgreSQLContainer postgreSQLContainer = - new PostgreSQLContainer<>(DockerImageName.parse("postgres").withTag("17.2-alpine")); -} diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/SchemaValidationTest.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/InnerSchemaValidationTest.java similarity index 79% rename from batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/SchemaValidationTest.java rename to batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/InnerSchemaValidationTest.java index cc9d24d8e..6edc759ad 100644 --- a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/SchemaValidationTest.java +++ b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/InnerSchemaValidationTest.java @@ -2,17 +2,17 @@ import static org.assertj.core.api.Assertions.assertThat; -import com.example.bootbatchjpa.common.TestContainersConfig; +import com.example.bootbatchjpa.common.ContainersConfig; import com.zaxxer.hikari.HikariDataSource; import javax.sql.DataSource; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.boot.testcontainers.context.ImportTestcontainers; +import org.springframework.context.annotation.Import; @DataJpaTest(properties = {"spring.jpa.hibernate.ddl-auto=validate"}) -@ImportTestcontainers(TestContainersConfig.class) +@Import(ContainersConfig.class) @AutoConfigureTestDatabase class SchemaValidationTest { diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java index 981d3c3b7..e5a4df57d 100644 --- a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java +++ b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java @@ -39,7 +39,7 @@ void setUp() { field(Customer.class, "gender"), gen -> gen.oneOf("male", "female")) .create(); - customerList = customerRepository.saveAllAndFlush(customerList); + customerList = customerRepository.saveAll(customerList); } @Test diff --git a/httpClients/boot-http-proxy/src/test/java/com/example/rest/proxy/TestApplication.java b/httpClients/boot-http-proxy/src/test/java/com/example/rest/proxy/TestApplication.java index 75164e1a1..052dfe602 100644 --- a/httpClients/boot-http-proxy/src/test/java/com/example/rest/proxy/TestApplication.java +++ b/httpClients/boot-http-proxy/src/test/java/com/example/rest/proxy/TestApplication.java @@ -6,6 +6,6 @@ class TestApplication { public static void main(String[] args) { - SpringApplication.from(Application::main).with(ContainersConfig.class).run(args); + SpringApplication.from(BatchApplication::main).with(ContainersConfig.class).run(args); } } diff --git a/httpClients/boot-rest-template/src/test/java/com/example/rest/template/TestApplication.java b/httpClients/boot-rest-template/src/test/java/com/example/rest/template/TestApplication.java index 5c25f9a20..5fde5e4f5 100644 --- a/httpClients/boot-rest-template/src/test/java/com/example/rest/template/TestApplication.java +++ b/httpClients/boot-rest-template/src/test/java/com/example/rest/template/TestApplication.java @@ -6,6 +6,6 @@ class TestApplication { public static void main(String[] args) { - SpringApplication.from(Application::main).with(ContainersConfig.class).run(args); + SpringApplication.from(BatchApplication::main).with(ContainersConfig.class).run(args); } } From b78b8f860a5a30690b18f2d26e847ce616a39286 Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Thu, 12 Dec 2024 11:35:34 +0000 Subject: [PATCH 4/4] fix : junit failures --- ...InnerSchemaValidationTest.java => SchemaValidationTest.java} | 0 .../bootbatchjpa/web/controllers/CustomerControllerIT.java | 2 ++ .../src/test/java/com/example/rest/proxy/TestApplication.java | 2 +- .../test/java/com/example/rest/template/TestApplication.java | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) rename batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/{InnerSchemaValidationTest.java => SchemaValidationTest.java} (100%) diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/InnerSchemaValidationTest.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/SchemaValidationTest.java similarity index 100% rename from batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/InnerSchemaValidationTest.java rename to batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/repository/SchemaValidationTest.java diff --git a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java index e5a4df57d..4d90dfb0d 100644 --- a/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java +++ b/batch-boot-jpa-sample/src/test/java/com/example/bootbatchjpa/web/controllers/CustomerControllerIT.java @@ -35,6 +35,7 @@ void setUp() { customerList = Instancio.ofList(Customer.class) .size(3) + .ignore(field(Customer.class, "id")) .generate( field(Customer.class, "gender"), gen -> gen.oneOf("male", "female")) .create(); @@ -72,6 +73,7 @@ void shouldFindCustomerById() throws Exception { @Test void shouldCreateNewCustomer() throws Exception { Customer customer = Instancio.create(Customer.class); + customer.setId(null); this.mockMvc .perform( post("/api/customers") diff --git a/httpClients/boot-http-proxy/src/test/java/com/example/rest/proxy/TestApplication.java b/httpClients/boot-http-proxy/src/test/java/com/example/rest/proxy/TestApplication.java index 052dfe602..75164e1a1 100644 --- a/httpClients/boot-http-proxy/src/test/java/com/example/rest/proxy/TestApplication.java +++ b/httpClients/boot-http-proxy/src/test/java/com/example/rest/proxy/TestApplication.java @@ -6,6 +6,6 @@ class TestApplication { public static void main(String[] args) { - SpringApplication.from(BatchApplication::main).with(ContainersConfig.class).run(args); + SpringApplication.from(Application::main).with(ContainersConfig.class).run(args); } } diff --git a/httpClients/boot-rest-template/src/test/java/com/example/rest/template/TestApplication.java b/httpClients/boot-rest-template/src/test/java/com/example/rest/template/TestApplication.java index 5fde5e4f5..5c25f9a20 100644 --- a/httpClients/boot-rest-template/src/test/java/com/example/rest/template/TestApplication.java +++ b/httpClients/boot-rest-template/src/test/java/com/example/rest/template/TestApplication.java @@ -6,6 +6,6 @@ class TestApplication { public static void main(String[] args) { - SpringApplication.from(BatchApplication::main).with(ContainersConfig.class).run(args); + SpringApplication.from(Application::main).with(ContainersConfig.class).run(args); } }