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

wuweijie 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 51f0cbd  Remove XATransactionManagerType (#12093)
51f0cbd is described below

commit 51f0cbdd4c91e71993ee11739159b6024f067d9b
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Aug 29 23:13:29 2021 +0800

    Remove XATransactionManagerType (#12093)
---
 .../AtomikosTransactionManagerProvider.java        |  3 +-
 .../BitronixXATransactionManagerProvider.java      |  3 +-
 .../xa/XAShardingSphereTransactionManagerTest.java |  3 +-
 .../XATransactionManagerProviderLoaderTest.java    |  3 +-
 .../NarayanaXATransactionManagerProvider.java      |  3 +-
 .../transaction/core/XATransactionManagerType.java | 51 ----------------------
 ...ShardingSphereTransactionManagerEngineTest.java |  3 +-
 7 files changed, 6 insertions(+), 63 deletions(-)

diff --git 
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-atomikos/src/main/java/org/apache/shardingsphere/transaction/xa/atomikos/manager/AtomikosTransactionManagerProvider.java
 
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-atomikos/src/main/java/org/apache/shardingsphere/transaction/xa/atomikos/manager/AtomikosTransactionManagerProvider.java
index 21cf063..34f0de2 100644
--- 
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-atomikos/src/main/java/org/apache/shardingsphere/transaction/xa/atomikos/manager/AtomikosTransactionManagerProvider.java
+++ 
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-atomikos/src/main/java/org/apache/shardingsphere/transaction/xa/atomikos/manager/AtomikosTransactionManagerProvider.java
@@ -21,7 +21,6 @@ import com.atomikos.icatch.config.UserTransactionService;
 import com.atomikos.icatch.config.UserTransactionServiceImp;
 import com.atomikos.icatch.jta.UserTransactionManager;
 import lombok.SneakyThrows;
-import org.apache.shardingsphere.transaction.core.XATransactionManagerType;
 import org.apache.shardingsphere.transaction.xa.spi.SingleXAResource;
 import 
org.apache.shardingsphere.transaction.xa.spi.XATransactionManagerProvider;
 
@@ -74,6 +73,6 @@ public final class AtomikosTransactionManagerProvider 
implements XATransactionMa
     
     @Override
     public String getType() {
-        return XATransactionManagerType.ATOMIKOS.getType();
+        return "Atomikos";
     }
 }
diff --git 
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProvider.java
 
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProvider.java
index 0361097..65c8aa6 100644
--- 
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProvider.java
+++ 
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-bitronix/src/main/java/org/apache/shardingsphere/transaction/xa/bitronix/manager/BitronixXATransactionManagerProvider.java
@@ -22,7 +22,6 @@ import bitronix.tm.TransactionManagerServices;
 import bitronix.tm.recovery.RecoveryException;
 import bitronix.tm.resource.ResourceRegistrar;
 import lombok.SneakyThrows;
-import org.apache.shardingsphere.transaction.core.XATransactionManagerType;
 import org.apache.shardingsphere.transaction.xa.spi.SingleXAResource;
 import 
org.apache.shardingsphere.transaction.xa.spi.XATransactionManagerProvider;
 
@@ -72,6 +71,6 @@ public final class BitronixXATransactionManagerProvider 
implements XATransaction
     
     @Override
     public String getType() {
-        return XATransactionManagerType.BITRONIX.getType();
+        return "Bitronix";
     }
 }
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 c177208..96bba43 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
@@ -25,7 +25,6 @@ import 
org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
 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.transaction.core.XATransactionManagerType;
 import org.apache.shardingsphere.transaction.rule.TransactionRule;
 import org.apache.shardingsphere.transaction.xa.fixture.DataSourceUtils;
 import 
