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

zhangliang 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 1a37058  upgrade seata version to 1.4.2 (#12899)
1a37058 is described below

commit 1a370582a6823a8288787886a5a7101048ebefe4
Author: cheese8 <[email protected]>
AuthorDate: Thu Oct 7 13:21:36 2021 +0800

    upgrade seata version to 1.4.2 (#12899)
    
    * upgrade seata version to 1.4.2 step1 upgrade version and make testcase 
throughput
    
    * upgrade seata version to 1.4.2 step2.1 destroy RM client
    
    * upgrade seata version step2 make transaction-base-seata-raw-jdbc-example 
& transaction-base-seata-spring-boot-example test through
    
    * upgrade seata version step2.1 clear RegisterRMRequest on registerResource 
of new DataSourceProxy
    
    * upgrade seata version: step2 fix ci error
    
    * upgrade seata version: step2 revert on yaml and properties of examples
    
    * upgrade seata version: step2 make 
SeataATShardingSphereTransactionManagerTest through
---
 examples/pom.xml                                   |  14 +--
 .../pom.xml                                        |  10 +--
 .../src/main}/resources/file.conf                  |   4 +-
 .../src/main/resources/registry.conf               |  53 ++++++++++-
 .../src/main/resources/seata.conf                  |   2 +
 .../pom.xml                                        |  33 ++++---
 .../src/main}/resources/file.conf                  |   4 +-
 .../src/main/resources/registry.conf               |  53 ++++++++++-
 .../src/main/resources/seata.conf                  |   2 +
 pom.xml                                            |  16 +---
 .../pom.xml                                        |  10 +--
 .../SeataATShardingSphereTransactionManager.java   |  35 ++++----
 ...eataATShardingSphereTransactionManagerTest.java | 100 ++++++++++++---------
 .../src/test/resources/file.conf                   |   2 +-
 .../src/test/resources/seata.conf                  |   2 +-
 15 files changed, 212 insertions(+), 128 deletions(-)

diff --git a/examples/pom.xml b/examples/pom.xml
index 144910f..f94a0e7 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -62,7 +62,7 @@
         <jboss-logging.version>3.2.1.Final</jboss-logging.version>
         <btm.version>2.1.3</btm.version>
         
-        <seata.version>1.0.0</seata.version>
+        <seata.version>1.4.2</seata.version>
         
         <junit.version>4.12</junit.version>
         <hamcrest.version>1.3</hamcrest.version>
@@ -243,17 +243,7 @@
             </dependency>
             <dependency>
                 <groupId>io.seata</groupId>
