From 43339f4493b4587ffe8be8b48d2147fe6e4d569d Mon Sep 17 00:00:00 2001 From: linghengqian Date: Fri, 4 Aug 2023 20:01:06 +0800 Subject: [PATCH] Remove the obsolete XA distributed transaction manager implementation of Bitronix --- distribution/jdbc/pom.xml | 5 - .../optional-plugins/_index.cn.md | 1 - .../optional-plugins/_index.en.md | 1 - .../special-api/transaction/bitronix.cn.md | 64 --------- .../special-api/transaction/bitronix.en.md | 63 --------- .../global-rule/alter-transaction-rule.cn.md | 2 +- .../global-rule/alter-transaction-rule.en.md | 2 +- .../optional-plugins/_index.cn.md | 1 - .../optional-plugins/_index.en.md | 1 - .../add_Bitronix_dependency.cn.md | 15 --- .../add_Bitronix_dependency.en.md | 15 --- examples/pom.xml | 11 -- ...amlExampleConfigurationSupportedValue.java | 2 +- .../type/XABitronixExampleScenario.java | 52 -------- ...rio.transaction.TransactionExampleScenario | 1 - .../src/main/resources/config.yaml | 1 - .../jdbc/java/config/Configuration.ftl | 2 - .../src/main/resources/template/jdbc/pom.ftl | 11 -- .../yaml/transaction/xa-bitronix.ftl | 19 --- .../antlr4/imports/transaction/Keyword.g4 | 4 - .../imports/transaction/RALStatement.g4 | 2 +- .../type/xa/provider/bitronix/pom.xml | 47 ------- .../manager/BitronixRecoveryResource.java | 97 -------------- .../BitronixXATransactionManagerProvider.java | 72 ---------- .../manager/SingleXAResourceHolder.java | 68 ---------- ...action.xa.spi.XATransactionManagerProvider | 19 --- .../manager/BitronixRecoveryResourceTest.java | 124 ------------------ ...ronixXATransactionManagerProviderTest.java | 86 ------------ .../manager/SingleXAResourceHolderTest.java | 80 ----------- .../bitronix-default-config.properties | 20 --- .../src/test/resources/logback-test.xml | 33 ----- kernel/transaction/type/xa/provider/pom.xml | 1 - src/resources/spotbugs.xml | 4 - test/e2e/fixture/pom.xml | 11 -- test/e2e/operation/transaction/pom.xml | 11 -- .../engine/base/TransactionBaseE2EIT.java | 2 +- .../constants/TransactionTestConstants.java | 2 - .../src/test/resources/env/it-env.properties | 2 +- .../mysql/config-sharding-xa-bitronix.yaml | 109 --------------- .../config-sharding-xa-bitronix.yaml | 109 --------------- .../config-sharding-xa-bitronix.yaml | 109 --------------- 41 files changed, 6 insertions(+), 1275 deletions(-) delete mode 100644 docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/bitronix.cn.md delete mode 100644 docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/bitronix.en.md delete mode 100644 docs/document/content/user-manual/shardingsphere-proxy/startup/dependencies-download/add_Bitronix_dependency.cn.md delete mode 100644 docs/document/content/user-manual/shardingsphere-proxy/startup/dependencies-download/add_Bitronix_dependency.en.md delete mode 100644 examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/transaction/type/XABitronixExampleScenario.java delete mode 100644 examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-bitronix.ftl delete mode 100644 kernel/transaction/type/xa/provider/bitronix/pom.xml delete mode 100644 kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixRecoveryResource.java delete mode 100644 kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProvider.java delete mode 100644 kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/SingleXAResourceHolder.java delete mode 100644 kernel/transaction/type/xa/provider/bitronix/src/main/resources/META-INF/services/org.apache.shardingsphere.transaction.xa.spi.XATransactionManagerProvider delete mode 100644 kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixRecoveryResourceTest.java delete mode 100644 kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProviderTest.java delete mode 100644 kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/SingleXAResourceHolderTest.java delete mode 100644 kernel/transaction/type/xa/provider/bitronix/src/test/resources/bitronix-default-config.properties delete mode 100644 kernel/transaction/type/xa/provider/bitronix/src/test/resources/logback-test.xml delete mode 100644 test/e2e/operation/transaction/src/test/resources/env/jdbc/mysql/config-sharding-xa-bitronix.yaml delete mode 100644 test/e2e/operation/transaction/src/test/resources/env/jdbc/opengauss/config-sharding-xa-bitronix.yaml delete mode 100644 test/e2e/operation/transaction/src/test/resources/env/jdbc/postgresql/config-sharding-xa-bitronix.yaml diff --git a/distribution/jdbc/pom.xml b/distribution/jdbc/pom.xml index 99c065ee03f78..1c59bb5f7d09d 100644 --- a/distribution/jdbc/pom.xml +++ b/distribution/jdbc/pom.xml @@ -45,11 +45,6 @@ shardingsphere-transaction-xa-narayana ${project.version} - - org.apache.shardingsphere - shardingsphere-transaction-xa-bitronix - ${project.version} - org.apache.shardingsphere shardingsphere-transaction-base-seata-at diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.cn.md index 2692f6e62c86e..c71734713decd 100644 --- a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.cn.md +++ b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.cn.md @@ -50,6 +50,5 @@ ShardingSphere 默认情况下仅包含核心 SPI 的实现,在 Git Source 存 - `org.apache.shardingsphere:shardingsphere-cluster-mode-repository-consul`,基于 Consul 的持久化实现 - XA 分布式事务管理器 - `org.apache.shardingsphere:shardingsphere-transaction-xa-narayana`,基于 Narayana 的 XA 分布式事务管理器 - - `org.apache.shardingsphere:shardingsphere-transaction-xa-bitronix`,基于 Bitronix 的 XA 分布式事务管理器 - SQL 翻译 - `org.apache.shardingsphere:shardingsphere-sql-translator-jooq-provider`,使用 JooQ 的 SQL 翻译器 diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.en.md index 62a25da6d7df5..f07d87c6b40f8 100644 --- a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.en.md +++ b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/_index.en.md @@ -50,6 +50,5 @@ All optional plugins are listed below in the form of `groupId:artifactId`. - `org.apache.shardingsphere:shardingsphere-cluster-mode-repository-consul`, Consul based persistence - XA transaction manager provider definition - `org.apache.shardingsphere:shardingsphere-transaction-xa-narayana`, XA distributed transaction manager based on Narayana - - `org.apache.shardingsphere:shardingsphere-transaction-xa-bitronix`, XA distributed transaction manager based on Bitronix - SQL translator - `org.apache.shardingsphere:shardingsphere-sql-translator-jooq-provider`, JooQ SQL translator diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/bitronix.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/bitronix.cn.md deleted file mode 100644 index f5e02696b6274..0000000000000 --- a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/bitronix.cn.md +++ /dev/null @@ -1,64 +0,0 @@ -+++ -title = "Bitronix 事务" -weight = 6 -+++ - -## 背景信息 - -Apache ShardingSphere 提供 XA 事务,集成了 Bitronix 的实现。 - -## 前提条件 - -引入 Maven 依赖 - -```xml - - 2.1.3 - - - - org.apache.shardingsphere - shardingsphere-jdbc-core - ${shardingsphere.version} - - - - - org.apache.shardingsphere - shardingsphere-transaction-xa-core - ${shardingsphere.version} - - - - org.apache.shardingsphere - shardingsphere-transaction-xa-bitronix - ${shardingsphere.version} - - - - org.codehaus.btm - btm - ${btm.version} - -``` - -## 操作步骤 - -1. 配置 XA 事务类型 -2. 配置 Bitronix - -## 配置示例 - -### 配置 XA 事务类型 - -Yaml: - -```yaml -transaction: - defaultType: XA - providerType: Bitronix -``` - -### 配置 Bitronix (可省略) - -详情请参见 [Bitronix 官方文档](https://github.com/bitronix/btm/wiki) 。 diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/bitronix.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/bitronix.en.md deleted file mode 100644 index e54d2e1eef7a0..0000000000000 --- a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/bitronix.en.md +++ /dev/null @@ -1,63 +0,0 @@ -+++ -title = "Bitronix Transaction" -weight = 5 -+++ - -## background - -Apache ShardingSphere provides XA transactions that integrate with the Bitronix implementation. - -## Prerequisites - -Introducing Maven dependency - -```xml - - 2.1.3 - - - - org.apache.shardingsphere - shardingsphere-jdbc-core - ${shardingsphere.version} - - - - - org.apache.shardingsphere - shardingsphere-transaction-xa-core - ${shardingsphere.version} - - - - org.apache.shardingsphere - shardingsphere-transaction-xa-bitronix - ${shardingsphere.version} - - - - org.codehaus.btm - btm - ${btm.version} - -``` - -## Procedure - -1. Configure the XA transaction type -2. Configure Bitronix - -## Sample - -### Configure the XA transaction type - -Yaml: - -```yaml -transaction: - defaultType: XA - providerType: Bitronix -``` - -### Configure Bitronix (Deletable) -See [Bitronix's Official Documentation](https://github.com/bitronix/btm/wiki) for more details. diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/global-rule/alter-transaction-rule.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/global-rule/alter-transaction-rule.cn.md index fcf107bfa7c77..b1c499b4cb515 100644 --- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/global-rule/alter-transaction-rule.cn.md +++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/global-rule/alter-transaction-rule.cn.md @@ -40,7 +40,7 @@ value ::= - `defaultTransactionType` 支持 `LOCAL`、`XA`、`BASE` -- `transactionManager` 支持 `Atomikos`、`Narayana` 和 `Bitronix` +- `transactionManager` 支持 `Atomikos` 和 `Narayana` ### 示例 diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/global-rule/alter-transaction-rule.en.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/global-rule/alter-transaction-rule.en.md index 3b4fb0aa0f997..e98bb3d4a7c7d 100644 --- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/global-rule/alter-transaction-rule.en.md +++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/global-rule/alter-transaction-rule.en.md @@ -40,7 +40,7 @@ value ::= - `defaultTransactionType` support `LOCAL`, `XA`, `BASE` -- `transactionManager` support `Atomikos`, `Narayana` and `Bitronix` +- `transactionManager` support `Atomikos` and `Narayana` ### Example diff --git a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md index 7d2cd7d160984..ad289661b7a40 100644 --- a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md +++ b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md @@ -37,6 +37,5 @@ ShardingSphere 默认情况下仅包含核心 SPI 的实现,在 Git Source 存 - `org.apache.shardingsphere:shardingsphere-cluster-mode-repository-consul`,基于 Consul 的持久化实现 - XA 分布式事务管理器 - `org.apache.shardingsphere:shardingsphere-transaction-xa-narayana`,基于 Narayana 的 XA 分布式事务管理器 - - `org.apache.shardingsphere:shardingsphere-transaction-xa-bitronix`,基于 Bitronix 的 XA 分布式事务管理器 - SQL 翻译 - `org.apache.shardingsphere:shardingsphere-sql-translator-jooq-provider`,使用 JooQ 的 SQL 翻译器 diff --git a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md index bf566b1a6ec12..d10f6a21f1701 100644 --- a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md +++ b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md @@ -37,6 +37,5 @@ All optional plugins are listed below in the form of `groupId:artifactId`. - `org.apache.shardingsphere:shardingsphere-cluster-mode-repository-consul`, Consul based persistence - XA transaction manager provider definition - `org.apache.shardingsphere:shardingsphere-transaction-xa-narayana`, XA distributed transaction manager based on Narayana - - `org.apache.shardingsphere:shardingsphere-transaction-xa-bitronix`, XA distributed transaction manager based on Bitronix - SQL translator - `org.apache.shardingsphere:shardingsphere-sql-translator-jooq-provider`, JooQ SQL translator diff --git a/docs/document/content/user-manual/shardingsphere-proxy/startup/dependencies-download/add_Bitronix_dependency.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/startup/dependencies-download/add_Bitronix_dependency.cn.md deleted file mode 100644 index 1056aa137bfd7..0000000000000 --- a/docs/document/content/user-manual/shardingsphere-proxy/startup/dependencies-download/add_Bitronix_dependency.cn.md +++ /dev/null @@ -1,15 +0,0 @@ -+++ -title = "添加 Bitronix 依赖" -weight = 1 -+++ - -## 添加 Bitronix 依赖包 - -添加 Bitronix 依赖需要下载以下 jar 文件并将其添加 `ext-lib` 目录下。 - -### jar 文件下载地址 - -- [btm-2.1.3.jar](https://repo1.maven.org/maven2/org/codehaus/btm/btm/2.1.3/btm-2.1.3.jar) -- [shardingsphere-transaction-xa-bitronix.jar](https://mvnrepository.com/artifact/org.apache.shardingsphere/shardingsphere-transaction-xa-bitronix) - -请根据 `proxy` 版本下载对应 `shardingsphere-transaction-xa-bitronix.jar` 文件。 diff --git a/docs/document/content/user-manual/shardingsphere-proxy/startup/dependencies-download/add_Bitronix_dependency.en.md b/docs/document/content/user-manual/shardingsphere-proxy/startup/dependencies-download/add_Bitronix_dependency.en.md deleted file mode 100644 index ba7e0dd3ef93a..0000000000000 --- a/docs/document/content/user-manual/shardingsphere-proxy/startup/dependencies-download/add_Bitronix_dependency.en.md +++ /dev/null @@ -1,15 +0,0 @@ -+++ -title = "Add Bitronix dependencies" -weight = 1 -+++ - -## Add Bitronix dependencies - -Adding Bitronix dependencies requires downloading the following jar files and adding them under `ext-lib` path. - -### jar file downloads - -- [btm-2.1.3.jar](https://repo1.maven.org/maven2/org/codehaus/btm/btm/2.1.3/btm-2.1.3.jar) -- [shardingsphere-transaction-xa-bitronix.jar](https://mvnrepository.com/artifact/org.apache.shardingsphere/shardingsphere-transaction-xa-bitronix) - -Please download the corresponding `shardingsphere-transaction-xa-bitronix.jar` file according to the `proxy` version. diff --git a/examples/pom.xml b/examples/pom.xml index 14051ea3f6e5e..e06f3cb1e08bd 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -58,7 +58,6 @@ 5.9.1.Final 7.6.0.Final 3.2.1.Final - 2.1.3 1.6.1 @@ -100,11 +99,6 @@ shardingsphere-transaction-xa-core ${project.version} - - org.apache.shardingsphere - shardingsphere-transaction-xa-bitronix - ${project.version} - org.apache.shardingsphere shardingsphere-transaction-xa-narayana @@ -279,11 +273,6 @@ jboss-logging ${jboss-logging.version} - - org.codehaus.btm - btm - ${btm.version} - io.seata seata-all diff --git a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfigurationSupportedValue.java b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfigurationSupportedValue.java index ad488bb162637..3b2179dceb66a 100644 --- a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfigurationSupportedValue.java +++ b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfigurationSupportedValue.java @@ -35,7 +35,7 @@ public enum YamlExampleConfigurationSupportedValue { MODES("modes", new HashSet<>(Arrays.asList("memory", "proxy", "cluster-zookeeper", "cluster-etcd", "standalone"))), - TRANSACTIONS("transactions", new HashSet<>(Arrays.asList("local", "xa-atomikos", "xa-narayana", "xa-bitronix", "base-seata"))), + TRANSACTIONS("transactions", new HashSet<>(Arrays.asList("local", "xa-atomikos", "xa-narayana", "base-seata"))), FEATURES("features", new HashSet<>(Arrays.asList("shadow", "sharding", "readwrite-splitting", "encrypt", "db-discovery", "mask"))), diff --git a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/transaction/type/XABitronixExampleScenario.java b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/transaction/type/XABitronixExampleScenario.java deleted file mode 100644 index bb4c507d44008..0000000000000 --- a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/transaction/type/XABitronixExampleScenario.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.example.generator.scenario.transaction.type; - -import org.apache.shardingsphere.example.generator.scenario.transaction.TransactionExampleScenario; - -import java.util.Collection; -import java.util.Collections; -import java.util.Map; - -public class XABitronixExampleScenario implements TransactionExampleScenario { - - @Override - public Map getJavaClassTemplateMap() { - return Collections.emptyMap(); - } - - @Override - public Map getResourceTemplateMap() { - return Collections.emptyMap(); - } - - @Override - public Collection getJavaClassPaths() { - return Collections.emptySet(); - } - - @Override - public Collection getResourcePaths() { - return Collections.emptySet(); - } - - @Override - public String getType() { - return "xa-bitronix"; - } -} diff --git a/examples/shardingsphere-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.scenario.transaction.TransactionExampleScenario b/examples/shardingsphere-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.scenario.transaction.TransactionExampleScenario index 1d67d291e75a5..9dfbde7738b95 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.scenario.transaction.TransactionExampleScenario +++ b/examples/shardingsphere-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.scenario.transaction.TransactionExampleScenario @@ -18,5 +18,4 @@ org.apache.shardingsphere.example.generator.scenario.transaction.type.LocalExampleScenario org.apache.shardingsphere.example.generator.scenario.transaction.type.SeataExampleScenario org.apache.shardingsphere.example.generator.scenario.transaction.type.XAAtomikosExampleScenario -org.apache.shardingsphere.example.generator.scenario.transaction.type.XABitronixExampleScenario org.apache.shardingsphere.example.generator.scenario.transaction.type.XANarayanaExampleScenario diff --git a/examples/shardingsphere-example-generator/src/main/resources/config.yaml b/examples/shardingsphere-example-generator/src/main/resources/config.yaml index 1ceff6c8574a2..1fbee7703a99d 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/config.yaml +++ b/examples/shardingsphere-example-generator/src/main/resources/config.yaml @@ -31,7 +31,6 @@ transactions: - local - xa-atomikos - xa-narayana - - xa-bitronix - base-seata # supported: sharding,readwrite-splitting,encrypt,shadow,mask diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/java/config/Configuration.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/java/config/Configuration.ftl index a19ffa6c6b923..a8d7ff538d3e4 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/java/config/Configuration.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/java/config/Configuration.ftl @@ -157,8 +157,6 @@ public final class Configuration { return new TransactionRuleConfiguration("XA", "Atomikos", new Properties()); <#elseif transaction=="xa-narayana"> return new TransactionRuleConfiguration("XA", "Narayana", new Properties()); - <#elseif transaction=="xa-bitronix"> - return new TransactionRuleConfiguration("XA", "Bitronix", new Properties()); <#elseif transaction=="base-seata"> return new TransactionRuleConfiguration("BASE", "Seata", new Properties()); diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl index eba1a717d7890..79ecc7d8eed7a 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl @@ -71,17 +71,6 @@ jboss-logging 3.2.1.Final - <#elseif transaction=="xa-bitronix"> - - org.apache.shardingsphere - shardingsphere-transaction-xa-bitronix - ${r'${project.version}'} - - - org.codehaus.btm - btm - 2.1.3 - <#elseif transaction=="base-seata"> org.apache.shardingsphere diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-bitronix.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-bitronix.ftl deleted file mode 100644 index 2ead73c9c4a22..0000000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-bitronix.ftl +++ /dev/null @@ -1,19 +0,0 @@ -<#-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -transaction: - defaultType: XA - providerType: Bitronix diff --git a/kernel/transaction/distsql/parser/src/main/antlr4/imports/transaction/Keyword.g4 b/kernel/transaction/distsql/parser/src/main/antlr4/imports/transaction/Keyword.g4 index a763402319e5d..38c42f380c95c 100644 --- a/kernel/transaction/distsql/parser/src/main/antlr4/imports/transaction/Keyword.g4 +++ b/kernel/transaction/distsql/parser/src/main/antlr4/imports/transaction/Keyword.g4 @@ -75,10 +75,6 @@ NARAYANA : N A R A Y A N A ; -BITRONIX - : B I T R O N I X - ; - TRUE : T R U E ; diff --git a/kernel/transaction/distsql/parser/src/main/antlr4/imports/transaction/RALStatement.g4 b/kernel/transaction/distsql/parser/src/main/antlr4/imports/transaction/RALStatement.g4 index 7476dbbbc3f7e..01db2ea19658d 100644 --- a/kernel/transaction/distsql/parser/src/main/antlr4/imports/transaction/RALStatement.g4 +++ b/kernel/transaction/distsql/parser/src/main/antlr4/imports/transaction/RALStatement.g4 @@ -48,5 +48,5 @@ providerName ; buildInProviderTypeName - : ATOMIKOS | NARAYANA | BITRONIX + : ATOMIKOS | NARAYANA ; diff --git a/kernel/transaction/type/xa/provider/bitronix/pom.xml b/kernel/transaction/type/xa/provider/bitronix/pom.xml deleted file mode 100644 index 0f123469e3c74..0000000000000 --- a/kernel/transaction/type/xa/provider/bitronix/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - 4.0.0 - - org.apache.shardingsphere - shardingsphere-transaction-xa-provider - 5.4.1-SNAPSHOT - - shardingsphere-transaction-xa-bitronix - ${project.artifactId} - - - 2.1.3 - - - - - org.apache.shardingsphere - shardingsphere-transaction-xa-spi - ${project.version} - - - - org.codehaus.btm - btm - ${btm.version} - provided - - - diff --git a/kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixRecoveryResource.java b/kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixRecoveryResource.java deleted file mode 100644 index f218ac8d844b8..0000000000000 --- a/kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixRecoveryResource.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.transaction.xa.bitronix.manager; - -import bitronix.tm.internal.XAResourceHolderState; -import bitronix.tm.resource.common.ResourceBean; -import bitronix.tm.resource.common.XAResourceHolder; -import bitronix.tm.resource.common.XAResourceProducer; -import bitronix.tm.resource.common.XAStatefulHolder; -import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; -import org.apache.shardingsphere.transaction.xa.spi.SingleXAResource; - -import javax.naming.Reference; -import javax.sql.XAConnection; -import javax.sql.XADataSource; -import javax.transaction.xa.XAResource; -import java.sql.SQLException; - -/** - * Recovery resource of Bitronix. - */ -@RequiredArgsConstructor -public final class BitronixRecoveryResource extends ResourceBean implements XAResourceProducer { - - private static final long serialVersionUID = 3352890484951804392L; - - private final String resourceName; - - private final transient XADataSource xaDataSource; - - private transient XAConnection xaConnection; - - @Override - public void init() { - } - - @Override - public String getUniqueName() { - return resourceName; - } - - @SneakyThrows(SQLException.class) - @Override - public XAResourceHolderState startRecovery() { - xaConnection = xaDataSource.getXAConnection(); - SingleXAResourceHolder singleXAResourceHolder = new SingleXAResourceHolder(xaConnection.getXAResource(), this); - return new XAResourceHolderState(singleXAResourceHolder, this); - } - - @SneakyThrows(SQLException.class) - @Override - public void endRecovery() { - if (null != xaConnection) { - xaConnection.close(); - } - } - - @Override - public void setFailed(final boolean failed) { - } - - @Override - public XAResourceHolder findXAResourceHolder(final XAResource xaResource) { - SingleXAResource singleXAResource = (SingleXAResource) xaResource; - return resourceName.equals(singleXAResource.getResourceName()) ? new SingleXAResourceHolder(xaResource, this) : null; - } - - @Override - public XAStatefulHolder createPooledConnection(final Object xaFactory, final ResourceBean bean) { - return null; - } - - @Override - public Reference getReference() { - return null; - } - - @Override - public void close() { - } -} diff --git a/kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProvider.java b/kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProvider.java deleted file mode 100644 index fb6acfa19f997..0000000000000 --- a/kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProvider.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.transaction.xa.bitronix.manager; - -import bitronix.tm.BitronixTransactionManager; -import bitronix.tm.TransactionManagerServices; -import bitronix.tm.recovery.RecoveryException; -import bitronix.tm.resource.ResourceRegistrar; -import lombok.Getter; -import lombok.SneakyThrows; -import org.apache.shardingsphere.transaction.xa.spi.SingleXAResource; -import org.apache.shardingsphere.transaction.xa.spi.XATransactionManagerProvider; - -import javax.sql.XADataSource; -import javax.transaction.RollbackException; -import javax.transaction.SystemException; - -/** - * Bitronix transaction manager provider. - */ -@Getter -public final class BitronixXATransactionManagerProvider implements XATransactionManagerProvider { - - private BitronixTransactionManager transactionManager; - - @Override - public void init() { - transactionManager = TransactionManagerServices.getTransactionManager(); - } - - @SneakyThrows(RecoveryException.class) - @Override - public void registerRecoveryResource(final String dataSourceName, final XADataSource xaDataSource) { - ResourceRegistrar.register(new BitronixRecoveryResource(dataSourceName, xaDataSource)); - } - - @Override - public void removeRecoveryResource(final String dataSourceName, final XADataSource xaDataSource) { - ResourceRegistrar.unregister(new BitronixRecoveryResource(dataSourceName, xaDataSource)); - } - - @SneakyThrows({SystemException.class, RollbackException.class}) - @Override - public void enlistResource(final SingleXAResource singleXAResource) { - transactionManager.getTransaction().enlistResource(singleXAResource); - } - - @Override - public void close() { - transactionManager.shutdown(); - } - - @Override - public String getType() { - return "Bitronix"; - } -} diff --git a/kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/SingleXAResourceHolder.java b/kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/SingleXAResourceHolder.java deleted file mode 100644 index ca5121587f0dd..0000000000000 --- a/kernel/transaction/type/xa/provider/bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/SingleXAResourceHolder.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.transaction.xa.bitronix.manager; - -import bitronix.tm.resource.common.AbstractXAResourceHolder; -import bitronix.tm.resource.common.ResourceBean; -import bitronix.tm.resource.common.XAResourceHolder; -import lombok.RequiredArgsConstructor; - -import javax.transaction.xa.XAResource; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -/** - * Single XA resource holder. - */ -@RequiredArgsConstructor -public final class SingleXAResourceHolder extends AbstractXAResourceHolder { - - private final XAResource xaResource; - - private final ResourceBean resourceBean; - - @Override - public XAResource getXAResource() { - return xaResource; - } - - @Override - public ResourceBean getResourceBean() { - return resourceBean; - } - - @Override - public List getXAResourceHolders() { - return Collections.emptyList(); - } - - @Override - public Object getConnectionHandle() { - return null; - } - - @Override - public Date getLastReleaseDate() { - return null; - } - - @Override - public void close() { - } -} diff --git a/kernel/transaction/type/xa/provider/bitronix/src/main/resources/META-INF/services/org.apache.shardingsphere.transaction.xa.spi.XATransactionManagerProvider b/kernel/transaction/type/xa/provider/bitronix/src/main/resources/META-INF/services/org.apache.shardingsphere.transaction.xa.spi.XATransactionManagerProvider deleted file mode 100644 index 113c86551beda..0000000000000 --- a/kernel/transaction/type/xa/provider/bitronix/src/main/resources/META-INF/services/org.apache.shardingsphere.transaction.xa.spi.XATransactionManagerProvider +++ /dev/null @@ -1,19 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -org.apache.shardingsphere.transaction.xa.bitronix.manager.BitronixXATransactionManagerProvider - diff --git a/kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixRecoveryResourceTest.java b/kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixRecoveryResourceTest.java deleted file mode 100644 index 9c9b410790f07..0000000000000 --- a/kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixRecoveryResourceTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.transaction.xa.bitronix.manager; - -import bitronix.tm.internal.XAResourceHolderState; -import bitronix.tm.resource.common.XAResourceHolder; -import org.apache.shardingsphere.transaction.xa.spi.SingleXAResource; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.mockito.junit.jupiter.MockitoSettings; -import org.mockito.quality.Strictness; - -import javax.sql.XAConnection; -import javax.sql.XADataSource; -import javax.transaction.xa.XAResource; -import java.sql.SQLException; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -@MockitoSettings(strictness = Strictness.LENIENT) -class BitronixRecoveryResourceTest { - - @Mock - private SingleXAResource singleXAResource; - - @Mock - private XADataSource xaDataSource; - - @Mock - private XAConnection xaConnection; - - @Mock - private XAResource xaResource; - - private BitronixRecoveryResource bitronixRecoveryResource; - - @BeforeEach - void setUp() throws SQLException { - when(singleXAResource.getResourceName()).thenReturn("ds1"); - when(xaDataSource.getXAConnection()).thenReturn(xaConnection); - when(xaConnection.getXAResource()).thenReturn(xaResource); - bitronixRecoveryResource = new BitronixRecoveryResource("ds1", xaDataSource); - } - - @Test - void assertRecovery() throws SQLException { - XAResourceHolderState xaResourceHolderState = bitronixRecoveryResource.startRecovery(); - assertThat(xaResourceHolderState.getUniqueName(), is("ds1")); - XAResourceHolder xaResourceHolder = xaResourceHolderState.getXAResourceHolder(); - assertThat(xaResourceHolder.getXAResource(), is(xaResource)); - bitronixRecoveryResource.endRecovery(); - verify(xaConnection).close(); - } - - @Test - void assertRecoveryWhenXaConnectionIsNull() throws SQLException { - BitronixRecoveryResource bitronixRecoveryResource = new BitronixRecoveryResource("ds1", null); - bitronixRecoveryResource.endRecovery(); - verify(xaConnection, times(0)).close(); - } - - @Test - void assertRecoveryWhenSQLExceptionIsThrown() throws SQLException { - when(xaDataSource.getXAConnection()).thenThrow(new SQLException()); - assertThrows(SQLException.class, () -> bitronixRecoveryResource.startRecovery()); - } - - @Test - void assertFindXAResourceHolder() { - assertNotNull(bitronixRecoveryResource.findXAResourceHolder(singleXAResource)); - } - - @Test - void assertCreatePooledConnection() { - assertNull(bitronixRecoveryResource.createPooledConnection(null, null)); - } - - @Test - void assertGetReference() { - assertNull(bitronixRecoveryResource.getReference()); - } - - @Test - void assertInit() { - assertDoesNotThrow(() -> bitronixRecoveryResource.init()); - } - - @Test - void assertSetFailed() { - assertDoesNotThrow(() -> bitronixRecoveryResource.setFailed(true)); - } - - @Test - void assertClose() { - assertDoesNotThrow(() -> bitronixRecoveryResource.close()); - } -} diff --git a/kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProviderTest.java b/kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProviderTest.java deleted file mode 100644 index e7c89bd3a5d13..0000000000000 --- a/kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProviderTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.transaction.xa.bitronix.manager; - -import bitronix.tm.BitronixTransactionManager; -import bitronix.tm.resource.ResourceRegistrar; -import org.apache.shardingsphere.transaction.xa.spi.SingleXAResource; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.internal.configuration.plugins.Plugins; -import org.mockito.junit.jupiter.MockitoExtension; - -import javax.sql.XADataSource; -import javax.transaction.RollbackException; -import javax.transaction.SystemException; -import javax.transaction.Transaction; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -class BitronixXATransactionManagerProviderTest { - - private final BitronixXATransactionManagerProvider transactionManagerProvider = new BitronixXATransactionManagerProvider(); - - @Mock - private BitronixTransactionManager transactionManager; - - @Mock - private XADataSource xaDataSource; - - @BeforeEach - void setUp() throws ReflectiveOperationException { - Plugins.getMemberAccessor().set(BitronixXATransactionManagerProvider.class.getDeclaredField("transactionManager"), transactionManagerProvider, transactionManager); - } - - @Test - void assertRegisterRecoveryResourceThenRemove() { - transactionManagerProvider.registerRecoveryResource("ds1", xaDataSource); - assertNotNull(ResourceRegistrar.get("ds1")); - transactionManagerProvider.removeRecoveryResource("ds1", xaDataSource); - assertNull(ResourceRegistrar.get("ds1")); - } - - @Test - void assertEnlistResource() throws SystemException, RollbackException { - SingleXAResource singleXAResource = mock(SingleXAResource.class); - Transaction transaction = mock(Transaction.class); - when(transactionManager.getTransaction()).thenReturn(transaction); - transactionManagerProvider.enlistResource(singleXAResource); - verify(transaction).enlistResource(singleXAResource); - } - - @Test - void assertGetTransactionManager() { - assertThat(transactionManagerProvider.getTransactionManager(), is(transactionManager)); - } - - @Test - void assertClose() { - transactionManagerProvider.close(); - verify(transactionManager).shutdown(); - } -} diff --git a/kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/SingleXAResourceHolderTest.java b/kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/SingleXAResourceHolderTest.java deleted file mode 100644 index abfa6a80d191f..0000000000000 --- a/kernel/transaction/type/xa/provider/bitronix/src/test/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/SingleXAResourceHolderTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.transaction.xa.bitronix.manager; - -import bitronix.tm.resource.common.ResourceBean; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import javax.transaction.xa.XAResource; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -@ExtendWith(MockitoExtension.class) -class SingleXAResourceHolderTest { - - @Mock - private XAResource xaResource; - - @Mock - private ResourceBean resourceBean; - - private SingleXAResourceHolder singleXAResourceHolder; - - @BeforeEach - void setUp() { - singleXAResourceHolder = new SingleXAResourceHolder(xaResource, resourceBean); - } - - @Test - void assertGetXAResource() { - assertThat(singleXAResourceHolder.getXAResource(), is(xaResource)); - } - - @Test - void assertGetResourceBean() { - assertThat(singleXAResourceHolder.getResourceBean(), is(resourceBean)); - } - - @Test - void assertGetXAResourceHolders() { - assertTrue(singleXAResourceHolder.getXAResourceHolders().isEmpty()); - } - - @Test - void assertGetConnectionHandle() { - assertNull(singleXAResourceHolder.getConnectionHandle()); - } - - @Test - void assertGetLastReleaseDate() { - assertNull(singleXAResourceHolder.getLastReleaseDate()); - } - - @Test - void assertClose() { - assertDoesNotThrow(() -> singleXAResourceHolder.close()); - } -} diff --git a/kernel/transaction/type/xa/provider/bitronix/src/test/resources/bitronix-default-config.properties b/kernel/transaction/type/xa/provider/bitronix/src/test/resources/bitronix-default-config.properties deleted file mode 100644 index 52d132ce53f18..0000000000000 --- a/kernel/transaction/type/xa/provider/bitronix/src/test/resources/bitronix-default-config.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -bitronix.tm.serverId = test-server -bitronix.tm.journal.disk.logPart1Filename = target/btm1.tlog -bitronix.tm.journal.disk.logPart2Filename = target/btm2.tlog diff --git a/kernel/transaction/type/xa/provider/bitronix/src/test/resources/logback-test.xml b/kernel/transaction/type/xa/provider/bitronix/src/test/resources/logback-test.xml deleted file mode 100644 index d90fc4a715683..0000000000000 --- a/kernel/transaction/type/xa/provider/bitronix/src/test/resources/logback-test.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n - - - - - - - - - - - diff --git a/kernel/transaction/type/xa/provider/pom.xml b/kernel/transaction/type/xa/provider/pom.xml index 0179a084d0871..05c4e3db3566a 100644 --- a/kernel/transaction/type/xa/provider/pom.xml +++ b/kernel/transaction/type/xa/provider/pom.xml @@ -30,6 +30,5 @@ atomikos narayana - bitronix diff --git a/src/resources/spotbugs.xml b/src/resources/spotbugs.xml index 302f31eebf60e..1e37cd018ddb7 100644 --- a/src/resources/spotbugs.xml +++ b/src/resources/spotbugs.xml @@ -60,10 +60,6 @@ - - - - diff --git a/test/e2e/fixture/pom.xml b/test/e2e/fixture/pom.xml index 80ae03f046a6e..fea55e7467dcc 100644 --- a/test/e2e/fixture/pom.xml +++ b/test/e2e/fixture/pom.xml @@ -32,7 +32,6 @@ 5.12.4.Final 7.6.0.Final 3.2.1.Final - 2.1.3 @@ -112,16 +111,6 @@ jboss-logging ${jboss-logging.version} - - org.apache.shardingsphere - shardingsphere-transaction-xa-bitronix - ${project.version} - - - org.codehaus.btm - btm - ${btm.version} - diff --git a/test/e2e/operation/transaction/pom.xml b/test/e2e/operation/transaction/pom.xml index fb02a1c52ec36..f266bba568e92 100644 --- a/test/e2e/operation/transaction/pom.xml +++ b/test/e2e/operation/transaction/pom.xml @@ -33,7 +33,6 @@ 5.12.4.Final 7.6.0.Final 3.2.1.Final - 2.1.3 @@ -123,16 +122,6 @@ jboss-logging ${jboss-logging.version} - - org.apache.shardingsphere - shardingsphere-transaction-xa-bitronix - ${project.version} - - - org.codehaus.btm - btm - ${btm.version} - org.awaitility awaitility diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionBaseE2EIT.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionBaseE2EIT.java index 3350071fa72bf..a897f0f19ba4f 100644 --- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionBaseE2EIT.java +++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionBaseE2EIT.java @@ -72,7 +72,7 @@ @Slf4j public abstract class TransactionBaseE2EIT { - private static final List ALL_XA_PROVIDERS = Arrays.asList(TransactionTestConstants.ATOMIKOS, TransactionTestConstants.BITRONIX, TransactionTestConstants.NARAYANA); + private static final List ALL_XA_PROVIDERS = Arrays.asList(TransactionTestConstants.ATOMIKOS, TransactionTestConstants.NARAYANA); private static final List> TEST_CASES = TestCaseClassScanner.scan(); diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/constants/TransactionTestConstants.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/constants/TransactionTestConstants.java index 4b72ea32399df..f8dc43f2a19ca 100644 --- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/constants/TransactionTestConstants.java +++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/constants/TransactionTestConstants.java @@ -42,8 +42,6 @@ public final class TransactionTestConstants { public static final String NARAYANA = "Narayana"; - public static final String BITRONIX = "Bitronix"; - public static final String JDBC = "jdbc"; public static final String PROXY = "proxy"; diff --git a/test/e2e/operation/transaction/src/test/resources/env/it-env.properties b/test/e2e/operation/transaction/src/test/resources/env/it-env.properties index cd60dd43d0f6c..56401d4fc3c61 100644 --- a/test/e2e/operation/transaction/src/test/resources/env/it-env.properties +++ b/test/e2e/operation/transaction/src/test/resources/env/it-env.properties @@ -20,7 +20,7 @@ transaction.it.env.type=NONE transaction.it.env.cases=TransactionDeadlockTestCase, MultiJDBCConnectionsTestCase, MultiTransactionInConnectionTestCase, MultiOperationsCommitAndRollbackTestCase, MySQLAutoCommitTestCase, PostgreSQLAutoCommitTestCase, BroadcastTableTransactionTestCase, ExceptionInTransactionTestCase, MultiTableCommitAndRollbackTestCase, SingleTableCommitAndRollbackTestCase, MySQLSetReadOnlyTestCase, MySQLSavePointTestCase, MySQLLocalTruncateTestCase, MySQLXATruncateTestCase, OpenGaussCursorTestCase, NestedTransactionTestCase, ReadwriteSplittingInTransactionTestCase # transaction.it.env.transtypes=LOCAL, XA, BASE transaction.it.env.transtypes=LOCAL, XA -# transaction.it.env.xa.providers=Atomikos, Bitronix, Narayana +# transaction.it.env.xa.providers=Atomikos, Narayana transaction.it.env.xa.providers=Atomikos, Narayana # transaction.it.docker.mysql.version=5.7,8.0 transaction.it.docker.mysql.version= diff --git a/test/e2e/operation/transaction/src/test/resources/env/jdbc/mysql/config-sharding-xa-bitronix.yaml b/test/e2e/operation/transaction/src/test/resources/env/jdbc/mysql/config-sharding-xa-bitronix.yaml deleted file mode 100644 index f9133d3cd328a..0000000000000 --- a/test/e2e/operation/transaction/src/test/resources/env/jdbc/mysql/config-sharding-xa-bitronix.yaml +++ /dev/null @@ -1,109 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -###################################################################################################### -# -# If you want to configure governance, authorization and proxy properties, please refer to this file. -# -###################################################################################################### - -databaseName: sharding_db -rules: - - !SHARDING - tables: - t_order: - actualDataNodes: ds_${0..1}.t_order_${0..1} - tableStrategy: - standard: - shardingColumn: order_id - shardingAlgorithmName: t_order_inline - keyGenerateStrategy: - column: order_id - keyGeneratorName: snowflake - t_order_item: - actualDataNodes: ds_${0..1}.t_order_item_${0..1} - tableStrategy: - standard: - shardingColumn: order_id - shardingAlgorithmName: t_order_item_inline - keyGenerateStrategy: - column: order_item_id - keyGeneratorName: snowflake - account: - actualDataNodes: ds_${0..1}.account_${0..1} - databaseStrategy: - standard: - shardingColumn: id - shardingAlgorithmName: database_id_inline - tableStrategy: - standard: - shardingColumn: id - shardingAlgorithmName: account_inline - keyGenerateStrategy: - column: id - keyGeneratorName: snowflake - bindingTables: - - t_order,t_order_item - defaultDatabaseStrategy: - standard: - shardingColumn: user_id - shardingAlgorithmName: database_inline - defaultTableStrategy: - none: - - shardingAlgorithms: - database_inline: - type: INLINE - props: - algorithm-expression: ds_${user_id % 2} - database_id_inline: - type: INLINE - props: - algorithm-expression: ds_${id % 2} - t_order_inline: - type: INLINE - props: - algorithm-expression: t_order_${order_id % 2} - t_order_item_inline: - type: INLINE - props: - algorithm-expression: t_order_item_${order_id % 2} - account_inline: - type: INLINE - props: - algorithm-expression: account_${id % 2} - - keyGenerators: - snowflake: - type: SNOWFLAKE - - - !BROADCAST - tables: - - t_address - -transaction: - defaultType: XA - providerType: Bitronix - -sqlFederation: - sqlFederationEnabled: true - executionPlanCache: - initialCapacity: 2000 - maximumSize: 65535 - -props: - sql-show: true diff --git a/test/e2e/operation/transaction/src/test/resources/env/jdbc/opengauss/config-sharding-xa-bitronix.yaml b/test/e2e/operation/transaction/src/test/resources/env/jdbc/opengauss/config-sharding-xa-bitronix.yaml deleted file mode 100644 index f9133d3cd328a..0000000000000 --- a/test/e2e/operation/transaction/src/test/resources/env/jdbc/opengauss/config-sharding-xa-bitronix.yaml +++ /dev/null @@ -1,109 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -###################################################################################################### -# -# If you want to configure governance, authorization and proxy properties, please refer to this file. -# -###################################################################################################### - -databaseName: sharding_db -rules: - - !SHARDING - tables: - t_order: - actualDataNodes: ds_${0..1}.t_order_${0..1} - tableStrategy: - standard: - shardingColumn: order_id - shardingAlgorithmName: t_order_inline - keyGenerateStrategy: - column: order_id - keyGeneratorName: snowflake - t_order_item: - actualDataNodes: ds_${0..1}.t_order_item_${0..1} - tableStrategy: - standard: - shardingColumn: order_id - shardingAlgorithmName: t_order_item_inline - keyGenerateStrategy: - column: order_item_id - keyGeneratorName: snowflake - account: - actualDataNodes: ds_${0..1}.account_${0..1} - databaseStrategy: - standard: - shardingColumn: id - shardingAlgorithmName: database_id_inline - tableStrategy: - standard: - shardingColumn: id - shardingAlgorithmName: account_inline - keyGenerateStrategy: - column: id - keyGeneratorName: snowflake - bindingTables: - - t_order,t_order_item - defaultDatabaseStrategy: - standard: - shardingColumn: user_id - shardingAlgorithmName: database_inline - defaultTableStrategy: - none: - - shardingAlgorithms: - database_inline: - type: INLINE - props: - algorithm-expression: ds_${user_id % 2} - database_id_inline: - type: INLINE - props: - algorithm-expression: ds_${id % 2} - t_order_inline: - type: INLINE - props: - algorithm-expression: t_order_${order_id % 2} - t_order_item_inline: - type: INLINE - props: - algorithm-expression: t_order_item_${order_id % 2} - account_inline: - type: INLINE - props: - algorithm-expression: account_${id % 2} - - keyGenerators: - snowflake: - type: SNOWFLAKE - - - !BROADCAST - tables: - - t_address - -transaction: - defaultType: XA - providerType: Bitronix - -sqlFederation: - sqlFederationEnabled: true - executionPlanCache: - initialCapacity: 2000 - maximumSize: 65535 - -props: - sql-show: true diff --git a/test/e2e/operation/transaction/src/test/resources/env/jdbc/postgresql/config-sharding-xa-bitronix.yaml b/test/e2e/operation/transaction/src/test/resources/env/jdbc/postgresql/config-sharding-xa-bitronix.yaml deleted file mode 100644 index f9133d3cd328a..0000000000000 --- a/test/e2e/operation/transaction/src/test/resources/env/jdbc/postgresql/config-sharding-xa-bitronix.yaml +++ /dev/null @@ -1,109 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -###################################################################################################### -# -# If you want to configure governance, authorization and proxy properties, please refer to this file. -# -###################################################################################################### - -databaseName: sharding_db -rules: - - !SHARDING - tables: - t_order: - actualDataNodes: ds_${0..1}.t_order_${0..1} - tableStrategy: - standard: - shardingColumn: order_id - shardingAlgorithmName: t_order_inline - keyGenerateStrategy: - column: order_id - keyGeneratorName: snowflake - t_order_item: - actualDataNodes: ds_${0..1}.t_order_item_${0..1} - tableStrategy: - standard: - shardingColumn: order_id - shardingAlgorithmName: t_order_item_inline - keyGenerateStrategy: - column: order_item_id - keyGeneratorName: snowflake - account: - actualDataNodes: ds_${0..1}.account_${0..1} - databaseStrategy: - standard: - shardingColumn: id - shardingAlgorithmName: database_id_inline - tableStrategy: - standard: - shardingColumn: id - shardingAlgorithmName: account_inline - keyGenerateStrategy: - column: id - keyGeneratorName: snowflake - bindingTables: - - t_order,t_order_item - defaultDatabaseStrategy: - standard: - shardingColumn: user_id - shardingAlgorithmName: database_inline - defaultTableStrategy: - none: - - shardingAlgorithms: - database_inline: - type: INLINE - props: - algorithm-expression: ds_${user_id % 2} - database_id_inline: - type: INLINE - props: - algorithm-expression: ds_${id % 2} - t_order_inline: - type: INLINE - props: - algorithm-expression: t_order_${order_id % 2} - t_order_item_inline: - type: INLINE - props: - algorithm-expression: t_order_item_${order_id % 2} - account_inline: - type: INLINE - props: - algorithm-expression: account_${id % 2} - - keyGenerators: - snowflake: - type: SNOWFLAKE - - - !BROADCAST - tables: - - t_address - -transaction: - defaultType: XA - providerType: Bitronix - -sqlFederation: - sqlFederationEnabled: true - executionPlanCache: - initialCapacity: 2000 - maximumSize: 65535 - -props: - sql-show: true