This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 040391d00e1 Bump Junit Platform to 5.10.3 to support using 
`@EnabledInNativeImage` on the test classes (#31982)
040391d00e1 is described below

commit 040391d00e17fbc30390f5ca8120e5a1b308aef1
Author: Ling Hengqian <[email protected]>
AuthorDate: Sat Jul 6 12:21:24 2024 +0800

    Bump Junit Platform to 5.10.3 to support using `@EnabledInNativeImage` on 
the test classes (#31982)
---
 .../graalvm-native-image/_index.cn.md              | 20 ++++++
 .../graalvm-native-image/_index.en.md              | 20 ++++++
 .../docker-java-api/3.3.6/reflect-config.json      |  7 +++
 .../reflect-config.json                            | 42 ++++++-------
 pom.xml                                            |  6 +-
 test/native/pom.xml                                |  8 +++
 .../jdbc/commons/repository/OrderRepository.java   | 11 ----
 .../natived/jdbc/databases/ClickHouseTest.java     |  2 +-
 .../test/natived/jdbc/databases/MySQLTest.java     | 73 ++++++++++++----------
 .../test/natived/jdbc/databases/OpenGaussTest.java | 62 ++++++++++--------
 .../test/natived/jdbc/databases/PostgresTest.java  |  2 +-
 .../test/natived/jdbc/databases/SQLServerTest.java |  2 +-
 .../test/natived/jdbc/modes/cluster/EtcdTest.java  | 58 +++++++++--------
 .../natived/jdbc/modes/cluster/ZookeeperTest.java  | 21 ++++---
 .../natived/jdbc/transactions/base/SeataTest.java  | 56 +++++++++++------
 .../resources/seata-script-client-conf-file.conf   |  6 +-
 16 files changed, 241 insertions(+), 155 deletions(-)

diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
index 01e3523414c..30ff0a61833 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
@@ -25,6 +25,18 @@ ShardingSphere JDBC 要求在如下或更高版本的 `GraalVM CE` 完成构建
 典型的例子来自 HiveServer2 JDBC Driver 相关的 
`org.apache.hive:hive-jdbc:4.0.0`,HiveServer2 JDBC Driver 使用了 AWT 相关的类,
 而 GraalVM CE 对 `java.beans.**` package 的支持仅位于 GraalVM CE For JDK22 及更高版本。
 
+```shell
+com.sun.beans.introspect.ClassInfo was unintentionally initialized at build 
time. To see why com.sun.beans.introspect.ClassInfo got initialized use 
--trace-class-initialization=com.sun.beans.introspect.ClassInfo
+java.beans.Introspector was unintentionally initialized at build time. To see 
why java.beans.Introspector got initialized use 
--trace-class-initialization=java.beans.Introspector
+com.sun.beans.util.Cache$Kind$2 was unintentionally initialized at build time. 
To see why com.sun.beans.util.Cache$Kind$2 got initialized use 
--trace-class-initialization=com.sun.beans.util.Cache$Kind$2
+com.sun.beans.TypeResolver was unintentionally initialized at build time. To 
see why com.sun.beans.TypeResolver got initialized use 
--trace-class-initialization=com.sun.beans.TypeResolver
+java.beans.ThreadGroupContext was unintentionally initialized at build time. 
To see why java.beans.ThreadGroupContext got initialized use 
--trace-class-initialization=java.beans.ThreadGroupContext
+com.sun.beans.util.Cache$Kind was unintentionally initialized at build time. 
To see why com.sun.beans.util.Cache$Kind got initialized use 
--trace-class-initialization=com.sun.beans.util.Cache$Kind
+com.sun.beans.introspect.MethodInfo was unintentionally initialized at build 
time. To see why com.sun.beans.introspect.MethodInfo got initialized use 
--trace-class-initialization=com.sun.beans.introspect.MethodInfo
+com.sun.beans.util.Cache$Kind$1 was unintentionally initialized at build time. 
To see why com.sun.beans.util.Cache$Kind$1 got initialized use 
--trace-class-initialization=com.sun.beans.util.Cache$Kind$1
+com.sun.beans.util.Cache$Kind$3 was unintentionally initialized at build time. 
To see why com.sun.beans.util.Cache$Kind$3 got initialized use 
--trace-class-initialization=com.sun.beans.util.Cache$Kind$3
+```
+
 ### Maven 生态
 
 使用者需要主动使用 GraalVM Reachability Metadata 中央仓库。
@@ -281,6 +293,14 @@ Caused by: java.io.UnsupportedEncodingException: Codepage 
Cp1252 is not supporte
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-runtime</artifactId>
             </exclusion>
+            <exclusion>
+               <groupId>commons-lang</groupId>
+               <artifactId>commons-lang</artifactId>
+            </exclusion>
+            <exclusion>
+               <groupId>org.apache.commons</groupId>
+               <artifactId>commons-pool2</artifactId>
+            </exclusion>
          </exclusions>
       </dependency>
     </dependencies>
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
index 35b038fd882..859e95e325a 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
@@ -26,6 +26,18 @@ However, this will cause the failure of building the GraalVM 
Native Image when i
 A typical example is related to the `org.apache.hive:hive-jdbc:4.0.0` 
HiveServer2 JDBC Driver, which uses AWT-related classes. 
 GraalVM CE only supports AWT for GraalVM CE For JDK22 and higher versions.
 
+```shell
+com.sun.beans.introspect.ClassInfo was unintentionally initialized at build 
time. To see why com.sun.beans.introspect.ClassInfo got initialized use 
--trace-class-initialization=com.sun.beans.introspect.ClassInfo
+java.beans.Introspector was unintentionally initialized at build time. To see 
why java.beans.Introspector got initialized use 
--trace-class-initialization=java.beans.Introspector
+com.sun.beans.util.Cache$Kind$2 was unintentionally initialized at build time. 
To see why com.sun.beans.util.Cache$Kind$2 got initialized use 
--trace-class-initialization=com.sun.beans.util.Cache$Kind$2
+com.sun.beans.TypeResolver was unintentionally initialized at build time. To 
see why com.sun.beans.TypeResolver got initialized use 
--trace-class-initialization=com.sun.beans.TypeResolver
+java.beans.ThreadGroupContext was unintentionally initialized at build time. 
To see why java.beans.ThreadGroupContext got initialized use 
--trace-class-initialization=java.beans.ThreadGroupContext
+com.sun.beans.util.Cache$Kind was unintentionally initialized at build time. 
To see why com.sun.beans.util.Cache$Kind got initialized use 
--trace-class-initialization=com.sun.beans.util.Cache$Kind
+com.sun.beans.introspect.MethodInfo was unintentionally initialized at build 
time. To see why com.sun.beans.introspect.MethodInfo got initialized use 
--trace-class-initialization=com.sun.beans.introspect.MethodInfo
+com.sun.beans.util.Cache$Kind$1 was unintentionally initialized at build time. 
To see why com.sun.beans.util.Cache$Kind$1 got initialized use 
--trace-class-initialization=com.sun.beans.util.Cache$Kind$1
+com.sun.beans.util.Cache$Kind$3 was unintentionally initialized at build time. 
To see why com.sun.beans.util.Cache$Kind$3 got initialized use 
--trace-class-initialization=com.sun.beans.util.Cache$Kind$3
+```
+
 ### Maven Ecology
 
 Users need to actively use the GraalVM Reachability Metadata central 
repository. 
@@ -296,6 +308,14 @@ Possible configuration examples are as follows,
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-runtime</artifactId>
             </exclusion>
+            <exclusion>
+               <groupId>commons-lang</groupId>
+               <artifactId>commons-lang</artifactId>
+            </exclusion>
+            <exclusion>
+               <groupId>org.apache.commons</groupId>
+               <artifactId>commons-pool2</artifactId>
+            </exclusion>
          </exclusions>
       </dependency>
     </dependencies>
diff --git 
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.github.docker-java/docker-java-api/3.3.6/reflect-config.json
 
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.github.docker-java/docker-java-api/3.3.6/reflect-config.json
new file mode 100644
index 00000000000..f3f5e1ef247
--- /dev/null
+++ 
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.github.docker-java/docker-java-api/3.3.6/reflect-config.json
@@ -0,0 +1,7 @@
+[
+{
+  "condition":{"typeReachable":"com.github.dockerjava.api.model.RuntimeInfo"},
+  "name":"com.github.dockerjava.api.model.RuntimeInfo",
+  "allPublicConstructors": true
+}
+]
diff --git 
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json
 
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json
index 74dab95028b..0aab93c80af 100644
--- 
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json
+++ 
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json
@@ -587,12 +587,12 @@
   "name":"org.apache.shardingsphere.infra.util.eventbus.EventSubscriber"
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.event.subsciber.DeliverEventSubscriberRegistry$$Lambda/0x00007f65a7c51060"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.event.subsciber.DeliverEventSubscriberRegistry$$Lambda/0x00007f30ffc53708"},
   "name":"org.apache.shardingsphere.infra.util.eventbus.EventSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   "name":"org.apache.shardingsphere.infra.util.eventbus.EventSubscriber",
   "queryAllDeclaredMethods":true
 },
