You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by tu...@apache.org on 2022/09/26 07:51:56 UTC
[shardingsphere] branch master updated: For code format (#21193)
This is an automated email from the ASF dual-hosted git repository.
tuichenchuxin 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 827278efb92 For code format (#21193)
827278efb92 is described below
commit 827278efb92c354a00b5d1be80df185450f7888c
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon Sep 26 15:51:47 2022 +0800
For code format (#21193)
* For code format
* For code format
---
.../execute/MySQLComStmtExecutePacketTest.java | 2 +-
.../WhereClauseShardingConditionEngineTest.java | 3 +-
.../update/AddMigrationSourceResourceUpdater.java | 3 +-
.../ShardingRuleStatementConverterTest.java | 5 ++-
.../query/ShardingTableRuleQueryResultSetTest.java | 4 +-
.../parser/segment/AuditStrategySegment.java | 17 +++----
.../engine/TopPaginationContextEngine.java | 2 +-
.../datasource/state/DataSourceStateManager.java | 4 +-
.../infra/metadata/ShardingSphereMetaData.java | 4 +-
.../database/ShardingSphereDatabasesFactory.java | 2 +-
.../engine/raw/callback/RawExecutorCallback.java | 4 +-
.../driver/vertx/VertxExecutorCallbackTest.java | 5 +--
.../core/datasource/ShardingSphereDataSource.java | 2 +-
.../statement/ShardingSpherePreparedStatement.java | 2 +-
...ractShardingSphereDataSourceForEncryptTest.java | 4 +-
.../core/driver/DriverDataSourceCacheTest.java | 5 +--
.../resultset/ShardingSphereResultSetTest.java | 2 +-
.../api/InventoryIncrementalJobPublicAPI.java | 3 +-
.../scenario/migration/MigrationJobAPIImpl.java | 2 +-
.../AlterSQLParserRuleStatementUpdaterTest.java | 3 +-
.../AdvancedSQLFederationExecutorTest.java | 2 +-
.../executor/TranslatableTableScanExecutor.java | 12 +----
.../metadata/translatable/StringToRexNodeUtil.java | 5 +--
.../AlterTrafficRuleStatementUpdaterTest.java | 5 +--
.../CreateTrafficRuleStatementUpdaterTest.java | 11 +++--
.../DropTrafficRuleStatementUpdaterTest.java | 5 +--
.../transaction/rule/TransactionRule.java | 4 +-
.../mode/manager/ContextManager.java | 8 ++--
.../subscriber/ComputeNodeStatusSubscriber.java | 2 +-
.../backend/communication/BackendConnection.java | 11 ++---
.../handler/DatabaseRequiredBackendHandler.java | 2 +-
.../handler/ProxyBackendHandlerFactory.java | 4 +-
.../admin/executor/DatabaseAdminQueryExecutor.java | 5 +--
.../distsql/DistSQLBackendHandlerFactory.java | 5 +--
.../ral/UpdatableGlobalRuleRALBackendHandler.java | 4 +-
.../distsql/ral/hint/HintRALBackendHandler.java | 2 +-
.../query/QueryableScalingRALBackendHandler.java | 3 +-
.../JDBCBackendTransactionManagerTest.java | 4 +-
.../DatabaseOperateBackendHandlerFactoryTest.java | 6 +--
.../PostgreSQLResetVariableAdminExecutorTest.java | 4 +-
.../PostgreSQLSetVariableAdminExecutorTest.java | 4 +-
.../DatabaseOperateBackendHandlerFactoryTest.java | 8 ++--
.../hint/HintRALStatementExecutorFactoryTest.java | 22 +++++----
.../ExportDatabaseConfigurationHandlerTest.java | 4 +-
.../queryable/ShowVariableBackendHandlerTest.java | 2 +-
.../distsql/rdl/RDLBackendHandlerFactoryTest.java | 10 ++---
.../resource/AddResourceBackendHandlerTest.java | 2 +-
.../backend/session/ConnectionSessionTest.java | 8 ++--
.../netty/FrontendChannelInboundHandler.java | 11 +----
.../mysql/command/MySQLCommandPacketFactory.java | 5 +--
.../admin/MySQLComSetOptionExecutorTest.java | 3 +-
.../MySQLComStmtSendLongDataExecutorTest.java | 3 +-
.../prepare/MySQLComStmtPrepareExecutorTest.java | 15 +++----
.../execute/PostgreSQLComExecuteExecutorTest.java | 3 +-
.../command/ReactiveCommandExecuteTaskTest.java | 7 ++-
.../visitor/format/impl/MySQLFormatSQLVisitor.java | 52 +++++++---------------
.../pipeline/env/IntegrationTestEnvironment.java | 2 +-
.../segment/assignment/AssignmentAssert.java | 12 +++--
.../impl/DefaultParallelRunnerExecutor.java | 2 +-
59 files changed, 131 insertions(+), 226 deletions(-)
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
index 15ad324e55a..26ec86a2d66 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacketTest.java
@@ -37,7 +37,7 @@ import static org.junit.Assert.assertTrue;
public final class MySQLComStmtExecutePacketTest {
@Test
- public void assertNewWithoutParameter() throws SQLException {
+ public void assertNewWithoutParameter() {
byte[] data = {0x01, 0x00, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00, 0x00};
MySQLPacketPayload payload = new MySQLPacketPayload(Unpooled.wrappedBuffer(data), StandardCharsets.UTF_8);
MySQLComStmtExecutePacket actual = new MySQLComStmtExecutePacket(payload, 0);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/WhereClauseShardingConditionEngineTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/WhereClauseShardingConditionEngineTest.java
index e99b8bf2d1d..d62ab6bcf9e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/WhereClauseShardingConditionEngineTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/WhereClauseShardingConditionEngineTest.java
@@ -41,7 +41,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import java.sql.SQLException;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@@ -71,7 +70,7 @@ public final class WhereClauseShardingConditionEngineTest {
private TablesContext tablesContext;
@Before
- public void setUp() throws SQLException {
+ public void setUp() {
shardingConditionEngine = new WhereClauseShardingConditionEngine(shardingRule, ShardingSphereDatabase.create("test_db", DatabaseTypeEngine.getDatabaseType("MySQL")));
when(sqlStatementContext.getWhereSegments()).thenReturn(Collections.singleton(whereSegment));
when(sqlStatementContext.getTablesContext()).thenReturn(tablesContext);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/AddMigrationSourceResourceUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/AddMigrationSourceResourceUpdater.java
index b28c0369bd2..487686439b4 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/AddMigrationSourceResourceUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/AddMigrationSourceResourceUpdater.java
@@ -32,7 +32,6 @@ import org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.
import org.apache.shardingsphere.migration.distsql.statement.AddMigrationSourceResourceStatement;
import org.apache.shardingsphere.sharding.distsql.handler.converter.ResourceSegmentsConverter;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -45,7 +44,7 @@ public final class AddMigrationSourceResourceUpdater implements RALUpdater<AddMi
private static final MigrationJobPublicAPI JOB_API = PipelineJobPublicAPIFactory.getMigrationJobPublicAPI();
@Override
- public void executeUpdate(final String databaseName, final AddMigrationSourceResourceStatement sqlStatement) throws SQLException {
+ public void executeUpdate(final String databaseName, final AddMigrationSourceResourceStatement sqlStatement) {
List<DataSourceSegment> dataSources = new ArrayList<>(sqlStatement.getDataSources());
ShardingSpherePreconditions.checkState(dataSources.stream().noneMatch(each -> each instanceof HostnameAndPortBasedDataSourceSegment),
() -> new UnsupportedSQLOperationException("Not currently support add hostname and port, please use url"));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/converter/ShardingRuleStatementConverterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/converter/ShardingRuleStatementConverterTest.java
index 5243e94f5a3..f9e181010e6 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/converter/ShardingRuleStatementConverterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/converter/ShardingRuleStatementConverterTest.java
@@ -33,6 +33,7 @@ import org.junit.Test;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Properties;
@@ -80,13 +81,13 @@ public final class ShardingRuleStatementConverterTest {
AutoTableRuleSegment autoTableRuleSegment2 = new AutoTableRuleSegment("t_order_2", Arrays.asList("ds0", "ds1"), "order_id",
new AlgorithmSegment("MOD", newProperties("sharding_count", "2")),
new KeyGenerateStrategySegment("order_id", "snowflake_algorithm"),
- new AuditStrategySegment(Arrays.asList("sharding_key_required_auditor"), Arrays.asList(new ShardingAuditorSegment("sharding_key_required_auditor",
+ new AuditStrategySegment(Collections.singleton("sharding_key_required_auditor"), Collections.singleton(new ShardingAuditorSegment("sharding_key_required_auditor",
new AlgorithmSegment("DML_SHARDING_CONDITIONS", new Properties()))), true));
TableRuleSegment tableRuleSegment = new TableRuleSegment("t_order", Arrays.asList("ds0", "ds1"),
new ShardingStrategySegment("standard", "order_id", null, databaseAlgorithmSegment),
new ShardingStrategySegment("standard", "order_id", "order_id_algorithm", null),
new KeyGenerateStrategySegment("order_id", new AlgorithmSegment("snowflake", newProperties("", ""))),
- new AuditStrategySegment(Arrays.asList("sharding_key_required_auditor"), Arrays.asList(new ShardingAuditorSegment("sharding_key_required_auditor",
+ new AuditStrategySegment(Collections.singleton("sharding_key_required_auditor"), Collections.singleton(new ShardingAuditorSegment("sharding_key_required_auditor",
new AlgorithmSegment("DML_SHARDING_CONDITIONS", new Properties()))), true));
result.add(autoTableRuleSegment1);
result.add(autoTableRuleSegment2);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingTableRuleQueryResultSetTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingTableRuleQueryResultSetTest.java
index 9d36eb0763a..33545e8b18c 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingTableRuleQueryResultSetTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingTableRuleQueryResultSetTest.java
@@ -33,7 +33,7 @@ import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.junit.Test;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Properties;
@@ -95,7 +95,7 @@ public final class ShardingTableRuleQueryResultSetTest {
ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_order", "ds_${0..1}.t_order_${0..1}");
result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "t_order_inline"));
result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("order_id", "snowflake"));
- result.setAuditStrategy(new ShardingAuditStrategyConfiguration(Arrays.asList("sharding_key_required_auditor"), true));
+ result.setAuditStrategy(new ShardingAuditStrategyConfiguration(Collections.singleton("sharding_key_required_auditor"), true));
return result;
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/segment/AuditStrategySegment.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/segment/AuditStrategySegment.java
index 8de2ba73340..6f67057438b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/segment/AuditStrategySegment.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/segment/AuditStrategySegment.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.sharding.distsql.parser.segment;
import lombok.Getter;
+import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
import java.util.Collection;
@@ -26,25 +27,17 @@ import java.util.Collections;
/**
* Audit strategy segment.
*/
+@RequiredArgsConstructor
@Getter
public final class AuditStrategySegment implements ASTNode {
- private Collection<String> auditorNames;
+ private final Collection<String> auditorNames;
- private Collection<ShardingAuditorSegment> shardingAuditorSegments;
+ private final Collection<ShardingAuditorSegment> shardingAuditorSegments;
private final boolean allowHintDisable;
public AuditStrategySegment(final Collection<String> auditorNames, final boolean allowHintDisable) {
- this.auditorNames = auditorNames;
- this.shardingAuditorSegments = Collections.EMPTY_LIST;
- this.allowHintDisable = allowHintDisable;
- }
-
- public AuditStrategySegment(final Collection<String> auditorNames, final Collection<ShardingAuditorSegment> shardingAuditorSegments,
- final boolean allowHintDisable) {
- this.auditorNames = auditorNames;
- this.shardingAuditorSegments = shardingAuditorSegments;
- this.allowHintDisable = allowHintDisable;
+ this(auditorNames, Collections.emptyList(), allowHintDisable);
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/pagination/engine/TopPaginationContextEngine.java b/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/pagination/engine/TopPaginationContextEngine.java
index 1d55bc253b6..928b98a370d 100644
--- a/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/pagination/engine/TopPaginationContextEngine.java
+++ b/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/pagination/engine/TopPaginationContextEngine.java
@@ -71,7 +71,7 @@ public final class TopPaginationContextEngine {
private boolean isRowNumberColumn(final ExpressionSegment predicate, final String rowNumberAlias) {
if (predicate instanceof BinaryOperationExpression) {
ExpressionSegment left = ((BinaryOperationExpression) predicate).getLeft();
- return left instanceof ColumnSegment ? ((ColumnSegment) left).getIdentifier().getValue().equalsIgnoreCase(rowNumberAlias) : false;
+ return left instanceof ColumnSegment && ((ColumnSegment) left).getIdentifier().getValue().equalsIgnoreCase(rowNumberAlias);
}
return false;
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/state/DataSourceStateManager.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/state/DataSourceStateManager.java
index 8a2c7b12ea7..c59d8225676 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/state/DataSourceStateManager.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/state/DataSourceStateManager.java
@@ -66,9 +66,7 @@ public final class DataSourceStateManager {
*/
public void initStates(final String databaseName, final Map<String, DataSource> dataSources, final Map<String, DataSourceState> storageDataSourceStates, final boolean force) {
this.force = force;
- dataSources.forEach((key, value) -> {
- initState(databaseName, storageDataSourceStates, key, value);
- });
+ dataSources.forEach((key, value) -> initState(databaseName, storageDataSourceStates, key, value));
initialized = true;
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
index 525bef3e484..a80ae4b42ed 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
@@ -25,7 +25,6 @@ import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRule
import org.apache.shardingsphere.infra.rule.identifier.type.DynamicDataSourceContainedRule;
import org.apache.shardingsphere.infra.rule.identifier.type.ResourceHeldRule;
-import java.sql.SQLException;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -60,9 +59,8 @@ public final class ShardingSphereMetaData {
*
* @param databaseName database name
* @param protocolType protocol database type
- * @throws SQLException SQL exception
*/
- public void addDatabase(final String databaseName, final DatabaseType protocolType) throws SQLException {
+ public void addDatabase(final String databaseName, final DatabaseType protocolType) {
ShardingSphereDatabase database = ShardingSphereDatabase.create(databaseName, protocolType);
putDatabase(database);
globalRuleMetaData.findRules(ResourceHeldRule.class).forEach(each -> each.addResource(database));
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabasesFactory.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabasesFactory.java
index b58c27bf3cf..bd65792dff8 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabasesFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabasesFactory.java
@@ -84,7 +84,7 @@ public final class ShardingSphereDatabasesFactory {
return result;
}
- private static Map<String, ShardingSphereDatabase> createSystemDatabases(final Map<String, DatabaseConfiguration> databaseConfigMap, final DatabaseType protocolType) throws SQLException {
+ private static Map<String, ShardingSphereDatabase> createSystemDatabases(final Map<String, DatabaseConfiguration> databaseConfigMap, final DatabaseType protocolType) {
Map<String, ShardingSphereDatabase> result = new HashMap<>(protocolType.getSystemDatabaseSchemaMap().size(), 1);
for (String each : protocolType.getSystemDatabaseSchemaMap().keySet()) {
if (!databaseConfigMap.containsKey(each) || databaseConfigMap.get(each).getDataSources().isEmpty()) {
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/raw/callback/RawExecutorCallback.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/raw/callback/RawExecutorCallback.java
index 62a3831f0f2..7a14bd419bb 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/raw/callback/RawExecutorCallback.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/raw/callback/RawExecutorCallback.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.callback
import org.apache.shardingsphere.infra.util.spi.annotation.SingletonSPI;
-import java.sql.SQLException;
import java.util.Collection;
import java.util.Map;
@@ -39,7 +38,6 @@ public interface RawExecutorCallback<I, O> {
* @param isTrunkThread is execution in trunk thread
* @param dataMap data map
* @return execution results
- * @throws SQLException throw when execute failure
*/
- Collection<O> execute(Collection<I> inputs, boolean isTrunkThread, Map<String, Object> dataMap) throws SQLException;
+ Collection<O> execute(Collection<I> inputs, boolean isTrunkThread, Map<String, Object> dataMap);
}
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/vertx/VertxExecutorCallbackTest.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/vertx/VertxExecutorCallbackTest.java
index 1aa05f83827..6fd0c6d2d4e 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/vertx/VertxExecutorCallbackTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/vertx/VertxExecutorCallbackTest.java
@@ -33,7 +33,6 @@ import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
@@ -65,14 +64,14 @@ public final class VertxExecutorCallbackTest {
}
@Test
- public void assertExecuteQuery() throws SQLException {
+ public void assertExecuteQuery() {
Collection<Future<ExecuteResult>> actual = callback.execute(Collections.singletonList(vertxExecutionUnit), true, Collections.emptyMap());
assertThat(actual.size(), is(1));
assertThat(actual.iterator().next().result(), instanceOf(VertxQueryResult.class));
}
@Test
- public void assertExecuteUpdate() throws SQLException {
+ public void assertExecuteUpdate() {
when(rowSet.columnDescriptors()).thenReturn(null);
when(rowSet.rowCount()).thenReturn(10);
when(rowSet.property(MySQLClient.LAST_INSERTED_ID)).thenReturn(-1L);
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java
index bf62bff857e..8cba0f40744 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/datasource/ShardingSphereDataSource.java
@@ -82,7 +82,7 @@ public final class ShardingSphereDataSource extends AbstractDataSourceAdapter im
}
@Override
- public Connection getConnection(final String username, final String password) throws SQLException {
+ public Connection getConnection(final String username, final String password) {
return getConnection();
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
index f80be7eec93..fd8dc7e4e31 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
@@ -626,7 +626,7 @@ public final class ShardingSpherePreparedStatement extends AbstractPreparedState
}
@Override
- public void clearBatch() throws SQLException {
+ public void clearBatch() {
currentResultSet = null;
batchPreparedStatementExecutor.clear();
clearParameters();
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractShardingSphereDataSourceForEncryptTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractShardingSphereDataSourceForEncryptTest.java
index 81ccc18dadb..361483e54ba 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractShardingSphereDataSourceForEncryptTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/base/AbstractShardingSphereDataSourceForEncryptTest.java
@@ -78,11 +78,11 @@ public abstract class AbstractShardingSphereDataSourceForEncryptTest extends Abs
}
}
- protected final Connection getEncryptConnection() throws SQLException {
+ protected final Connection getEncryptConnection() {
return queryWithPlainDataSource.getConnection();
}
- protected final ShardingSphereConnection getEncryptConnectionWithProps() throws SQLException {
+ protected final ShardingSphereConnection getEncryptConnectionWithProps() {
return (ShardingSphereConnection) queryWithCipherDataSource.getConnection();
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/DriverDataSourceCacheTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/DriverDataSourceCacheTest.java
index b9773c47d7b..7c6cff09873 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/DriverDataSourceCacheTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/DriverDataSourceCacheTest.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.driver.jdbc.core.driver;
import org.junit.Test;
import javax.sql.DataSource;
-import java.sql.SQLException;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
@@ -29,7 +28,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
public class DriverDataSourceCacheTest {
@Test
- public void assertGetNewDataSource() throws SQLException {
+ public void assertGetNewDataSource() {
DriverDataSourceCache dataSourceCache = new DriverDataSourceCache();
DataSource fooDataSource = dataSourceCache.get("jdbc:shardingsphere:classpath:config/driver/foo-driver-fixture.yaml");
DataSource barDataSource = dataSourceCache.get("jdbc:shardingsphere:classpath:config/driver/bar-driver-fixture.yaml");
@@ -37,7 +36,7 @@ public class DriverDataSourceCacheTest {
}
@Test
- public void assertGetExistedDataSource() throws SQLException {
+ public void assertGetExistedDataSource() {
DriverDataSourceCache dataSourceCache = new DriverDataSourceCache();
DataSource dataSource1 = dataSourceCache.get("jdbc:shardingsphere:classpath:config/driver/foo-driver-fixture.yaml");
DataSource dataSource2 = dataSourceCache.get("jdbc:shardingsphere:classpath:config/driver/foo-driver-fixture.yaml");
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java
index fd0a8cbd42f..c9a6b48bd19 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java
@@ -496,7 +496,7 @@ public final class ShardingSphereResultSetTest {
@Test
public void assertGetObjectWithByte() throws SQLException {
- Byte result = new Byte((byte) 1);
+ Byte result = (byte) 1;
when(mergeResultSet.getValue(1, byte.class)).thenReturn(result);
assertThat(shardingSphereResultSet.getObject(1, byte.class), is(result));
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/InventoryIncrementalJobPublicAPI.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/InventoryIncrementalJobPublicAPI.java
index 5750e196aca..47b0051238c 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/InventoryIncrementalJobPublicAPI.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/InventoryIncrementalJobPublicAPI.java
@@ -75,9 +75,8 @@ public interface InventoryIncrementalJobPublicAPI extends PipelineJobPublicAPI,
* Commit pipeline job.
*
* @param jobId job id
- * @throws SQLException when commit underlying database data
*/
- void commit(String jobId) throws SQLException;
+ void commit(String jobId);
/**
* Get job progress.
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
index 034c7555060..24aac28d387 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
@@ -275,7 +275,7 @@ public final class MigrationJobAPIImpl extends AbstractInventoryIncrementalJobAP
}
@Override
- public void commit(final String jobId) throws SQLException {
+ public void commit(final String jobId) {
checkModeConfig();
log.info("Commit job {}", jobId);
stop(jobId);
diff --git a/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-distsql/shardingsphere-parser-distsql-handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/update/AlterSQLParserRuleStatementUpdaterTest.java b/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-distsql/shardingsphere-parser-distsql-handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/update/AlterSQLParserRuleStatementUpdaterTest.java
index 7df9b0cb2b0..00fc4563ab0 100644
--- a/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-distsql/shardingsphere-parser-distsql-handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/update/AlterSQLParserRuleStatementUpdaterTest.java
+++ b/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-distsql/shardingsphere-parser-distsql-handler/src/test/java/org/apache/shardingsphere/parser/distsql/handler/update/AlterSQLParserRuleStatementUpdaterTest.java
@@ -26,7 +26,6 @@ import org.apache.shardingsphere.parser.rule.SQLParserRule;
import org.apache.shardingsphere.parser.rule.builder.DefaultSQLParserRuleConfigurationBuilder;
import org.junit.Test;
-import java.sql.SQLException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Properties;
@@ -38,7 +37,7 @@ import static org.junit.Assert.assertTrue;
public final class AlterSQLParserRuleStatementUpdaterTest {
@Test
- public void assertExecute() throws SQLException {
+ public void assertExecute() {
AlterSQLParserRuleStatementUpdater updater = new AlterSQLParserRuleStatementUpdater();
AlterSQLParserRuleStatement sqlStatement = new AlterSQLParserRuleStatement(true, new CacheOptionSegment(64, 512L), new CacheOptionSegment(1000, 1000L));
ShardingSphereMetaData metaData = createMetaData();
diff --git a/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-executor/shardingsphere-sql-federation-executor-advanced/src/test/java/org/apache/shardingsphere/sqlfederation/advanced/AdvancedSQLFederationExecutorTest.java b/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-executor/shardingsphere-sql-federation-executor-advanced/src/test/java/org/apache/shardingsphere/sqlfederation/advanced/AdvancedSQLFederationExecutorTest.java
index 283252922fb..93226946609 100644
--- a/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-executor/shardingsphere-sql-federation-executor-advanced/src/test/java/org/apache/shardingsphere/sqlfederation/advanced/AdvancedSQLFederationExecutorTest.java
+++ b/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-executor/shardingsphere-sql-federation-executor-advanced/src/test/java/org/apache/shardingsphere/sqlfederation/advanced/AdvancedSQLFederationExecutorTest.java
@@ -43,7 +43,7 @@ import java.util.Map;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-public class AdvancedSQLFederationExecutorTest {
+public final class AdvancedSQLFederationExecutorTest {
private SQLFederationExecutor sqlFederationExecutor;
diff --git a/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-executor/shardingsphere-sql-federation-executor-core/src/main/java/org/apache/shardingsphere/sqlfederation/executor/TranslatableTableScanExecutor.java b/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-executor/shardingsphere-sql-federation-executor-core/src/main/java/org/apache/shardingsphere/sqlfederation/executor/TranslatableTableScanExecutor.java
index 67dd29c786d..00d9c1c577b 100644
--- a/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-executor/shardingsphere-sql-federation-executor-core/src/main/java/org/apache/shardingsphere/sqlfederation/executor/TranslatableTableScanExecutor.java
+++ b/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-executor/shardingsphere-sql-federation-executor-core/src/main/java/org/apache/shardingsphere/sqlfederation/executor/TranslatableTableScanExecutor.java
@@ -80,7 +80,6 @@ import org.apache.shardingsphere.sqlfederation.row.EmptyRowEnumerator;
import org.apache.shardingsphere.sqlfederation.row.SQLFederationRowEnumerator;
import org.apache.shardingsphere.sqlfederation.spi.SQLFederationExecutorContext;
-import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -219,16 +218,9 @@ public final class TranslatableTableScanExecutor implements TableScanExecutor {
JavaTypeFactory typeFactory = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
RexBuilder rexBuilder = new RexBuilder(typeFactory);
for (String each : filterValues) {
- if (Strings.isNullOrEmpty(each)) {
- continue;
+ if (!Strings.isNullOrEmpty(each)) {
+ result.add(StringToRexNodeUtil.buildRexNode(each, rexBuilder));
}
- RexNode filterCondition;
- try {
- filterCondition = StringToRexNodeUtil.buildRexNode(each, rexBuilder);
- } catch (IOException ignored) {
- continue;
- }
- result.add(filterCondition);
}
return result;
}
diff --git a/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/metadata/translatable/StringToRexNodeUtil.java b/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/metadata/translatable/StringToRexNodeUtil.java
index 001691efc72..b028f6ea187 100644
--- a/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/metadata/translatable/StringToRexNodeUtil.java
+++ b/shardingsphere-kernel/shardingsphere-sql-federation/shardingsphere-sql-federation-optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/metadata/translatable/StringToRexNodeUtil.java
@@ -28,8 +28,6 @@ import org.apache.calcite.rex.RexNode;
import org.apache.shardingsphere.sqlfederation.optimizer.parser.rexnode.ParseRexNodeLexer;
import org.apache.shardingsphere.sqlfederation.optimizer.parser.rexnode.ParseRexNodeParser;
-import java.io.IOException;
-
/**
* Utility for parsing string and generate rex node.
*/
@@ -40,9 +38,8 @@ public final class StringToRexNodeUtil {
* @param filterValue filter condition
* @param rexBuilder used to build rex node
* @return rex node
- * @throws IOException io exception
*/
- public static RexNode buildRexNode(final String filterValue, final RexBuilder rexBuilder) throws IOException {
+ public static RexNode buildRexNode(final String filterValue, final RexBuilder rexBuilder) {
CharStream input = CharStreams.fromString(filterValue);
ParseRexNodeLexer lexer = new ParseRexNodeLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
diff --git a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/AlterTrafficRuleStatementUpdaterTest.java b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/AlterTrafficRuleStatementUpdaterTest.java
index 1bcb18dac41..5b1e874d476 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/AlterTrafficRuleStatementUpdaterTest.java
+++ b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/AlterTrafficRuleStatementUpdaterTest.java
@@ -31,15 +31,14 @@ import org.apache.shardingsphere.traffic.rule.TrafficRule;
import org.apache.shardingsphere.traffic.rule.TrafficStrategyRule;
import org.junit.Test;
-import java.sql.SQLException;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -79,7 +78,7 @@ public final class AlterTrafficRuleStatementUpdaterTest {
}
@Test
- public void assertExecute() throws SQLException {
+ public void assertExecute() {
ShardingSphereMetaData metaData = createMetaData();
TrafficRuleSegment trafficRuleSegment1 = new TrafficRuleSegment(
"rule_name_1", Arrays.asList("olap", "order_by"), new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()), new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()));
diff --git a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/CreateTrafficRuleStatementUpdaterTest.java b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/CreateTrafficRuleStatementUpdaterTest.java
index 1653ae1195b..2ca88af7978 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/CreateTrafficRuleStatementUpdaterTest.java
+++ b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/CreateTrafficRuleStatementUpdaterTest.java
@@ -31,7 +31,6 @@ import org.apache.shardingsphere.traffic.rule.TrafficRule;
import org.apache.shardingsphere.traffic.rule.TrafficStrategyRule;
import org.junit.Test;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -39,15 +38,15 @@ import java.util.LinkedList;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public final class CreateTrafficRuleStatementUpdaterTest {
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithInUsedRuleName() throws SQLException {
+ public void assertExecuteWithInUsedRuleName() {
ShardingSphereMetaData metaData = createMetaData();
TrafficRuleSegment trafficRuleSegment = new TrafficRuleSegment(
"rule_name_1", Arrays.asList("olap", "order_by"), new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()), new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()));
@@ -56,7 +55,7 @@ public final class CreateTrafficRuleStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithmType() throws SQLException {
+ public void assertExecuteWithInvalidAlgorithmType() {
ShardingSphereMetaData metaData = createMetaData();
TrafficRuleSegment trafficRuleSegment = new TrafficRuleSegment("input_rule_name", Arrays.asList("olap", "order_by"),
new AlgorithmSegment("invalid", new Properties()), new AlgorithmSegment("invalid", new Properties()));
@@ -65,7 +64,7 @@ public final class CreateTrafficRuleStatementUpdaterTest {
}
@Test(expected = IllegalStateException.class)
- public void assertExecuteWithLoadBalancerCannotBeNull() throws SQLException {
+ public void assertExecuteWithLoadBalancerCannotBeNull() {
ShardingSphereMetaData metaData = createMetaData();
TrafficRuleSegment trafficRuleSegment = new TrafficRuleSegment("input_rule_name", Arrays.asList("olap", "order_by"),
new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()), null);
@@ -80,7 +79,7 @@ public final class CreateTrafficRuleStatementUpdaterTest {
}
@Test
- public void assertExecute() throws SQLException {
+ public void assertExecute() {
ShardingSphereMetaData metaData = createMetaData();
TrafficRuleSegment trafficRuleSegment1 = new TrafficRuleSegment(
"rule_name_3", Arrays.asList("olap", "order_by"), new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()), new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()));
diff --git a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/DropTrafficRuleStatementUpdaterTest.java b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/DropTrafficRuleStatementUpdaterTest.java
index bf0d056cae5..bb4b0b04354 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/DropTrafficRuleStatementUpdaterTest.java
+++ b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/update/DropTrafficRuleStatementUpdaterTest.java
@@ -27,7 +27,6 @@ import org.apache.shardingsphere.traffic.distsql.parser.statement.updatable.Drop
import org.apache.shardingsphere.traffic.rule.TrafficRule;
import org.junit.Test;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -35,8 +34,8 @@ import java.util.LinkedList;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -61,7 +60,7 @@ public final class DropTrafficRuleStatementUpdaterTest {
}
@Test
- public void assertExecute() throws SQLException {
+ public void assertExecute() {
ShardingSphereMetaData metaData = createMetaData();
DropTrafficRuleStatementUpdater updater = new DropTrafficRuleStatementUpdater();
updater.executeUpdate(metaData, new DropTrafficRuleStatement(false, Collections.singleton("rule_name_1")));
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
index 580221154a8..4f9a6b90913 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
@@ -74,9 +74,7 @@ public final class TransactionRule implements GlobalRule, ResourceHeldRule<Shard
Set<DatabaseType> databaseTypes = new HashSet<>();
for (Entry<String, ShardingSphereDatabase> entry : databases.entrySet()) {
ShardingSphereDatabase database = entry.getValue();
- database.getResource().getDataSources().forEach((key, value) -> {
- dataSourceMap.put(database.getName() + "." + key, value);
- });
+ database.getResource().getDataSources().forEach((key, value) -> dataSourceMap.put(database.getName() + "." + key, value));
if (null != entry.getValue().getResource().getDatabaseType()) {
databaseTypes.add(entry.getValue().getResource().getDatabaseType());
}
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
index 9230e395af2..b0724a11c1a 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
@@ -102,9 +102,8 @@ public final class ContextManager implements AutoCloseable {
* Add database.
*
* @param databaseName database name
- * @throws SQLException SQL exception
*/
- public synchronized void addDatabase(final String databaseName) throws SQLException {
+ public synchronized void addDatabase(final String databaseName) {
if (metaDataContexts.getMetaData().containsDatabase(databaseName)) {
return;
}
@@ -116,9 +115,8 @@ public final class ContextManager implements AutoCloseable {
* Add database and persist.
*
* @param databaseName database name
- * @throws SQLException SQL exception
*/
- public synchronized void addDatabaseAndPersist(final String databaseName) throws SQLException {
+ public synchronized void addDatabaseAndPersist(final String databaseName) {
if (metaDataContexts.getMetaData().containsDatabase(databaseName)) {
return;
}
@@ -578,7 +576,7 @@ public final class ContextManager implements AutoCloseable {
}
@Override
- public void close() throws Exception {
+ public void close() {
executorEngine.close();
metaDataContexts.close();
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatus [...]
index 17dec9bcc78..d88774d36ef 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java
@@ -73,7 +73,7 @@ public final class ComputeNodeStatusSubscriber {
@Subscribe
public void update(final LabelsChangedEvent event) {
if (event.getLabels().isEmpty()) {
- registryCenter.getComputeNodeStatusService().persistInstanceLabels(event.getInstanceId(), Collections.EMPTY_LIST);
+ registryCenter.getComputeNodeStatusService().persistInstanceLabels(event.getInstanceId(), Collections.emptyList());
} else {
registryCenter.getComputeNodeStatusService().persistInstanceLabels(event.getInstanceId(), event.getLabels());
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/BackendConnection.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/BackendConnection.java
index e420808bf11..c01afa6ad23 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/BackendConnection.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/BackendConnection.java
@@ -20,8 +20,6 @@ package org.apache.shardingsphere.proxy.backend.communication;
import org.apache.shardingsphere.proxy.backend.exception.BackendConnectionException;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import java.sql.SQLException;
-
/**
* Backend connection for Proxy.
*
@@ -40,17 +38,15 @@ public interface BackendConnection<T> {
* Prepare for task execution.
*
* @return can be Void or Future
- * @throws SQLException SQL exception
*/
- T prepareForTaskExecution() throws SQLException;
+ T prepareForTaskExecution();
/**
* Handle auto commit.
*
* @return can be Void or Future
- * @throws SQLException SQL exception
*/
- T handleAutoCommit() throws SQLException;
+ T handleAutoCommit();
/**
* Close resources used in execution.
@@ -64,7 +60,6 @@ public interface BackendConnection<T> {
* Close all resources.
*
* @return can be Void or Future
- * @throws BackendConnectionException backend connection exception
*/
- T closeAllResources() throws BackendConnectionException;
+ T closeAllResources();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/DatabaseRequiredBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/DatabaseRequiredBackendHandler.java
index def8cef05d2..fc894904bc8 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/DatabaseRequiredBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/DatabaseRequiredBackendHandler.java
@@ -52,7 +52,7 @@ public abstract class DatabaseRequiredBackendHandler<T extends SQLStatement> imp
return execute(databaseName, sqlStatement);
}
- protected abstract ResponseHeader execute(String databaseName, T sqlStatement) throws SQLException;
+ protected abstract ResponseHeader execute(String databaseName, T sqlStatement);
private String getDatabaseName(final ConnectionSession connectionSession, final T sqlStatement) {
Optional<DatabaseSegment> databaseSegment = sqlStatement instanceof FromDatabaseAvailable ? ((FromDatabaseAvailable) sqlStatement).getDatabase() : Optional.empty();
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactory.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactory.java
index edaf17d2bcc..8cc25470b2e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactory.java
@@ -174,7 +174,7 @@ public final class ProxyBackendHandlerFactory {
: ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabase(databaseName).getProtocolType();
}
- private static void handleAutoCommit(final SQLStatement sqlStatement, final ConnectionSession connectionSession) throws SQLException {
+ private static void handleAutoCommit(final SQLStatement sqlStatement, final ConnectionSession connectionSession) {
if (AutoCommitUtils.needOpenTransaction(sqlStatement)) {
connectionSession.getBackendConnection().handleAutoCommit();
}
@@ -189,7 +189,7 @@ public final class ProxyBackendHandlerFactory {
return Optional.empty();
}
- private static Optional<ProxyBackendHandler> findDatabaseOperateBackendHandler(final SQLStatement sqlStatement, final ConnectionSession connectionSession) throws SQLException {
+ private static Optional<ProxyBackendHandler> findDatabaseOperateBackendHandler(final SQLStatement sqlStatement, final ConnectionSession connectionSession) {
if (sqlStatement instanceof CreateDatabaseStatement || sqlStatement instanceof DropDatabaseStatement) {
return Optional.of(DatabaseOperateBackendHandlerFactory.newInstance(sqlStatement, connectionSession));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/DatabaseAdminQueryExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/DatabaseAdminQueryExecutor.java
index 99ce73b6218..0130dddca96 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/DatabaseAdminQueryExecutor.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/DatabaseAdminQueryExecutor.java
@@ -20,8 +20,6 @@ package org.apache.shardingsphere.proxy.backend.handler.admin.executor;
import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData;
import org.apache.shardingsphere.infra.merge.result.MergedResult;
-import java.sql.SQLException;
-
/**
* Database admin query executor.
*/
@@ -38,7 +36,6 @@ public interface DatabaseAdminQueryExecutor extends DatabaseAdminExecutor {
* Get merged result.
*
* @return merged result
- * @throws SQLException SQL exception
*/
- MergedResult getMergedResult() throws SQLException;
+ MergedResult getMergedResult();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactory.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactory.java
index 77b2fe11881..6012382cb10 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactory.java
@@ -32,8 +32,6 @@ import org.apache.shardingsphere.proxy.backend.handler.distsql.rql.RQLBackendHan
import org.apache.shardingsphere.proxy.backend.handler.distsql.rul.RULBackendHandlerFactory;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import java.sql.SQLException;
-
/**
* DistSQL backend handler factory.
*/
@@ -46,9 +44,8 @@ public final class DistSQLBackendHandlerFactory {
* @param sqlStatement dist SQL statement
* @param connectionSession connection session
* @return proxy backend handler
- * @throws SQLException SQL exception
*/
- public static ProxyBackendHandler newInstance(final DistSQLStatement sqlStatement, final ConnectionSession connectionSession) throws SQLException {
+ public static ProxyBackendHandler newInstance(final DistSQLStatement sqlStatement, final ConnectionSession connectionSession) {
if (sqlStatement instanceof RQLStatement) {
return RQLBackendHandlerFactory.newInstance((RQLStatement) sqlStatement, connectionSession);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/UpdatableGlobalRuleRALBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/UpdatableGlobalRuleRALBackendHandler.java
index 7fe74019a07..70c90ea59cc 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/UpdatableGlobalRuleRALBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/UpdatableGlobalRuleRALBackendHandler.java
@@ -25,8 +25,6 @@ import org.apache.shardingsphere.proxy.backend.handler.ProxyBackendHandler;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
-import java.sql.SQLException;
-
/**
* Updatable RAL backend handler for global rule.
*/
@@ -42,7 +40,7 @@ public final class UpdatableGlobalRuleRALBackendHandler implements ProxyBackendH
}
@Override
- public ResponseHeader execute() throws SQLException {
+ public ResponseHeader execute() {
updater.executeUpdate(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData(), sqlStatement);
persistNewRuleConfigurations();
return new UpdateResponseHeader(sqlStatement);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/HintRALBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/HintRALBackendHandler.java
index a2a0978e749..dced2911706 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/HintRALBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/HintRALBackendHandler.java
@@ -45,7 +45,7 @@ public final class HintRALBackendHandler extends RALBackendHandler {
private HintRALStatementExecutor<? extends HintRALStatement> hintRALStatementExecutor;
@Override
- public ResponseHeader execute() throws SQLException {
+ public ResponseHeader execute() {
ShardingSpherePreconditions.checkState(
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.PROXY_HINT_ENABLED),
() -> new UnsupportedSQLOperationException(String.format("%s should be true, please check your config", ConfigurationPropertyKey.PROXY_HINT_ENABLED.getKey())));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/migration/query/QueryableScalingRALBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/migration/query/QueryableScalingRALBackendHandler.java
index 62097db9886..e56753b2364 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/migration/query/QueryableScalingRALBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/migration/query/QueryableScalingRALBackendHandler.java
@@ -27,7 +27,6 @@ import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import org.apache.shardingsphere.proxy.backend.response.header.query.QueryHeader;
import org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
-import java.sql.SQLException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Collection;
@@ -44,7 +43,7 @@ public final class QueryableScalingRALBackendHandler implements ProxyBackendHand
private final DatabaseDistSQLResultSet resultSet;
@Override
- public ResponseHeader execute() throws SQLException {
+ public ResponseHeader execute() {
resultSet.init(null, sqlStatement);
List<QueryHeader> queryHeaders = new ArrayList<>();
for (String each : resultSet.getColumnNames()) {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/transaction/JDBCBackendTransactionManagerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/transaction/JDBCBackendTransactionManagerTest.java
index f97a8634ef2..bd7e0060439 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/transaction/JDBCBackendTransactionManagerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/transaction/JDBCBackendTransactionManagerTest.java
@@ -95,7 +95,7 @@ public final class JDBCBackendTransactionManagerTest extends ProxyContextRestore
}
@Test
- public void assertBeginForLocalTransaction() throws SQLException {
+ public void assertBeginForLocalTransaction() {
newBackendTransactionManager(TransactionType.LOCAL, false);
backendTransactionManager.begin();
verify(transactionStatus).setInTransaction(true);
@@ -105,7 +105,7 @@ public final class JDBCBackendTransactionManagerTest extends ProxyContextRestore
}
@Test
- public void assertBeginForDistributedTransaction() throws SQLException {
+ public void assertBeginForDistributedTransaction() {
newBackendTransactionManager(TransactionType.XA, true);
backendTransactionManager.begin();
verify(transactionStatus, times(0)).setInTransaction(true);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseOperateBackendHandlerFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseOperateBackendHandlerFactoryTest.java
index 332da18cf01..b2991fb5ecc 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseOperateBackendHandlerFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseOperateBackendHandlerFactoryTest.java
@@ -114,16 +114,16 @@ public final class DatabaseOperateBackendHandlerFactoryTest extends ProxyContext
}
@Test
- public void assertExecuteMySQLCreateDatabaseContextWithException() throws SQLException {
+ public void assertExecuteMySQLCreateDatabaseContextWithException() {
assertExecuteCreateDatabaseContextWithException(new MySQLCreateDatabaseStatement());
}
@Test
- public void assertExecutePostgreSQLCreateDatabaseContextWithException() throws SQLException {
+ public void assertExecutePostgreSQLCreateDatabaseContextWithException() {
assertExecuteCreateDatabaseContextWithException(new PostgreSQLCreateDatabaseStatement());
}
- public void assertExecuteCreateDatabaseContextWithException(final CreateDatabaseStatement sqlStatement) throws SQLException {
+ public void assertExecuteCreateDatabaseContextWithException(final CreateDatabaseStatement sqlStatement) {
sqlStatement.setDatabaseName("db");
setGovernanceMetaDataContexts(true);
try {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/PostgreSQLResetVariableAdminExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/PostgreSQLResetVariableAdminExecutorTest.java
index f80afddab13..ccd0d526aef 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/PostgreSQLResetVariableAdminExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/PostgreSQLResetVariableAdminExecutorTest.java
@@ -21,8 +21,6 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.dal
import org.junit.Test;
import org.mockito.MockedStatic;
-import java.sql.SQLException;
-
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.verify;
@@ -30,7 +28,7 @@ import static org.mockito.Mockito.verify;
public final class PostgreSQLResetVariableAdminExecutorTest {
@Test
- public void assertExecute() throws SQLException {
+ public void assertExecute() {
PostgreSQLResetVariableAdminExecutor executor = new PostgreSQLResetVariableAdminExecutor(new PostgreSQLResetParameterStatement("key"));
try (MockedStatic<PostgreSQLSessionVariableHandlerFactory> mockStatic = mockStatic(PostgreSQLSessionVariableHandlerFactory.class)) {
PostgreSQLSessionVariableHandler mockHandler = mock(PostgreSQLSessionVariableHandler.class);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/PostgreSQLSetVariableAdminExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/PostgreSQLSetVariableAdminExecutorTest.java
index 45045943b03..9d4445e46bb 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/PostgreSQLSetVariableAdminExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/PostgreSQLSetVariableAdminExecutorTest.java
@@ -23,8 +23,6 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.dal
import org.junit.Test;
import org.mockito.MockedStatic;
-import java.sql.SQLException;
-
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.verify;
@@ -32,7 +30,7 @@ import static org.mockito.Mockito.verify;
public final class PostgreSQLSetVariableAdminExecutorTest {
@Test
- public void assertExecute() throws SQLException {
+ public void assertExecute() {
VariableAssignSegment variableAssignSegment = new VariableAssignSegment();
VariableSegment variable = new VariableSegment();
variable.setVariable("key");
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DatabaseOperateBackendHandlerFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DatabaseOperateBackendHandlerFactoryTest.java
index be5171fa1d2..7ccdd76d791 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DatabaseOperateBackendHandlerFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DatabaseOperateBackendHandlerFactoryTest.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.AlterDataba
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateDatabaseStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropDatabaseStatement;
import org.junit.Test;
-import java.sql.SQLException;
+
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
@@ -31,17 +31,17 @@ import static org.mockito.Mockito.mock;
public final class DatabaseOperateBackendHandlerFactoryTest {
@Test
- public void assertDatabaseOperateBackendHandlerFactoryReturnCreateDatabaseBackendHandler() throws SQLException {
+ public void assertDatabaseOperateBackendHandlerFactoryReturnCreateDatabaseBackendHandler() {
assertThat(DatabaseOperateBackendHandlerFactory.newInstance(mock(CreateDatabaseStatement.class), mock(ConnectionSession.class)), instanceOf(CreateDatabaseBackendHandler.class));
}
@Test
- public void assertDatabaseOperateBackendHandlerFactoryReturnDropDatabaseBackendHandler() throws SQLException {
+ public void assertDatabaseOperateBackendHandlerFactoryReturnDropDatabaseBackendHandler() {
assertThat(DatabaseOperateBackendHandlerFactory.newInstance(mock(DropDatabaseStatement.class), mock(ConnectionSession.class)), instanceOf(DropDatabaseBackendHandler.class));
}
@Test(expected = UnsupportedSQLOperationException.class)
- public void assertDatabaseOperateBackendHandlerFactoryThrowUnsupportedOperationException() throws SQLException {
+ public void assertDatabaseOperateBackendHandlerFactoryThrowUnsupportedOperationException() {
DatabaseOperateBackendHandlerFactory.newInstance(mock(AlterDatabaseStatement.class), mock(ConnectionSession.class));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/HintRALStatementExecutorFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/HintRALStatementExecutorFactoryTest.java
index 1f6d7bd5c19..3ea9fa49f5f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/HintRALStatementExecutorFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/HintRALStatementExecutorFactoryTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.hint;
import org.apache.shardingsphere.distsql.parser.statement.ral.HintRALStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.hint.ClearHintStatement;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.hint.executor.AddShardingHintDatabaseValueExecutor;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.hint.executor.AddShardingHintTableValueExecutor;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.hint.executor.ClearHintExecutor;
@@ -29,6 +28,7 @@ import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.hint.executor
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.hint.executor.SetShardingHintDatabaseValueExecutor;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.hint.executor.ShowReadwriteSplittingHintStatusExecutor;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.hint.executor.ShowShardingHintStatusExecutor;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.hint.ClearReadwriteSplittingHintStatement;
import org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.hint.SetReadwriteSplittingHintStatement;
import org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.hint.ShowReadwriteSplittingHintStatusStatement;
@@ -42,8 +42,6 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import java.sql.SQLException;
-
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
@@ -55,55 +53,55 @@ public final class HintRALStatementExecutorFactoryTest {
private ConnectionSession connectionSession;
@Test
- public void assertSetReadwriteSplittingHintSourceExecutor() throws SQLException {
+ public void assertSetReadwriteSplittingHintSourceExecutor() {
HintRALStatement sqlStatement = mock(SetReadwriteSplittingHintStatement.class);
assertThat(HintRALStatementExecutorFactory.newInstance(sqlStatement, connectionSession), instanceOf(SetReadwriteSplittingHintExecutor.class));
}
@Test
- public void assertShowReadwriteSplittingHintSourceExecutor() throws SQLException {
+ public void assertShowReadwriteSplittingHintSourceExecutor() {
HintRALStatement sqlStatement = mock(ShowReadwriteSplittingHintStatusStatement.class);
assertThat(HintRALStatementExecutorFactory.newInstance(sqlStatement, connectionSession), instanceOf(ShowReadwriteSplittingHintStatusExecutor.class));
}
@Test
- public void assertClearReadwriteSplittingHintSourceExecutor() throws SQLException {
+ public void assertClearReadwriteSplittingHintSourceExecutor() {
HintRALStatement sqlStatement = mock(ClearReadwriteSplittingHintStatement.class);
assertThat(HintRALStatementExecutorFactory.newInstance(sqlStatement, connectionSession), instanceOf(ClearReadwriteSplittingHintExecutor.class));
}
@Test
- public void assertClearHintExecutor() throws SQLException {
+ public void assertClearHintExecutor() {
HintRALStatement sqlStatement = mock(ClearHintStatement.class);
assertThat(HintRALStatementExecutorFactory.newInstance(sqlStatement, connectionSession), instanceOf(ClearHintExecutor.class));
}
@Test
- public void assertSetShardingHintDatabaseValueExecutor() throws SQLException {
+ public void assertSetShardingHintDatabaseValueExecutor() {
HintRALStatement sqlStatement = mock(SetShardingHintDatabaseValueStatement.class);
assertThat(HintRALStatementExecutorFactory.newInstance(sqlStatement, connectionSession), instanceOf(SetShardingHintDatabaseValueExecutor.class));
}
@Test
- public void assertAddShardingHintDatabaseValueExecutor() throws SQLException {
+ public void assertAddShardingHintDatabaseValueExecutor() {
HintRALStatement sqlStatement = mock(AddShardingHintDatabaseValueStatement.class);
assertThat(HintRALStatementExecutorFactory.newInstance(sqlStatement, connectionSession), instanceOf(AddShardingHintDatabaseValueExecutor.class));
}
@Test
- public void assertAddShardingHintTableValueExecutor() throws SQLException {
+ public void assertAddShardingHintTableValueExecutor() {
HintRALStatement sqlStatement = mock(AddShardingHintTableValueStatement.class);
assertThat(HintRALStatementExecutorFactory.newInstance(sqlStatement, connectionSession), instanceOf(AddShardingHintTableValueExecutor.class));
}
@Test
- public void assertShowShardingHintStatusExecutor() throws SQLException {
+ public void assertShowShardingHintStatusExecutor() {
HintRALStatement sqlStatement = mock(ShowShardingHintStatusStatement.class);
assertThat(HintRALStatementExecutorFactory.newInstance(sqlStatement, connectionSession), instanceOf(ShowShardingHintStatusExecutor.class));
}
@Test
- public void assertClearShardingValueHintExecutor() throws SQLException {
+ public void assertClearShardingValueHintExecutor() {
HintRALStatement sqlStatement = mock(ClearShardingHintStatement.class);
assertThat(HintRALStatementExecutorFactory.newInstance(sqlStatement, connectionSession), instanceOf(ClearShardingHintExecutor.class));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationHandlerTest.java
index ed06d2ea3b0..ce1779c1446 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportDatabaseConfigurationHandlerTest.java
@@ -211,14 +211,14 @@ public final class ExportDatabaseConfigurationHandlerTest extends ProxyContextRe
}
@Test(expected = UnknownDatabaseException.class)
- public void assertExecuteWithNotExistedDatabase() throws SQLException {
+ public void assertExecuteWithNotExistedDatabase() {
ExportDatabaseConfigurationHandler handler = new ExportDatabaseConfigurationHandler();
handler.init(new ExportDatabaseConfigurationStatement(new DatabaseSegment(0, 0, new IdentifierValue("not_exist_db")), null), mock(ConnectionSession.class));
handler.execute();
}
@Test(expected = NoDatabaseSelectedException.class)
- public void assertExecuteWithNoDatabaseSelected() throws SQLException {
+ public void assertExecuteWithNoDatabaseSelected() {
ExportDatabaseConfigurationHandler handler = new ExportDatabaseConfigurationHandler();
handler.init(new ExportDatabaseConfigurationStatement(null, null), mock(ConnectionSession.class));
handler.execute();
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowVariableBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowVariableBackendHandlerTest.java
index 4aef441a8d0..bc3a534aae2 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowVariableBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowVariableBackendHandlerTest.java
@@ -87,7 +87,7 @@ public final class ShowVariableBackendHandlerTest extends ProxyContextRestorer {
}
@Test(expected = UnsupportedVariableException.class)
- public void assertShowCachedConnectionFailed() throws SQLException {
+ public void assertShowCachedConnectionFailed() {
connectionSession.setCurrentDatabase("db");
ShowVariableHandler backendHandler = new ShowVariableHandler();
backendHandler.init(new ShowVariableStatement("cached_connectionss"), connectionSession);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/RDLBackendHandlerFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/RDLBackendHandlerFactoryTest.java
index 8a9eb44b9ff..2786c22aeb5 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/RDLBackendHandlerFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/RDLBackendHandlerFactoryTest.java
@@ -28,8 +28,6 @@ import org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.rule.RuleDefi
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.junit.Test;
-import java.sql.SQLException;
-
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
@@ -37,22 +35,22 @@ import static org.mockito.Mockito.mock;
public final class RDLBackendHandlerFactoryTest {
@Test
- public void assertNewInstanceWithAddResourceStatement() throws SQLException {
+ public void assertNewInstanceWithAddResourceStatement() {
assertThat(RDLBackendHandlerFactory.newInstance(mock(AddResourceStatement.class), mock(ConnectionSession.class)), instanceOf(AddResourceBackendHandler.class));
}
@Test
- public void assertNewInstanceWithAlterResourceStatement() throws SQLException {
+ public void assertNewInstanceWithAlterResourceStatement() {
assertThat(RDLBackendHandlerFactory.newInstance(mock(AlterResourceStatement.class), mock(ConnectionSession.class)), instanceOf(AlterResourceBackendHandler.class));
}
@Test
- public void assertNewInstanceWithDropResourceStatement() throws SQLException {
+ public void assertNewInstanceWithDropResourceStatement() {
assertThat(RDLBackendHandlerFactory.newInstance(mock(DropResourceStatement.class), mock(ConnectionSession.class)), instanceOf(DropResourceBackendHandler.class));
}
@Test
- public void assertNewInstanceWithRuleDefinitionStatement() throws SQLException {
+ public void assertNewInstanceWithRuleDefinitionStatement() {
assertThat(RDLBackendHandlerFactory.newInstance(mock(RuleDefinitionStatement.class), mock(ConnectionSession.class)), instanceOf(RuleDefinitionBackendHandler.class));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AddResourceBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AddResourceBackendHandlerTest.java
index f23ed65a64c..ba722fbd534 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AddResourceBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AddResourceBackendHandlerTest.java
@@ -87,7 +87,7 @@ public final class AddResourceBackendHandlerTest extends ProxyContextRestorer {
}
@Test
- public void assertExecute() throws Exception {
+ public void assertExecute() {
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
ProxyContext.init(contextManager);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSessionTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSessionTest.java
index a8986bccc93..bdf1594cfe2 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSessionTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSessionTest.java
@@ -35,13 +35,11 @@ import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import java.sql.SQLException;
-
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -74,7 +72,7 @@ public final class ConnectionSessionTest extends ProxyContextRestorer {
}
@Test(expected = SwitchTypeInTransactionException.class)
- public void assertFailedSwitchTransactionTypeWhileBegin() throws SQLException {
+ public void assertFailedSwitchTransactionTypeWhileBegin() {
connectionSession.setCurrentDatabase("db");
JDBCBackendTransactionManager transactionManager = new JDBCBackendTransactionManager(backendConnection);
transactionManager.begin();
@@ -82,7 +80,7 @@ public final class ConnectionSessionTest extends ProxyContextRestorer {
}
@Test
- public void assertSwitchSchemaWhileBegin() throws SQLException {
+ public void assertSwitchSchemaWhileBegin() {
connectionSession.setCurrentDatabase("db");
JDBCBackendTransactionManager transactionManager = new JDBCBackendTransactionManager(backendConnection);
transactionManager.begin();
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 95319adbbbe..7b4fba13dd4 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
@@ -29,7 +29,6 @@ import org.apache.shardingsphere.infra.executor.sql.process.ExecuteProcessEngine
import org.apache.shardingsphere.infra.metadata.user.Grantee;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.JDBCBackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.exception.BackendConnectionException;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
import org.apache.shardingsphere.proxy.frontend.executor.ConnectionThreadExecutorGroup;
@@ -38,8 +37,6 @@ import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngi
import org.apache.shardingsphere.proxy.frontend.state.ProxyStateContext;
import org.apache.shardingsphere.transaction.rule.TransactionRule;
-import java.util.Optional;
-
/**
* Frontend channel inbound handler.
*/
@@ -102,12 +99,8 @@ public final class FrontendChannelInboundHandler extends ChannelInboundHandlerAd
private void closeAllResources() {
ConnectionThreadExecutorGroup.getInstance().unregisterAndAwaitTermination(connectionSession.getConnectionId());
- try {
- connectionSession.getBackendConnection().closeAllResources();
- } catch (final BackendConnectionException ex) {
- log.error("Exception occurred when frontend connection [{}] disconnected", connectionSession.getConnectionId(), ex);
- }
- Optional.ofNullable(connectionSession.getExecutionId()).ifPresent(ExecuteProcessEngine::finishConnection);
+ connectionSession.getBackendConnection().closeAllResources();
+ ExecuteProcessEngine.finishConnection(connectionSession.getExecutionId());
databaseProtocolFrontendEngine.release(connectionSession);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandPacketFactory.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandPacketFactory.java
index 27c73731912..e2b3bfafef7 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandPacketFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandPacketFactory.java
@@ -37,8 +37,6 @@ import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.MySQLPreparedStatement;
-import java.sql.SQLException;
-
/**
* Command packet factory for MySQL.
*/
@@ -52,9 +50,8 @@ public final class MySQLCommandPacketFactory {
* @param payload packet payload for MySQL
* @param connectionSession connection session
* @return created instance
- * @throws SQLException SQL exception
*/
- public static MySQLCommandPacket newInstance(final MySQLCommandPacketType commandPacketType, final MySQLPacketPayload payload, final ConnectionSession connectionSession) throws SQLException {
+ public static MySQLCommandPacket newInstance(final MySQLCommandPacketType commandPacketType, final MySQLPacketPayload payload, final ConnectionSession connectionSession) {
switch (commandPacketType) {
case COM_QUIT:
return new MySQLComQuitPacket();
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/admin/MySQLComSetOptionExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/admin/MySQLComSetOptionExecutorTest.java
index 54b103fe23d..391b0c1513f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/admin/MySQLComSetOptionExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/admin/MySQLComSetOptionExecutorTest.java
@@ -30,7 +30,6 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import java.sql.SQLException;
import java.util.Collection;
import static org.hamcrest.CoreMatchers.instanceOf;
@@ -55,7 +54,7 @@ public final class MySQLComSetOptionExecutorTest {
private MySQLComSetOptionExecutor executor;
@Test
- public void assertExecute() throws SQLException {
+ public void assertExecute() {
when(packet.getValue()).thenReturn(MySQLComSetOptionPacket.MYSQL_OPTION_MULTI_STATEMENTS_ON);
when(connectionSession.getAttributeMap().attr(MySQLConstants.MYSQL_OPTION_MULTI_STATEMENTS)).thenReturn(attribute);
Collection<DatabasePacket<?>> actual = executor.execute();
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/MySQLComStmtSendLongDataExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/MySQLComStmtSendLongDataExecutorTest.java
index 9d7d2903524..65d10d98ead 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/MySQLComStmtSendLongDataExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/MySQLComStmtSendLongDataExecutorTest.java
@@ -25,7 +25,6 @@ import org.apache.shardingsphere.proxy.backend.session.PreparedStatementRegistry
import org.junit.Test;
import java.nio.charset.StandardCharsets;
-import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
@@ -37,7 +36,7 @@ import static org.mockito.Mockito.when;
public final class MySQLComStmtSendLongDataExecutorTest {
@Test
- public void assertExecute() throws SQLException {
+ public void assertExecute() {
MySQLComStmtSendLongDataPacket packet = mock(MySQLComStmtSendLongDataPacket.class);
when(packet.getStatementId()).thenReturn(1);
when(packet.getParamId()).thenReturn(0);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java
index 133414b950f..a6b588ad902 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java
@@ -20,11 +20,11 @@ package org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.prep
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLCharacterSet;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLConstants;
import org.apache.shardingsphere.db.protocol.mysql.packet.command.query.MySQLColumnDefinition41Packet;
-import org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.MySQLStatementIDGenerator;
import org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.prepare.MySQLComStmtPrepareOKPacket;
import org.apache.shardingsphere.db.protocol.mysql.packet.command.query.binary.prepare.MySQLComStmtPreparePacket;
import org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLEofPacket;
import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
+import org.apache.shardingsphere.dialect.mysql.exception.UnsupportedPreparedStatementException;
import org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
import org.apache.shardingsphere.infra.binder.statement.dml.UpdateStatementContext;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
@@ -36,9 +36,9 @@ import org.apache.shardingsphere.parser.rule.SQLParserRule;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.session.PreparedStatementRegistry;
-import org.apache.shardingsphere.dialect.mysql.exception.UnsupportedPreparedStatementException;
import org.apache.shardingsphere.proxy.frontend.mysql.ProxyContextRestorer;
import org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.MySQLPreparedStatement;
+import org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.MySQLStatementIDGenerator;
import org.apache.shardingsphere.sql.parser.api.CacheOption;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLUpdateStatement;
@@ -49,13 +49,12 @@ import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import java.sql.SQLException;
import java.util.Iterator;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
@@ -89,7 +88,7 @@ public final class MySQLComStmtPrepareExecutorTest extends ProxyContextRestorer
}
@Test(expected = UnsupportedPreparedStatementException.class)
- public void assertPrepareMultiStatements() throws SQLException {
+ public void assertPrepareMultiStatements() {
when(packet.getSql()).thenReturn("update t set v=v+1 where id=1;update t set v=v+1 where id=2;update t set v=v+1 where id=3");
when(connectionSession.getAttributeMap().hasAttr(MySQLConstants.MYSQL_OPTION_MULTI_STATEMENTS)).thenReturn(true);
when(connectionSession.getAttributeMap().attr(MySQLConstants.MYSQL_OPTION_MULTI_STATEMENTS).get()).thenReturn(0);
@@ -97,7 +96,7 @@ public final class MySQLComStmtPrepareExecutorTest extends ProxyContextRestorer
}
@Test
- public void assertPrepareSelectStatement() throws SQLException {
+ public void assertPrepareSelectStatement() {
String sql = "select name from db.user where id = ?";
when(packet.getSql()).thenReturn(sql);
when(connectionSession.getConnectionId()).thenReturn(1);
@@ -118,7 +117,7 @@ public final class MySQLComStmtPrepareExecutorTest extends ProxyContextRestorer
}
@Test
- public void assertPrepareUpdateStatement() throws SQLException {
+ public void assertPrepareUpdateStatement() {
String sql = "update t set v = ?";
when(packet.getSql()).thenReturn(sql);
when(connectionSession.getConnectionId()).thenReturn(1);
@@ -137,7 +136,7 @@ public final class MySQLComStmtPrepareExecutorTest extends ProxyContextRestorer
}
@Test(expected = UnsupportedPreparedStatementException.class)
- public void assertPrepareNotAllowedStatement() throws SQLException {
+ public void assertPrepareNotAllowedStatement() {
when(packet.getSql()).thenReturn("begin");
new MySQLComStmtPrepareExecutor(packet, connectionSession).execute();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/execute/PostgreSQLComExecuteExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/execute/PostgreSQLComExecuteExecutorTest.java
index 5f88b2662e1..852b817a58d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/execute/PostgreSQLComExecuteExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/execute/PostgreSQLComExecuteExecutorTest.java
@@ -32,7 +32,6 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import java.sql.SQLException;
import java.util.Collections;
import java.util.List;
@@ -67,7 +66,7 @@ public final class PostgreSQLComExecuteExecutorTest {
}
@Test
- public void assertExecute() throws SQLException {
+ public void assertExecute() {
PostgreSQLPacket expectedPacket = mock(PostgreSQLPacket.class);
when(portal.execute(anyInt())).thenReturn(Collections.singletonList(expectedPacket));
List<DatabasePacket<?>> actualPackets = executor.execute();
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/command/ReactiveCommandExecuteTaskTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/command/ReactiveCommandExecuteTaskTest.java
index 01901789c20..6a84bd4be22 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/command/ReactiveCommandExecuteTaskTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/command/ReactiveCommandExecuteTaskTest.java
@@ -34,7 +34,6 @@ import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import java.sql.SQLException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Optional;
@@ -68,7 +67,7 @@ public final class ReactiveCommandExecuteTaskTest {
private ReactiveCommandExecutor reactiveCommandExecutor;
@Before
- public void setup() throws BackendConnectionException, SQLException {
+ public void setup() throws BackendConnectionException {
reactiveCommandExecuteTask = new ReactiveCommandExecuteTask(frontendEngine, connectionSession, channelHandlerContext, message);
when(connectionSession.getBackendConnection().prepareForTaskExecution()).thenReturn(Future.succeededFuture());
when(connectionSession.getBackendConnection().closeExecutionResources()).thenReturn(Future.succeededFuture());
@@ -111,8 +110,8 @@ public final class ReactiveCommandExecuteTaskTest {
}
@Test
- public void assertExecuteAndExceptionOccur() throws SQLException {
- SQLException ex = new SQLException("");
+ public void assertExecuteAndExceptionOccur() {
+ RuntimeException ex = new RuntimeException("");
when(connectionSession.getBackendConnection().prepareForTaskExecution()).thenThrow(ex);
DatabasePacket errorPacket = mock(DatabasePacket.class);
when(frontendEngine.getCommandExecuteEngine().getErrorPacket(ex)).thenReturn(errorPacket);
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/impl/MySQLFormatSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/impl/MySQLFormatSQLVisitor.java
index 4ca7b526cbd..87057e05dde 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/impl/MySQLFormatSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/impl/MySQLFormatSQLVisitor.java
@@ -272,12 +272,10 @@ public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<St
formatPrintln(" (");
int identifierCount = ctx.identifier().size();
for (int i = 0; i < identifierCount; i++) {
- if (0 == i) {
- visit(ctx.identifier(i));
- } else {
+ if (0 != i) {
formatPrint(" ,");
- visit(ctx.identifier(i));
}
+ visit(ctx.identifier(i));
}
formatPrint(")");
return result.toString();
@@ -303,13 +301,11 @@ public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<St
if (!ctx.assignmentValues().isEmpty()) {
int valueCount = ctx.assignmentValues().size();
for (int i = 0; i < valueCount; i++) {
- if (0 == i) {
- visit(ctx.assignmentValues(i));
- } else {
+ if (0 != i) {
formatPrint(",");
formatPrintln();
- visit(ctx.assignmentValues(i));
}
+ visit(ctx.assignmentValues(i));
}
}
if (null != ctx.rowConstructorList()) {
@@ -354,12 +350,10 @@ public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<St
formatPrint(" ");
int assignmentCount = ctx.assignment().size();
for (int i = 0; i < assignmentCount; i++) {
- if (0 == i) {
- visit(ctx.assignment(i));
- } else {
+ if (0 != i) {
formatPrintln(",");
- visit(ctx.assignment(i));
}
+ visit(ctx.assignment(i));
}
indentCount--;
return result.toString();
@@ -370,12 +364,10 @@ public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<St
formatPrint("(");
int aliasCount = ctx.alias().size();
for (int i = 0; i < aliasCount; i++) {
- if (0 == i) {
- visit(ctx.alias(i));
- } else {
+ if (0 != i) {
formatPrint(", ");
- visit(ctx.alias(i));
}
+ visit(ctx.alias(i));
}
formatPrint(")");
return result.toString();
@@ -394,12 +386,10 @@ public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<St
indentCount++;
int assignmentCount = ctx.assignment().size();
for (int i = 0; i < assignmentCount; i++) {
- if (0 == i) {
- visit(ctx.assignment(i));
- } else {
+ if (0 != i) {
formatPrintln();
- visit(ctx.assignment(i));
}
+ visit(ctx.assignment(i));
}
indentCount--;
return result.toString();
@@ -515,16 +505,12 @@ public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<St
public String visitRowConstructorList(final RowConstructorListContext ctx) {
int rowCount = ctx.assignmentValues().size();
for (int i = 0; i < rowCount; i++) {
- if (0 == i) {
- visit(ctx.ROW(i));
- formatPrint(" ");
- visit(ctx.assignmentValues(i));
- } else {
+ if (0 != i) {
formatPrintln(",");
- visit(ctx.ROW(i));
- formatPrint(" ");
- visit(ctx.assignmentValues(i));
}
+ visit(ctx.ROW(i));
+ formatPrint(" ");
+ visit(ctx.assignmentValues(i));
}
return result.toString();
}
@@ -536,10 +522,8 @@ public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<St
for (int i = 0; i < assignCount; i++) {
if (i != 0) {
formatPrint(", ");
- visit(ctx.assignmentValue(i));
- } else {
- visit(ctx.assignmentValue(i));
}
+ visit(ctx.assignmentValue(i));
}
formatPrint(")");
return result.toString();
@@ -645,12 +629,10 @@ public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<St
public String visitTableElementList(final TableElementListContext ctx) {
int tableElementCount = ctx.tableElement().size();
for (int i = 0; i < tableElementCount; i++) {
- if (0 == i) {
- visit(ctx.tableElement(i));
- } else {
+ if (0 != i) {
formatPrintln(",");
- visit(ctx.tableElement(i));
}
+ visit(ctx.tableElement(i));
}
return result.toString();
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java
index f3f6c0d902e..4a6fac8f07a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java
@@ -146,7 +146,7 @@ public final class IntegrationTestEnvironment {
}
/**
- * List storage contaienr images.
+ * List storage container images.
*
* @param databaseType database type.
* @return database storage container images
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/assignment/AssignmentAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/assignment/AssignmentAssert.java
index 5935b293012..a5d30704724 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/assignment/AssignmentAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/assignment/AssignmentAssert.java
@@ -42,19 +42,17 @@ public final class AssignmentAssert {
* @param expected expected assignment
*/
public static void assertIs(final SQLCaseAssertContext assertContext, final AssignmentSegment actual, final ExpectedAssignment expected) {
- if (null != expected.getColumns()) {
+ if (null == expected.getColumns()) {
+ ColumnAssert.assertIs(assertContext, actual.getColumns().get(0), expected.getColumn());
+ } else {
assertThat(assertContext.getText("Assignment columns size assertion error: "), actual.getColumns().size(), is(expected.getColumns().size()));
int count = 0;
for (ColumnSegment each : actual.getColumns()) {
ColumnAssert.assertIs(assertContext, each, expected.getColumns().get(count));
count++;
}
- // TODO assert assign operator
- AssignmentValueAssert.assertIs(assertContext, actual.getValue(), expected.getAssignmentValue());
- } else {
- ColumnAssert.assertIs(assertContext, actual.getColumns().get(0), expected.getColumn());
- // TODO assert assign operator
- AssignmentValueAssert.assertIs(assertContext, actual.getValue(), expected.getAssignmentValue());
}
+ // TODO assert assign operator
+ AssignmentValueAssert.assertIs(assertContext, actual.getValue(), expected.getAssignmentValue());
}
}
diff --git a/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/impl/DefaultParallelRunnerExecutor.java b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/impl/DefaultParallelRunnerExecutor.java
index 6135264e33e..4b5582f442b 100644
--- a/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/impl/DefaultParallelRunnerExecutor.java
+++ b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/impl/DefaultParallelRunnerExecutor.java
@@ -93,7 +93,7 @@ public class DefaultParallelRunnerExecutor<T> implements ParallelRunnerExecutor<
} catch (final InterruptedException | ExecutionException ignored) {
}
});
- executorServiceMap.values().forEach(each -> each.shutdownNow());
+ executorServiceMap.values().forEach(ExecutorService::shutdownNow);
if (null != defaultExecutorService) {
defaultExecutorService.shutdownNow();
}