This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 96796159bc9 Refactor TypedSPILoader (#27902)
96796159bc9 is described below
commit 96796159bc9bdbf665908ba497c604f7d2659426
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Aug 3 23:04:54 2023 +0800
Refactor TypedSPILoader (#27902)
* Refactor TypedSPILoader
* Remove useless fixture
---
.../infra/spi/type/typed/TypedSPILoader.java | 3 +-
...herShardingSphereTransactionManagerFixture.java | 73 ----------------------
...ransaction.spi.ShardingSphereTransactionManager | 1 -
3 files changed, 1 insertion(+), 76 deletions(-)
diff --git
a/infra/spi/src/main/java/org/apache/shardingsphere/infra/spi/type/typed/TypedSPILoader.java
b/infra/spi/src/main/java/org/apache/shardingsphere/infra/spi/type/typed/TypedSPILoader.java
index c7bd6617e75..262e8bdc540 100644
---
a/infra/spi/src/main/java/org/apache/shardingsphere/infra/spi/type/typed/TypedSPILoader.java
+++
b/infra/spi/src/main/java/org/apache/shardingsphere/infra/spi/type/typed/TypedSPILoader.java
@@ -36,10 +36,9 @@ public final class TypedSPILoader {
*
* @param serviceInterface typed SPI service interface to be judged
* @param type type
- * @param <T> SPI class type
* @return contains or not
*/
- public static <T extends TypedSPI> boolean contains(final Class<T>
serviceInterface, final Object type) {
+ public static boolean contains(final Class<? extends TypedSPI>
serviceInterface, final Object type) {
return
ShardingSphereServiceLoader.getServiceInstances(serviceInterface).stream().anyMatch(each
-> matchesType(type, each));
}
diff --git
a/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/core/fixture/OtherShardingSphereTransactionManagerFixture.java
b/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/core/fixture/OtherShardingSphereTransactionManagerFixture.java
deleted file mode 100644
index 15a64cb2c55..00000000000
---
a/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/core/fixture/OtherShardingSphereTransactionManagerFixture.java
+++ /dev/null
@@ -1,73 +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.fixture;
-
-import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
-import org.apache.shardingsphere.transaction.api.TransactionType;
-import
org.apache.shardingsphere.transaction.spi.ShardingSphereTransactionManager;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.util.Map;
-
-public final class OtherShardingSphereTransactionManagerFixture implements
ShardingSphereTransactionManager {
-
- @Override
- public void init(final Map<String, DatabaseType> databaseTypes, final
Map<String, DataSource> dataSources, final String providerType) {
- }
-
- @Override
- public TransactionType getTransactionType() {
- return TransactionType.XA;
- }
-
- @Override
- public boolean isInTransaction() {
- return true;
- }
-
- @Override
- public Connection getConnection(final String databaseName, final String
dataSourceName) {
- return null;
- }
-
- @Override
- public void begin() {
- }
-
- @Override
- public void begin(final int timeout) {
- }
-
- @Override
- public void commit(final boolean rollbackOnly) {
- }
-
- @Override
- public void rollback() {
- }
-
- @Override
- public void close() {
- }
-
- @Override
- public String getType() {
- return TransactionType.XA.name();
- }
-}
diff --git
a/kernel/transaction/core/src/test/resources/META-INF/services/org.apache.shardingsphere.transaction.spi.ShardingSphereTransactionManager
b/kernel/transaction/core/src/test/resources/META-INF/services/org.apache.shardingsphere.transaction.spi.ShardingSphereTransactionManager
index 161f4954513..48d6f27c718 100644
---
a/kernel/transaction/core/src/test/resources/META-INF/services/org.apache.shardingsphere.transaction.spi.ShardingSphereTransactionManager
+++
b/kernel/transaction/core/src/test/resources/META-INF/services/org.apache.shardingsphere.transaction.spi.ShardingSphereTransactionManager
@@ -16,4 +16,3 @@
#
org.apache.shardingsphere.transaction.core.fixture.ShardingSphereTransactionManagerFixture
-org.apache.shardingsphere.transaction.core.fixture.OtherShardingSphereTransactionManagerFixture