@@ -906,52 +906,52 @@
   
"name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfigurationCustomizer"
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.event.subsciber.DeliverEventSubscriberRegistry$$Lambda/0x00007f65a7c51060"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.event.subsciber.DeliverEventSubscriberRegistry$$Lambda/0x00007f30ffc53708"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.deliver.DeliverQualifiedDataSourceSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.CacheEvictedSubscriber",
-  
"methods":[{"name":"onGovernanceEvent","parameterTypes":["org.apache.shardingsphere.infra.rule.event.GovernanceEvent"]
 }]
+  
"methods":[{"name":"cleanCache","parameterTypes":["org.apache.shardingsphere.mode.event.dispatch.DispatchEvent"]
 }]
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.CacheEvictedSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ComputeNodeOnlineSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.DatabaseChangedSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.GlobalRuleConfigurationEventSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ListenerAssistedMetaDataChangedSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ProcessListChangedSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.PropertiesEventSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.QualifiedDataSourceSubscriber",
   "queryAllDeclaredMethods":true
 },
@@ -960,26 +960,26 @@
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ResourceMetaDataChangedSubscriber"
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.coordinator.listener.MetaDataChangedListener$$Lambda/0x00007f65a7c67bd0"},
-  
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ResourceMetaDataChangedSubscriber"
-},
-{
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ResourceMetaDataChangedSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.listener.MetaDataChangedListener$$Lambda/0x00007f30ffc6a438"},
+  
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.ResourceMetaDataChangedSubscriber"
+},
+{
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.RuleItemChangedSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.StateChangedSubscriber",
   "queryAllDeclaredMethods":true
 },
 {
-  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f65a7c61ca8"},
+  
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.registry.ClusterDispatchEventSubscriberRegistry$$Lambda/0x00007f30ffc643b0"},
   
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.StorageUnitEventSubscriber",
   "queryAllDeclaredMethods":true
 },