org.apache.shardingsphere.transaction.xa.jta.datasource.XATransactionDataSource;
@@ -61,7 +60,7 @@ public final class XAShardingSphereTransactionManagerTest {
     public void setUp() {
         Collection<ResourceDataSource> resourceDataSources = 
createResourceDataSources(DatabaseTypeRegistry.getActualDatabaseType("H2"));
         Properties props = new Properties();
-        props.setProperty("xa-transaction-manager-type", 
XATransactionManagerType.ATOMIKOS.getType());
+        props.setProperty("xa-transaction-manager-type", "Atomikos");
         TransactionRule transactionRule = new TransactionRule(new 
TransactionRuleConfiguration("XA", props));
         
xaTransactionManager.init(DatabaseTypeRegistry.getActualDatabaseType("H2"), 
resourceDataSources, transactionRule);
     }
diff --git 
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/manager/XATransactionManagerProviderLoaderTest.java
 
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/manager/XATransactionManagerProviderLoaderTest.java
index 6a925b4..4c336c5 100644
--- 
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/manager/XATransactionManagerProviderLoaderTest.java
+++ 
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/manager/XATransactionManagerProviderLoaderTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.transaction.xa.manager;
 
-import org.apache.shardingsphere.transaction.core.XATransactionManagerType;
 import 
org.apache.shardingsphere.transaction.xa.atomikos.manager.AtomikosTransactionManagerProvider;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -31,6 +30,6 @@ public final class XATransactionManagerProviderLoaderTest {
     
     @Test
     public void assertGetTransactionManager() {
-        
assertThat(XATransactionManagerLoader.getInstance().getXATransactionManager(XATransactionManagerType.ATOMIKOS.getType()),
 instanceOf(AtomikosTransactionManagerProvider.class));
+        
assertThat(XATransactionManagerLoader.getInstance().getXATransactionManager("Atomikos"),
 instanceOf(AtomikosTransactionManagerProvider.class));
     }
 }
diff --git 
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/NarayanaXATransactionManagerProvider.java
 
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/NarayanaXATransactionManagerProvider.java
index 2195b56..c0a5d53 100644
--- 
a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/NarayanaXATransactionManagerProvider.java
+++ 
b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/NarayanaXATransactionManagerProvider.java
@@ -22,7 +22,6 @@ import 
com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
 import com.arjuna.ats.jbossatx.jta.RecoveryManagerService;
 import com.arjuna.ats.jta.common.jtaPropertyManager;
 import lombok.SneakyThrows;
-import org.apache.shardingsphere.transaction.core.XATransactionManagerType;
 import org.apache.shardingsphere.transaction.xa.spi.SingleXAResource;
 import 
org.apache.shardingsphere.transaction.xa.spi.XATransactionManagerProvider;
 
@@ -86,6 +85,6 @@ public final class NarayanaXATransactionManagerProvider 
implements XATransaction
     
     @Override
     public String getType() {
-        return XATransactionManagerType.NARAYANA.getType();
+        return "Narayana";
     }
 }
diff --git 
a/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/core/XATransactionManagerType.java
 
b/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/core/XATransactionManagerType.java
deleted file mode 100644
index d1ae780..0000000
--- 
a/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/core/XATransactionManagerType.java
+++ /dev/null
@@ -1,51 +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.core;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-import java.util.Arrays;
-
-/**
- * XA transaction manager type.
- */
-@RequiredArgsConstructor
-@Getter
-public enum XATransactionManagerType {
-    
-    ATOMIKOS("Atomikos"),
-    
-    NARAYANA("Narayana"),
-    
-    BITRONIX("Bitronix"),
-    
-    SEATA("Seata");
-    
-    private final String type;
-    
-    /**
-     * Value from transaction manager type.
-     *
-     * @param type value to be transaction manager type
-     * @return value from transaction manager type
-     */
-    public static XATransactionManagerType valueFrom(final String type) {
-        return Arrays.stream(values()).filter(each -> 
each.type.equalsIgnoreCase(type)).findFirst().orElse(ATOMIKOS);
-    }
-}
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 d73288e..7d2a0b5 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
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.transaction;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
 import 
org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration;
 import org.apache.shardingsphere.transaction.core.TransactionType;
-import org.apache.shardingsphere.transaction.core.XATransactionManagerType;
 import 
org.apache.shardingsphere.transaction.core.fixture.ShardingSphereTransactionManagerFixture;
 import org.apache.shardingsphere.transaction.rule.TransactionRule;
 import org.junit.Test;
@@ -48,7 +47,7 @@ public final class ShardingSphereTransactionManagerEngineTest 
{
         ShardingSphereTransactionManagerFixture transactionManager = 
(ShardingSphereTransactionManagerFixture) 
transactionManagerEngine.getTransactionManager(TransactionType.XA);
         transactionManager.setCaller(caller);
         Properties props = new Properties();
-        props.setProperty("xa-transaction-manager-type", 
XATransactionManagerType.ATOMIKOS.getType());
+        props.setProperty("xa-transaction-manager-type", "Atomikos");
         TransactionRule transactionRule = new TransactionRule(new 
TransactionRuleConfiguration("XA", props));
         
transactionManagerEngine.init(DatabaseTypeRegistry.getActualDatabaseType("H2"), 
Collections.emptyMap(), transactionRule);
         verify(caller).run();

Reply via email to