From 2d63f4c7c6bbc6ed257b9f7b0f7f116ae8bb2244 Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Thu, 16 Nov 2023 01:15:51 +0000 Subject: [PATCH] #876 - Upgrade to Java 21 and SB 3.2.0-RC2 --- .../workflows/boot-api-archunit-sample.yml | 6 ++--- boot-api-archunit-sample/pom.xml | 25 +++++++++++++++++-- .../archunit/ApplicationIntegrationTest.java | 10 -------- .../archunit/SchemaValidationTest.java | 22 ++++++++++------ .../archunit/common/ContainersConfig.java | 2 +- 5 files changed, 42 insertions(+), 23 deletions(-) delete mode 100644 boot-api-archunit-sample/src/test/java/com/example/archunit/ApplicationIntegrationTest.java diff --git a/.github/workflows/boot-api-archunit-sample.yml b/.github/workflows/boot-api-archunit-sample.yml index 85891765a..8e275211e 100644 --- a/.github/workflows/boot-api-archunit-sample.yml +++ b/.github/workflows/boot-api-archunit-sample.yml @@ -25,11 +25,11 @@ jobs: with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3.13.0 with: - java-version: 17 - distribution: "zulu" + java-version: 21 + distribution: "microsoft" cache: "maven" - name: Build and analyze diff --git a/boot-api-archunit-sample/pom.xml b/boot-api-archunit-sample/pom.xml index f8c8db658..d4dbd44b8 100644 --- a/boot-api-archunit-sample/pom.xml +++ b/boot-api-archunit-sample/pom.xml @@ -7,7 +7,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.5 + 3.2.0-RC2 com.example.archunit @@ -20,7 +20,7 @@ UTF-8 UTF-8 - 17 + 21 2.2.0 1.2.0 @@ -333,4 +333,25 @@ + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/boot-api-archunit-sample/src/test/java/com/example/archunit/ApplicationIntegrationTest.java b/boot-api-archunit-sample/src/test/java/com/example/archunit/ApplicationIntegrationTest.java deleted file mode 100644 index 261aee9f1..000000000 --- a/boot-api-archunit-sample/src/test/java/com/example/archunit/ApplicationIntegrationTest.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.example.archunit; - -import com.example.archunit.common.AbstractIntegrationTest; -import org.junit.jupiter.api.Test; - -class ApplicationIntegrationTest extends AbstractIntegrationTest { - - @Test - void contextLoads() {} -} diff --git a/boot-api-archunit-sample/src/test/java/com/example/archunit/SchemaValidationTest.java b/boot-api-archunit-sample/src/test/java/com/example/archunit/SchemaValidationTest.java index 2b0625bd6..0a7e1448d 100644 --- a/boot-api-archunit-sample/src/test/java/com/example/archunit/SchemaValidationTest.java +++ b/boot-api-archunit-sample/src/test/java/com/example/archunit/SchemaValidationTest.java @@ -1,16 +1,24 @@ package com.example.archunit; +import static org.assertj.core.api.Assertions.assertThat; + +import com.example.archunit.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.orm.jpa.DataJpaTest; +import org.springframework.context.annotation.Import; -@DataJpaTest( - properties = { - "spring.jpa.hibernate.ddl-auto=validate", - "spring.test.database.replace=none", - "spring.datasource.url=jdbc:tc:postgresql:16.0-alpine:///db" - }) +@DataJpaTest(properties = {"spring.jpa.hibernate.ddl-auto=validate", "spring.test.database.replace=none"}) +@Import(ContainersConfig.class) class SchemaValidationTest { + @Autowired + private DataSource dataSource; + @Test - void validateJpaMappingsWithDbSchema() {} + void validateJpaMappingsWithDbSchema() { + assertThat(dataSource).isInstanceOf(HikariDataSource.class); + } } diff --git a/boot-api-archunit-sample/src/test/java/com/example/archunit/common/ContainersConfig.java b/boot-api-archunit-sample/src/test/java/com/example/archunit/common/ContainersConfig.java index 78c0b1115..5839cec8e 100644 --- a/boot-api-archunit-sample/src/test/java/com/example/archunit/common/ContainersConfig.java +++ b/boot-api-archunit-sample/src/test/java/com/example/archunit/common/ContainersConfig.java @@ -12,6 +12,6 @@ public class ContainersConfig { @Bean @ServiceConnection PostgreSQLContainer postgreSQLContainer() { - return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16.0-alpine")); + return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16.1-alpine")); } }