@@ -994,7 +994,7 @@
 },
 {
   
"condition":{"typeReachable":"org.apache.shardingsphere.mode.persist.PersistServiceFacade"},
-  
"name":"org.apache.shardingsphere.mode.manager.standalone.persist.service.StandalonePersistServiceBuilder",
+  
"name":"org.apache.shardingsphere.mode.manager.standalone.persist.StandalonePersistServiceBuilder",
   "methods":[{"name":"<init>","parameterTypes":[] }]
 },
 {
diff --git a/pom.xml b/pom.xml
index 24062f9e23b..d08c07677c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -136,14 +136,14 @@
         <opentelemetry.version>1.31.0</opentelemetry.version>
         <kotlin-stdlib.version>1.9.10</kotlin-stdlib.version>
         
-        <junit.version>5.10.2</junit.version>
+        <junit.version>5.10.3</junit.version>
         <hamcrest.version>2.2</hamcrest.version>
         <mockito.version>4.11.0</mockito.version>
         <awaitility.version>4.2.0</awaitility.version>
-        <testcontainers.version>1.19.3</testcontainers.version>
+        <testcontainers.version>1.19.8</testcontainers.version>
         <commons-csv.version>1.9.0</commons-csv.version>
         
-        <graal-sdk.version>24.0.0</graal-sdk.version>
+        <graal-sdk.version>24.0.1</graal-sdk.version>
         <jedis.version>4.4.6</jedis.version>
         
         <!-- 3rd party library plugin versions -->
diff --git a/test/native/pom.xml b/test/native/pom.xml
index 1266875230c..71f1c36005d 100644
--- a/test/native/pom.xml
+++ b/test/native/pom.xml
@@ -115,6 +115,14 @@ using Seata Client under GraalVM Native Image requires 
using the version release
                     <groupId>org.antlr</groupId>
                     <artifactId>antlr4-runtime</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>commons-lang</groupId>
+                    <artifactId>commons-lang</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.commons</groupId>
+                    <artifactId>commons-pool2</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/OrderRepository.java
 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/OrderRepository.java
index 01e69141d9c..7cded2baf10 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/OrderRepository.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/OrderRepository.java
@@ -265,17 +265,6 @@ public final class OrderRepository {
         return order.getOrderId();
     }
     
-    /**
-     * insert Order to table without auto generated key. Databases like 
ClickHouse do not support returning auto generated keys after executing SQL,
-     * see <a 
href="https://github.com/ClickHouse/ClickHouse/issues/56228";>ClickHouse/ClickHouse#56228</a>
 .
-     *
-     * @param order order
-     * @throws SQLException SQL Exception
-     */
-    public void insertWithoutAutoGeneratedKey(final Order order) throws 
SQLException {
-        insert(order, Statement.NO_GENERATED_KEYS);
-    }
-    
     /**
      * delete by orderId.
      *
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/ClickHouseTest.java
 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/ClickHouseTest.java
index 6b57356d87e..1291caa9f1c 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/ClickHouseTest.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/ClickHouseTest.java
@@ -28,6 +28,7 @@ import java.sql.SQLException;
 
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 
+@EnabledInNativeImage
 class ClickHouseTest {
     
     private TestShardingService testShardingService;
@@ -37,7 +38,6 @@ class ClickHouseTest {
      *      after {@link TestShardingService#processSuccessInClickHouse()}.
      *
      */
-    @EnabledInNativeImage
     @Test
     void assertShardingInLocalTransactions() {
         HikariConfig config = new HikariConfig();
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java
 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java
index 1403a074110..4124e975e2a 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java
@@ -22,6 +22,9 @@ import com.zaxxer.hikari.HikariConfig;
 import com.zaxxer.hikari.HikariDataSource;
 import org.apache.shardingsphere.test.natived.jdbc.commons.TestShardingService;
 import org.awaitility.Awaitility;
+import org.junit.ClassRule;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.EnabledInNativeImage;
 import org.testcontainers.containers.GenericContainer;
@@ -43,6 +46,7 @@ import static org.hamcrest.Matchers.nullValue;
  * Unable to use `org.testcontainers:mysql:1.19.3` under GraalVM Native Image.
  * Background comes from <a 
href="https://github.com/testcontainers/testcontainers-java/issues/7954";>testcontainers/testcontainers-java#7954</a>.
  */
+@EnabledInNativeImage
 class MySQLTest {
     
     private static final String SYSTEM_PROP_KEY_PREFIX = 
"fixture.test-native.yaml.database.mysql.";
@@ -53,27 +57,40 @@ class MySQLTest {
     
     private static final String DATABASE = "test";
     
+    @SuppressWarnings("resource")
+    @ClassRule
+    public static GenericContainer<?> container = new 
GenericContainer<>(DockerImageName.parse("mysql:8.4.0-oracle"))
+            .withEnv("MYSQL_DATABASE", DATABASE)
+            .withEnv("MYSQL_ROOT_PASSWORD", PASSWORD)
+            .withExposedPorts(3306);
+    
     private String jdbcUrlPrefix;
     
     private TestShardingService testShardingService;
     
-    @SuppressWarnings("resource")
+    @BeforeAll
+    static void beforeAll() {
+        assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds0.jdbc-url"), is(nullValue()));
+        assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds1.jdbc-url"), is(nullValue()));
+        assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds2.jdbc-url"), is(nullValue()));
+    }
+    
+    @AfterAll
+    static void afterAll() {
+        System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds0.jdbc-url");
+        System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds1.jdbc-url");
+        System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds2.jdbc-url");
+    }
+    
     @Test
-    @EnabledInNativeImage
     void assertShardingInLocalTransactions() throws SQLException {
-        try (
-                GenericContainer<?> container = new 
GenericContainer<>(DockerImageName.parse("mysql:8.4.0-oracle"))
-                        .withEnv("MYSQL_DATABASE", DATABASE)
-                        .withEnv("MYSQL_ROOT_PASSWORD", PASSWORD)
-                        .withExposedPorts(3306)) {
-            container.start();
-            jdbcUrlPrefix = "jdbc:mysql://localhost:" + 
container.getMappedPort(3306) + "/";
-            DataSource dataSource = createDataSource();
-            testShardingService = new TestShardingService(dataSource);
-            initEnvironment();
-            testShardingService.processSuccess();
-            testShardingService.cleanEnvironment();
-        }
+        container.start();
+        jdbcUrlPrefix = "jdbc:mysql://localhost:" + 
container.getMappedPort(3306) + "/";
+        DataSource dataSource = createDataSource();
+        testShardingService = new TestShardingService(dataSource);
+        initEnvironment();
+        testShardingService.processSuccess();
+        testShardingService.cleanEnvironment();
     }
     
     private void initEnvironment() throws SQLException {
@@ -94,11 +111,10 @@ class MySQLTest {
     
     @SuppressWarnings({"SqlDialectInspection", "SqlNoDataSourceInspection"})
     private DataSource createDataSource() throws SQLException {
-        
Awaitility.await().atMost(Duration.ofMinutes(1L)).ignoreExceptionsMatching(e -> 
e instanceof CommunicationsException)
-                .until(() -> {
-                    openConnection().close();
-                    return true;
-                });
+        
Awaitility.await().atMost(Duration.ofMinutes(1L)).ignoreExceptionsMatching(e -> 
e instanceof CommunicationsException).until(() -> {
+            openConnection().close();
+            return true;
+        });
         try (
                 Connection connection = openConnection();
                 Statement statement = connection.createStatement()) {
@@ -109,18 +125,9 @@ class MySQLTest {
         HikariConfig config = new HikariConfig();
         
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
         
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/databases/mysql.yaml?placeholder-type=system_props");
-        try {
-            assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds0.jdbc-url"), is(nullValue()));
-            assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds1.jdbc-url"), is(nullValue()));
-            assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds2.jdbc-url"), is(nullValue()));
-            System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds0.jdbc-url", 
jdbcUrlPrefix + "demo_ds_0");
-            System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds1.jdbc-url", 
jdbcUrlPrefix + "demo_ds_1");
-            System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds2.jdbc-url", 
jdbcUrlPrefix + "demo_ds_2");
-            return new HikariDataSource(config);
-        } finally {
-            System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds0.jdbc-url");
-            System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds1.jdbc-url");
-            System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds2.jdbc-url");
-        }
+        System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds0.jdbc-url", 
jdbcUrlPrefix + "demo_ds_0");
+        System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds1.jdbc-url", 
jdbcUrlPrefix + "demo_ds_1");
+        System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds2.jdbc-url", 
jdbcUrlPrefix + "demo_ds_2");
+        return new HikariDataSource(config);
     }
 }
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/OpenGaussTest.java
 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/OpenGaussTest.java
index ad96a195fa2..9e03e9a7706 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/OpenGaussTest.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/OpenGaussTest.java
@@ -21,6 +21,9 @@ import com.zaxxer.hikari.HikariConfig;
 import com.zaxxer.hikari.HikariDataSource;
 import org.apache.shardingsphere.test.natived.jdbc.commons.TestShardingService;
 import org.awaitility.Awaitility;
+import org.junit.ClassRule;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.EnabledInNativeImage;
 import org.testcontainers.containers.GenericContainer;
@@ -38,6 +41,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.nullValue;
 
+@EnabledInNativeImage
 class OpenGaussTest {
     
     private static final String SYSTEM_PROP_KEY_PREFIX = 
"fixture.test-native.yaml.database.opengauss.";
@@ -48,26 +52,39 @@ class OpenGaussTest {
     
     private static final String DATABASE = "postgres";
     
+    @SuppressWarnings("resource")
+    @ClassRule
+    public static GenericContainer<?> container = new 
GenericContainer<>(DockerImageName.parse("opengauss/opengauss:5.0.0"))
+            .withEnv("GS_PASSWORD", PASSWORD)
+            .withExposedPorts(5432);
+    
     private String jdbcUrlPrefix;
     
     private TestShardingService testShardingService;
     
-    @SuppressWarnings("resource")
+    @BeforeAll
+    static void beforeAll() {
+        assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds0.jdbc-url"), is(nullValue()));
+        assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds1.jdbc-url"), is(nullValue()));
+        assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds2.jdbc-url"), is(nullValue()));
+    }
+    
+    @AfterAll
+    static void afterAll() {
+        System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds0.jdbc-url");
+        System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds1.jdbc-url");
+        System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds2.jdbc-url");
+    }
+    
     @Test
-    @EnabledInNativeImage
     void assertShardingInLocalTransactions() throws SQLException {
-        try (
-                GenericContainer<?> openGaussContainer = new 
GenericContainer<>(DockerImageName.parse("opengauss/opengauss:5.0.0"))
-                        .withEnv("GS_PASSWORD", PASSWORD)
-                        .withExposedPorts(5432)) {
-            openGaussContainer.start();
-            jdbcUrlPrefix = "jdbc:opengauss://localhost:" + 
openGaussContainer.getMappedPort(5432) + "/";
-            DataSource dataSource = createDataSource();
-            testShardingService = new TestShardingService(dataSource);
-            initEnvironment();
-            testShardingService.processSuccess();
-            testShardingService.cleanEnvironment();
-        }
+        container.start();
+        jdbcUrlPrefix = "jdbc:opengauss://localhost:" + 
container.getMappedPort(5432) + "/";
+        DataSource dataSource = createDataSource();
+        testShardingService = new TestShardingService(dataSource);
+        initEnvironment();
+        testShardingService.processSuccess();
+        testShardingService.cleanEnvironment();
     }
     
     private void initEnvironment() throws SQLException {
@@ -102,18 +119,9 @@ class OpenGaussTest {
         HikariConfig config = new HikariConfig();
         
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
         
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/databases/opengauss.yaml?placeholder-type=system_props");
-        try {
-            assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds0.jdbc-url"), is(nullValue()));
-            assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds1.jdbc-url"), is(nullValue()));
-            assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"ds2.jdbc-url"), is(nullValue()));
-            System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds0.jdbc-url", 
jdbcUrlPrefix + "demo_ds_0");
-            System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds1.jdbc-url", 
jdbcUrlPrefix + "demo_ds_1");
-            System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds2.jdbc-url", 
jdbcUrlPrefix + "demo_ds_2");
-            return new HikariDataSource(config);
-        } finally {
-            System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds0.jdbc-url");
-            System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds1.jdbc-url");
-            System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "ds2.jdbc-url");
-        }
+        System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds0.jdbc-url", 
jdbcUrlPrefix + "demo_ds_0");
+        System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds1.jdbc-url", 
jdbcUrlPrefix + "demo_ds_1");
+        System.setProperty(SYSTEM_PROP_KEY_PREFIX + "ds2.jdbc-url", 
jdbcUrlPrefix + "demo_ds_2");
+        return new HikariDataSource(config);
     }
 }
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java
 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java
