This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 36fc329 Add provideType for transaction rule (#12105)
36fc329 is described below
commit 36fc3299f932b56c03cb53479cbb7520fc94a15f
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Aug 30 18:00:59 2021 +0800
Add provideType for transaction rule (#12105)
* Add provideType for transaction rule
* Add provideType for transaction rule
---
.../shardingsphere-jdbc/usage/transaction/bitronix.cn.md | 3 +--
.../shardingsphere-jdbc/usage/transaction/bitronix.en.md | 3 +--
.../shardingsphere-jdbc/usage/transaction/narayana.cn.md | 3 +--
.../shardingsphere-jdbc/usage/transaction/narayana.en.md | 3 +--
.../user-manual/shardingsphere-proxy/usage/transaction.cn.md | 6 ++----
.../user-manual/shardingsphere-proxy/usage/transaction.en.md | 6 ++----
.../src/main/resources/META-INF/sharding-databases-tables.yaml | 3 +--
.../src/main/resources/META-INF/sharding-databases-tables.yaml | 5 ++---
.../shardingsphere/mode/manager/cluster/ClusterContextManager.java | 3 +--
.../mode/manager/cluster/ClusterContextManagerBuilder.java | 2 +-
.../mode/manager/memory/MemoryContextManagerBuilder.java | 2 +-
.../mode/manager/standalone/StandaloneContextManagerBuilder.java | 2 +-
.../communication/jdbc/datasource/JDBCBackendDataSource.java | 3 +--
.../src/main/resources/conf/server.yaml | 3 +--
.../proxy/frontend/netty/FrontendChannelInboundHandler.java | 3 +--
.../transaction/xa/XAShardingSphereTransactionManager.java | 2 +-
.../transaction/xa/XAShardingSphereTransactionManagerTest.java | 5 +----
.../base/seata/at/SeataATShardingSphereTransactionManagerTest.java | 7 +++----
.../transaction/config/TransactionRuleConfiguration.java | 4 +---
.../apache/shardingsphere/transaction/rule/TransactionRule.java | 6 ++----
.../transaction/yaml/config/YamlTransactionRuleConfiguration.java | 4 +---
.../yaml/swapper/TransactionRuleConfigurationYamlSwapper.java | 6 ++----
.../transaction/ShardingSphereTransactionManagerEngineTest.java | 5 +----
23 files changed, 30 insertions(+), 59 deletions(-)
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/bitronix.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/bitronix.cn.md
index 482e13f..d4aa743 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/bitronix.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/bitronix.cn.md
@@ -47,8 +47,7 @@ Yaml:
```yaml
- !TRANSACTION
defaultType: XA
- props:
- xa-transaction-manager-type: Bitronix
+ providerType: Bitronix
```
SpringBoot:
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/bitronix.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/bitronix.en.md
index 1ca9b1c..7271ba4 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/bitronix.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/bitronix.en.md
@@ -46,8 +46,7 @@ Yaml:
```yaml
- !TRANSACTION
defaultType: XA
- props:
- xa-transaction-manager-type: Bitronix
+ providerType: Bitronix
```
SpringBoot:
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/narayana.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/narayana.cn.md
index 611282b..3864831 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/narayana.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/narayana.cn.md
@@ -65,8 +65,7 @@ Yaml:
```yaml
- !TRANSACTION
defaultType: XA
- props:
- xa-transaction-manager-type: Narayana
+ providerType: Narayana
```
SpringBoot:
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/narayana.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/narayana.en.md
index ce822e4..27c42eb 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/narayana.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/transaction/narayana.en.md
@@ -65,8 +65,7 @@ Yaml:
```yaml
- !TRANSACTION
defaultType: XA
- props:
- xa-transaction-manager-type: Narayana
+ providerType: Narayana
```
SpringBoot:
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/usage/transaction.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/usage/transaction.cn.md
index d67b0d0..3aec48c 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/usage/transaction.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/usage/transaction.cn.md
@@ -54,8 +54,7 @@ ShardingSphere-Proxy 接入的分布式事务 API 同 ShardingSphere-JDBC 保持
```yaml
- !TRANSACTION
defaultType: XA
- props:
- xa-transaction-manager-type: Narayana
+ providerType: Narayana
```
3. 新增 `jbossts-properties.xml` 文件来定制化 Narayana 配置项,它的加载路径顺序:`user.dir (pwd)` >
`user.home` > `java.home` > `classpath`。
@@ -88,8 +87,7 @@ ShardingSphere-Proxy 接入的分布式事务 API 同 ShardingSphere-JDBC 保持
```yaml
- !TRANSACTION
defaultType: XA
- props:
- xa-transaction-manager-type: Bitronix
+ providerType: Bitronix
```
3. Bitronix 配置详情请参见[Bitronix官方文档](https://github.com/bitronix/btm/wiki)。
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/usage/transaction.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/usage/transaction.en.md
index 4ba0d5a..c814cb8 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/usage/transaction.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/usage/transaction.en.md
@@ -46,8 +46,7 @@ Default XA transaction manager of ShardingSphere is Atomikos.
Users can customiz
```yaml
- !TRANSACTION
defaultType: XA
- props:
- xa-transaction-manager-type: Narayana
+ providerType: Narayana
```
3. Add `jbossts-properties.xml` to customize Narayana configuration.
@@ -81,8 +80,7 @@ Please refer to [Narayana official
documentation](https://narayana.io/documentat
```yaml
- !TRANSACTION
defaultType: XA
- props:
- xa-transaction-manager-type: Bitronix
+ providerType: Bitronix
```
3. Please refer to [Bitronix official
documentation](https://github.com/bitronix/btm/wiki) for more details.
diff --git
a/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-bitronix-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables.yaml
b/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-bitronix-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables.yaml
index 3358d14..64ebc74 100644
---
a/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-bitronix-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables.yaml
+++
b/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-bitronix-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables.yaml
@@ -69,8 +69,7 @@ rules:
- !TRANSACTION
defaultType: XA
- props:
- xa-transaction-manager-type: Bitronix
+ providerType: Bitronix
props:
sql-show: false
diff --git
a/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-narayana-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables.yaml
b/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-narayana-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables.yaml
index 5e9279f..2c12f81 100644
---
a/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-narayana-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables.yaml
+++
b/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-narayana-raw-jdbc-example/src/main/resources/META-INF/sharding-databases-tables.yaml
@@ -69,8 +69,7 @@ rules:
- !TRANSACTION
defaultType: XA
- props:
- xa-transaction-manager-type: Narayana
-
+ providerType: Narayana
+
props:
sql-show: false
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManager.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManager.java
index 4e66a04..5b2c24c 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManager.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManager.java
@@ -77,7 +77,6 @@ import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
-import java.util.Properties;
import java.util.stream.Collectors;
/**
@@ -451,7 +450,7 @@ public final class ClusterContextManager implements
ContextManager {
private TransactionRule getTransactionRule() {
Optional<TransactionRule> transactionRule =
metaDataContexts.getGlobalRuleMetaData().getRules().stream().filter(
each -> each instanceof TransactionRule).map(each ->
(TransactionRule) each).findFirst();
- return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), new Properties())));
+ return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), null)));
}
private void renewContexts(final Map<String,
ShardingSphereTransactionManagerEngine> engines) {
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
index d99f31b..5b0b14b 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
@@ -197,7 +197,7 @@ public final class ClusterContextManagerBuilder implements
ContextManagerBuilder
private TransactionRule getTransactionRule(final MetaDataContexts
metaDataContexts) {
Optional<TransactionRule> transactionRule =
metaDataContexts.getGlobalRuleMetaData().getRules().stream().filter(
each -> each instanceof TransactionRule).map(each ->
(TransactionRule) each).findFirst();
- return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), new Properties())));
+ return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), null)));
}
@Override
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
index b31fea4..7492a05 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
@@ -69,7 +69,7 @@ public final class MemoryContextManagerBuilder implements
ContextManagerBuilder
private TransactionRule getTransactionRule(final MetaDataContexts
metaDataContexts) {
Optional<TransactionRule> transactionRule =
metaDataContexts.getGlobalRuleMetaData().getRules().stream().filter(
each -> each instanceof TransactionRule).map(each ->
(TransactionRule) each).findFirst();
- return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), new Properties())));
+ return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), null)));
}
@Override
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
index d032a1b..7a8e78a 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
@@ -189,7 +189,7 @@ public final class StandaloneContextManagerBuilder
implements ContextManagerBuil
private TransactionRule getTransactionRule(final MetaDataContexts
metaDataContexts) {
Optional<TransactionRule> transactionRule =
metaDataContexts.getGlobalRuleMetaData().getRules().stream().filter(
each -> each instanceof TransactionRule).map(each ->
(TransactionRule) each).findFirst();
- return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), new Properties())));
+ return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), null)));
}
@Override
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java
index 66cbaa7..ff445e9 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java
@@ -33,7 +33,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import java.util.Properties;
/**
* Backend data source of JDBC.
@@ -123,6 +122,6 @@ public final class JDBCBackendDataSource implements
BackendDataSource {
private TransactionRule getTransactionRule() {
Optional<TransactionRule> transactionRule =
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getGlobalRuleMetaData().getRules().stream().filter(
each -> each instanceof TransactionRule).map(each ->
(TransactionRule) each).findFirst();
- return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), new Properties())));
+ return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), null)));
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
index 067225c..298325f 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
+++
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
@@ -47,8 +47,7 @@
# type: NATIVE
# - !TRANSACTION
# defaultType: XA
-# props:
-# xa-transaction-manager-type: Atomikos
+# providerType: Atomikos
#props:
# max-connections-size-per-query: 1
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
index f11f14b..81d6758 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
@@ -35,7 +35,6 @@ import
org.apache.shardingsphere.transaction.core.TransactionType;
import org.apache.shardingsphere.transaction.rule.TransactionRule;
import java.util.Optional;
-import java.util.Properties;
/**
* Frontend channel inbound handler.
@@ -57,7 +56,7 @@ public final class FrontendChannelInboundHandler extends
ChannelInboundHandlerAd
private TransactionRule getTransactionRule() {
Optional<TransactionRule> transactionRule =
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getGlobalRuleMetaData().getRules().stream().filter(
each -> each instanceof TransactionRule).map(each ->
(TransactionRule) each).findFirst();
- return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), new Properties())));
+ return transactionRule.orElseGet(() -> new TransactionRule(new
TransactionRuleConfiguration(TransactionType.LOCAL.name(), null)));
}
@Override
diff --git
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/XAShardingSphereTransactionManager.java
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/XAShardingSphereTransactionManager.java
index 148cb33..a93e3a8 100644
---
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/XAShardingSphereTransactionManager.java
+++
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/XAShardingSphereTransactionManager.java
@@ -51,7 +51,7 @@ public final class XAShardingSphereTransactionManager
implements ShardingSphereT
@Override
public void init(final DatabaseType databaseType, final
Collection<ResourceDataSource> resourceDataSources, final TransactionRule
transactionRule) {
- xaTransactionManagerProvider =
XATransactionManagerProviderLoader.getInstance().getXATransactionManagerProvider(transactionRule.getProps().getProperty("xa-transaction-manager-type"));
+ xaTransactionManagerProvider =
XATransactionManagerProviderLoader.getInstance().getXATransactionManagerProvider(transactionRule.getProviderType());
xaTransactionManagerProvider.init();
resourceDataSources.forEach(each ->
cachedDataSources.put(each.getOriginalName(),
newXATransactionDataSource(databaseType, each)));
}
diff --git
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/XAShardingSphereTransactionManagerTest.java
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/XAShardingSphereTransactionManagerTest.java
index 96bba43..c9e4ae9 100644
---
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/XAShardingSphereTransactionManagerTest.java
+++
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/XAShardingSphereTransactionManagerTest.java
@@ -42,7 +42,6 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
import java.util.Set;
import static org.hamcrest.CoreMatchers.instanceOf;
@@ -59,9 +58,7 @@ public final class XAShardingSphereTransactionManagerTest {
@Before
public void setUp() {
Collection<ResourceDataSource> resourceDataSources =
createResourceDataSources(DatabaseTypeRegistry.getActualDatabaseType("H2"));
- Properties props = new Properties();
- props.setProperty("xa-transaction-manager-type", "Atomikos");
- TransactionRule transactionRule = new TransactionRule(new
TransactionRuleConfiguration("XA", props));
+ TransactionRule transactionRule = new TransactionRule(new
TransactionRuleConfiguration("XA", "Atomikos"));
xaTransactionManager.init(DatabaseTypeRegistry.getActualDatabaseType("H2"),
resourceDataSources, transactionRule);
}
diff --git
a/shardingsphere-transaction/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManagerTest.java
b/shardingsphere-transaction/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManagerTest.java
index 4685593..f3c5cc2 100644
---
a/shardingsphere-transaction/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManagerTest.java
+++
b/shardingsphere-transaction/shardingsphere-transaction-base/shardingsphere-transaction-base-seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/SeataATShardingSphereTransactionManagerTest.java
@@ -31,12 +31,12 @@ import io.seata.rm.datasource.DataSourceProxy;
import io.seata.tm.api.GlobalTransactionContext;
import lombok.SneakyThrows;
import org.apache.commons.dbcp2.BasicDataSource;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import org.apache.shardingsphere.infra.executor.kernel.model.ExecutorDataMap;
import
org.apache.shardingsphere.transaction.base.seata.at.fixture.MockSeataServer;
import
org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration;
import org.apache.shardingsphere.transaction.core.ResourceDataSource;
import org.apache.shardingsphere.transaction.core.TransactionType;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.infra.executor.kernel.model.ExecutorDataMap;
import org.apache.shardingsphere.transaction.rule.TransactionRule;
import org.junit.After;
import org.junit.AfterClass;
@@ -53,7 +53,6 @@ import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
-import java.util.Properties;
import java.util.Queue;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -93,7 +92,7 @@ public final class
SeataATShardingSphereTransactionManagerTest {
@Before
public void setUp() {
-
seataTransactionManager.init(DatabaseTypeRegistry.getActualDatabaseType("MySQL"),
getResourceDataSources(), new TransactionRule(new
TransactionRuleConfiguration("BASE", new Properties())));
+
seataTransactionManager.init(DatabaseTypeRegistry.getActualDatabaseType("MySQL"),
getResourceDataSources(), new TransactionRule(new
TransactionRuleConfiguration("BASE", "Seata")));
}
@After
diff --git
a/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/config/TransactionRuleConfiguration.java
b/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/config/TransactionRuleConfiguration.java
index 0843ad6..e86c595 100644
---
a/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/config/TransactionRuleConfiguration.java
+++
b/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/config/TransactionRuleConfiguration.java
@@ -21,8 +21,6 @@ import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.config.scope.GlobalRuleConfiguration;
-import java.util.Properties;
-
/**
* Transaction rule configuration.
*
@@ -33,5 +31,5 @@ public final class TransactionRuleConfiguration implements
GlobalRuleConfigurati
private final String defaultType;
- private final Properties props;
+ private final String providerType;
}
diff --git
a/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
b/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
index 42b82ea..f62cbda 100644
---
a/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
+++
b/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
@@ -23,8 +23,6 @@ import
org.apache.shardingsphere.infra.rule.identifier.scope.GlobalRule;
import
org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration;
import org.apache.shardingsphere.transaction.core.TransactionType;
-import java.util.Properties;
-
/**
* Transaction rule.
*
@@ -34,10 +32,10 @@ public final class TransactionRule implements KernelRule,
GlobalRule {
private final TransactionType defaultType;
- private final Properties props;
+ private final String providerType;
public TransactionRule(final TransactionRuleConfiguration ruleConfig) {
defaultType = TransactionType.valueOf(ruleConfig.getDefaultType());
- props = ruleConfig.getProps();
+ providerType = ruleConfig.getProviderType();
}
}
diff --git
a/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/yaml/config/YamlTransactionRuleConfiguration.java
b/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/yaml/config/YamlTransactionRuleConfiguration.java
index 134d6f5..64eb325 100644
---
a/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/yaml/config/YamlTransactionRuleConfiguration.java
+++
b/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/yaml/config/YamlTransactionRuleConfiguration.java
@@ -22,8 +22,6 @@ import lombok.Setter;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration;
import
org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration;
-import java.util.Properties;
-
/**
* Transaction rule configuration for YAML.
*/
@@ -33,7 +31,7 @@ public final class YamlTransactionRuleConfiguration
implements YamlRuleConfigura
private String defaultType;
- private Properties props = new Properties();
+ private String providerType;
@Override
public Class<TransactionRuleConfiguration> getRuleConfigurationType() {
diff --git
a/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/TransactionRuleConfigurationYamlSwapper.java
b/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/TransactionRuleConfigurationYamlSwapper.java
index 7fbc6fc..a83028e 100644
---
a/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/TransactionRuleConfigurationYamlSwapper.java
+++
b/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/TransactionRuleConfigurationYamlSwapper.java
@@ -22,8 +22,6 @@ import
org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration
import org.apache.shardingsphere.transaction.constant.TransactionOrder;
import
org.apache.shardingsphere.transaction.yaml.config.YamlTransactionRuleConfiguration;
-import java.util.Properties;
-
/**
* Transaction rule configuration YAML swapper.
*/
@@ -33,13 +31,13 @@ public final class TransactionRuleConfigurationYamlSwapper
implements YamlRuleCo
public YamlTransactionRuleConfiguration swapToYamlConfiguration(final
TransactionRuleConfiguration data) {
YamlTransactionRuleConfiguration result = new
YamlTransactionRuleConfiguration();
result.setDefaultType(data.getDefaultType());
- result.setProps(null == data.getProps() ? new Properties() :
data.getProps());
+ result.setProviderType(data.getProviderType());
return result;
}
@Override
public TransactionRuleConfiguration swapToObject(final
YamlTransactionRuleConfiguration yamlConfig) {
- return new TransactionRuleConfiguration(yamlConfig.getDefaultType(),
yamlConfig.getProps());
+ return new TransactionRuleConfiguration(yamlConfig.getDefaultType(),
yamlConfig.getProviderType());
}
@Override
diff --git
a/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/ShardingSphereTransactionManagerEngineTest.java
b/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/ShardingSphereTransactionManagerEngineTest.java
index 7d2a0b5..943d30a 100644
---
a/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/ShardingSphereTransactionManagerEngineTest.java
+++
b/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/ShardingSphereTransactionManagerEngineTest.java
@@ -25,7 +25,6 @@ import
org.apache.shardingsphere.transaction.rule.TransactionRule;
import org.junit.Test;
import java.util.Collections;
-import java.util.Properties;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertThat;
@@ -46,9 +45,7 @@ public final class ShardingSphereTransactionManagerEngineTest
{
Runnable caller = mock(Runnable.class);
ShardingSphereTransactionManagerFixture transactionManager =
(ShardingSphereTransactionManagerFixture)
transactionManagerEngine.getTransactionManager(TransactionType.XA);
transactionManager.setCaller(caller);
- Properties props = new Properties();
- props.setProperty("xa-transaction-manager-type", "Atomikos");
- TransactionRule transactionRule = new TransactionRule(new
TransactionRuleConfiguration("XA", props));
+ TransactionRule transactionRule = new TransactionRule(new
TransactionRuleConfiguration("XA", "Atomikos"));
transactionManagerEngine.init(DatabaseTypeRegistry.getActualDatabaseType("H2"),
Collections.emptyMap(), transactionRule);
verify(caller).run();
}