From 5c49980d94ed126b5a407fb8ce9c4f62bbf1108c Mon Sep 17 00:00:00 2001 From: AlexBob Date: Sun, 22 Dec 2024 12:54:40 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20refactor(`QueryHelperTest.java`)?= =?UTF-8?q?:=20Remove=20unused=20JUnit=20test=20class.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ⬇️ refactor(`InfrastructureConfiguration.java`): Remove unused import. 🚀 refactor(`BootApplicationTest.java`): Update SpringBootTest annotation. ⬆️ refactor(`build.gradle`): Upgrade dependency-management plugin. 🔧 refactor(`platform/build.gradle`): Comment out Jooq implementation. ➖ refactor(`ContextUtils.java`): Remove JOOQDSL and related code. 🚨 refactor(`R2dbcConfiguration.java`): Remove DSLContext bean definition. --- boot/platform/build.gradle | 2 +- .../com/plate/boot/commons/utils/ContextUtils.java | 6 +----- .../com/plate/boot/config/R2dbcConfiguration.java | 11 ----------- .../test/java/com/plate/boot/BootApplicationTest.java | 3 ++- .../boot/commons/utils/query/QueryHelperTest.java | 10 ---------- .../boot/config/InfrastructureConfiguration.java | 1 - build.gradle | 8 +++++++- 7 files changed, 11 insertions(+), 30 deletions(-) delete mode 100644 boot/platform/src/test/java/com/plate/boot/commons/utils/query/QueryHelperTest.java diff --git a/boot/platform/build.gradle b/boot/platform/build.gradle index 084fe1fb..4b178825 100644 --- a/boot/platform/build.gradle +++ b/boot/platform/build.gradle @@ -15,7 +15,7 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-data-redis-reactive") //implementation("org.springframework.boot:spring-boot-starter-jooq") - implementation("org.jooq:jooq") + //implementation("org.jooq:jooq") implementation("org.springframework.boot:spring-boot-starter-data-r2dbc") implementation("org.postgresql:r2dbc-postgresql") diff --git a/boot/platform/src/main/java/com/plate/boot/commons/utils/ContextUtils.java b/boot/platform/src/main/java/com/plate/boot/commons/utils/ContextUtils.java index 1e4c7bcc..92623ec7 100644 --- a/boot/platform/src/main/java/com/plate/boot/commons/utils/ContextUtils.java +++ b/boot/platform/src/main/java/com/plate/boot/commons/utils/ContextUtils.java @@ -7,7 +7,6 @@ import com.plate.boot.security.SecurityDetails; import com.plate.boot.security.core.user.UsersService; import lombok.extern.log4j.Log4j2; -import org.jooq.DSLContext; import org.springframework.beans.factory.InitializingBean; import org.springframework.http.HttpHeaders; import org.springframework.http.server.reactive.ServerHttpRequest; @@ -107,18 +106,15 @@ public final class ContextUtils implements InitializingBean { */ public static UsersService USERS_SERVICE; - public static DSLContext JOOQDSL; - /** * Initializes the ContextUtils class with necessary dependencies. * * @param objectMapper The ObjectMapper instance used for JSON serialization and deserialization. * @param usersService The UsersService instance to provide access to user-related operations. */ - ContextUtils(ObjectMapper objectMapper, UsersService usersService, DSLContext create) { + ContextUtils(ObjectMapper objectMapper, UsersService usersService) { ContextUtils.OBJECT_MAPPER = objectMapper; ContextUtils.USERS_SERVICE = usersService; - ContextUtils.JOOQDSL = create; } /** diff --git a/boot/platform/src/main/java/com/plate/boot/config/R2dbcConfiguration.java b/boot/platform/src/main/java/com/plate/boot/config/R2dbcConfiguration.java index 9c5d36b0..955cb4e6 100644 --- a/boot/platform/src/main/java/com/plate/boot/config/R2dbcConfiguration.java +++ b/boot/platform/src/main/java/com/plate/boot/config/R2dbcConfiguration.java @@ -6,9 +6,6 @@ import io.r2dbc.spi.ConnectionFactories; import io.r2dbc.spi.ConnectionFactory; import lombok.RequiredArgsConstructor; -import org.jooq.DSLContext; -import org.jooq.SQLDialect; -import org.jooq.impl.DSL; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.convert.converter.Converter; @@ -16,7 +13,6 @@ import org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration; import org.springframework.data.r2dbc.config.EnableR2dbcAuditing; import org.springframework.lang.NonNull; -import org.springframework.r2dbc.connection.TransactionAwareConnectionFactoryProxy; import org.springframework.transaction.annotation.EnableTransactionManagement; import java.util.List; @@ -75,11 +71,4 @@ public ReactiveAuditorAware userAuditorProvider() { return new UserAuditorAware(); } - @Bean - public DSLContext dslContext(ConnectionFactory connectionFactory) { - return DSL.using( - new TransactionAwareConnectionFactoryProxy(connectionFactory), - SQLDialect.POSTGRES - ); - } } \ No newline at end of file diff --git a/boot/platform/src/test/java/com/plate/boot/BootApplicationTest.java b/boot/platform/src/test/java/com/plate/boot/BootApplicationTest.java index d2f3881b..bd60d813 100644 --- a/boot/platform/src/test/java/com/plate/boot/BootApplicationTest.java +++ b/boot/platform/src/test/java/com/plate/boot/BootApplicationTest.java @@ -1,11 +1,12 @@ package com.plate.boot; import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; /** * @author Alex Bob */ -//@SpringBootTest(classes = InfrastructureConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest class BootApplicationTest { @Test diff --git a/boot/platform/src/test/java/com/plate/boot/commons/utils/query/QueryHelperTest.java b/boot/platform/src/test/java/com/plate/boot/commons/utils/query/QueryHelperTest.java deleted file mode 100644 index ac21f142..00000000 --- a/boot/platform/src/test/java/com/plate/boot/commons/utils/query/QueryHelperTest.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.plate.boot.commons.utils.query; - -import org.junit.jupiter.api.Test; - -class QueryHelperTest { - - @Test - void jooqTest() { - } -} \ No newline at end of file diff --git a/boot/platform/src/test/java/com/plate/boot/config/InfrastructureConfiguration.java b/boot/platform/src/test/java/com/plate/boot/config/InfrastructureConfiguration.java index 33db9d13..6d6bb6aa 100644 --- a/boot/platform/src/test/java/com/plate/boot/config/InfrastructureConfiguration.java +++ b/boot/platform/src/test/java/com/plate/boot/config/InfrastructureConfiguration.java @@ -10,5 +10,4 @@ @SpringBootApplication(exclude = {SecurityAutoConfiguration.class, SecurityConfiguration.class}) @EnableTransactionManagement public class InfrastructureConfiguration { - } diff --git a/build.gradle b/build.gradle index 6fba0eb1..c1bc049c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'org.springframework.boot' version '3.4.1' apply false - id 'io.spring.dependency-management' version '1.1.6' + id 'io.spring.dependency-management' version '1.1.7' id 'org.graalvm.buildtools.native' version '0.10.3' } @@ -36,6 +36,12 @@ configure(subprojects - project(":boot")) { project -> ] } + java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } + } + configurations { compileOnly { extendsFrom annotationProcessor