index f2fd80218fb..d64abb19650 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java
@@ -26,11 +26,11 @@ import org.junit.jupiter.api.condition.EnabledInNativeImage;
 import javax.sql.DataSource;
 import java.sql.SQLException;
 
+@EnabledInNativeImage
 class PostgresTest {
     
     private TestShardingService testShardingService;
     
-    @EnabledInNativeImage
     @Test
     void assertShardingInLocalTransactions() throws SQLException {
         HikariConfig config = new HikariConfig();
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java
 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java
index 85cda969606..4cdaa36d2f8 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java
@@ -26,11 +26,11 @@ import org.junit.jupiter.api.condition.EnabledInNativeImage;
 import javax.sql.DataSource;
 import java.sql.SQLException;
 
+@EnabledInNativeImage
 class SQLServerTest {
     
     private TestShardingService testShardingService;
     
-    @EnabledInNativeImage
     @Test
     void assertShardingInLocalTransactions() throws SQLException {
         HikariConfig config = new HikariConfig();
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/EtcdTest.java
 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/EtcdTest.java
index f8ceff784eb..abf2e44b903 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/EtcdTest.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/EtcdTest.java
@@ -19,12 +19,14 @@ package 
org.apache.shardingsphere.test.natived.jdbc.modes.cluster;
 
 import com.zaxxer.hikari.HikariConfig;
 import com.zaxxer.hikari.HikariDataSource;
-import io.etcd.jetcd.launcher.Etcd;
-import io.etcd.jetcd.launcher.EtcdCluster;
+import io.etcd.jetcd.test.EtcdClusterExtension;
 import org.apache.shardingsphere.test.natived.jdbc.commons.TestShardingService;
 import org.awaitility.Awaitility;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.EnabledInNativeImage;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import javax.sql.DataSource;
 import java.net.URI;
@@ -36,12 +38,29 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.nullValue;
 
+@EnabledInNativeImage
 class EtcdTest {
     
+    @RegisterExtension
+    public static final EtcdClusterExtension CLUSTER = 
EtcdClusterExtension.builder()
+            .withNodes(1)
+            .withMountDirectory(false)
+            .build();
+    
     private static final String SYSTEM_PROP_KEY_PREFIX = 
"fixture.test-native.yaml.mode.cluster.etcd.";
     
     private TestShardingService testShardingService;
     
+    @BeforeAll
+    static void beforeAll() {
+        assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"server-lists"), is(nullValue()));
+    }
+    
+    @AfterAll
+    static void afterAll() {
+        System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "server-lists");
+    }
+    
     /**
      * TODO On low-performance devices in Github Actions, `INSERT` related 
SQLs may throw a table not found error under nativeTest.
      *  So that we need to wait for a period of time after executing `CREATE 
TABLE` related SQLs before executing `INSERT` related SQLs.
@@ -50,24 +69,16 @@ class EtcdTest {
      * @see 
org.apache.shardingsphere.mode.repository.cluster.etcd.EtcdRepository
      */
     @Test
-    @EnabledInNativeImage
     void assertShardingInLocalTransactions() throws SQLException {
-        try (
-                EtcdCluster etcd = Etcd.builder()
-                        .withNodes(1)
-                        .withMountedDataDirectory(false)
-                        .build()) {
-            etcd.start();
-            DataSource dataSource = createDataSource(etcd.clientEndpoints());
-            testShardingService = new TestShardingService(dataSource);
-            initEnvironment();
-            
Awaitility.await().atMost(Duration.ofSeconds(30L)).ignoreExceptions().until(() 
-> {
-                dataSource.getConnection().close();
-                return true;
-            });
-            testShardingService.processSuccess();
-            testShardingService.cleanEnvironment();
-        }
+        DataSource dataSource = createDataSource(CLUSTER.clientEndpoints());
+        testShardingService = new TestShardingService(dataSource);
+        initEnvironment();
+        
Awaitility.await().atMost(Duration.ofSeconds(30L)).ignoreExceptions().until(() 
-> {
+            dataSource.getConnection().close();
+            return true;
+        });
+        testShardingService.processSuccess();
+        testShardingService.cleanEnvironment();
     }
     
     private void initEnvironment() throws SQLException {
@@ -84,12 +95,7 @@ class EtcdTest {
         HikariConfig config = new HikariConfig();
         
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
         
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/modes/cluster/etcd.yaml?placeholder-type=system_props");
-        try {
-            assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"server-lists"), is(nullValue()));
-            System.setProperty(SYSTEM_PROP_KEY_PREFIX + "server-lists", 
clientEndpoint.toString());
-            return new HikariDataSource(config);
-        } finally {
-            System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "server-lists");
-        }
+        System.setProperty(SYSTEM_PROP_KEY_PREFIX + "server-lists", 
clientEndpoint.toString());
+        return new HikariDataSource(config);
     }
 }
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/ZookeeperTest.java
 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/ZookeeperTest.java