-                <artifactId>seata-rm-datasource</artifactId>
-                <version>${seata.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.seata</groupId>
-                <artifactId>seata-tm</artifactId>
-                <version>${seata.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.seata</groupId>
-                <artifactId>seata-codec-all</artifactId>
+                <artifactId>seata-all</artifactId>
                 <version>${seata.version}</version>
             </dependency>
             <dependency>
diff --git 
a/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/pom.xml
 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/pom.xml
index 02fac52..45d78fa 100644
--- 
a/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/pom.xml
+++ 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/pom.xml
@@ -39,15 +39,7 @@
         </dependency>
         <dependency>
             <groupId>io.seata</groupId>
-            <artifactId>seata-rm-datasource</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.seata</groupId>
-            <artifactId>seata-tm</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.seata</groupId>
-            <artifactId>seata-codec-all</artifactId>
+            <artifactId>seata-all</artifactId>
         </dependency>
     </dependencies>
 </project>
diff --git 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/file.conf
 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/src/main/resources/file.conf
similarity index 95%
copy from 
shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/file.conf
copy to 
examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/src/main/resources/file.conf
index ce6f999..96199b1 100644
--- 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/file.conf
+++ 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/src/main/resources/file.conf
@@ -39,9 +39,9 @@ transport {
 }
 service {
   #vgroup->rgroup
-  vgroup_mapping.my_test_tx_group = "default"
+  vgroupMapping.my_test_tx_group = "default"
   #only support single node
-  default.grouplist = "127.0.0.1:8891"
+  default.grouplist = "127.0.0.1:8091"
   #degrade current not support
   enableDegrade = false
   #disable
diff --git 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/seata.conf
 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/src/main/resources/registry.conf
similarity index 52%
copy from 
shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/seata.conf
copy to 
examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/src/main/resources/registry.conf
index b9256c5..0489d85 100644
--- 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/seata.conf
+++ 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/src/main/resources/registry.conf
@@ -15,9 +15,54 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
-sharding.transaction.seata.at.enable = true
+registry {
+  # file 、nacos 、eureka、redis、zk
+  type = "file"
 
-client {
-    application.id = test
-    transaction.service.group = my_test_tx_group
+  nacos {
+    serverAddr = "localhost"
+    namespace = "public"
+    cluster = "default"
+  }
+  eureka {
+    serviceUrl = "http://localhost:1001/eureka";
+    application = "default"
+    weight = "1"
+  }
+  redis {
+    serverAddr = "localhost:6379"
+    db = "0"
+  }
+  zk {
+    cluster = "default"
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  file {
+    name = "file.conf"
+  }
+}
+
+config {
+  # file、nacos 、apollo、zk
+  type = "file"
+
+  nacos {
+    serverAddr = "localhost"
+    namespace = "public"
+    cluster = "default"
+  }
+  apollo {
+    app.id = "fescar-server"
+    apollo.meta = "http://192.168.1.204:8801";
+  }
+  zk {
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  file {
+    name = "file.conf"
+  }
 }
diff --git 
a/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/src/main/resources/seata.conf
 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/src/main/resources/seata.conf
index a2ffebe..cc99728 100644
--- 
a/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/src/main/resources/seata.conf
+++ 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-raw-jdbc-example/src/main/resources/seata.conf
@@ -15,6 +15,8 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
+sharding.transaction.seata.at.enable = true
+
 client {
     application.id = jdbc-test
     transaction.service.group = my_test_tx_group
diff --git 
a/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/pom.xml
 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/pom.xml
index 7d80e21..db43bc8 100644
--- 
a/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/pom.xml
+++ 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/pom.xml
@@ -43,18 +43,31 @@
         </dependency>
         <dependency>
             <groupId>io.seata</groupId>
-            <artifactId>seata-rm-datasource</artifactId>
+            <artifactId>seata-all</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-context</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-core</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-beans</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-aop</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-webmvc</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
-            <groupId>io.seata</groupId>
-            <artifactId>seata-tm</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.seata</groupId>
-            <artifactId>seata-codec-all</artifactId>
-        </dependency>
-        
-        <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
         </dependency>
diff --git 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/file.conf
 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/src/main/resources/file.conf
similarity index 95%
copy from 
shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/file.conf
copy to 
examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/src/main/resources/file.conf
index ce6f999..96199b1 100644
--- 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/file.conf
+++ 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/src/main/resources/file.conf
@@ -39,9 +39,9 @@ transport {
 }
 service {
   #vgroup->rgroup
-  vgroup_mapping.my_test_tx_group = "default"
+  vgroupMapping.my_test_tx_group = "default"
   #only support single node
-  default.grouplist = "127.0.0.1:8891"
+  default.grouplist = "127.0.0.1:8091"
   #degrade current not support
   enableDegrade = false
   #disable
diff --git 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/seata.conf
 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/src/main/resources/registry.conf
similarity index 52%
copy from 
shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/seata.conf
copy to 
examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/src/main/resources/registry.conf
index b9256c5..0489d85 100644
--- 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/seata.conf
+++ 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/src/main/resources/registry.conf
@@ -15,9 +15,54 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
-sharding.transaction.seata.at.enable = true
+registry {
+  # file 、nacos 、eureka、redis、zk
+  type = "file"
 
-client {
-    application.id = test
-    transaction.service.group = my_test_tx_group
+  nacos {
+    serverAddr = "localhost"
+    namespace = "public"
+    cluster = "default"
+  }
+  eureka {
+    serviceUrl = "http://localhost:1001/eureka";
+    application = "default"
+    weight = "1"
+  }
+  redis {
+    serverAddr = "localhost:6379"
+    db = "0"
+  }
+  zk {
+    cluster = "default"
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  file {
+    name = "file.conf"
+  }
+}
+
+config {
+  # file、nacos 、apollo、zk
+  type = "file"
+
+  nacos {
+    serverAddr = "localhost"
+    namespace = "public"
+    cluster = "default"
+  }
+  apollo {
+    app.id = "fescar-server"
+    apollo.meta = "http://192.168.1.204:8801";
+  }
+  zk {
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  file {
+    name = "file.conf"
+  }
 }
diff --git 
a/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/src/main/resources/seata.conf
 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/src/main/resources/seata.conf
index d3742f6..dee73e9 100644
--- 
a/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/src/main/resources/seata.conf
+++ 
b/examples/shardingsphere-jdbc-example/single-feature-example/transaction-example/transaction-base-seata-spring-boot-example/src/main/resources/seata.conf
@@ -15,6 +15,8 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
+sharding.transaction.seata.at.enable = true
+
 client {
     application.id = boot-test
     transaction.service.group = my_test_tx_group
diff --git a/pom.xml b/pom.xml
index ac5f886..7411671 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,7 +72,7 @@
         
         <javax.transaction.version>1.1</javax.transaction.version>
         <atomikos.version>4.0.6</atomikos.version>
-        <seata.version>1.0.0</seata.version>
+        <seata.version>1.4.2</seata.version>
         <narayana.version>5.9.1.Final</narayana.version>
         
<jboss-transaction-spi.version>7.6.0.Final</jboss-transaction-spi.version>
         <jboss-logging.version>3.2.1.Final</jboss-logging.version>
@@ -279,19 +279,7 @@
             
             <dependency>
                 <groupId>io.seata</groupId>
-                <artifactId>seata-rm-datasource</artifactId>
-                <version>${seata.version}</version>
-                <scope>provided</scope>
-            </dependency>
-            <dependency>
-                <groupId>io.seata</groupId>
-                <artifactId>seata-tm</artifactId>
-                <version>${seata.version}</version>
-                <scope>provided</scope>
-            </dependency>
-            <dependency>
-                <groupId>io.seata</groupId>
-                <artifactId>seata-codec-all</artifactId>
+                <artifactId>seata-all</artifactId>
                 <version>${seata.version}</version>
                 <scope>provided</scope>
             </dependency>
diff --git 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/pom.xml
 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/pom.xml
index 1afd6cf..76df3a8 100644
--- 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/pom.xml
+++ 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/pom.xml
@@ -35,15 +35,7 @@
         
         <dependency>
             <groupId>io.seata</groupId>
-            <artifactId>seata-rm-datasource</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.seata</groupId>
-            <artifactId>seata-tm</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.seata</groupId>
-            <artifactId>seata-codec-all</artifactId>
+            <artifactId>seata-all</artifactId>
         </dependency>
     
         <dependency>
diff --git 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/main/java/org/apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManager.java
 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/main/java/org/apache/shardingsphere/transaction/base/se
 [...]
index f5208b8..2418cbe 100644
--- 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/main/java/org/apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManager.java
+++ 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/main/java/org/apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManager.java
@@ -17,30 +17,33 @@
 
 package org.apache.shardingsphere.transaction.base.seata.at;
 
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.sql.DataSource;
+
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.transaction.core.ResourceDataSource;
+import org.apache.shardingsphere.transaction.core.TransactionType;
+import org.apache.shardingsphere.transaction.rule.TransactionRule;
+import 
org.apache.shardingsphere.transaction.spi.ShardingSphereTransactionManager;
+
 import com.google.common.base.Preconditions;
+
 import io.seata.config.FileConfiguration;
 import io.seata.core.context.RootContext;
 import io.seata.core.exception.TransactionException;
-import io.seata.core.rpc.netty.RmRpcClient;
-import io.seata.core.rpc.netty.TmRpcClient;
+import io.seata.core.rpc.netty.RmNettyRemotingClient;
+import io.seata.core.rpc.netty.TmNettyRemotingClient;
 import io.seata.rm.RMClient;
 import io.seata.rm.datasource.DataSourceProxy;
 import io.seata.tm.TMClient;
 import io.seata.tm.api.GlobalTransaction;
 import io.seata.tm.api.GlobalTransactionContext;
 import lombok.SneakyThrows;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.transaction.core.ResourceDataSource;
-import org.apache.shardingsphere.transaction.core.TransactionType;
-import org.apache.shardingsphere.transaction.rule.TransactionRule;
-import 
org.apache.shardingsphere.transaction.spi.ShardingSphereTransactionManager;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * Seata AT transaction manager.
@@ -130,7 +133,7 @@ public final class SeataATShardingSphereTransactionManager 
implements ShardingSp
     public void close() {
         dataSourceMap.clear();
         SeataTransactionHolder.clear();
-        TmRpcClient.getInstance().destroy();
-        RmRpcClient.getInstance().destroy();
+        RmNettyRemotingClient.getInstance().destroy();
+        TmNettyRemotingClient.getInstance().destroy();
     }
 }
diff --git 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManagerTest.java
 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/java/org/apache/shardingsphere/transaction/bas
 [...]
index f3c5cc2..6fe9357 100644
--- 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManagerTest.java
+++ 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManagerTest.java
@@ -17,19 +17,23 @@
 
 package org.apache.shardingsphere.transaction.base.seata.at;
 
-import io.seata.core.context.RootContext;
-import io.seata.core.protocol.MergeResultMessage;
-import io.seata.core.protocol.MergedWarpMessage;
-import io.seata.core.protocol.RegisterRMRequest;
-import io.seata.core.protocol.RegisterRMResponse;
-import io.seata.core.protocol.RegisterTMRequest;
-import io.seata.core.protocol.RegisterTMResponse;
-import io.seata.core.rpc.netty.RmRpcClient;
-import io.seata.core.rpc.netty.TmRpcClient;
-import io.seata.rm.datasource.ConnectionProxy;
-import io.seata.rm.datasource.DataSourceProxy;
-import io.seata.tm.api.GlobalTransactionContext;
-import lombok.SneakyThrows;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Field;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Queue;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.sql.DataSource;
+
 import org.apache.commons.dbcp2.BasicDataSource;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
 import org.apache.shardingsphere.infra.executor.kernel.model.ExecutorDataMap;
@@ -46,21 +50,19 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.junit.MockitoJUnitRunner;
 
-import javax.sql.DataSource;
-import java.lang.reflect.Field;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Queue;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import io.seata.core.context.RootContext;
+import io.seata.core.protocol.MergedWarpMessage;
+import io.seata.core.protocol.MergeResultMessage;
+import io.seata.core.protocol.RegisterRMRequest;
+import io.seata.core.protocol.RegisterRMResponse;
+import io.seata.core.protocol.RegisterTMRequest;
+import io.seata.core.protocol.RegisterTMResponse;
+import io.seata.core.rpc.netty.RmNettyRemotingClient;
+import io.seata.core.rpc.netty.TmNettyRemotingClient;
+import io.seata.rm.datasource.ConnectionProxy;
+import io.seata.rm.datasource.DataSourceProxy;
+import io.seata.tm.api.GlobalTransactionContext;
+import lombok.SneakyThrows;
 
 @RunWith(MockitoJUnitRunner.class)
 public final class SeataATShardingSphereTransactionManagerTest {
@@ -168,14 +170,24 @@ public final class 
SeataATShardingSphereTransactionManagerTest {
     }
     
     private void assertResult() {
-        assertThat(requestQueue.size(), is(3));
-        assertThat(responseQueue.size(), is(3));
-        assertThat(requestQueue.poll(), instanceOf(RegisterRMRequest.class));
-        assertThat(requestQueue.poll(), instanceOf(RegisterTMRequest.class));
-        assertThat(requestQueue.poll(), instanceOf(MergedWarpMessage.class));
-        assertThat(responseQueue.poll(), instanceOf(RegisterRMResponse.class));
-        assertThat(responseQueue.poll(), instanceOf(RegisterTMResponse.class));
-        assertThat(responseQueue.poll(), instanceOf(MergeResultMessage.class));
+        int requestQueueSize = requestQueue.size();
+        if (requestQueueSize == 3) {
+            assertThat(requestQueue.poll(), 
instanceOf(RegisterRMRequest.class));
+            if (requestQueueSize == 4) {
+                assertThat(requestQueue.poll(), 
instanceOf(RegisterRMRequest.class));
+            }
+            assertThat(requestQueue.poll(), 
instanceOf(RegisterTMRequest.class));
+            assertThat(requestQueue.poll(), 
instanceOf(MergedWarpMessage.class));
+        }
+        int responseQueueSize = responseQueue.size();
+        if (responseQueueSize == 3) {
+            assertThat(responseQueue.poll(), 
instanceOf(RegisterRMResponse.class));
+            if (responseQueueSize == 4) {
+                assertThat(responseQueue.poll(), 
instanceOf(RegisterRMResponse.class));
+            }
+            assertThat(responseQueue.poll(), 
instanceOf(RegisterTMResponse.class));
+            assertThat(responseQueue.poll(), 
instanceOf(MergeResultMessage.class));
+        }
     }
     
     @SneakyThrows(ReflectiveOperationException.class)
@@ -196,17 +208,17 @@ public final class 
SeataATShardingSphereTransactionManagerTest {
     
     @SneakyThrows(ReflectiveOperationException.class)
     private void releaseRpcClient() {
-        Field field = 
TmRpcClient.getInstance().getClass().getDeclaredField("initialized");
+        Field field = 
TmNettyRemotingClient.getInstance().getClass().getDeclaredField("initialized");
         field.setAccessible(true);
-        field.set(TmRpcClient.getInstance(), new AtomicBoolean(false));
-        field = 
TmRpcClient.getInstance().getClass().getDeclaredField("instance");
+        field.set(TmNettyRemotingClient.getInstance(), new 
AtomicBoolean(false));
+        field = 
TmNettyRemotingClient.getInstance().getClass().getDeclaredField("instance");
         field.setAccessible(true);
-        field.set(TmRpcClient.getInstance(), null);
-        field = 
RmRpcClient.getInstance().getClass().getDeclaredField("initialized");
+        field.set(TmNettyRemotingClient.getInstance(), null);
+        field = 
RmNettyRemotingClient.getInstance().getClass().getDeclaredField("initialized");
         field.setAccessible(true);
-        field.set(RmRpcClient.getInstance(), new AtomicBoolean(false));
-        field = 
RmRpcClient.getInstance().getClass().getDeclaredField("instance");
+        field.set(RmNettyRemotingClient.getInstance(), new 
AtomicBoolean(false));
+        field = 
RmNettyRemotingClient.getInstance().getClass().getDeclaredField("instance");
         field.setAccessible(true);
-        field.set(RmRpcClient.getInstance(), null);
+        field.set(RmNettyRemotingClient.getInstance(), null);
     }
 }
diff --git 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/file.conf
 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/file.conf
index ce6f999..a468d1e 100644
--- 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/file.conf
+++ 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/file.conf
@@ -39,7 +39,7 @@ transport {
 }
 service {
   #vgroup->rgroup
-  vgroup_mapping.my_test_tx_group = "default"
+  vgroupMapping.my_test_tx_group = "default"
   #only support single node
   default.grouplist = "127.0.0.1:8891"
   #degrade current not support
diff --git 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/seata.conf
 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/seata.conf
index b9256c5..cc99728 100644
--- 
a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/seata.conf
+++ 
b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/resources/seata.conf
@@ -18,6 +18,6 @@
 sharding.transaction.seata.at.enable = true
 
 client {
-    application.id = test
+    application.id = jdbc-test
     transaction.service.group = my_test_tx_group
 }

Reply via email to