index 88836303e1a..5ff2a61e44e 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/ZookeeperTest.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/modes/cluster/ZookeeperTest.java
@@ -25,6 +25,8 @@ import org.apache.curator.retry.ExponentialBackoffRetry;
 import org.apache.curator.test.TestingServer;
 import org.apache.shardingsphere.test.natived.jdbc.commons.TestShardingService;
 import org.awaitility.Awaitility;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
 import javax.sql.DataSource;
@@ -42,6 +44,16 @@ class ZookeeperTest {
     
     private TestShardingService testShardingService;
     
+    @BeforeAll
+    static void beforeAll() {
+        assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"server-lists"), is(nullValue()));
+    }
+    
+    @AfterAll
+    static void afterAll() {
+        System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "server-lists");
+    }
+    
     /**
      * TODO On low-performance devices in Github Actions, `INSERT` related 
SQLs may throw a table not found error under nativeTest.
      *  So that we need to wait for a period of time after executing `CREATE 
TABLE` related SQLs before executing `INSERT` related SQLs.
@@ -84,12 +96,7 @@ class ZookeeperTest {
         HikariConfig config = new HikariConfig();
         
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
         
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/modes/cluster/zookeeper.yaml?placeholder-type=system_props");
-        try {
-            assertThat(System.getProperty(SYSTEM_PROP_KEY_PREFIX + 
"server-lists"), is(nullValue()));
-            System.setProperty(SYSTEM_PROP_KEY_PREFIX + "server-lists", 
connectString);
-            return new HikariDataSource(config);
-        } finally {
-            System.clearProperty(SYSTEM_PROP_KEY_PREFIX + "server-lists");
-        }
+        System.setProperty(SYSTEM_PROP_KEY_PREFIX + "server-lists", 
connectString);
+        return new HikariDataSource(config);
     }
 }
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java
 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java
index 827d856a1c1..fa3e3d4e2ec 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java
@@ -21,40 +21,55 @@ import com.zaxxer.hikari.HikariConfig;
 import com.zaxxer.hikari.HikariDataSource;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.shardingsphere.test.natived.jdbc.commons.TestShardingService;
+import org.junit.ClassRule;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.EnabledInNativeImage;
-import org.testcontainers.containers.FixedHostPortGenericContainer;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.wait.strategy.Wait;
 
 import javax.sql.DataSource;
 import java.sql.SQLException;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.nullValue;
+
+@EnabledInNativeImage
 class SeataTest {
     
-    private TestShardingService testShardingService;
-    
     /**
-     * TODO Since Seata Client 1.8.0 does not provide the function of defining 
`service.default.grouplist` through Java API, we need to use a hard-defined 
host port `39567` here.
      * TODO Further processing of `/health` awaits <a 
href="https://github.com/apache/incubator-seata/pull/6356";>apache/incubator-seata#6356</a>.
-     * @throws SQLException An exception that provides information on a 
database access error or other errors.
      */
-    @SuppressWarnings({"resource", "deprecation"})
+    @ClassRule
+    @SuppressWarnings("resource")
+    public static GenericContainer<?> container = new 
GenericContainer<>("seataio/seata-server:1.8.0")
+            .withExposedPorts(7091, 8091)
+            
.waitingFor(Wait.forHttp("/health").forPort(7091).forStatusCode(HttpStatus.SC_UNAUTHORIZED));
+    
+    private static final String SERVICE_DEFAULT_GROUP_LIST_KEY = 
"service.default.grouplist";
+    
+    private TestShardingService testShardingService;
+    
+    @BeforeAll
+    static void beforeAll() {
+        assertThat(System.getProperty(SERVICE_DEFAULT_GROUP_LIST_KEY), 
is(nullValue()));
+    }
+    
+    @AfterAll
+    static void afterAll() {
+        System.clearProperty(SERVICE_DEFAULT_GROUP_LIST_KEY);
+    }
+    
     @Test
-    @EnabledInNativeImage
     void assertShardingInSeataTransactions() throws SQLException {
-        try (
-                GenericContainer<?> container = new 
FixedHostPortGenericContainer<>("seataio/seata-server:1.8.0")
-                        .withFixedExposedPort(39567, 8091)
-                        .withExposedPorts(7091)
-                        
.waitingFor(Wait.forHttp("/health").forPort(7091).forStatusCode(HttpStatus.SC_UNAUTHORIZED)))
 {
-            container.start();
-            DataSource dataSource = createDataSource();
-            testShardingService = new TestShardingService(dataSource);
-            initEnvironment();
-            testShardingService.processSuccess();
-            testShardingService.cleanEnvironment();
-        }
+        container.start();
+        DataSource dataSource = 
createDataSource(container.getMappedPort(8091));
+        testShardingService = new TestShardingService(dataSource);
+        initEnvironment();
+        testShardingService.processSuccess();
+        testShardingService.cleanEnvironment();
     }
     
     private void initEnvironment() throws SQLException {
@@ -66,7 +81,8 @@ class SeataTest {
         testShardingService.getAddressRepository().truncateTable();
     }
     
-    private DataSource createDataSource() {
+    private DataSource createDataSource(final int hostPort) {
+        System.setProperty(SERVICE_DEFAULT_GROUP_LIST_KEY, "127.0.0.1:" + 
hostPort);
         HikariConfig config = new HikariConfig();
         
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
         
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/transactions/base/seata.yaml");
diff --git a/test/native/src/test/resources/seata-script-client-conf-file.conf 
b/test/native/src/test/resources/seata-script-client-conf-file.conf
index 7e3b7556951..28a355c0ca7 100644
--- a/test/native/src/test/resources/seata-script-client-conf-file.conf
+++ b/test/native/src/test/resources/seata-script-client-conf-file.conf
@@ -15,10 +15,8 @@
 # limitations under the License.
 #
 
-# TODO Due to limitations of `io.seata:seata-all:1.8.0`,
-# there is no ability to dynamically define `service.default.grouplist` 
without using Spring Boot.
-# This requires further investigation.
+# Please note that this file only contains part of the Seata Client 
configuration.
+# Additional configurations such as `service.default.grouplist` are defined in 
`org.apache.shardingsphere.test.natived.jdbc.transactions.base.SeataTest` 
through `java.lang.System#setProperty(String, String)`.
 service {
     vgroupMapping.default_tx_group = "default"
-    default.grouplist = "127.0.0.1:39567"
 }


Reply via email to