You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/09/23 16:23:44 UTC
[shardingsphere] branch master updated: Remove useless throws DistSQLException (#21159)
This is an automated email from the ASF dual-hosted git repository.
zhaojinchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new b986956b256 Remove useless throws DistSQLException (#21159)
b986956b256 is described below
commit b986956b256a59afd01d3308f4167bef553d1ec7
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Sep 24 00:23:20 2022 +0800
Remove useless throws DistSQLException (#21159)
---
...DatabaseDiscoveryHeartbeatStatementUpdater.java | 9 ++----
...AlterDatabaseDiscoveryRuleStatementUpdater.java | 11 +++----
...AlterDatabaseDiscoveryTypeStatementUpdater.java | 13 +++-----
...DatabaseDiscoveryHeartbeatStatementUpdater.java | 7 ++--
...reateDatabaseDiscoveryRuleStatementUpdater.java | 12 +++----
...reateDatabaseDiscoveryTypeStatementUpdater.java | 9 ++----
...DatabaseDiscoveryHeartbeatStatementUpdater.java | 13 +++-----
.../DropDatabaseDiscoveryRuleStatementUpdater.java | 12 +++----
.../DropDatabaseDiscoveryTypeStatementUpdater.java | 13 +++-----
...baseDiscoveryHeartbeatStatementUpdaterTest.java | 5 ++-
...overyProviderAlgorithmStatementUpdaterTest.java | 9 +++---
...rDatabaseDiscoveryRuleStatementUpdaterTest.java | 13 ++++----
...baseDiscoveryHeartbeatStatementUpdaterTest.java | 5 ++-
...overyProviderAlgorithmStatementUpdaterTest.java | 9 +++---
...eDatabaseDiscoveryRuleStatementUpdaterTest.java | 11 +++----
...baseDiscoveryHeartbeatStatementUpdaterTest.java | 11 +++----
...overyProviderAlgorithmStatementUpdaterTest.java | 11 +++----
...pDatabaseDiscoveryRuleStatementUpdaterTest.java | 11 +++----
.../update/AlterEncryptRuleStatementUpdater.java | 7 ++--
.../update/CreateEncryptRuleStatementUpdater.java | 5 ++-
.../update/DropEncryptRuleStatementUpdater.java | 6 ++--
.../AlterEncryptRuleStatementUpdaterTest.java | 9 +++---
.../CreateEncryptRuleStatementUpdaterTest.java | 7 ++--
.../DropEncryptRuleStatementUpdaterTest.java | 9 +++---
.../ReadwriteSplittingRuleStatementChecker.java | 9 ++----
...lterReadwriteSplittingRuleStatementUpdater.java | 6 ++--
...eateReadwriteSplittingRuleStatementUpdater.java | 8 ++---
...ReadwriteSplittingRuleStatementUpdaterTest.java | 19 ++++++-----
...ReadwriteSplittingRuleStatementUpdaterTest.java | 23 +++++++-------
.../checker/ShadowRuleStatementChecker.java | 24 +++++---------
.../AlterShadowAlgorithmStatementUpdater.java | 7 ++--
.../update/AlterShadowRuleStatementUpdater.java | 11 +++----
...eateDefaultShadowAlgorithmStatementUpdater.java | 5 ++-
.../CreateShadowAlgorithmStatementUpdater.java | 9 +++---
.../update/CreateShadowRuleStatementUpdater.java | 9 +++---
...DropDefaultShadowAlgorithmStatementUpdater.java | 7 ++--
.../DropShadowAlgorithmStatementUpdater.java | 8 ++---
.../update/DropShadowRuleStatementUpdater.java | 7 ++--
.../AlterShadowAlgorithmStatementUpdaterTest.java | 7 ++--
.../AlterShadowRuleStatementUpdaterTest.java | 15 ++++-----
...DefaultShadowAlgorithmStatementUpdaterTest.java | 3 +-
.../CreateShadowAlgorithmStatementUpdaterTest.java | 9 +++---
.../CreateShadowRuleStatementUpdaterTest.java | 13 ++++----
...DefaultShadowAlgorithmStatementUpdaterTest.java | 7 ++--
.../DropShadowAlgorithmStatementUpdaterTest.java | 7 ++--
.../update/DropShadowRuleStatementUpdaterTest.java | 9 +++---
.../checker/ShardingTableRuleStatementChecker.java | 31 ++++++++----------
...terDefaultShardingStrategyStatementUpdater.java | 15 +++------
.../AlterShardingAlgorithmStatementUpdater.java | 9 +++---
.../AlterShardingAuditorStatementUpdater.java | 10 +++---
.../AlterShardingKeyGeneratorStatementUpdater.java | 10 +++---
.../AlterShardingTableRuleStatementUpdater.java | 4 +--
...ateDefaultShardingStrategyStatementUpdater.java | 10 +++---
.../CreateShardingAlgorithmStatementUpdater.java | 11 +++----
.../CreateShardingAuditorStatementUpdater.java | 11 +++----
...teShardingBindingTableRuleStatementUpdater.java | 5 ++-
...CreateShardingKeyGeneratorStatementUpdater.java | 10 +++---
.../CreateShardingTableRuleStatementUpdater.java | 4 +--
.../DropDefaultStrategyStatementUpdater.java | 7 ++--
.../DropShardingAuditorStatementUpdater.java | 9 ++----
...opShardingBindingTableRuleStatementUpdater.java | 8 ++---
...ShardingBroadcastTableRuleStatementUpdater.java | 7 ++--
.../DropShardingKeyGeneratorStatementUpdater.java | 10 +++---
.../checker/ShardingRuleStatementCheckerTest.java | 37 +++++++++++-----------
...efaultShardingStrategyStatementUpdaterTest.java | 13 ++++----
...AlterShardingAlgorithmStatementUpdaterTest.java | 9 +++---
.../AlterShardingAuditorStatementUpdaterTest.java | 9 +++---
...erShardingKeyGeneratorStatementUpdaterTest.java | 9 +++---
...AlterShardingTableRuleStatementUpdaterTest.java | 7 ++--
...efaultShardingStrategyStatementUpdaterTest.java | 13 ++++----
...reateShardingAlgorithmStatementUpdaterTest.java | 9 +++---
.../CreateShardingAuditorStatementUpdaterTest.java | 7 ++--
...ardingBindingTableRuleStatementUpdaterTest.java | 7 ++--
...teShardingKeyGeneratorStatementUpdaterTest.java | 7 ++--
...reateShardingTableRuleStatementUpdaterTest.java | 6 ++--
...efaultShardingStrategyStatementUpdaterTest.java | 7 ++--
.../DropShardingAuditorStatementUpdaterTest.java | 7 ++--
...ardingBindingTableRuleStatementUpdaterTest.java | 15 ++++-----
...dingBroadcastTableRuleStatementUpdaterTest.java | 9 +++---
...opShardingKeyGeneratorStatementUpdaterTest.java | 7 ++--
.../infra/distsql/update/GlobalRuleRALUpdater.java | 4 +--
.../distsql/update/RuleDefinitionUpdater.java | 4 +--
.../update/AlterTrafficRuleStatementUpdater.java | 9 +++---
.../update/CreateTrafficRuleStatementUpdater.java | 9 +++---
.../update/DropTrafficRuleStatementUpdater.java | 7 ++--
.../AlterTransactionRuleStatementUpdaterTest.java | 5 ++-
...aseDiscoveryRuleConfigurationImportChecker.java | 8 ++---
...iteSplittingRuleConfigurationImportChecker.java | 8 ++---
.../ShardingRuleConfigurationImportChecker.java | 14 ++++----
.../ImportDatabaseConfigurationHandler.java | 18 +++++------
.../SetReadwriteSplittingStatusHandler.java | 9 +++---
.../rdl/resource/AddResourceBackendHandler.java | 5 ++-
.../rdl/resource/AlterResourceBackendHandler.java | 11 +++----
.../rdl/resource/DropResourceBackendHandler.java | 11 +++----
...lterDefaultSingleTableRuleStatementUpdater.java | 9 +++---
...eateDefaultSingleTableRuleStatementUpdater.java | 8 ++---
...DropDefaultSingleTableRuleStatementUpdater.java | 7 ++--
.../rdl/rule/RuleDefinitionBackendHandler.java | 3 +-
.../resource/AddResourceBackendHandlerTest.java | 3 +-
.../resource/AlterResourceBackendHandlerTest.java | 7 ++--
.../resource/DropResourceBackendHandlerTest.java | 2 +-
101 files changed, 402 insertions(+), 557 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryHeartbeatStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDataba [...]
index 755bade35c5..7fb71508dd1 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryHeartbeatStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryHeartbeatStatementUpdater.java
@@ -21,7 +21,6 @@ import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleCon
import org.apache.shardingsphere.dbdiscovery.distsql.handler.converter.DatabaseDiscoveryRuleStatementConverter;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryHeartbeatSegment;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.AlterDatabaseDiscoveryHeartbeatStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionAlterUpdater;
@@ -49,23 +48,21 @@ public final class AlterDatabaseDiscoveryHeartbeatStatementUpdater implements Ru
}
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
ShardingSpherePreconditions.checkNotNull(currentRuleConfig, () -> new MissingRequiredRuleException(RULE_TYPE, databaseName));
checkDuplicateHeartbeat(databaseName, sqlStatement);
checkNotExistHeartbeat(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkNotExistHeartbeat(final String databaseName, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkNotExistHeartbeat(final String databaseName, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Collection<String> currentHeartbeats = currentRuleConfig.getDiscoveryHeartbeats().keySet();
Collection<String> notExistHeartbeats = sqlStatement.getHeartbeats().stream().map(DatabaseDiscoveryHeartbeatSegment::getHeartbeatName)
.filter(each -> !currentHeartbeats.contains(each)).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(notExistHeartbeats.isEmpty(), () -> new MissingRequiredRuleException(RULE_TYPE, databaseName, notExistHeartbeats));
}
- private void checkDuplicateHeartbeat(final String databaseName, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement) throws DistSQLException {
+ private void checkDuplicateHeartbeat(final String databaseName, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement) {
Collection<String> duplicateRuleNames = getToBeCreatedDuplicateRuleNames(sqlStatement);
ShardingSpherePreconditions.checkState(duplicateRuleNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE, databaseName, duplicateRuleNames));
}
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDis [...]
index 9f3d52fab78..f08c7487faa 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdater.java
@@ -27,7 +27,6 @@ import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDisc
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.AlterDatabaseDiscoveryRuleStatement;
import org.apache.shardingsphere.dbdiscovery.factory.DatabaseDiscoveryProviderAlgorithmFactory;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
@@ -52,7 +51,7 @@ public final class AlterDatabaseDiscoveryRuleStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
- final AlterDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final AlterDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
checkToBeAlteredRules(databaseName, sqlStatement, currentRuleConfig);
@@ -60,12 +59,12 @@ public final class AlterDatabaseDiscoveryRuleStatementUpdater implements RuleDef
checkDiscoverTypeAndHeartbeat(sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String databaseName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkNotNull(currentRuleConfig, () -> new MissingRequiredRuleException("database discovery", databaseName));
}
private void checkToBeAlteredRules(final String databaseName,
- final AlterDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final AlterDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Collection<String> currentRuleNames = currentRuleConfig.getDataSources().stream().map(DatabaseDiscoveryDataSourceRuleConfiguration::getGroupName).collect(Collectors.toSet());
Collection<String> notExistedRuleNames = getToBeAlteredRuleNames(sqlStatement).stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedRuleNames.isEmpty(), () -> new MissingRequiredRuleException("database discovery", databaseName, notExistedRuleNames));
@@ -75,7 +74,7 @@ public final class AlterDatabaseDiscoveryRuleStatementUpdater implements RuleDef
return sqlStatement.getRules().stream().map(AbstractDatabaseDiscoverySegment::getName).collect(Collectors.toList());
}
- private void checkToBeAlteredResources(final String databaseName, final AlterDatabaseDiscoveryRuleStatement sqlStatement, final ShardingSphereResource resource) throws DistSQLException {
+ private void checkToBeAlteredResources(final String databaseName, final AlterDatabaseDiscoveryRuleStatement sqlStatement, final ShardingSphereResource resource) {
Collection<String> notExistedResources = resource.getNotExistedResources(getToBeAlteredResourceNames(sqlStatement));
ShardingSpherePreconditions.checkState(notExistedResources.isEmpty(), () -> new MissingRequiredResourcesException(databaseName, notExistedResources));
}
@@ -86,7 +85,7 @@ public final class AlterDatabaseDiscoveryRuleStatementUpdater implements RuleDef
return result;
}
- private void checkDiscoverTypeAndHeartbeat(final AlterDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDiscoverTypeAndHeartbeat(final AlterDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Map<String, List<AbstractDatabaseDiscoverySegment>> segmentMap = sqlStatement.getRules().stream().collect(Collectors.groupingBy(each -> each.getClass().getSimpleName()));
Collection<String> invalidInput = segmentMap.getOrDefault(DatabaseDiscoveryDefinitionSegment.class.getSimpleName(), Collections.emptyList()).stream()
.map(each -> ((DatabaseDiscoveryDefinitionSegment) each).getDiscoveryType().getName()).distinct()
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryTypeStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDis [...]
index c65c51b869b..6c928491590 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryTypeStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryTypeStatementUpdater.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDisc
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.AlterDatabaseDiscoveryTypeStatement;
import org.apache.shardingsphere.dbdiscovery.factory.DatabaseDiscoveryProviderAlgorithmFactory;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
@@ -43,8 +42,7 @@ public final class AlterDatabaseDiscoveryTypeStatementUpdater implements RuleDef
private static final String RULE_TYPE = "database discovery";
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final AlterDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final AlterDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
checkDuplicateDiscoveryType(databaseName, sqlStatement);
@@ -52,8 +50,7 @@ public final class AlterDatabaseDiscoveryTypeStatementUpdater implements RuleDef
checkInvalidDiscoverType(sqlStatement);
}
- private void checkNotExistDiscoveryType(final String databaseName,
- final AlterDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkNotExistDiscoveryType(final String databaseName, final AlterDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Collection<String> existTypes = currentRuleConfig.getDiscoveryTypes().keySet();
Collection<String> notExistTypes = sqlStatement.getProviders().stream().map(DatabaseDiscoveryProviderAlgorithmSegment::getDiscoveryProviderName)
.filter(each -> !existTypes.contains(each)).collect(Collectors.toSet());
@@ -61,11 +58,11 @@ public final class AlterDatabaseDiscoveryTypeStatementUpdater implements RuleDef
}
- private void checkCurrentRuleConfiguration(final String databaseName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkState(null != currentRuleConfig, () -> new MissingRequiredRuleException(RULE_TYPE, databaseName));
}
- private void checkDuplicateDiscoveryType(final String databaseName, final AlterDatabaseDiscoveryTypeStatement sqlStatement) throws DistSQLException {
+ private void checkDuplicateDiscoveryType(final String databaseName, final AlterDatabaseDiscoveryTypeStatement sqlStatement) {
Collection<String> duplicateTypeNames = getToBeAlteredDuplicateTypeNames(sqlStatement);
ShardingSpherePreconditions.checkState(duplicateTypeNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE, databaseName, duplicateTypeNames));
}
@@ -75,7 +72,7 @@ public final class AlterDatabaseDiscoveryTypeStatementUpdater implements RuleDef
.entrySet().stream().filter(entry -> entry.getValue() > 1).map(Entry::getKey).collect(Collectors.toSet());
}
- private void checkInvalidDiscoverType(final AlterDatabaseDiscoveryTypeStatement sqlStatement) throws DistSQLException {
+ private void checkInvalidDiscoverType(final AlterDatabaseDiscoveryTypeStatement sqlStatement) {
Collection<String> invalidType = sqlStatement.getProviders().stream().map(each -> each.getAlgorithm().getName()).distinct()
.filter(each -> !DatabaseDiscoveryProviderAlgorithmFactory.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(invalidType.isEmpty(), () -> new InvalidAlgorithmConfigurationException(RULE_TYPE, invalidType));
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryHeartbeatStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateData [...]
index 624a70425a2..a44affcec3a 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryHeartbeatStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryHeartbeatStatementUpdater.java
@@ -21,7 +21,6 @@ import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleCon
import org.apache.shardingsphere.dbdiscovery.distsql.handler.converter.DatabaseDiscoveryRuleStatementConverter;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryHeartbeatSegment;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryHeartbeatStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -48,14 +47,12 @@ public final class CreateDatabaseDiscoveryHeartbeatStatementUpdater implements R
}
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final CreateDatabaseDiscoveryHeartbeatStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkDuplicateHeartbeat(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkDuplicateHeartbeat(final String databaseName, final CreateDatabaseDiscoveryHeartbeatStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDuplicateHeartbeat(final String databaseName, final CreateDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
if (null == currentRuleConfig) {
return;
}
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseD [...]
index 575edbab967..08cdf519621 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryRuleStatementUpdater.java
@@ -25,7 +25,6 @@ import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDisc
import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryDefinitionSegment;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryRuleStatement;
import org.apache.shardingsphere.dbdiscovery.factory.DatabaseDiscoveryProviderAlgorithmFactory;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
@@ -51,16 +50,14 @@ public final class CreateDatabaseDiscoveryRuleStatementUpdater implements RuleDe
private static final String RULE_TYPE = "Database discovery";
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final CreateDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkDuplicateRuleNames(databaseName, sqlStatement, currentRuleConfig);
checkResources(databaseName, sqlStatement, database.getResource());
checkDiscoverTypeAndHeartbeat(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkDuplicateRuleNames(final String databaseName,
- final CreateDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDuplicateRuleNames(final String databaseName, final CreateDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
if (null == currentRuleConfig) {
return;
}
@@ -75,15 +72,14 @@ public final class CreateDatabaseDiscoveryRuleStatementUpdater implements RuleDe
.entrySet().stream().filter(entry -> entry.getValue() > 1).map(Entry::getKey).collect(Collectors.toSet());
}
- private void checkResources(final String databaseName, final CreateDatabaseDiscoveryRuleStatement sqlStatement, final ShardingSphereResource resource) throws MissingRequiredResourcesException {
+ private void checkResources(final String databaseName, final CreateDatabaseDiscoveryRuleStatement sqlStatement, final ShardingSphereResource resource) {
Collection<String> resources = new LinkedHashSet<>();
sqlStatement.getRules().forEach(each -> resources.addAll(each.getDataSources()));
Collection<String> notExistResources = resource.getNotExistedResources(resources);
ShardingSpherePreconditions.checkState(notExistResources.isEmpty(), () -> new MissingRequiredResourcesException(databaseName, notExistResources));
}
- private void checkDiscoverTypeAndHeartbeat(final String databaseName,
- final CreateDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDiscoverTypeAndHeartbeat(final String databaseName, final CreateDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Map<String, List<AbstractDatabaseDiscoverySegment>> segmentMap = sqlStatement.getRules().stream().collect(Collectors.groupingBy(each -> each.getClass().getSimpleName()));
Collection<String> invalidInput = segmentMap.getOrDefault(DatabaseDiscoveryDefinitionSegment.class.getSimpleName(), Collections.emptyList()).stream()
.map(each -> ((DatabaseDiscoveryDefinitionSegment) each).getDiscoveryType().getName()).distinct()
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryTypeStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseD [...]
index bbd79464791..9fb8c62fc53 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryTypeStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryTypeStatementUpdater.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDisc
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryTypeStatement;
import org.apache.shardingsphere.dbdiscovery.factory.DatabaseDiscoveryProviderAlgorithmFactory;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
@@ -42,15 +41,13 @@ public final class CreateDatabaseDiscoveryTypeStatementUpdater implements RuleDe
private static final String RULE_TYPE = "database discovery";
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final CreateDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkDuplicateDiscoveryType(databaseName, sqlStatement, currentRuleConfig);
checkInvalidDiscoverType(sqlStatement);
}
- private void checkDuplicateDiscoveryType(final String databaseName,
- final CreateDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDuplicateDiscoveryType(final String databaseName, final CreateDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
if (null == currentRuleConfig) {
return;
}
@@ -66,7 +63,7 @@ public final class CreateDatabaseDiscoveryTypeStatementUpdater implements RuleDe
.entrySet().stream().filter(entry -> entry.getValue() > 1).map(Entry::getKey).collect(Collectors.toSet());
}
- private void checkInvalidDiscoverType(final CreateDatabaseDiscoveryTypeStatement sqlStatement) throws DistSQLException {
+ private void checkInvalidDiscoverType(final CreateDatabaseDiscoveryTypeStatement sqlStatement) {
Collection<String> invalidType = sqlStatement.getProviders().stream().map(each -> each.getAlgorithm().getName()).distinct()
.filter(each -> !DatabaseDiscoveryProviderAlgorithmFactory.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(invalidType.isEmpty(), () -> new InvalidAlgorithmConfigurationException(RULE_TYPE, invalidType));
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabase [...]
index 770a1605e94..d2174e1d726 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdater.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.dbdiscovery.distsql.handler.update;
import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.DropDatabaseDiscoveryHeartbeatStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.RuleInUsedException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
@@ -38,15 +37,13 @@ public final class DropDatabaseDiscoveryHeartbeatStatementUpdater implements Rul
private static final String RULE_TYPE = "Database discovery";
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final DropDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkCurrentRuleConfiguration(databaseName, sqlStatement, currentRuleConfig);
checkIsInUse(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String databaseName,
- final DropDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
if (sqlStatement.isIfExists()) {
return;
}
@@ -54,15 +51,13 @@ public final class DropDatabaseDiscoveryHeartbeatStatementUpdater implements Rul
checkIsExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkIsExist(final String databaseName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkIsExist(final String databaseName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Collection<String> currentRuleNames = currentRuleConfig.getDiscoveryHeartbeats().keySet();
Collection<String> notExistedRuleNames = sqlStatement.getHeartbeatNames().stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedRuleNames.isEmpty(), () -> new MissingRequiredRuleException(RULE_TYPE, databaseName, notExistedRuleNames));
}
- private void checkIsInUse(final String databaseName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkIsInUse(final String databaseName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Collection<String> heartbeatInUse = currentRuleConfig.getDataSources().stream().map(DatabaseDiscoveryDataSourceRuleConfiguration::getDiscoveryHeartbeatName).collect(Collectors.toSet());
Collection<String> invalid = sqlStatement.getHeartbeatNames().stream().filter(heartbeatInUse::contains).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(invalid.isEmpty(), () -> new RuleInUsedException(RULE_TYPE, databaseName, invalid));
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDisco [...]
index 663145b4b15..570d633e381 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdater.java
@@ -22,7 +22,6 @@ import org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDa
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.DropDatabaseDiscoveryRuleStatement;
import org.apache.shardingsphere.infra.distsql.constant.ExportableConstants;
import org.apache.shardingsphere.infra.distsql.constant.ExportableItemConstants;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.RuleInUsedException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
@@ -46,15 +45,13 @@ public final class DropDatabaseDiscoveryRuleStatementUpdater implements RuleDefi
private static final String RULE_TYPE = "Database discovery";
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final DropDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final DropDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkCurrentRuleConfiguration(databaseName, sqlStatement, currentRuleConfig);
checkIsInUse(databaseName, sqlStatement, database);
}
- private void checkCurrentRuleConfiguration(final String databaseName, final DropDatabaseDiscoveryRuleStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final DropDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
if (sqlStatement.isIfExists()) {
return;
}
@@ -62,14 +59,13 @@ public final class DropDatabaseDiscoveryRuleStatementUpdater implements RuleDefi
checkIsExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkIsExist(final String databaseName, final DropDatabaseDiscoveryRuleStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkIsExist(final String databaseName, final DropDatabaseDiscoveryRuleStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Collection<String> currentRuleNames = currentRuleConfig.getDataSources().stream().map(DatabaseDiscoveryDataSourceRuleConfiguration::getGroupName).collect(Collectors.toList());
Collection<String> notExistedRuleNames = sqlStatement.getRuleNames().stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedRuleNames.isEmpty(), () -> new MissingRequiredRuleException(RULE_TYPE, databaseName));
}
- private void checkIsInUse(final String databaseName, final DropDatabaseDiscoveryRuleStatement sqlStatement, final ShardingSphereDatabase database) throws DistSQLException {
+ private void checkIsInUse(final String databaseName, final DropDatabaseDiscoveryRuleStatement sqlStatement, final ShardingSphereDatabase database) {
Optional<ExportableRule> exportableRule = database.getRuleMetaData().findRules(ExportableRule.class).stream()
.filter(each -> new RuleExportEngine(each).containExportableKey(Collections.singletonList(ExportableConstants.EXPORT_DYNAMIC_READWRITE_SPLITTING_RULE))).findFirst();
Collection<String> rulesInUse = new LinkedList<>();
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryTypeStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDisco [...]
index 4b5599425d8..f0607130540 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryTypeStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryTypeStatementUpdater.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.dbdiscovery.distsql.handler.update;
import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.DropDatabaseDiscoveryTypeStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.RuleInUsedException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
@@ -38,15 +37,13 @@ public final class DropDatabaseDiscoveryTypeStatementUpdater implements RuleDefi
private static final String RULE_TYPE = "Database discovery";
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final DropDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final DropDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkCurrentRuleConfiguration(databaseName, sqlStatement, currentRuleConfig);
checkIsInUse(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String databaseName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final DropDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
if (sqlStatement.isIfExists()) {
return;
}
@@ -54,15 +51,13 @@ public final class DropDatabaseDiscoveryTypeStatementUpdater implements RuleDefi
checkIsExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkIsExist(final String databaseName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkIsExist(final String databaseName, final DropDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Collection<String> currentRuleNames = currentRuleConfig.getDiscoveryTypes().keySet();
Collection<String> notExistedRuleNames = sqlStatement.getTypes().stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedRuleNames.isEmpty(), () -> new MissingRequiredRuleException(RULE_TYPE, databaseName, notExistedRuleNames));
}
- private void checkIsInUse(final String databaseName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
- final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkIsInUse(final String databaseName, final DropDatabaseDiscoveryTypeStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Collection<String> heartbeatInUse = currentRuleConfig.getDataSources().stream().map(DatabaseDiscoveryDataSourceRuleConfiguration::getDiscoveryTypeName).collect(Collectors.toSet());
Collection<String> invalid = sqlStatement.getTypes().stream().filter(heartbeatInUse::contains).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(invalid.isEmpty(), () -> new RuleInUsedException(RULE_TYPE, databaseName, invalid));
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryHeartbeatStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDa [...]
index 4727ad5bc6b..6814c98eb70 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryHeartbeatStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryHeartbeatStatementUpdaterTest.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.dbdiscovery.distsql.handler.update;
import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryHeartbeatSegment;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.AlterDatabaseDiscoveryHeartbeatStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -48,7 +47,7 @@ public final class AlterDatabaseDiscoveryHeartbeatStatementUpdaterTest {
private ShardingSphereDatabase database;
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithDuplicateHeartbeatNames() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateHeartbeatNames() {
DatabaseDiscoveryHeartbeatSegment segment1 = new DatabaseDiscoveryHeartbeatSegment("heartbeat", createProperties("key", "value"));
DatabaseDiscoveryHeartbeatSegment segment2 = new DatabaseDiscoveryHeartbeatSegment("heartbeat", createProperties("key", "value"));
updater.checkSQLStatement(database, new AlterDatabaseDiscoveryHeartbeatStatement(Arrays.asList(segment1, segment2)),
@@ -56,7 +55,7 @@ public final class AlterDatabaseDiscoveryHeartbeatStatementUpdaterTest {
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithNotExistDiscoveryHeartbeatName() throws DistSQLException {
+ public void assertCheckSQLStatementWithNotExistDiscoveryHeartbeatName() {
DatabaseDiscoveryHeartbeatSegment segment = new DatabaseDiscoveryHeartbeatSegment("heartbeat", createProperties("key", "value"));
DatabaseDiscoveryRuleConfiguration config = new DatabaseDiscoveryRuleConfiguration(Collections.emptyList(), Collections.singletonMap("heartbeat1", null), Collections.emptyMap());
updater.checkSQLStatement(database, new AlterDatabaseDiscoveryHeartbeatStatement(Collections.singleton(segment)), config);
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update [...]
index 1643129cf8c..d99ca19ce91 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDisc
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.AlterDatabaseDiscoveryTypeStatement;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
@@ -55,7 +54,7 @@ public final class AlterDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest {
private ShardingSphereDatabase database;
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithDuplicate() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicate() {
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig = new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds", Collections.emptyList(), "ha-heartbeat", "test");
List<DatabaseDiscoveryProviderAlgorithmSegment> algorithmSegments = Arrays.asList(
new DatabaseDiscoveryProviderAlgorithmSegment("discovery_type", new AlgorithmSegment("DISTSQL.FIXTURE", new Properties())),
@@ -65,7 +64,7 @@ public final class AlterDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest {
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithNotExist() throws DistSQLException {
+ public void assertCheckSQLStatementWithNotExist() {
List<DatabaseDiscoveryProviderAlgorithmSegment> algorithmSegments =
Collections.singletonList(new DatabaseDiscoveryProviderAlgorithmSegment("discovery_type_1", new AlgorithmSegment("DISTSQL.FIXTURE", new Properties())));
updater.checkSQLStatement(database, new AlterDatabaseDiscoveryTypeStatement(algorithmSegments),
@@ -74,7 +73,7 @@ public final class AlterDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckSQLStatementWithDatabaseDiscoveryType() throws DistSQLException {
+ public void assertCheckSQLStatementWithDatabaseDiscoveryType() {
Collection<DatabaseDiscoveryProviderAlgorithmSegment> algorithmSegments = Collections.singleton(
new DatabaseDiscoveryProviderAlgorithmSegment("discovery_type", new AlgorithmSegment("INVALID_TYPE", new Properties())));
updater.checkSQLStatement(database, new AlterDatabaseDiscoveryTypeStatement(algorithmSegments),
@@ -83,7 +82,7 @@ public final class AlterDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest {
}
@Test
- public void assertBuildAndUpdate() throws DistSQLException {
+ public void assertBuildAndUpdate() {
Properties currentProps = new Properties();
currentProps.put("key", "value");
DatabaseDiscoveryRuleConfiguration currentRuleConfig = new DatabaseDiscoveryRuleConfiguration(Collections.emptyList(), Collections.emptyMap(),
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabas [...]
index 189a1d49d93..5cac5501b66 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdaterTest.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDisc
import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryDefinitionSegment;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.AlterDatabaseDiscoveryRuleStatement;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
@@ -67,19 +66,19 @@ public final class AlterDatabaseDiscoveryRuleStatementUpdaterTest {
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentRule() {
updater.checkSQLStatement(database, new AlterDatabaseDiscoveryRuleStatement(Collections.emptyList()), null);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutToBeAlteredDatabaseDiscoveryRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeAlteredDatabaseDiscoveryRule() {
DatabaseDiscoveryConstructionSegment segment = new DatabaseDiscoveryConstructionSegment("readwrite_ds", Arrays.asList("ds_read_0", "ds_read_1"), "", "");
updater.checkSQLStatement(database, new AlterDatabaseDiscoveryRuleStatement(Collections.singletonList(segment)),
new DatabaseDiscoveryRuleConfiguration(Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap()));
}
@Test(expected = MissingRequiredResourcesException.class)
- public void assertCheckSQLStatementWithoutExistedResources() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutExistedResources() {
when(resource.getNotExistedResources(any())).thenReturn(Collections.singleton("ds0"));
DatabaseDiscoveryConstructionSegment segment = new DatabaseDiscoveryConstructionSegment("readwrite_ds", Arrays.asList("ds_read_0", "ds_read_1"), "readwrite_ds_mgr", "readwrite_ds_heartbeat");
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig = new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds", Collections.emptyList(), "ha-heartbeat", "TEST");
@@ -89,7 +88,7 @@ public final class AlterDatabaseDiscoveryRuleStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckSQLStatementWithDatabaseDiscoveryType() throws DistSQLException {
+ public void assertCheckSQLStatementWithDatabaseDiscoveryType() {
AlgorithmSegment algorithmSegment = new AlgorithmSegment("INVALID_TYPE", new Properties());
DatabaseDiscoveryDefinitionSegment segment = new DatabaseDiscoveryDefinitionSegment("readwrite_ds", Arrays.asList("ds_read_0", "ds_read_1"), algorithmSegment, new Properties());
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig = new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds", Collections.emptyList(), "ha-heartbeat", "TEST");
@@ -99,7 +98,7 @@ public final class AlterDatabaseDiscoveryRuleStatementUpdaterTest {
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertCheckSQLStatementWithNotExistDiscoveryTypeName() throws DistSQLException {
+ public void assertCheckSQLStatementWithNotExistDiscoveryTypeName() {
DatabaseDiscoveryConstructionSegment segment = new DatabaseDiscoveryConstructionSegment("readwrite_ds", Arrays.asList("ds_read_0", "ds_read_1"), "not_exist_discovery_type_name", "");
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig = new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds", Collections.emptyList(), "ha-heartbeat", "TEST");
DatabaseDiscoveryRuleConfiguration ruleConfig = new DatabaseDiscoveryRuleConfiguration(new LinkedList<>(Collections.singleton(dataSourceRuleConfig)),
@@ -108,7 +107,7 @@ public final class AlterDatabaseDiscoveryRuleStatementUpdaterTest {
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertCheckSQLStatementWithNotExistDiscoveryHeartbeatName() throws DistSQLException {
+ public void assertCheckSQLStatementWithNotExistDiscoveryHeartbeatName() {
DatabaseDiscoveryConstructionSegment segment = new DatabaseDiscoveryConstructionSegment(
"readwrite_ds", Arrays.asList("ds_read_0", "ds_read_1"), "discovery_type_name", "not_exist_heartbeat_name");
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig = new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds", Collections.emptyList(), "ha-heartbeat", "TEST");
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryHeartbeatStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/Create [...]
index f05d0e77417..fff071829fa 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryHeartbeatStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryHeartbeatStatementUpdaterTest.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.dbdiscovery.distsql.handler.update;
import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryHeartbeatSegment;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryHeartbeatStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.junit.Test;
@@ -47,7 +46,7 @@ public final class CreateDatabaseDiscoveryHeartbeatStatementUpdaterTest {
private ShardingSphereDatabase database;
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithDuplicateHeartbeatNames() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateHeartbeatNames() {
DatabaseDiscoveryHeartbeatSegment segment1 = new DatabaseDiscoveryHeartbeatSegment("heartbeat", createProperties("key", "value"));
DatabaseDiscoveryHeartbeatSegment segment2 = new DatabaseDiscoveryHeartbeatSegment("heartbeat", createProperties("key", "value"));
updater.checkSQLStatement(database, new CreateDatabaseDiscoveryHeartbeatStatement(Arrays.asList(segment1, segment2)),
@@ -55,7 +54,7 @@ public final class CreateDatabaseDiscoveryHeartbeatStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithExistDiscoveryHeartbeatName() throws DistSQLException {
+ public void assertCheckSQLStatementWithExistDiscoveryHeartbeatName() {
DatabaseDiscoveryHeartbeatSegment segment = new DatabaseDiscoveryHeartbeatSegment("heartbeat", createProperties("key", "value"));
DatabaseDiscoveryRuleConfiguration ruleConfig = new DatabaseDiscoveryRuleConfiguration(Collections.emptyList(), Collections.singletonMap("heartbeat", null), Collections.emptyMap());
updater.checkSQLStatement(database, new CreateDatabaseDiscoveryHeartbeatStatement(Collections.singleton(segment)), ruleConfig);
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/updat [...]
index da60b31879e..d53a58ff429 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDisc
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryTypeStatement;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -52,7 +51,7 @@ public final class CreateDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest
private ShardingSphereDatabase database;
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithDuplicate() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicate() {
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig = new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds", Collections.emptyList(), "ha-heartbeat", "test");
Collection<DatabaseDiscoveryProviderAlgorithmSegment> algorithmSegments = Arrays.asList(
new DatabaseDiscoveryProviderAlgorithmSegment("discovery_type", new AlgorithmSegment("DISTSQL.FIXTURE", new Properties())),
@@ -62,7 +61,7 @@ public final class CreateDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest
}
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithExist() throws DistSQLException {
+ public void assertCheckSQLStatementWithExist() {
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig = new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds", Collections.emptyList(), "ha-heartbeat", "test");
Collection<DatabaseDiscoveryProviderAlgorithmSegment> algorithmSegments = Collections.singletonList(
new DatabaseDiscoveryProviderAlgorithmSegment("discovery_type", new AlgorithmSegment("DISTSQL.FIXTURE", new Properties())));
@@ -72,14 +71,14 @@ public final class CreateDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckSQLStatementWithDatabaseDiscoveryType() throws DistSQLException {
+ public void assertCheckSQLStatementWithDatabaseDiscoveryType() {
Collection<DatabaseDiscoveryProviderAlgorithmSegment> algorithmSegments = Collections.singleton(
new DatabaseDiscoveryProviderAlgorithmSegment("discovery_type", new AlgorithmSegment("INVALID_TYPE", new Properties())));
updater.checkSQLStatement(database, new CreateDatabaseDiscoveryTypeStatement(algorithmSegments), null);
}
@Test
- public void assertBuildAndUpdate() throws DistSQLException {
+ public void assertBuildAndUpdate() {
Collection<DatabaseDiscoveryProviderAlgorithmSegment> algorithmSegments = Collections.singleton(
new DatabaseDiscoveryProviderAlgorithmSegment("discovery_type", new AlgorithmSegment("DISTSQL.FIXTURE", new Properties())));
updater.checkSQLStatement(database, new CreateDatabaseDiscoveryTypeStatement(algorithmSegments), null);
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatab [...]
index 8698dba5b63..b22f92df35e 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryRuleStatementUpdaterTest.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDisc
import org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryDefinitionSegment;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryRuleStatement;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
@@ -67,7 +66,7 @@ public final class CreateDatabaseDiscoveryRuleStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithDuplicateRuleNames() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateRuleNames() {
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig = new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds", Collections.emptyList(), "ha-heartbeat", "test");
DatabaseDiscoveryConstructionSegment segment = new DatabaseDiscoveryConstructionSegment("readwrite_ds", Collections.emptyList(), "", "");
updater.checkSQLStatement(database, new CreateDatabaseDiscoveryRuleStatement(Collections.singleton(segment)),
@@ -75,28 +74,28 @@ public final class CreateDatabaseDiscoveryRuleStatementUpdaterTest {
}
@Test(expected = MissingRequiredResourcesException.class)
- public void assertCheckSQLStatementWithoutExistedResources() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutExistedResources() {
when(resource.getNotExistedResources(any())).thenReturn(Collections.singleton("ds_read_0"));
DatabaseDiscoveryConstructionSegment segment = new DatabaseDiscoveryConstructionSegment("readwrite_ds", Arrays.asList("ds_read_0", "ds_read_1"), "", "");
updater.checkSQLStatement(database, new CreateDatabaseDiscoveryRuleStatement(Collections.singleton(segment)), null);
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckSQLStatementWithDatabaseDiscoveryType() throws DistSQLException {
+ public void assertCheckSQLStatementWithDatabaseDiscoveryType() {
AlgorithmSegment algorithmSegment = new AlgorithmSegment("INVALID_TYPE", new Properties());
DatabaseDiscoveryDefinitionSegment segment = new DatabaseDiscoveryDefinitionSegment("readwrite_ds", Arrays.asList("ds_read_0", "ds_read_1"), algorithmSegment, new Properties());
updater.checkSQLStatement(database, new CreateDatabaseDiscoveryRuleStatement(Collections.singleton(segment)), null);
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertCheckSQLStatementWithNotExistDiscoveryTypeName() throws DistSQLException {
+ public void assertCheckSQLStatementWithNotExistDiscoveryTypeName() {
DatabaseDiscoveryConstructionSegment segment = new DatabaseDiscoveryConstructionSegment("readwrite_ds", Arrays.asList("ds_read_0", "ds_read_1"), "not_exist_discovery_type_name", "");
DatabaseDiscoveryRuleConfiguration ruleConfig = new DatabaseDiscoveryRuleConfiguration(Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap());
updater.checkSQLStatement(database, new CreateDatabaseDiscoveryRuleStatement(Collections.singleton(segment)), ruleConfig);
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertCheckSQLStatementWithNotExistDiscoveryHeartbeatName() throws DistSQLException {
+ public void assertCheckSQLStatementWithNotExistDiscoveryHeartbeatName() {
DatabaseDiscoveryConstructionSegment segment = new DatabaseDiscoveryConstructionSegment(
"readwrite_ds", Arrays.asList("ds_read_0", "ds_read_1"), "discovery_type_name", "not_exist_heartbeat_name");
DatabaseDiscoveryRuleConfiguration ruleConfig = new DatabaseDiscoveryRuleConfiguration(Collections.emptyList(), Collections.emptyMap(),
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropData [...]
index 4905dec65fd..d82ddb32c65 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdaterTest.java
@@ -21,7 +21,6 @@ import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleCon
import org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryHeartBeatConfiguration;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.DropDatabaseDiscoveryHeartbeatStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.RuleInUsedException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -37,8 +36,8 @@ import java.util.Map;
import java.util.Properties;
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;
@RunWith(MockitoJUnitRunner.class)
@@ -50,17 +49,17 @@ public final class DropDatabaseDiscoveryHeartbeatStatementUpdaterTest {
private ShardingSphereDatabase database;
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentHeartbeat() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentHeartbeat() {
updater.checkSQLStatement(database, createSQLStatement(), null);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutToBeDroppedHeartbeat() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeDroppedHeartbeat() {
updater.checkSQLStatement(database, createSQLStatement(), new DatabaseDiscoveryRuleConfiguration(Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap()));
}
@Test(expected = RuleInUsedException.class)
- public void assertCheckSQLStatementWithInUsed() throws DistSQLException {
+ public void assertCheckSQLStatementWithInUsed() {
DatabaseDiscoveryDataSourceRuleConfiguration ruleConfig = new DatabaseDiscoveryDataSourceRuleConfiguration("name", Collections.emptyList(), "heartbeat_name", "");
updater.checkSQLStatement(database, createSQLStatement(), new DatabaseDiscoveryRuleConfiguration(Collections.singletonList(ruleConfig),
Collections.singletonMap("heartbeat_name", null), Collections.emptyMap()));
@@ -74,7 +73,7 @@ public final class DropDatabaseDiscoveryHeartbeatStatementUpdaterTest {
}
@Test
- public void assertUpdateCurrentRuleConfigurationWithIfExists() throws DistSQLException {
+ public void assertUpdateCurrentRuleConfigurationWithIfExists() {
DatabaseDiscoveryRuleConfiguration ruleConfig = createCurrentRuleConfiguration();
DropDatabaseDiscoveryHeartbeatStatement dropDatabaseDiscoveryHeartbeatStatement = createSQLStatementWithIfExists();
updater.checkSQLStatement(database, dropDatabaseDiscoveryHeartbeatStatement, ruleConfig);
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/ [...]
index 0f949c7a850..fc611d3bdca 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest.java
@@ -21,7 +21,6 @@ import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleCon
import org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.DropDatabaseDiscoveryTypeStatement;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.RuleInUsedException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -37,8 +36,8 @@ import java.util.Map;
import java.util.Properties;
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;
@RunWith(MockitoJUnitRunner.class)
@@ -50,17 +49,17 @@ public final class DropDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest {
private ShardingSphereDatabase database;
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentType() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentType() {
updater.checkSQLStatement(database, createSQLStatement(), null);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutToBeDroppedTypes() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeDroppedTypes() {
updater.checkSQLStatement(database, createSQLStatement(), new DatabaseDiscoveryRuleConfiguration(Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap()));
}
@Test(expected = RuleInUsedException.class)
- public void assertCheckSQLStatementWithInUsed() throws DistSQLException {
+ public void assertCheckSQLStatementWithInUsed() {
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig = new DatabaseDiscoveryDataSourceRuleConfiguration("name", Collections.emptyList(), "", "type_name");
updater.checkSQLStatement(database, createSQLStatement(), new DatabaseDiscoveryRuleConfiguration(Collections.singletonList(dataSourceRuleConfig),
Collections.emptyMap(), Collections.singletonMap("type_name", null)));
@@ -74,7 +73,7 @@ public final class DropDatabaseDiscoveryProviderAlgorithmStatementUpdaterTest {
}
@Test
- public void assertUpdateCurrentRuleConfigurationWithIfExists() throws DistSQLException {
+ public void assertUpdateCurrentRuleConfigurationWithIfExists() {
DatabaseDiscoveryRuleConfiguration ruleConfig = createCurrentRuleConfiguration();
DropDatabaseDiscoveryTypeStatement dropDatabaseDiscoveryRuleStatement = createSQLStatementWithIfExists();
updater.checkSQLStatement(database, dropDatabaseDiscoveryRuleStatement, ruleConfig);
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseD [...]
index 99158634500..1d5a256eeab 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdaterTest.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.DropDataba
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.distsql.constant.ExportableConstants;
import org.apache.shardingsphere.infra.distsql.constant.ExportableItemConstants;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.RuleInUsedException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -41,8 +40,8 @@ import java.util.Map;
import java.util.Properties;
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;
@@ -61,17 +60,17 @@ public final class DropDatabaseDiscoveryRuleStatementUpdaterTest {
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentRule() {
updater.checkSQLStatement(database, createSQLStatement(), null);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutToBeDroppedRules() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeDroppedRules() {
updater.checkSQLStatement(database, createSQLStatement(), new DatabaseDiscoveryRuleConfiguration(Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap()));
}
@Test(expected = RuleInUsedException.class)
- public void assertCheckSQLStatementWithRuleInUsed() throws DistSQLException {
+ public void assertCheckSQLStatementWithRuleInUsed() {
when(database.getRuleMetaData()).thenReturn(mock(ShardingSphereRuleMetaData.class, RETURNS_DEEP_STUBS));
ExportableRule exportableRule = mock(ExportableRule.class);
when(exportableRule.getExportData()).thenReturn(getExportData());
@@ -112,7 +111,7 @@ public final class DropDatabaseDiscoveryRuleStatementUpdaterTest {
}
@Test
- public void assertUpdateCurrentRuleConfigurationWithIfExists() throws DistSQLException {
+ public void assertUpdateCurrentRuleConfigurationWithIfExists() {
DatabaseDiscoveryRuleConfiguration databaseDiscoveryRuleConfig = createCurrentRuleConfiguration();
DropDatabaseDiscoveryRuleStatement dropDatabaseDiscoveryRuleStatement = createSQLStatementWithIfExists();
updater.checkSQLStatement(database, dropDatabaseDiscoveryRuleStatement, databaseDiscoveryRuleConfig);
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdater.java
index 6c9c389cf32..ef8867ac433 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdater.java
@@ -26,7 +26,6 @@ import org.apache.shardingsphere.encrypt.distsql.parser.segment.EncryptRuleSegme
import org.apache.shardingsphere.encrypt.distsql.parser.statement.AlterEncryptRuleStatement;
import org.apache.shardingsphere.encrypt.factory.EncryptAlgorithmFactory;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidRuleConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
@@ -46,7 +45,7 @@ import java.util.stream.Collectors;
public final class AlterEncryptRuleStatementUpdater implements RuleDefinitionAlterUpdater<AlterEncryptRuleStatement, EncryptRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final AlterEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final AlterEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
checkToBeAlteredRules(databaseName, sqlStatement, currentRuleConfig);
@@ -59,7 +58,7 @@ public final class AlterEncryptRuleStatementUpdater implements RuleDefinitionAlt
}
}
- private void checkToBeAlteredRules(final String databaseName, final AlterEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkToBeAlteredRules(final String databaseName, final AlterEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) {
Collection<String> currentEncryptTableNames = currentRuleConfig.getTables().stream().map(EncryptTableRuleConfiguration::getName).collect(Collectors.toList());
Collection<String> notExistEncryptTableNames = getToBeAlteredEncryptTableNames(sqlStatement).stream().filter(each -> !currentEncryptTableNames.contains(each)).collect(Collectors.toList());
if (!notExistEncryptTableNames.isEmpty()) {
@@ -72,7 +71,7 @@ public final class AlterEncryptRuleStatementUpdater implements RuleDefinitionAlt
return sqlStatement.getRules().stream().map(EncryptRuleSegment::getTableName).collect(Collectors.toList());
}
- private void checkDataType(final AlterEncryptRuleStatement sqlStatement) throws DistSQLException {
+ private void checkDataType(final AlterEncryptRuleStatement sqlStatement) {
Collection<String> invalidRules = sqlStatement.getRules().stream()
.map(each -> getInvalidColumns(each.getTableName(), each.getColumns())).flatMap(Collection::stream).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(invalidRules.isEmpty(), () -> new InvalidRuleConfigurationException("encrypt", invalidRules, Collections.singleton("incomplete data type")));
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdater.java
index 1580adea9fc..ef17939ab8d 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdater.java
@@ -24,7 +24,6 @@ import org.apache.shardingsphere.encrypt.distsql.parser.segment.EncryptColumnSeg
import org.apache.shardingsphere.encrypt.distsql.parser.segment.EncryptRuleSegment;
import org.apache.shardingsphere.encrypt.distsql.parser.statement.CreateEncryptRuleStatement;
import org.apache.shardingsphere.encrypt.factory.EncryptAlgorithmFactory;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidRuleConfigurationException;
@@ -43,7 +42,7 @@ import java.util.stream.Collectors;
public final class CreateEncryptRuleStatementUpdater implements RuleDefinitionCreateUpdater<CreateEncryptRuleStatement, EncryptRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final CreateEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) {
checkDuplicateRuleNames(database.getName(), sqlStatement, currentRuleConfig);
checkDataType(sqlStatement);
checkToBeCreatedEncryptors(sqlStatement);
@@ -60,7 +59,7 @@ public final class CreateEncryptRuleStatementUpdater implements RuleDefinitionCr
}
}
- private void checkDataType(final CreateEncryptRuleStatement sqlStatement) throws DistSQLException {
+ private void checkDataType(final CreateEncryptRuleStatement sqlStatement) {
Collection<String> invalidRules = sqlStatement.getRules().stream()
.map(each -> getInvalidColumns(each.getTableName(), each.getColumns())).flatMap(Collection::stream).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(invalidRules.isEmpty(), () -> new InvalidRuleConfigurationException("encrypt", invalidRules, Collections.singleton("incomplete data type")));
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java
index e8765a5f45b..5647fd1be4d 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.encrypt.distsql.handler.update;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
import org.apache.shardingsphere.encrypt.distsql.parser.statement.DropEncryptRuleStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -36,12 +35,11 @@ import java.util.stream.Collectors;
public final class DropEncryptRuleStatementUpdater implements RuleDefinitionDropUpdater<DropEncryptRuleStatement, EncryptRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final DropEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final DropEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) {
checkToBeDroppedEncryptTableNames(database.getName(), sqlStatement, currentRuleConfig);
}
- private void checkToBeDroppedEncryptTableNames(final String databaseName, final DropEncryptRuleStatement sqlStatement,
- final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkToBeDroppedEncryptTableNames(final String databaseName, final DropEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) {
if (sqlStatement.isIfExists()) {
return;
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
index 92d0ceeb51e..d868767ad46 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfigu
import org.apache.shardingsphere.encrypt.distsql.parser.segment.EncryptColumnSegment;
import org.apache.shardingsphere.encrypt.distsql.parser.segment.EncryptRuleSegment;
import org.apache.shardingsphere.encrypt.distsql.parser.statement.AlterEncryptRuleStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidRuleConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
@@ -47,22 +46,22 @@ public final class AlterEncryptRuleStatementUpdaterTest {
private final AlterEncryptRuleStatementUpdater updater = new AlterEncryptRuleStatementUpdater();
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentRule() {
updater.checkSQLStatement(database, createSQLStatement("MD5"), null);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutToBeAlteredRules() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeAlteredRules() {
updater.checkSQLStatement(database, createSQLStatement("MD5"), new EncryptRuleConfiguration(Collections.emptyList(), Collections.emptyMap()));
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckSQLStatementWithoutToBeAlteredEncryptors() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeAlteredEncryptors() {
updater.checkSQLStatement(database, createSQLStatement("INVALID_TYPE"), createCurrentRuleConfiguration());
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithIncompleteDataType() throws DistSQLException {
+ public void assertCheckSQLStatementWithIncompleteDataType() {
EncryptColumnSegment columnSegment = new EncryptColumnSegment("user_id", "user_cipher", "user_plain", "assisted_column",
"int varchar(10)", null, null, null, new AlgorithmSegment("test", new Properties()),
new AlgorithmSegment("test", new Properties()));
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java
index ed352db2300..3cdf181e65f 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfigu
import org.apache.shardingsphere.encrypt.distsql.parser.segment.EncryptColumnSegment;
import org.apache.shardingsphere.encrypt.distsql.parser.segment.EncryptRuleSegment;
import org.apache.shardingsphere.encrypt.distsql.parser.statement.CreateEncryptRuleStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidRuleConfigurationException;
@@ -46,17 +45,17 @@ public final class CreateEncryptRuleStatementUpdaterTest {
private final CreateEncryptRuleStatementUpdater updater = new CreateEncryptRuleStatementUpdater();
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithDuplicateEncryptRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateEncryptRule() {
updater.checkSQLStatement(database, createSQLStatement("MD5"), getCurrentRuleConfig());
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckSQLStatementWithoutToBeCreatedEncryptors() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeCreatedEncryptors() {
updater.checkSQLStatement(database, createSQLStatement("INVALID_TYPE"), null);
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithIncompleteDataType() throws DistSQLException {
+ public void assertCheckSQLStatementWithIncompleteDataType() {
EncryptColumnSegment columnSegment = new EncryptColumnSegment("user_id", "user_cipher", "user_plain", "assisted_column",
"int varchar(10)", null, null, null, new AlgorithmSegment("test", new Properties()),
new AlgorithmSegment("test", new Properties()));
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
index bd1976fa346..fc68fd5e10e 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
@@ -22,7 +22,6 @@ import org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnRuleConfig
import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
import org.apache.shardingsphere.encrypt.distsql.parser.statement.DropEncryptRuleStatement;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.junit.Test;
@@ -39,8 +38,8 @@ import java.util.Map;
import java.util.Properties;
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.mock;
@@ -53,12 +52,12 @@ public final class DropEncryptRuleStatementUpdaterTest {
private ShardingSphereDatabase database;
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentRule() {
updater.checkSQLStatement(database, createSQLStatement("t_encrypt"), null);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutToBeDroppedRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeDroppedRule() {
updater.checkSQLStatement(database, createSQLStatement("t_encrypt"), new EncryptRuleConfiguration(Collections.emptyList(), Collections.emptyMap()));
}
@@ -77,7 +76,7 @@ public final class DropEncryptRuleStatementUpdaterTest {
}
@Test
- public void assertUpdateCurrentRuleConfigurationWithIfExists() throws DistSQLException {
+ public void assertUpdateCurrentRuleConfigurationWithIfExists() {
EncryptRuleConfiguration ruleConfig = createCurrentRuleConfiguration();
DropEncryptRuleStatement statement = createSQLStatement(true, "t_encrypt_1");
updater.checkSQLStatement(database, statement, mock(EncryptRuleConfiguration.class));
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readw [...]
index 350f96a453d..77c86c28d0e 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.readwritesplitting.distsql.handler.checker;
import com.google.common.base.Strings;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidRuleConfigurationException;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
@@ -42,10 +41,9 @@ public final class ReadwriteSplittingRuleStatementChecker {
* @param segments segments
* @param currentRuleConfig current rule config
* @param isCreating whether is creating
- * @throws DistSQLException DistSQL Exception
*/
public static void checkDuplicateResourceNames(final String databaseName, final Collection<ReadwriteSplittingRuleSegment> segments,
- final ReadwriteSplittingRuleConfiguration currentRuleConfig, final boolean isCreating) throws DistSQLException {
+ final ReadwriteSplittingRuleConfiguration currentRuleConfig, final boolean isCreating) {
Collection<String> existedWriteDataSourceNames = new HashSet<>();
Collection<String> existedReadDataSourceNames = new HashSet<>();
if (null != currentRuleConfig) {
@@ -65,8 +63,7 @@ public final class ReadwriteSplittingRuleStatementChecker {
return segments.stream().map(ReadwriteSplittingRuleSegment::getName).collect(Collectors.toSet());
}
- private static void checkDuplicateWriteResourceNames(final String databaseName, final Collection<ReadwriteSplittingRuleSegment> segments,
- final Collection<String> writeDataSourceNames) throws DistSQLException {
+ private static void checkDuplicateWriteResourceNames(final String databaseName, final Collection<ReadwriteSplittingRuleSegment> segments, final Collection<String> writeDataSourceNames) {
for (final ReadwriteSplittingRuleSegment each : segments) {
if (!Strings.isNullOrEmpty(each.getWriteDataSource())) {
String writeDataSource = each.getWriteDataSource();
@@ -77,7 +74,7 @@ public final class ReadwriteSplittingRuleStatementChecker {
}
private static void checkDuplicateReadResourceNames(final String databaseName, final Collection<ReadwriteSplittingRuleSegment> segments,
- final Collection<String> readDataSourceNames) throws DistSQLException {
+ final Collection<String> readDataSourceNames) {
for (final ReadwriteSplittingRuleSegment each : segments) {
if (null != each.getReadDataSources()) {
for (final String readDataSource : each.getReadDataSources()) {
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/r [...]
index b93ea12f0b5..be1679d4ad6 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdater.java
@@ -21,7 +21,6 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
import org.apache.shardingsphere.infra.distsql.constant.ExportableConstants;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
@@ -53,8 +52,7 @@ import java.util.stream.Collectors;
public final class AlterReadwriteSplittingRuleStatementUpdater implements RuleDefinitionAlterUpdater<AlterReadwriteSplittingRuleStatement, ReadwriteSplittingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final AlterReadwriteSplittingRuleStatement sqlStatement,
- final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final AlterReadwriteSplittingRuleStatement sqlStatement, final ReadwriteSplittingRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
checkToBeAlteredRules(databaseName, sqlStatement, currentRuleConfig);
@@ -91,7 +89,7 @@ public final class AlterReadwriteSplittingRuleStatementUpdater implements RuleDe
}
}
- private void checkToBeAlteredResources(final String databaseName, final AlterReadwriteSplittingRuleStatement sqlStatement, final ShardingSphereDatabase database) throws DistSQLException {
+ private void checkToBeAlteredResources(final String databaseName, final AlterReadwriteSplittingRuleStatement sqlStatement, final ShardingSphereDatabase database) {
Collection<String> requireResources = new LinkedHashSet<>();
Collection<String> requireDiscoverableResources = new LinkedHashSet<>();
sqlStatement.getRules().forEach(each -> {
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/ [...]
index c004041a2e0..84d34ab5fdf 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdater.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.readwritesplitting.distsql.handler.update;
import com.google.common.base.Strings;
import org.apache.shardingsphere.infra.distsql.constant.ExportableConstants;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
@@ -53,8 +52,7 @@ import java.util.stream.Collectors;
public final class CreateReadwriteSplittingRuleStatementUpdater implements RuleDefinitionCreateUpdater<CreateReadwriteSplittingRuleStatement, ReadwriteSplittingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final CreateReadwriteSplittingRuleStatement sqlStatement, final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateReadwriteSplittingRuleStatement sqlStatement, final ReadwriteSplittingRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkDuplicateRuleNames(databaseName, sqlStatement, currentRuleConfig, database.getResource());
checkToBeCreatedResources(databaseName, sqlStatement, database);
@@ -64,7 +62,7 @@ public final class CreateReadwriteSplittingRuleStatementUpdater implements RuleD
}
private void checkDuplicateRuleNames(final String databaseName, final CreateReadwriteSplittingRuleStatement sqlStatement,
- final ReadwriteSplittingRuleConfiguration currentRuleConfig, final ShardingSphereResource resource) throws DistSQLException {
+ final ReadwriteSplittingRuleConfiguration currentRuleConfig, final ShardingSphereResource resource) {
Collection<String> currentRuleNames = new LinkedList<>();
if (null != resource && null != resource.getDataSources()) {
currentRuleNames.addAll(resource.getDataSources().keySet());
@@ -82,7 +80,7 @@ public final class CreateReadwriteSplittingRuleStatementUpdater implements RuleD
}
}
- private void checkToBeCreatedResources(final String databaseName, final CreateReadwriteSplittingRuleStatement sqlStatement, final ShardingSphereDatabase database) throws DistSQLException {
+ private void checkToBeCreatedResources(final String databaseName, final CreateReadwriteSplittingRuleStatement sqlStatement, final ShardingSphereDatabase database) {
Collection<String> requireResources = new LinkedHashSet<>();
Collection<String> requireDiscoverableResources = new LinkedHashSet<>();
sqlStatement.getRules().forEach(each -> {
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphe [...]
index 837d4486455..df6ef7e8b07 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.readwritesplitting.distsql.handler.update;
import org.apache.shardingsphere.infra.distsql.constant.ExportableConstants;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidRuleConfigurationException;
@@ -66,23 +65,23 @@ public final class AlterReadwriteSplittingRuleStatementUpdaterTest {
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentRule() {
updater.checkSQLStatement(database, createSQLStatement("TEST"), null);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutToBeAlteredRules() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeAlteredRules() {
updater.checkSQLStatement(database, createSQLStatement("TEST"), new ReadwriteSplittingRuleConfiguration(Collections.emptyList(), Collections.emptyMap()));
}
@Test(expected = MissingRequiredResourcesException.class)
- public void assertCheckSQLStatementWithoutExistedResources() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutExistedResources() {
when(resource.getNotExistedResources(any())).thenReturn(Collections.singleton("read_ds_0"));
updater.checkSQLStatement(database, createSQLStatement("TEST"), createCurrentRuleConfiguration());
}
@Test(expected = MissingRequiredResourcesException.class)
- public void assertCheckSQLStatementWithoutExistedAutoAwareResources() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutExistedAutoAwareResources() {
ExportableRule exportableRule = mock(ExportableRule.class);
when(exportableRule.getExportData()).thenReturn(Collections.singletonMap(ExportableConstants.EXPORT_DB_DISCOVERY_PRIMARY_DATA_SOURCES, Collections.singletonMap("ms_group", "ds_0")));
when(database.getRuleMetaData().findRules(ExportableRule.class)).thenReturn(Collections.singleton(exportableRule));
@@ -91,34 +90,34 @@ public final class AlterReadwriteSplittingRuleStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckSQLStatementWithoutToBeAlteredLoadBalancers() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeAlteredLoadBalancers() {
when(database.getRuleMetaData().findRules(any())).thenReturn(Collections.emptyList());
updater.checkSQLStatement(database, createSQLStatement("INVALID_TYPE"), createCurrentRuleConfiguration());
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithDuplicateWriteResourceNamesInStatement() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateWriteResourceNamesInStatement() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getResource()).thenReturn(resource);
updater.checkSQLStatement(database, createSQLStatementWithDuplicateWriteResourceNames("readwrite_ds_0", "readwrite_ds_1", "TEST"), createCurrentRuleConfigurationWithMultipleRules());
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithDuplicateWriteResourceNames() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateWriteResourceNames() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getResource()).thenReturn(resource);
updater.checkSQLStatement(database, createSQLStatement("readwrite_ds_0", "ds_write_1", Arrays.asList("read_ds_0", "read_ds_1"), "TEST"), createCurrentRuleConfigurationWithMultipleRules());
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithDuplicateReadResourceNamesInStatement() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateReadResourceNamesInStatement() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getResource()).thenReturn(resource);
updater.checkSQLStatement(database, createSQLStatementWithDuplicateReadResourceNames("readwrite_ds_0", "readwrite_ds_1", "TEST"), createCurrentRuleConfigurationWithMultipleRules());
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithDuplicateReadResourceNames() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateReadResourceNames() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getResource()).thenReturn(resource);
updater.checkSQLStatement(database, createSQLStatement("readwrite_ds_1", "write_ds_1", Arrays.asList("read_ds_0_0", "read_ds_0_1"), "TEST"), createCurrentRuleConfigurationWithMultipleRules());
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsph [...]
index 46b13158c4d..ffc9ba75adb 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdaterTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.readwritesplitting.distsql.handler.update;
import org.apache.shardingsphere.infra.distsql.constant.ExportableConstants;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
@@ -26,6 +25,7 @@ import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidRuleConfigu
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResource;
import org.apache.shardingsphere.infra.rule.identifier.type.exportable.ExportableRule;
+import org.apache.shardingsphere.infra.util.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
import org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplittingDataSourceRuleConfiguration;
import org.apache.shardingsphere.readwritesplitting.api.strategy.StaticReadwriteSplittingStrategyConfiguration;
@@ -33,7 +33,6 @@ import org.apache.shardingsphere.readwritesplitting.distsql.parser.segment.Readw
import org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.CreateReadwriteSplittingRuleStatement;
import org.apache.shardingsphere.readwritesplitting.factory.ReadQueryLoadBalanceAlgorithmFactory;
import org.apache.shardingsphere.readwritesplitting.spi.ReadQueryLoadBalanceAlgorithm;
-import org.apache.shardingsphere.infra.util.spi.ShardingSphereServiceLoader;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -75,14 +74,14 @@ public final class CreateReadwriteSplittingRuleStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithDuplicateRuleNames() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateRuleNames() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getResource().getDataSources().keySet()).thenReturn(Collections.emptySet());
updater.checkSQLStatement(database, createSQLStatement("TEST"), createCurrentRuleConfiguration());
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithDuplicateResource() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateResource() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getResource()).thenReturn(resource);
when(resource.getDataSources()).thenReturn(Collections.singletonMap("write_ds", null));
@@ -90,13 +89,13 @@ public final class CreateReadwriteSplittingRuleStatementUpdaterTest {
}
@Test(expected = MissingRequiredResourcesException.class)
- public void assertCheckSQLStatementWithoutExistedResources() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutExistedResources() {
when(resource.getNotExistedResources(any())).thenReturn(Arrays.asList("read_ds_0", "read_ds_1"));
updater.checkSQLStatement(database, createSQLStatement("TEST"), null);
}
@Test(expected = MissingRequiredResourcesException.class)
- public void assertCheckSQLStatementWithoutExistedAutoAwareResources() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutExistedAutoAwareResources() {
ExportableRule exportableRule = mock(ExportableRule.class);
when(exportableRule.getExportData()).thenReturn(Collections.singletonMap(ExportableConstants.EXPORT_DB_DISCOVERY_PRIMARY_DATA_SOURCES, Collections.singletonMap("ms_group", "ds_0")));
when(database.getRuleMetaData().findRules(ExportableRule.class)).thenReturn(Collections.singleton(exportableRule));
@@ -105,41 +104,41 @@ public final class CreateReadwriteSplittingRuleStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckSQLStatementWithoutToBeCreatedLoadBalancers() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutToBeCreatedLoadBalancers() {
when(database.getRuleMetaData().findRules(any())).thenReturn(Collections.emptyList());
updater.checkSQLStatement(database, createSQLStatement("INVALID_TYPE"), null);
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithDuplicateWriteResourceNamesInStatement() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateWriteResourceNamesInStatement() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getResource()).thenReturn(resource);
updater.checkSQLStatement(database, createSQLStatementWithDuplicateWriteResourceNames("write_ds_0", "write_ds_1", "TEST"), null);
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithDuplicateWriteResourceNames() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateWriteResourceNames() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getResource()).thenReturn(resource);
updater.checkSQLStatement(database, createSQLStatement("readwrite_ds_1", "ds_write", Arrays.asList("read_ds_0", "read_ds_1"), "TEST"), createCurrentRuleConfiguration());
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithDuplicateReadResourceNamesInStatement() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateReadResourceNamesInStatement() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getResource()).thenReturn(resource);
updater.checkSQLStatement(database, createSQLStatementWithDuplicateReadResourceNames("write_ds_0", "write_ds_1", "TEST"), null);
}
@Test(expected = InvalidRuleConfigurationException.class)
- public void assertCheckSQLStatementWithDuplicateReadResourceNames() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateReadResourceNames() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getResource()).thenReturn(resource);
updater.checkSQLStatement(database, createSQLStatement("readwrite_ds_1", "write_ds_1", Arrays.asList("read_ds_0", "read_ds_1"), "TEST"), createCurrentRuleConfiguration());
}
@Test
- public void assertUpdateSuccess() throws DistSQLException {
+ public void assertUpdateSuccess() {
ExportableRule exportableRule = mock(ExportableRule.class);
when(exportableRule.getExportData()).thenReturn(Collections.singletonMap(ExportableConstants.EXPORT_DB_DISCOVERY_PRIMARY_DATA_SOURCES, Collections.singletonMap("ms_group", "ds_0")));
when(database.getRuleMetaData().findRules(ExportableRule.class)).thenReturn(Collections.singleton(exportableRule));
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java
index 1125dae7748..09bbab10022 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java
@@ -44,9 +44,8 @@ public class ShadowRuleStatementChecker {
*
* @param databaseName database name
* @param config configuration
- * @throws DistSQLException DistSQL exception
*/
- public static void checkConfigurationExist(final String databaseName, final DatabaseRuleConfiguration config) throws DistSQLException {
+ public static void checkConfigurationExist(final String databaseName, final DatabaseRuleConfiguration config) {
ShardingSpherePreconditions.checkNotNull(config, () -> new MissingRequiredRuleException(SHADOW, databaseName));
}
@@ -55,9 +54,8 @@ public class ShadowRuleStatementChecker {
*
* @param resources resource being checked
* @param database database
- * @throws DistSQLException DistSQL exception
*/
- public static void checkResourceExist(final Collection<String> resources, final ShardingSphereDatabase database) throws DistSQLException {
+ public static void checkResourceExist(final Collection<String> resources, final ShardingSphereDatabase database) {
Collection<String> notExistedResources = database.getResource().getNotExistedResources(resources);
ShardingSpherePreconditions.checkState(notExistedResources.isEmpty(), () -> new MissingRequiredResourcesException(database.getName(), notExistedResources));
}
@@ -66,9 +64,8 @@ public class ShadowRuleStatementChecker {
* Check the completeness of the algorithm.
*
* @param algorithmSegments algorithmSegments to be checked
- * @throws DistSQLException DistSQL exception
*/
- public static void checkAlgorithmCompleteness(final Collection<ShadowAlgorithmSegment> algorithmSegments) throws DistSQLException {
+ public static void checkAlgorithmCompleteness(final Collection<ShadowAlgorithmSegment> algorithmSegments) {
Set<ShadowAlgorithmSegment> incompleteAlgorithms = algorithmSegments.stream().filter(each -> !each.isComplete()).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(incompleteAlgorithms.isEmpty(), () -> new InvalidAlgorithmConfigurationException(SHADOW));
}
@@ -79,10 +76,9 @@ public class ShadowRuleStatementChecker {
* @param requireRules require rules
* @param currentRules current rules
* @param thrower thrower
- * @throws DistSQLException DistSQL exception
*/
public static void checkRulesExist(final Collection<String> requireRules,
- final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) {
ShadowRuleStatementChecker.checkAnyDifferent(requireRules, currentRules, thrower);
}
@@ -92,10 +88,9 @@ public class ShadowRuleStatementChecker {
* @param requireAlgorithms require algorithms
* @param currentAlgorithms current algorithms
* @param thrower thrower
- * @throws DistSQLException DistSQL exception
*/
public static void checkAlgorithmExist(final Collection<String> requireAlgorithms,
- final Collection<String> currentAlgorithms, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ final Collection<String> currentAlgorithms, final Function<Collection<String>, DistSQLException> thrower) {
ShadowRuleStatementChecker.checkAnyDifferent(requireAlgorithms, currentAlgorithms, thrower);
}
@@ -104,9 +99,8 @@ public class ShadowRuleStatementChecker {
*
* @param rules rules to be checked
* @param thrower exception thrower
- * @throws DistSQLException DistSQL exception
*/
- public static void checkAnyDuplicate(final Collection<String> rules, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ public static void checkAnyDuplicate(final Collection<String> rules, final Function<Collection<String>, DistSQLException> thrower) {
Collection<String> duplicateRequire = getDuplicate(rules);
ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> thrower.apply(duplicateRequire));
}
@@ -117,10 +111,9 @@ public class ShadowRuleStatementChecker {
* @param requireRules rules to be checked
* @param currentRules rules to be checked
* @param thrower exception thrower
- * @throws DistSQLException DistSQL exception
*/
public static void checkAnyDuplicate(final Collection<String> requireRules,
- final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) {
Collection<String> identical = getIdentical(requireRules, currentRules);
ShardingSpherePreconditions.checkState(identical.isEmpty(), () -> thrower.apply(identical));
}
@@ -131,10 +124,9 @@ public class ShadowRuleStatementChecker {
* @param requireRules rules to be checked
* @param currentRules rules to be checked
* @param thrower exception thrower
- * @throws DistSQLException DistSQL exception
*/
public static void checkAnyDifferent(final Collection<String> requireRules,
- final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) {
Collection<String> different = getDifferent(requireRules, currentRules);
ShardingSpherePreconditions.checkState(different.isEmpty(), () -> thrower.apply(different));
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowAlgorithmStatementUpdater.java
index a1841f9deff..17803436d4e 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowAlgorithmStatementUpdater.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.shadow.distsql.handler.update;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.AlgorithmInUsedException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionAlterUpdater;
@@ -58,16 +57,16 @@ public final class AlterShadowAlgorithmStatementUpdater implements RuleDefinitio
}
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final AlterShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final AlterShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
checkConfigurationExist(database.getName(), currentRuleConfig);
checkAlgorithms(database.getName(), sqlStatement, currentRuleConfig);
}
- private void checkConfigurationExist(final String databaseName, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkConfigurationExist(final String databaseName, final ShadowRuleConfiguration currentRuleConfig) {
ShadowRuleStatementChecker.checkConfigurationExist(databaseName, currentRuleConfig);
}
- private void checkAlgorithms(final String databaseName, final AlterShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkAlgorithms(final String databaseName, final AlterShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
ShadowRuleStatementChecker.checkAlgorithmCompleteness(sqlStatement.getAlgorithms());
Collection<String> requireAlgorithmNames = sqlStatement.getAlgorithms().stream().map(ShadowAlgorithmSegment::getAlgorithmName).collect(Collectors.toList());
ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, duplicated -> new AlgorithmInUsedException("Shadow", databaseName, duplicated));
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleStatementUpdater.java
index 56c0232e8d4..600bec38534 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleStatementUpdater.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.shadow.distsql.handler.update;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.AlgorithmInUsedException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
@@ -67,7 +66,7 @@ public final class AlterShadowRuleStatementUpdater implements RuleDefinitionAlte
}
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final AlterShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final AlterShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
Collection<ShadowRuleSegment> rules = sqlStatement.getRules();
checkConfigurationExist(databaseName, currentRuleConfig);
@@ -76,23 +75,23 @@ public final class AlterShadowRuleStatementUpdater implements RuleDefinitionAlte
checkAlgorithms(databaseName, rules);
}
- private void checkConfigurationExist(final String databaseName, final DatabaseRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkConfigurationExist(final String databaseName, final DatabaseRuleConfiguration currentRuleConfig) {
ShadowRuleStatementChecker.checkConfigurationExist(databaseName, currentRuleConfig);
}
- private void checkRuleNames(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkRuleNames(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) {
Collection<String> currentRuleNames = ShadowRuleStatementSupporter.getRuleNames(currentRuleConfig);
Collection<String> requireRuleNames = ShadowRuleStatementSupporter.getRuleNames(rules);
ShadowRuleStatementChecker.checkAnyDuplicate(requireRuleNames, duplicated -> new DuplicateRuleException(SHADOW, databaseName, duplicated));
ShadowRuleStatementChecker.checkRulesExist(requireRuleNames, currentRuleNames, different -> new InvalidAlgorithmConfigurationException("shadow rule name ", different));
}
- private void checkResources(final ShardingSphereDatabase database, final Collection<ShadowRuleSegment> rules) throws DistSQLException {
+ private void checkResources(final ShardingSphereDatabase database, final Collection<ShadowRuleSegment> rules) {
Collection<String> requireResource = ShadowRuleStatementSupporter.getResourceNames(rules);
ShadowRuleStatementChecker.checkResourceExist(requireResource, database);
}
- private void checkAlgorithms(final String databaseName, final Collection<ShadowRuleSegment> rules) throws DistSQLException {
+ private void checkAlgorithms(final String databaseName, final Collection<ShadowRuleSegment> rules) {
Collection<ShadowAlgorithmSegment> shadowAlgorithmSegment = ShadowRuleStatementSupporter.getShadowAlgorithmSegment(rules);
ShadowRuleStatementChecker.checkAlgorithmCompleteness(shadowAlgorithmSegment);
Collection<String> requireAlgorithms = ShadowRuleStatementSupporter.getAlgorithmNames(rules);
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java
index 434204d0da3..44f0148f05e 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.shadow.distsql.handler.update;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -47,11 +46,11 @@ public final class CreateDefaultShadowAlgorithmStatementUpdater implements RuleD
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
- final CreateDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final CreateDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
checkAlgorithmExist(database.getName(), sqlStatement, currentRuleConfig);
}
- private void checkAlgorithmExist(final String databaseName, final CreateDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkAlgorithmExist(final String databaseName, final CreateDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkState(currentRuleConfig.getShadowAlgorithms().containsKey(sqlStatement.getAlgorithmName()),
() -> new MissingRequiredAlgorithmException(databaseName, Collections.singleton(sqlStatement.getAlgorithmName())));
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowAlgorithmStatementUpdater.java
index 1c9f8e8b040..4a00d79224e 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowAlgorithmStatementUpdater.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.shadow.distsql.handler.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
@@ -61,25 +60,25 @@ public final class CreateShadowAlgorithmStatementUpdater implements RuleDefiniti
}
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
ShadowRuleStatementChecker.checkAlgorithmCompleteness(sqlStatement.getAlgorithms());
checkDuplicatedInput(database.getName(), sqlStatement);
checkExist(database.getName(), sqlStatement, currentRuleConfig);
checkAlgorithmType(sqlStatement);
}
- private void checkAlgorithmType(final CreateShadowAlgorithmStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithmType(final CreateShadowAlgorithmStatement sqlStatement) {
Collection<String> notExistedShadowAlgorithms = sqlStatement.getAlgorithms().stream().map(ShadowAlgorithmSegment::getAlgorithmSegment).map(AlgorithmSegment::getName)
.filter(each -> !ShadowAlgorithmFactory.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedShadowAlgorithms.isEmpty(), () -> new InvalidAlgorithmConfigurationException(SHADOW, notExistedShadowAlgorithms));
}
- private void checkDuplicatedInput(final String databaseName, final CreateShadowAlgorithmStatement sqlStatement) throws DistSQLException {
+ private void checkDuplicatedInput(final String databaseName, final CreateShadowAlgorithmStatement sqlStatement) {
Collection<String> requireAlgorithmNames = sqlStatement.getAlgorithms().stream().map(ShadowAlgorithmSegment::getAlgorithmName).collect(Collectors.toList());
ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, duplicated -> new DuplicateRuleException(SHADOW, databaseName, duplicated));
}
- private void checkExist(final String databaseName, final CreateShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final CreateShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
if (null == currentRuleConfig) {
return;
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowRuleStatementUpdater.java
index 08a32175ec9..dba61dbc00c 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowRuleStatementUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.shadow.distsql.handler.update;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -60,7 +59,7 @@ public final class CreateShadowRuleStatementUpdater implements RuleDefinitionCre
}
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
Collection<ShadowRuleSegment> rules = sqlStatement.getRules();
checkRuleNames(databaseName, rules, currentRuleConfig);
@@ -68,19 +67,19 @@ public final class CreateShadowRuleStatementUpdater implements RuleDefinitionCre
checkAlgorithms(databaseName, rules, currentRuleConfig);
}
- private void checkRuleNames(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkRuleNames(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) {
Collection<String> requireRuleNames = ShadowRuleStatementSupporter.getRuleNames(rules);
ShadowRuleStatementChecker.checkAnyDuplicate(requireRuleNames, duplicated -> new DuplicateRuleException(SHADOW, databaseName, duplicated));
Collection<String> currentRuleName = ShadowRuleStatementSupporter.getRuleNames(currentRuleConfig);
ShadowRuleStatementChecker.checkAnyDuplicate(requireRuleNames, currentRuleName, identical -> new DuplicateRuleException(SHADOW, databaseName, identical));
}
- private void checkResources(final ShardingSphereDatabase database, final Collection<ShadowRuleSegment> rules) throws DistSQLException {
+ private void checkResources(final ShardingSphereDatabase database, final Collection<ShadowRuleSegment> rules) {
Collection<String> requireResource = ShadowRuleStatementSupporter.getResourceNames(rules);
ShadowRuleStatementChecker.checkResourceExist(requireResource, database);
}
- private void checkAlgorithms(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkAlgorithms(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) {
Collection<ShadowAlgorithmSegment> requireAlgorithms = ShadowRuleStatementSupporter.getShadowAlgorithmSegment(rules);
ShadowRuleStatementChecker.checkAlgorithmCompleteness(requireAlgorithms);
Collection<String> requireAlgorithmNames = ShadowRuleStatementSupporter.getAlgorithmNames(rules);
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java
index 2bea4dd41d8..48c89cc4ff9 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.shadow.distsql.handler.update;
import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -38,7 +37,7 @@ public final class DropDefaultShadowAlgorithmStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereDatabase database, final DropDefaultShadowAlgorithmStatement sqlStatement,
- final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final ShadowRuleConfiguration currentRuleConfig) {
if (sqlStatement.isIfExists() && !isExistRuleConfig(currentRuleConfig)) {
return;
}
@@ -46,11 +45,11 @@ public final class DropDefaultShadowAlgorithmStatementUpdater implements RuleDef
checkAlgorithm(database.getName(), sqlStatement, currentRuleConfig);
}
- private void checkConfigurationExist(final String databaseName, final DatabaseRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkConfigurationExist(final String databaseName, final DatabaseRuleConfiguration currentRuleConfig) {
ShadowRuleStatementChecker.checkConfigurationExist(databaseName, currentRuleConfig);
}
- private void checkAlgorithm(final String databaseName, final DropDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkAlgorithm(final String databaseName, final DropDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
if (!sqlStatement.isIfExists()) {
ShardingSpherePreconditions.checkNotNull(currentRuleConfig.getDefaultShadowAlgorithmName(),
() -> new MissingRequiredAlgorithmException(SHADOW, databaseName, Collections.singleton("default")));
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java
index ce24e3f3f45..cbadb7ee8fb 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java
@@ -45,7 +45,7 @@ public final class DropShadowAlgorithmStatementUpdater implements RuleDefinition
private static final String SHADOW = "shadow";
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final DropShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final DropShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
if (sqlStatement.isIfExists() && !isExistRuleConfig(currentRuleConfig)) {
return;
}
@@ -53,11 +53,11 @@ public final class DropShadowAlgorithmStatementUpdater implements RuleDefinition
checkAlgorithm(database.getName(), sqlStatement, currentRuleConfig);
}
- private void checkConfigurationExist(final String databaseName, final DatabaseRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkConfigurationExist(final String databaseName, final DatabaseRuleConfiguration currentRuleConfig) {
ShadowRuleStatementChecker.checkConfigurationExist(databaseName, currentRuleConfig);
}
- private void checkAlgorithm(final String databaseName, final DropShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkAlgorithm(final String databaseName, final DropShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
Collection<String> currentAlgorithms = ShadowRuleStatementSupporter.getAlgorithmNames(currentRuleConfig);
Collection<String> requireAlgorithms = sqlStatement.getAlgorithmNames();
String defaultShadowAlgorithmName = currentRuleConfig.getDefaultShadowAlgorithmName();
@@ -70,7 +70,7 @@ public final class DropShadowAlgorithmStatementUpdater implements RuleDefinition
}
private void checkAlgorithmInUsed(final Collection<String> requireAlgorithms, final Collection<String> currentAlgorithms,
- final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ final Function<Collection<String>, DistSQLException> thrower) {
ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithms, currentAlgorithms, thrower);
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java
index 4c7a60d65f1..3a548819608 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.shadow.distsql.handler.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -36,7 +35,7 @@ public final class DropShadowRuleStatementUpdater implements RuleDefinitionDropU
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
- final DropShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final DropShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
if (sqlStatement.isIfExists() && !isExistRuleConfig(currentRuleConfig)) {
return;
}
@@ -44,11 +43,11 @@ public final class DropShadowRuleStatementUpdater implements RuleDefinitionDropU
checkRuleNames(database.getName(), sqlStatement, currentRuleConfig);
}
- private void checkConfigurationExist(final String databaseName, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkConfigurationExist(final String databaseName, final ShadowRuleConfiguration currentRuleConfig) {
ShadowRuleStatementChecker.checkConfigurationExist(databaseName, currentRuleConfig);
}
- private void checkRuleNames(final String databaseName, final DropShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkRuleNames(final String databaseName, final DropShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) {
Collection<String> currentRuleNames = currentRuleConfig.getDataSources().keySet();
if (!sqlStatement.isIfExists()) {
ShadowRuleStatementChecker.checkRulesExist(sqlStatement.getRuleNames(), currentRuleNames, different -> new MissingRequiredRuleException(SHADOW, databaseName, different));
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowAlgorithmStatementUpdaterTest.java
index 1bdcf831780..4ab7e297ca2 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowAlgorithmStatementUpdaterTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.shadow.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.AlgorithmInUsedException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
@@ -52,7 +51,7 @@ public final class AlterShadowAlgorithmStatementUpdaterTest {
private final AlterShadowAlgorithmStatementUpdater updater = new AlterShadowAlgorithmStatementUpdater();
@Test(expected = AlgorithmInUsedException.class)
- public void assertExecuteDuplicateAlgorithm() throws DistSQLException {
+ public void assertExecuteDuplicateAlgorithm() {
Properties prop = new Properties();
prop.setProperty("type", "value");
AlterShadowAlgorithmStatement sqlStatement = createSQLStatement(new ShadowAlgorithmSegment("simpleHintAlgorithm", new AlgorithmSegment("SIMPLE_HINT", prop)),
@@ -61,7 +60,7 @@ public final class AlterShadowAlgorithmStatementUpdaterTest {
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertExecuteAlgorithmWithoutConfiguration() throws DistSQLException {
+ public void assertExecuteAlgorithmWithoutConfiguration() {
Properties prop = new Properties();
prop.setProperty("type", "value");
AlterShadowAlgorithmStatement sqlStatement = createSQLStatement(new ShadowAlgorithmSegment("simpleHintAlgorithm", new AlgorithmSegment("SIMPLE_HINT", prop)));
@@ -69,7 +68,7 @@ public final class AlterShadowAlgorithmStatementUpdaterTest {
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertExecuteAlgorithmNotInMetaData() throws DistSQLException {
+ public void assertExecuteAlgorithmNotInMetaData() {
Properties prop = new Properties();
prop.setProperty("type", "value");
when(currentConfig.getShadowAlgorithms()).thenReturn(Collections.singletonMap("simpleHintAlgorithm", new AlgorithmConfiguration("type", prop)));
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java
index 85223a39224..fc3f671f193 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.shadow.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.AlgorithmInUsedException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
@@ -73,25 +72,25 @@ public final class AlterShadowRuleStatementUpdaterTest {
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertExecuteWithoutCurrentConfiguration() throws DistSQLException {
+ public void assertExecuteWithoutCurrentConfiguration() {
ShadowRuleSegment ruleSegment = new ShadowRuleSegment("ruleName", null, null, null);
updater.checkSQLStatement(database, createSQLStatement(ruleSegment, ruleSegment), null);
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicateRuleName() throws DistSQLException {
+ public void assertExecuteWithDuplicateRuleName() {
ShadowRuleSegment ruleSegment = new ShadowRuleSegment("ruleName", null, null, null);
updater.checkSQLStatement(database, createSQLStatement(ruleSegment, ruleSegment), currentConfig);
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithRuleNameNotInMetaData() throws DistSQLException {
+ public void assertExecuteWithRuleNameNotInMetaData() {
ShadowRuleSegment ruleSegment = new ShadowRuleSegment("ruleName", null, null, null);
updater.checkSQLStatement(database, createSQLStatement(ruleSegment), currentConfig);
}
@Test(expected = MissingRequiredResourcesException.class)
- public void assertExecuteWithNotExistResource() throws DistSQLException {
+ public void assertExecuteWithNotExistResource() {
List<String> dataSources = Arrays.asList("ds", "ds0");
when(resource.getNotExistedResources(any())).thenReturn(dataSources);
AlterShadowRuleStatement sqlStatement = createSQLStatement(new ShadowRuleSegment("initRuleName1", "ds3", null, null));
@@ -99,7 +98,7 @@ public final class AlterShadowRuleStatementUpdaterTest {
}
@Test(expected = AlgorithmInUsedException.class)
- public void assertExecuteDuplicateAlgorithm() throws DistSQLException {
+ public void assertExecuteDuplicateAlgorithm() {
Properties prop = new Properties();
prop.setProperty("type", "value");
ShadowAlgorithmSegment segment = new ShadowAlgorithmSegment("algorithmName", new AlgorithmSegment("name", prop));
@@ -109,7 +108,7 @@ public final class AlterShadowRuleStatementUpdaterTest {
}
@Test(expected = AlgorithmInUsedException.class)
- public void assertExecuteDuplicateAlgorithmWithoutConfiguration() throws DistSQLException {
+ public void assertExecuteDuplicateAlgorithmWithoutConfiguration() {
Properties prop = new Properties();
prop.setProperty("type", "value");
ShadowAlgorithmSegment segment = new ShadowAlgorithmSegment("algorithmName", new AlgorithmSegment("name", prop));
@@ -119,7 +118,7 @@ public final class AlterShadowRuleStatementUpdaterTest {
}
@Test
- public void assertExecuteSuccess() throws DistSQLException {
+ public void assertExecuteSuccess() {
Properties prop = new Properties();
prop.setProperty("type", "value");
ShadowAlgorithmSegment segment1 = new ShadowAlgorithmSegment("algorithmName1", new AlgorithmSegment("name", prop));
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateDefaultShadowAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateDefaultShadowAlgorithmStatementUpdaterTest.java
index 35938453926..b7bb24b0fb3 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateDefaultShadowAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateDefaultShadowAlgorithmStatementUpdaterTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.shadow.distsql.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
@@ -45,7 +44,7 @@ public final class CreateDefaultShadowAlgorithmStatementUpdaterTest {
private final CreateDefaultShadowAlgorithmStatementUpdater updater = new CreateDefaultShadowAlgorithmStatementUpdater();
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertExecuteWithNotExistAlgorithm() throws DistSQLException {
+ public void assertExecuteWithNotExistAlgorithm() {
when(currentConfig.getShadowAlgorithms()).thenReturn(Collections.singletonMap("default_name", null));
updater.checkSQLStatement(database, new CreateDefaultShadowAlgorithmStatement("input_default_name"), currentConfig);
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowAlgorithmStatementUpdaterTest.java
index cf09dc963cf..1e96c72d87a 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowAlgorithmStatementUpdaterTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.shadow.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -50,7 +49,7 @@ public final class CreateShadowAlgorithmStatementUpdaterTest {
private final CreateShadowAlgorithmStatementUpdater updater = new CreateShadowAlgorithmStatementUpdater();
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicateAlgorithm() throws DistSQLException {
+ public void assertExecuteWithDuplicateAlgorithm() {
Properties props = new Properties();
props.setProperty("type", "value");
CreateShadowAlgorithmStatement sqlStatement = createSQLStatement(new ShadowAlgorithmSegment("foo_algorithm", new AlgorithmSegment("SIMPLE_HINT", props)),
@@ -59,7 +58,7 @@ public final class CreateShadowAlgorithmStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithExistAlgorithm() throws DistSQLException {
+ public void assertExecuteWithExistAlgorithm() {
when(currentConfig.getShadowAlgorithms()).thenReturn(Collections.singletonMap("foo_algorithm", null));
Properties props = new Properties();
props.setProperty("type", "value");
@@ -68,7 +67,7 @@ public final class CreateShadowAlgorithmStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithAlgorithmCompleteness() throws DistSQLException {
+ public void assertExecuteWithAlgorithmCompleteness() {
Properties props = new Properties();
props.setProperty("type", "value");
CreateShadowAlgorithmStatement sqlStatement = createSQLStatement(new ShadowAlgorithmSegment("foo_algorithm", new AlgorithmSegment("", props)));
@@ -76,7 +75,7 @@ public final class CreateShadowAlgorithmStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithmType() throws DistSQLException {
+ public void assertExecuteWithInvalidAlgorithmType() {
Properties props = new Properties();
props.setProperty("type", "value");
CreateShadowAlgorithmStatement sqlStatement = createSQLStatement(new ShadowAlgorithmSegment("foo_algorithm", new AlgorithmSegment("NOT_EXISTED_ALGORITHM", props)));
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java
index 4ef3ab5fca4..a9ba9558a59 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.shadow.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -66,20 +65,20 @@ public final class CreateShadowRuleStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicateRuleName() throws DistSQLException {
+ public void assertExecuteWithDuplicateRuleName() {
ShadowRuleSegment ruleSegment = new ShadowRuleSegment("ruleName", null, null, null);
updater.checkSQLStatement(database, createSQLStatement(ruleSegment, ruleSegment), null);
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicateRuleNameInMetaData() throws DistSQLException {
+ public void assertExecuteWithDuplicateRuleNameInMetaData() {
when(currentConfig.getDataSources()).thenReturn(Collections.singletonMap("ruleName", null));
ShadowRuleSegment ruleSegment = new ShadowRuleSegment("ruleName", null, null, null);
updater.checkSQLStatement(database, createSQLStatement(ruleSegment), currentConfig);
}
@Test(expected = MissingRequiredResourcesException.class)
- public void assertExecuteWithNotExistResource() throws DistSQLException {
+ public void assertExecuteWithNotExistResource() {
List<String> dataSources = Arrays.asList("ds0", "ds1");
when(resource.getNotExistedResources(any())).thenReturn(dataSources);
CreateShadowRuleStatement sqlStatement = createSQLStatement(new ShadowRuleSegment("ruleName", "ds1", null, null));
@@ -87,7 +86,7 @@ public final class CreateShadowRuleStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteDuplicateAlgorithm() throws DistSQLException {
+ public void assertExecuteDuplicateAlgorithm() {
Properties prop = new Properties();
prop.setProperty("type", "value");
ShadowAlgorithmSegment segment = new ShadowAlgorithmSegment("algorithmName", new AlgorithmSegment("name", prop));
@@ -97,7 +96,7 @@ public final class CreateShadowRuleStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteDuplicateAlgorithmWithoutConfiguration() throws DistSQLException {
+ public void assertExecuteDuplicateAlgorithmWithoutConfiguration() {
Properties prop = new Properties();
prop.setProperty("type", "value");
ShadowAlgorithmSegment segment = new ShadowAlgorithmSegment("algorithmName", new AlgorithmSegment("name", prop));
@@ -107,7 +106,7 @@ public final class CreateShadowRuleStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteDuplicateAlgorithmInMetaData() throws DistSQLException {
+ public void assertExecuteDuplicateAlgorithmInMetaData() {
Properties prop = new Properties();
prop.setProperty("type", "value");
when(currentConfig.getShadowAlgorithms()).thenReturn(Collections.singletonMap("algorithmName", new AlgorithmConfiguration("type", prop)));
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmStatementUpdaterTest.java
index d419870c68d..f6c5e4490ee 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmStatementUpdaterTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.shadow.distsql.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
@@ -44,18 +43,18 @@ public final class DropDefaultShadowAlgorithmStatementUpdaterTest {
private final DropDefaultShadowAlgorithmStatementUpdater updater = new DropDefaultShadowAlgorithmStatementUpdater();
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertCheckWithoutDefaultAlgorithm() throws DistSQLException {
+ public void assertCheckWithoutDefaultAlgorithm() {
updater.checkSQLStatement(database, new DropDefaultShadowAlgorithmStatement(false), currentConfig);
}
@Test
- public void assertCheckWithIfExists() throws DistSQLException {
+ public void assertCheckWithIfExists() {
updater.checkSQLStatement(database, new DropDefaultShadowAlgorithmStatement(true), currentConfig);
updater.checkSQLStatement(database, new DropDefaultShadowAlgorithmStatement(true), null);
}
@Test
- public void assertUpdate() throws DistSQLException {
+ public void assertUpdate() {
ShadowRuleConfiguration ruleConfig = new ShadowRuleConfiguration();
ruleConfig.setDefaultShadowAlgorithmName("default");
DropDefaultShadowAlgorithmStatement statement = new DropDefaultShadowAlgorithmStatement(false);
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java
index fe74a54a2dd..750836824a3 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.shadow.distsql.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
@@ -46,18 +45,18 @@ public final class DropShadowAlgorithmStatementUpdaterTest {
private final DropShadowAlgorithmStatementUpdater updater = new DropShadowAlgorithmStatementUpdater();
@Test(expected = MissingRequiredRuleException.class)
- public void assertExecuteWithoutAlgorithmNameInMetaData() throws DistSQLException {
+ public void assertExecuteWithoutAlgorithmNameInMetaData() {
updater.checkSQLStatement(database, createSQLStatement("ruleSegment"), null);
}
@Test
- public void assertExecuteWithIfExists() throws DistSQLException {
+ public void assertExecuteWithIfExists() {
DropShadowAlgorithmStatement sqlStatement = createSQLStatement(true, "ruleSegment");
updater.checkSQLStatement(database, sqlStatement, mock(ShadowRuleConfiguration.class));
}
@Test
- public void assertUpdate() throws DistSQLException {
+ public void assertUpdate() {
DropShadowAlgorithmStatement sqlStatement = createSQLStatement(true, "ds_0");
ShadowRuleConfiguration ruleConfig = new ShadowRuleConfiguration();
ruleConfig.getTables().put("t_order", new ShadowTableConfiguration(new ArrayList<>(Collections.singleton("ds_0")), Collections.emptyList()));
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java
index 08e23fcfa9c..7b35cfa8799 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.shadow.distsql.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
@@ -56,18 +55,18 @@ public final class DropShadowRuleStatementUpdaterTest {
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertExecuteWithoutRuleNameInMetaData() throws DistSQLException {
+ public void assertExecuteWithoutRuleNameInMetaData() {
updater.checkSQLStatement(database, createSQLStatement("ruleSegment"), null);
}
@Test
- public void assertExecuteWithIfExists() throws DistSQLException {
+ public void assertExecuteWithIfExists() {
DropShadowRuleStatement sqlStatement = createSQLStatement(true, "ruleSegment");
updater.checkSQLStatement(database, sqlStatement, mock(ShadowRuleConfiguration.class));
}
@Test
- public void assertUpdate() throws DistSQLException {
+ public void assertUpdate() {
DropShadowRuleStatement sqlStatement = createSQLStatement(true, "ds_0");
ShadowRuleConfiguration ruleConfig = new ShadowRuleConfiguration();
ruleConfig.getTables().put("t_order", new ShadowTableConfiguration(new ArrayList<>(Collections.singleton("ds_0")), Collections.emptyList()));
@@ -77,7 +76,7 @@ public final class DropShadowRuleStatementUpdaterTest {
}
@Test
- public void assertExecuteSuccess() throws DistSQLException {
+ public void assertExecuteSuccess() {
updater.checkSQLStatement(database, createSQLStatement("initRuleName"), currentConfig);
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
index cf08bbed4e0..667650a4014 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
@@ -22,13 +22,12 @@ import com.google.common.base.Splitter;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.datanode.DataNode;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidRuleConfigurationException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
+import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
@@ -91,10 +90,9 @@ public final class ShardingTableRuleStatementChecker {
* @param database database
* @param rules rules
* @param currentRuleConfig current rule configuration
- * @throws DistSQLException definition violation exception
*/
public static void checkCreation(final ShardingSphereDatabase database,
- final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) {
check(database, rules, currentRuleConfig, true);
}
@@ -104,15 +102,13 @@ public final class ShardingTableRuleStatementChecker {
* @param database database
* @param rules rules
* @param currentRuleConfig current rule configuration
- * @throws DistSQLException definition violation exception
*/
- public static void checkAlteration(final ShardingSphereDatabase database,
- final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public static void checkAlteration(final ShardingSphereDatabase database, final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) {
check(database, rules, currentRuleConfig, false);
}
private static void check(final ShardingSphereDatabase database,
- final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig, final boolean isCreate) throws DistSQLException {
+ final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig, final boolean isCreate) {
String databaseName = database.getName();
checkTables(databaseName, rules, currentRuleConfig, isCreate);
checkResources(databaseName, rules, database);
@@ -144,7 +140,7 @@ public final class ShardingTableRuleStatementChecker {
defaultDatabaseShardingStrategyConfig, defaultTableShardingStrategyConfig, checkedConfig.getDefaultShardingColumn()));
}
- private static void checkResources(final String databaseName, final Collection<AbstractTableRuleSegment> rules, final ShardingSphereDatabase database) throws DistSQLException {
+ private static void checkResources(final String databaseName, final Collection<AbstractTableRuleSegment> rules, final ShardingSphereDatabase database) {
Collection<String> requiredResource = getRequiredResources(rules);
Collection<String> notExistedResources = database.getResource().getNotExistedResources(requiredResource);
Collection<String> logicResources = getLogicResources(database);
@@ -202,8 +198,7 @@ public final class ShardingTableRuleStatementChecker {
return dataNodeStr.contains(DELIMITER) && 2 == Splitter.on(DELIMITER).omitEmptyStrings().splitToList(dataNodeStr).size();
}
- private static void checkTables(final String databaseName, final Collection<AbstractTableRuleSegment> rules,
- final ShardingRuleConfiguration currentRuleConfig, final boolean isCreate) throws DistSQLException {
+ private static void checkTables(final String databaseName, final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig, final boolean isCreate) {
Collection<String> requiredTables = rules.stream().map(AbstractTableRuleSegment::getLogicTable).collect(Collectors.toList());
Collection<String> duplicatedTables = getDuplicate(requiredTables);
ShardingSpherePreconditions.checkState(duplicatedTables.isEmpty(), () -> new DuplicateRuleException("sharding", databaseName, duplicatedTables));
@@ -242,7 +237,7 @@ public final class ShardingTableRuleStatementChecker {
return result;
}
- private static void checkKeyGenerators(final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private static void checkKeyGenerators(final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) {
Set<String> notExistKeyGenerator = new LinkedHashSet<>(rules.size());
Set<String> requiredKeyGenerators = new LinkedHashSet<>(rules.size());
rules.stream().map(AbstractTableRuleSegment::getKeyGenerateStrategySegment).filter(Objects::nonNull)
@@ -254,7 +249,7 @@ public final class ShardingTableRuleStatementChecker {
ShardingSpherePreconditions.checkState(invalidKeyGenerators.isEmpty(), () -> new InvalidAlgorithmConfigurationException("key generator", invalidKeyGenerators));
}
- private static void checkAuditors(final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private static void checkAuditors(final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) {
Set<String> notExistAuditors = new LinkedHashSet<>();
Set<String> requiredAuditors = new LinkedHashSet<>();
Collection<AuditStrategySegment> auditStrategySegments = rules.stream().map(AbstractTableRuleSegment::getAuditStrategySegment).filter(Objects::nonNull).collect(Collectors.toList());
@@ -272,7 +267,7 @@ public final class ShardingTableRuleStatementChecker {
ShardingSpherePreconditions.checkState(invalidAuditors.isEmpty(), () -> new InvalidAlgorithmConfigurationException("auditor", invalidAuditors));
}
- private static void checkAutoTableRule(final Collection<AbstractTableRuleSegment> rules) throws DistSQLException {
+ private static void checkAutoTableRule(final Collection<AbstractTableRuleSegment> rules) {
Collection<AutoTableRuleSegment> autoTableRules = rules.stream().map(each -> (AutoTableRuleSegment) each).collect(Collectors.toList());
Optional<AlgorithmSegment> anyAutoTableRule = autoTableRules.stream().map(AutoTableRuleSegment::getShardingAlgorithmSegment).filter(Objects::nonNull).findAny();
if (anyAutoTableRule.isPresent()) {
@@ -280,7 +275,7 @@ public final class ShardingTableRuleStatementChecker {
}
}
- private static void checkAutoTableShardingAlgorithms(final Collection<AutoTableRuleSegment> rules) throws DistSQLException {
+ private static void checkAutoTableShardingAlgorithms(final Collection<AutoTableRuleSegment> rules) {
Collection<AutoTableRuleSegment> incompleteShardingRules = rules.stream().filter(each -> !each.isCompleteShardingAlgorithm()).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(incompleteShardingRules.isEmpty(), () -> new InvalidAlgorithmConfigurationException("sharding"));
Collection<String> invalidShardingAlgorithms = rules.stream().map(each -> each.getShardingAlgorithmSegment().getName()).distinct()
@@ -291,7 +286,7 @@ public final class ShardingTableRuleStatementChecker {
ShardingSpherePreconditions.checkState(invalidShardingAlgorithms.isEmpty(), () -> new InvalidAlgorithmConfigurationException("sharding", invalidShardingAlgorithms));
}
- private static void checkTableRule(final String databaseName, final ShardingRuleConfiguration currentRuleConfig, final Collection<AbstractTableRuleSegment> rules) throws DistSQLException {
+ private static void checkTableRule(final String databaseName, final ShardingRuleConfiguration currentRuleConfig, final Collection<AbstractTableRuleSegment> rules) {
Collection<TableRuleSegment> tableRules = rules.stream().map(each -> (TableRuleSegment) each).collect(Collectors.toList());
Optional<ShardingStrategySegment> anyTableRule = tableRules.stream().map(each -> Arrays.asList(each.getDatabaseStrategySegment(), each.getTableStrategySegment()))
.flatMap(Collection::stream).filter(Objects::nonNull).findAny();
@@ -300,7 +295,7 @@ public final class ShardingTableRuleStatementChecker {
}
}
- private static void checkStrategy(final String databaseName, final ShardingRuleConfiguration currentRuleConfig, final Collection<TableRuleSegment> rules) throws DistSQLException {
+ private static void checkStrategy(final String databaseName, final ShardingRuleConfiguration currentRuleConfig, final Collection<TableRuleSegment> rules) {
Collection<String> currentAlgorithms = null == currentRuleConfig ? Collections.emptySet() : currentRuleConfig.getShardingAlgorithms().keySet();
Collection<String> invalidAlgorithms = rules.stream().map(each -> Arrays.asList(each.getDatabaseStrategySegment(), each.getTableStrategySegment()))
.flatMap(Collection::stream).filter(Objects::nonNull).filter(each -> isInvalidStrategy(currentAlgorithms, each))
@@ -325,7 +320,7 @@ public final class ShardingTableRuleStatementChecker {
return rules.stream().collect(Collectors.groupingBy(each -> each.getClass().getSimpleName()));
}
- private static void checkBindingTableRules(final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private static void checkBindingTableRules(final Collection<AbstractTableRuleSegment> rules, final ShardingRuleConfiguration currentRuleConfig) {
if (null == currentRuleConfig || currentRuleConfig.getBindingTableGroups().isEmpty()) {
return;
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java
index 0289edce232..a96b69a0e07 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.handler.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
@@ -42,19 +41,18 @@ import java.util.Optional;
public final class AlterDefaultShardingStrategyStatementUpdater implements RuleDefinitionAlterUpdater<AlterDefaultShardingStrategyStatement, ShardingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final AlterDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final AlterDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
checkAlgorithm(databaseName, currentRuleConfig, sqlStatement);
checkExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkNotNull(currentRuleConfig, () -> new MissingRequiredRuleException("Sharding", databaseName));
}
- private void checkAlgorithm(final String databaseName, final ShardingRuleConfiguration currentRuleConfig, final AlterDefaultShardingStrategyStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithm(final String databaseName, final ShardingRuleConfiguration currentRuleConfig, final AlterDefaultShardingStrategyStatement sqlStatement) {
ShardingSpherePreconditions.checkState(ShardingStrategyType.contain(sqlStatement.getStrategyType()), () -> new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
ShardingSpherePreconditions.checkState(ShardingStrategyType.getValueOf(sqlStatement.getStrategyType()).isValid(sqlStatement.getShardingColumn()),
() -> new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
@@ -70,7 +68,7 @@ public final class AlterDefaultShardingStrategyStatementUpdater implements RuleD
return null != sqlStatement.getShardingAlgorithmName() || null != sqlStatement.getAlgorithmSegment();
}
- private void checkExist(final String databaseName, final AlterDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final AlterDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
Optional<ShardingStrategyConfiguration> strategyConfig = getStrategyConfiguration(currentRuleConfig, sqlStatement.getDefaultType());
ShardingSpherePreconditions.checkState(strategyConfig.isPresent(),
() -> new MissingRequiredRuleException(String.format("Default sharding %s strategy", sqlStatement.getDefaultType().toLowerCase()), databaseName));
@@ -94,10 +92,7 @@ public final class AlterDefaultShardingStrategyStatementUpdater implements RuleD
}
private String getShardingAlgorithmName(final AlterDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration shardingRuleConfig) {
- if (null != sqlStatement.getShardingAlgorithmName()) {
- return sqlStatement.getShardingAlgorithmName();
- }
- return createDefaultAlgorithm(sqlStatement, shardingRuleConfig);
+ return null == sqlStatement.getShardingAlgorithmName() ? createDefaultAlgorithm(sqlStatement, shardingRuleConfig) : sqlStatement.getShardingAlgorithmName();
}
private String createDefaultAlgorithm(final AlterDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration shardingRuleConfig) {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java
index a5a7865ddd8..89f0e1d37aa 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.handler.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
@@ -43,25 +42,25 @@ public final class AlterShardingAlgorithmStatementUpdater implements RuleDefinit
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
- final AlterShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final AlterShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> requireNames = sqlStatement.getAlgorithmSegments().stream().map(ShardingAlgorithmSegment::getShardingAlgorithmName).collect(Collectors.toList());
checkDuplicate(database.getName(), requireNames);
checkExist(requireNames, currentRuleConfig);
checkAlgorithmType(sqlStatement);
}
- private void checkDuplicate(final String databaseName, final Collection<String> requireNames) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final Collection<String> requireNames) {
Collection<String> duplicateRequire = requireNames.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
.filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> new DuplicateRuleException("sharding", databaseName, duplicateRequire));
}
- private void checkExist(final Collection<String> requireNames, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final Collection<String> requireNames, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> notExistAlgorithms = requireNames.stream().filter(each -> !currentRuleConfig.getShardingAlgorithms().containsKey(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistAlgorithms.isEmpty(), () -> new MissingRequiredAlgorithmException("sharding", notExistAlgorithms));
}
- private void checkAlgorithmType(final AlterShardingAlgorithmStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithmType(final AlterShardingAlgorithmStatement sqlStatement) {
Collection<String> requireNames = sqlStatement.getAlgorithmSegments().stream().map(ShardingAlgorithmSegment::getAlgorithmSegment).map(AlgorithmSegment::getName).collect(Collectors.toList());
Collection<String> invalidAlgorithmNames = requireNames.stream().filter(each -> !ShardingAlgorithmFactory.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(invalidAlgorithmNames.isEmpty(), () -> new InvalidAlgorithmConfigurationException("sharding", invalidAlgorithmNames));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAuditorStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAuditorStatementUpdater.java
index a960090717e..82a289cb4b7 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAuditorStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAuditorStatementUpdater.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.handler.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
@@ -42,8 +41,7 @@ import java.util.stream.Collectors;
public final class AlterShardingAuditorStatementUpdater implements RuleDefinitionAlterUpdater<AlterShardingAuditorStatement, ShardingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final AlterShardingAuditorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final AlterShardingAuditorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
Collection<String> requireNames = sqlStatement.getAuditorSegments().stream().map(ShardingAuditorSegment::getAuditorName).collect(Collectors.toList());
checkDuplicate(databaseName, requireNames);
@@ -51,18 +49,18 @@ public final class AlterShardingAuditorStatementUpdater implements RuleDefinitio
checkAlgorithmType(sqlStatement);
}
- private void checkDuplicate(final String databaseName, final Collection<String> requireNames) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final Collection<String> requireNames) {
Collection<String> duplicateRequire = requireNames.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
.filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> new DuplicateRuleException("sharding", databaseName, duplicateRequire));
}
- private void checkExist(final Collection<String> requireNames, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final Collection<String> requireNames, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> notExistAlgorithms = requireNames.stream().filter(each -> !currentRuleConfig.getAuditors().containsKey(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistAlgorithms.isEmpty(), () -> new MissingRequiredAlgorithmException("sharding", notExistAlgorithms));
}
- private void checkAlgorithmType(final AlterShardingAuditorStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithmType(final AlterShardingAuditorStatement sqlStatement) {
Collection<String> requireNames = sqlStatement.getAuditorSegments().stream()
.map(ShardingAuditorSegment::getAlgorithmSegment).map(AlgorithmSegment::getName).collect(Collectors.toList());
Collection<String> invalidAlgorithmNames = requireNames.stream().filter(each -> !KeyGenerateAlgorithmFactory.contains(each)).collect(Collectors.toList());
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java
index 8e49ac440f4..90d268af8df 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.handler.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
@@ -42,8 +41,7 @@ import java.util.stream.Collectors;
public final class AlterShardingKeyGeneratorStatementUpdater implements RuleDefinitionAlterUpdater<AlterShardingKeyGeneratorStatement, ShardingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final AlterShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final AlterShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
Collection<String> requireNames = sqlStatement.getKeyGeneratorSegments().stream().map(ShardingKeyGeneratorSegment::getKeyGeneratorName).collect(Collectors.toList());
checkDuplicate(databaseName, requireNames);
@@ -51,18 +49,18 @@ public final class AlterShardingKeyGeneratorStatementUpdater implements RuleDefi
checkAlgorithmType(sqlStatement);
}
- private void checkDuplicate(final String databaseName, final Collection<String> requireNames) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final Collection<String> requireNames) {
Collection<String> duplicateRequire = requireNames.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
.filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> new DuplicateRuleException("sharding", databaseName, duplicateRequire));
}
- private void checkExist(final Collection<String> requireNames, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final Collection<String> requireNames, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> notExistAlgorithms = requireNames.stream().filter(each -> !currentRuleConfig.getKeyGenerators().containsKey(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistAlgorithms.isEmpty(), () -> new MissingRequiredAlgorithmException("sharding", notExistAlgorithms));
}
- private void checkAlgorithmType(final AlterShardingKeyGeneratorStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithmType(final AlterShardingKeyGeneratorStatement sqlStatement) {
Collection<String> requireNames = sqlStatement.getKeyGeneratorSegments().stream()
.map(ShardingKeyGeneratorSegment::getAlgorithmSegment).map(AlgorithmSegment::getName).collect(Collectors.toList());
Collection<String> invalidAlgorithmNames = requireNames.stream().filter(each -> !KeyGenerateAlgorithmFactory.contains(each)).collect(Collectors.toList());
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingTableRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingTableRuleStatementUpdater.java
index 5a1f67b6556..4598fb72950 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingTableRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingTableRuleStatementUpdater.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionAlterUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -38,8 +37,7 @@ import java.util.stream.Collectors;
public final class AlterShardingTableRuleStatementUpdater implements RuleDefinitionAlterUpdater<AlterShardingTableRuleStatement, ShardingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final AlterShardingTableRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final AlterShardingTableRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkNotNull(currentRuleConfig, () -> new MissingRequiredRuleException("Sharding", database.getName()));
ShardingTableRuleStatementChecker.checkAlteration(database, sqlStatement.getRules(), currentRuleConfig);
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java
index 85bf55fcc22..5feab9b3486 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.handler.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
@@ -43,19 +42,18 @@ import java.util.Optional;
public final class CreateDefaultShardingStrategyStatementUpdater implements RuleDefinitionCreateUpdater<CreateDefaultShardingStrategyStatement, ShardingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final CreateDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
checkAlgorithm(databaseName, currentRuleConfig, sqlStatement);
checkExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkNotNull(currentRuleConfig, () -> new MissingRequiredRuleException("Sharding", databaseName));
}
- private void checkAlgorithm(final String databaseName, final ShardingRuleConfiguration currentRuleConfig, final CreateDefaultShardingStrategyStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithm(final String databaseName, final ShardingRuleConfiguration currentRuleConfig, final CreateDefaultShardingStrategyStatement sqlStatement) {
ShardingSpherePreconditions.checkState(ShardingStrategyType.contain(sqlStatement.getStrategyType()), () -> new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
ShardingSpherePreconditions.checkState(ShardingStrategyType.getValueOf(sqlStatement.getStrategyType())
.isValid(sqlStatement.getShardingColumn()), () -> new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
@@ -71,7 +69,7 @@ public final class CreateDefaultShardingStrategyStatementUpdater implements Rule
return null != sqlStatement.getShardingAlgorithmName() || null != sqlStatement.getAlgorithmSegment();
}
- private void checkExist(final String databaseName, final CreateDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final CreateDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
Optional<ShardingStrategyConfiguration> strategyConfig = getStrategyConfiguration(currentRuleConfig, sqlStatement.getDefaultType());
ShardingSpherePreconditions.checkState(!strategyConfig.isPresent(),
() -> new DuplicateRuleException(String.format("default sharding %s strategy", sqlStatement.getDefaultType().toLowerCase()), databaseName));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java
index 1ab00d0f9bd..59069e7d976 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java
@@ -42,14 +42,13 @@ import java.util.stream.Collectors;
public final class CreateShardingAlgorithmStatementUpdater implements RuleDefinitionCreateUpdater<CreateShardingAlgorithmStatement, ShardingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShardingAlgorithmStatement sqlStatement,
- final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkDuplicate(databaseName, sqlStatement, currentRuleConfig);
checkAlgorithm(sqlStatement);
}
- private void checkDuplicate(final String databaseName, final CreateShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final CreateShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> shardingAlgorithmNames = sqlStatement.getAlgorithmSegments().stream().map(ShardingAlgorithmSegment::getShardingAlgorithmName).collect(Collectors.toList());
checkDuplicateInput(shardingAlgorithmNames, duplicated -> new DuplicateRuleException("sharding", databaseName, duplicated));
if (currentRuleConfig != null) {
@@ -57,18 +56,18 @@ public final class CreateShardingAlgorithmStatementUpdater implements RuleDefini
}
}
- private void checkDuplicateInput(final Collection<String> rules, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ private void checkDuplicateInput(final Collection<String> rules, final Function<Collection<String>, DistSQLException> thrower) {
Collection<String> duplicateRequire = rules.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
.filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> thrower.apply(duplicateRequire));
}
- private void checkExist(final Collection<String> requireRules, final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ private void checkExist(final Collection<String> requireRules, final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) {
Collection<String> identical = requireRules.stream().filter(currentRules::contains).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(identical.isEmpty(), () -> thrower.apply(identical));
}
- private void checkAlgorithm(final CreateShardingAlgorithmStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithm(final CreateShardingAlgorithmStatement sqlStatement) {
Collection<String> notExistedShardingAlgorithms = sqlStatement.getAlgorithmSegments().stream().map(ShardingAlgorithmSegment::getAlgorithmSegment).map(AlgorithmSegment::getName)
.filter(each -> !ShardingAlgorithmFactory.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedShardingAlgorithms.isEmpty(), () -> new InvalidAlgorithmConfigurationException("sharding", notExistedShardingAlgorithms));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAuditorStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAuditorStatementUpdater.java
index fb30e1c830d..832d0cb1343 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAuditorStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAuditorStatementUpdater.java
@@ -42,13 +42,12 @@ import java.util.stream.Collectors;
public final class CreateShardingAuditorStatementUpdater implements RuleDefinitionCreateUpdater<CreateShardingAuditorStatement, ShardingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShardingAuditorStatement sqlStatement,
- final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShardingAuditorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
checkDuplicate(database.getName(), sqlStatement, currentRuleConfig);
checkAuditorAlgorithm(sqlStatement);
}
- private void checkDuplicate(final String databaseName, final CreateShardingAuditorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final CreateShardingAuditorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> auditorNames = sqlStatement.getAuditorSegments().stream().map(ShardingAuditorSegment::getAuditorName).collect(Collectors.toList());
checkDuplicateInput(auditorNames, duplicated -> new DuplicateAlgorithmException("Sharding auditor", databaseName, duplicated));
if (null != currentRuleConfig) {
@@ -56,18 +55,18 @@ public final class CreateShardingAuditorStatementUpdater implements RuleDefiniti
}
}
- private void checkDuplicateInput(final Collection<String> rules, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ private void checkDuplicateInput(final Collection<String> rules, final Function<Collection<String>, DistSQLException> thrower) {
Collection<String> duplicateRequire = rules.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
.filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> thrower.apply(duplicateRequire));
}
- private void checkExist(final Collection<String> requireRules, final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ private void checkExist(final Collection<String> requireRules, final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) {
Collection<String> identical = requireRules.stream().filter(currentRules::contains).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(identical.isEmpty(), () -> thrower.apply(identical));
}
- private void checkAuditorAlgorithm(final CreateShardingAuditorStatement sqlStatement) throws DistSQLException {
+ private void checkAuditorAlgorithm(final CreateShardingAuditorStatement sqlStatement) {
Collection<String> notExistedAuditorAlgorithms = sqlStatement.getAuditorSegments().stream().map(ShardingAuditorSegment::getAlgorithmSegment).map(AlgorithmSegment::getName)
.filter(each -> !ShardingAuditAlgorithmFactory.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedAuditorAlgorithms.isEmpty(), () -> new InvalidAlgorithmConfigurationException("sharding", notExistedAuditorAlgorithms));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBindingTableRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBindingTableRuleStatementUpd [...]
index e0ea0b5cf71..4ae813455b8 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBindingTableRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBindingTableRuleStatementUpdater.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
@@ -41,7 +40,7 @@ public final class CreateShardingBindingTableRuleStatementUpdater implements Rul
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
- final CreateShardingBindingTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final CreateShardingBindingTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
checkToBeCreatedBindingTables(databaseName, sqlStatement, currentRuleConfig);
@@ -55,7 +54,7 @@ public final class CreateShardingBindingTableRuleStatementUpdater implements Rul
}
private void checkToBeCreatedBindingTables(final String databaseName,
- final CreateShardingBindingTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final CreateShardingBindingTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> currentLogicTables = getCurrentLogicTables(currentRuleConfig);
Collection<String> notExistedBindingTables = sqlStatement.getBindingTables().stream()
.filter(each -> !containsIgnoreCase(currentLogicTables, each)).collect(Collectors.toSet());
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java
index 4ef1ae039f8..d54e84ac312 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java
@@ -43,12 +43,12 @@ public final class CreateShardingKeyGeneratorStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
- final CreateShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final CreateShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
checkDuplicate(database.getName(), sqlStatement, currentRuleConfig);
checkKeyGeneratorAlgorithm(sqlStatement);
}
- private void checkDuplicate(final String databaseName, final CreateShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final CreateShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> keyGeneratorNames = sqlStatement.getKeyGeneratorSegments().stream().map(ShardingKeyGeneratorSegment::getKeyGeneratorName).collect(Collectors.toList());
checkDuplicateInput(keyGeneratorNames, duplicated -> new DuplicateAlgorithmException("Key generator", databaseName, duplicated));
if (null != currentRuleConfig) {
@@ -56,18 +56,18 @@ public final class CreateShardingKeyGeneratorStatementUpdater implements RuleDef
}
}
- private void checkDuplicateInput(final Collection<String> rules, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ private void checkDuplicateInput(final Collection<String> rules, final Function<Collection<String>, DistSQLException> thrower) {
Collection<String> duplicateRequire = rules.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
.filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> thrower.apply(duplicateRequire));
}
- private void checkExist(final Collection<String> requireRules, final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) throws DistSQLException {
+ private void checkExist(final Collection<String> requireRules, final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) {
Collection<String> identical = requireRules.stream().filter(currentRules::contains).collect(Collectors.toSet());
ShardingSpherePreconditions.checkState(identical.isEmpty(), () -> thrower.apply(identical));
}
- private void checkKeyGeneratorAlgorithm(final CreateShardingKeyGeneratorStatement sqlStatement) throws DistSQLException {
+ private void checkKeyGeneratorAlgorithm(final CreateShardingKeyGeneratorStatement sqlStatement) {
Collection<String> notExistedKeyGeneratorAlgorithms = sqlStatement.getKeyGeneratorSegments().stream().map(ShardingKeyGeneratorSegment::getAlgorithmSegment).map(AlgorithmSegment::getName)
.filter(each -> !KeyGenerateAlgorithmFactory.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedKeyGeneratorAlgorithms.isEmpty(), () -> new InvalidAlgorithmConfigurationException("sharding", notExistedKeyGeneratorAlgorithms));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableRuleStatementUpdater.java
index 21b8a271d48..9215a7f9c57 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableRuleStatementUpdater.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -31,8 +30,7 @@ import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardin
public final class CreateShardingTableRuleStatementUpdater implements RuleDefinitionCreateUpdater<CreateShardingTableRuleStatement, ShardingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShardingTableRuleStatement sqlStatement,
- final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShardingTableRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
ShardingTableRuleStatementChecker.checkCreation(database, sqlStatement.getRules(), currentRuleConfig);
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
index 427529c6589..387323bcbe9 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -36,7 +35,7 @@ public final class DropDefaultStrategyStatementUpdater implements RuleDefinition
@Override
public void checkSQLStatement(final ShardingSphereDatabase database, final DropDefaultShardingStrategyStatement sqlStatement,
- final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final ShardingRuleConfiguration currentRuleConfig) {
if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExists()) {
return;
}
@@ -45,7 +44,7 @@ public final class DropDefaultStrategyStatementUpdater implements RuleDefinition
checkExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkExist(final String databaseName, final DropDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final DropDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
if (sqlStatement.isIfExists()) {
return;
}
@@ -61,7 +60,7 @@ public final class DropDefaultStrategyStatementUpdater implements RuleDefinition
return Optional.ofNullable(result);
}
- private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkNotNull(currentRuleConfig, () -> new MissingRequiredRuleException("Sharding", databaseName));
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAuditorStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAuditorStatementUpdater.java
index 98eef9df877..2c39017a58a 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAuditorStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAuditorStatementUpdater.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.AlgorithmInUsedException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
@@ -39,8 +38,7 @@ import java.util.stream.Collectors;
public final class DropShardingAuditorStatementUpdater implements RuleDefinitionDropUpdater<DropShardingAuditorStatement, ShardingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final DropShardingAuditorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final DropShardingAuditorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
if (null == currentRuleConfig && sqlStatement.isIfExists()) {
return;
}
@@ -50,8 +48,7 @@ public final class DropShardingAuditorStatementUpdater implements RuleDefinition
checkInUsed(databaseName, auditorNames, currentRuleConfig);
}
- private void checkExist(final String databaseName, final Collection<String> auditorNames, final ShardingRuleConfiguration currentRuleConfig,
- final DropShardingAuditorStatement sqlStatement) throws DistSQLException {
+ private void checkExist(final String databaseName, final Collection<String> auditorNames, final ShardingRuleConfiguration currentRuleConfig, final DropShardingAuditorStatement sqlStatement) {
if (sqlStatement.isIfExists()) {
return;
}
@@ -59,7 +56,7 @@ public final class DropShardingAuditorStatementUpdater implements RuleDefinition
ShardingSpherePreconditions.checkState(notExistAuditors.isEmpty(), () -> new MissingRequiredAlgorithmException("Sharding auditor", databaseName, notExistAuditors));
}
- private void checkInUsed(final String databaseName, final Collection<String> auditorNames, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkInUsed(final String databaseName, final Collection<String> auditorNames, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> usedAuditors = getUsedAuditors(currentRuleConfig);
Collection<String> inUsedNames = auditorNames.stream().filter(usedAuditors::contains).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(inUsedNames.isEmpty(), () -> new AlgorithmInUsedException("Sharding auditor", databaseName, inUsedNames));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java
index 2f3be63e6c2..880b9a81a17 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.handler.update;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -47,8 +46,7 @@ public final class DropShardingBindingTableRuleStatementUpdater implements RuleD
private Map<String, String> bindingTableRules = Collections.emptyMap();
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final DropShardingBindingTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final DropShardingBindingTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExists()) {
return;
}
@@ -58,7 +56,7 @@ public final class DropShardingBindingTableRuleStatementUpdater implements RuleD
checkBindingTableRuleExist(databaseName, sqlStatement, bindingTableRules);
}
- private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkState(null != currentRuleConfig && !currentRuleConfig.getBindingTableGroups().isEmpty(), () -> new MissingRequiredRuleException("Binding", databaseName));
}
@@ -69,7 +67,7 @@ public final class DropShardingBindingTableRuleStatementUpdater implements RuleD
}
private void checkBindingTableRuleExist(final String databaseName, final DropShardingBindingTableRulesStatement sqlStatement,
- final Map<String, String> bindingRelationship) throws DistSQLException {
+ final Map<String, String> bindingRelationship) {
if (sqlStatement.isIfExists()) {
return;
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpd [...]
index 825728dd5ea..59b3b14a04f 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpdater.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -35,7 +34,7 @@ public final class DropShardingBroadcastTableRuleStatementUpdater implements Rul
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
- final DropShardingBroadcastTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final DropShardingBroadcastTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExists()) {
return;
@@ -45,7 +44,7 @@ public final class DropShardingBroadcastTableRuleStatementUpdater implements Rul
}
private void checkBroadcastTableRuleExist(final String databaseName,
- final DropShardingBroadcastTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final DropShardingBroadcastTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
if (sqlStatement.isIfExists()) {
return;
}
@@ -60,7 +59,7 @@ public final class DropShardingBroadcastTableRuleStatementUpdater implements Rul
return collection.stream().anyMatch(each -> each.equalsIgnoreCase(str));
}
- private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkNotNull(currentRuleConfig, () -> new MissingRequiredRuleException("Broadcast", databaseName));
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java
index c0df44ef44a..653f87173a0 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
import com.google.common.base.Strings;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.AlgorithmInUsedException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
@@ -40,8 +39,7 @@ import java.util.stream.Collectors;
public final class DropShardingKeyGeneratorStatementUpdater implements RuleDefinitionDropUpdater<DropShardingKeyGeneratorStatement, ShardingRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final DropShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final DropShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
if (null == currentRuleConfig && sqlStatement.isIfExists()) {
return;
}
@@ -51,8 +49,8 @@ public final class DropShardingKeyGeneratorStatementUpdater implements RuleDefin
checkInUsed(databaseName, keyGeneratorNames, currentRuleConfig);
}
- private void checkExist(final String databaseName, final Collection<String> keyGeneratorNames, final ShardingRuleConfiguration currentRuleConfig,
- final DropShardingKeyGeneratorStatement sqlStatement) throws DistSQLException {
+ private void checkExist(final String databaseName, final Collection<String> keyGeneratorNames,
+ final ShardingRuleConfiguration currentRuleConfig, final DropShardingKeyGeneratorStatement sqlStatement) {
if (sqlStatement.isIfExists()) {
return;
}
@@ -60,7 +58,7 @@ public final class DropShardingKeyGeneratorStatementUpdater implements RuleDefin
ShardingSpherePreconditions.checkState(notExistKeyGenerators.isEmpty(), () -> new MissingRequiredAlgorithmException("Key generator", databaseName, notExistKeyGenerators));
}
- private void checkInUsed(final String databaseName, final Collection<String> keyGeneratorNames, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkInUsed(final String databaseName, final Collection<String> keyGeneratorNames, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> usedKeyGenerators = getUsedKeyGenerators(currentRuleConfig);
Collection<String> inUsedNames = keyGeneratorNames.stream().filter(usedKeyGenerators::contains).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(inUsedNames.isEmpty(), () -> new AlgorithmInUsedException("Key generator", databaseName, inUsedNames));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
index c07010bc49a..09df22b4acb 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.checker;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
@@ -83,7 +82,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test
- public void assertCheckerAutoTableSuccess() throws DistSQLException {
+ public void assertCheckerAutoTableSuccess() {
Collection<AbstractTableRuleSegment> rules = new LinkedList<>();
rules.add(createCompleteAutoTableRule());
rules.add(createCompleteTableRule());
@@ -94,7 +93,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test
- public void assertCheckerBindingTableSuccess() throws DistSQLException {
+ public void assertCheckerBindingTableSuccess() {
ShardingRuleConfiguration shardingRuleConfig = createShardingRuleConfiguration();
shardingRuleConfig.getBindingTableGroups().add("t_order,t_order_item");
Collection<AbstractTableRuleSegment> rules = new LinkedList<>();
@@ -106,7 +105,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertCheckCreationWithDuplicated() throws DistSQLException {
+ public void assertCheckCreationWithDuplicated() {
List<AbstractTableRuleSegment> rules = Arrays.asList(
new AutoTableRuleSegment("t_order_duplicated", Arrays.asList("ds_0", "ds_1")),
new AutoTableRuleSegment("t_order_duplicated", Arrays.asList("ds_0", "ds_1")));
@@ -114,32 +113,32 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertCheckCreationWithIdentical() throws DistSQLException {
+ public void assertCheckCreationWithIdentical() {
List<AbstractTableRuleSegment> rules = Collections.singletonList(new AutoTableRuleSegment("t_order", Arrays.asList("ds_0", "ds_1")));
ShardingTableRuleStatementChecker.checkCreation(database, rules, shardingRuleConfig);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckAlterationWithRuleRequiredMissed() throws DistSQLException {
+ public void assertCheckAlterationWithRuleRequiredMissed() {
List<AbstractTableRuleSegment> rules = Collections.singletonList(new AutoTableRuleSegment("t_order_required_missed", Arrays.asList("ds_0", "ds_1")));
ShardingTableRuleStatementChecker.checkAlteration(database, rules, shardingRuleConfig);
}
@Test(expected = MissingRequiredResourcesException.class)
- public void assertCheckCreationWithResourceRequiredMissed() throws DistSQLException {
+ public void assertCheckCreationWithResourceRequiredMissed() {
List<AbstractTableRuleSegment> rules = Collections.singletonList(new AutoTableRuleSegment("t_product", Arrays.asList("ds_required_missed", "ds_1")));
ShardingTableRuleStatementChecker.checkCreation(database, rules, shardingRuleConfig);
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckCreationWithInvalidKeyGenerateAlgorithm() throws DistSQLException {
+ public void assertCheckCreationWithInvalidKeyGenerateAlgorithm() {
AutoTableRuleSegment autoTableRuleSegment = new AutoTableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
autoTableRuleSegment.setKeyGenerateStrategySegment(new KeyGenerateStrategySegment("product_id", new AlgorithmSegment("invalid", newProperties("invalid", "invalid"))));
ShardingTableRuleStatementChecker.checkCreation(database, Collections.singleton(autoTableRuleSegment), shardingRuleConfig);
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertCheckCreationWithMissedAuditAlgorithm() throws DistSQLException {
+ public void assertCheckCreationWithMissedAuditAlgorithm() {
AutoTableRuleSegment autoTableRuleSegment = new AutoTableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
autoTableRuleSegment.setAuditStrategySegment(new AuditStrategySegment(Collections.singleton("invalid"),
Collections.singletonList(new ShardingAuditorSegment("invalid", new AlgorithmSegment("DML_SHARDING_CONDITIONS", new Properties()))), true));
@@ -147,7 +146,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckCreationWithInvalidAuditAlgorithm() throws DistSQLException {
+ public void assertCheckCreationWithInvalidAuditAlgorithm() {
AutoTableRuleSegment autoTableRuleSegment = new AutoTableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
autoTableRuleSegment.setAuditStrategySegment(new AuditStrategySegment(Collections.singleton("sharding_key_required_auditor"),
Collections.singletonList(new ShardingAuditorSegment("sharding_key_required_auditor", new AlgorithmSegment("invalid", new Properties()))), true));
@@ -155,7 +154,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckAutoTableWithNotExistShardingAlgorithms() throws DistSQLException {
+ public void assertCheckAutoTableWithNotExistShardingAlgorithms() {
AutoTableRuleSegment autoTableRuleSegment = new AutoTableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
autoTableRuleSegment.setShardingColumn("product_id");
autoTableRuleSegment.setShardingAlgorithmSegment(new AlgorithmSegment("not_exist", newProperties("", "")));
@@ -166,7 +165,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckAutoTableWithComplexShardingAlgorithms() throws DistSQLException {
+ public void assertCheckAutoTableWithComplexShardingAlgorithms() {
AutoTableRuleSegment autoTableRuleSegment = new AutoTableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
autoTableRuleSegment.setShardingColumn("product_id");
autoTableRuleSegment.setShardingAlgorithmSegment(new AlgorithmSegment("complex", newProperties("", "")));
@@ -175,7 +174,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckTableWithInvalidShardingStrategyType() throws DistSQLException {
+ public void assertCheckTableWithInvalidShardingStrategyType() {
TableRuleSegment tableRuleSegment = new TableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
tableRuleSegment.setTableStrategySegment(new ShardingStrategySegment("invalid", "product_id", "t_order_algorithm", null));
List<AbstractTableRuleSegment> rules = Collections.singletonList(tableRuleSegment);
@@ -183,7 +182,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckTableWithUnmatchedShardingStrategyType1() throws DistSQLException {
+ public void assertCheckTableWithUnmatchedShardingStrategyType1() {
TableRuleSegment tableRuleSegment = new TableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
tableRuleSegment.setTableStrategySegment(new ShardingStrategySegment("complex", "product_id", "t_order_algorithm", null));
List<AbstractTableRuleSegment> rules = Collections.singletonList(tableRuleSegment);
@@ -191,7 +190,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckTableWithUnmatchedShardingStrategyType2() throws DistSQLException {
+ public void assertCheckTableWithUnmatchedShardingStrategyType2() {
TableRuleSegment tableRuleSegment = new TableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
tableRuleSegment.setTableStrategySegment(new ShardingStrategySegment("standard", "product_id,user_id", "t_order_algorithm", null));
List<AbstractTableRuleSegment> rules = Collections.singletonList(tableRuleSegment);
@@ -199,7 +198,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckTableWithInvalidAlgorithmName() throws DistSQLException {
+ public void assertCheckTableWithInvalidAlgorithmName() {
TableRuleSegment tableRuleSegment = new TableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
tableRuleSegment.setTableStrategySegment(new ShardingStrategySegment("hint", "product_id", "invalid", null));
List<AbstractTableRuleSegment> rules = Collections.singletonList(tableRuleSegment);
@@ -207,7 +206,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckTableWithInvalidAlgorithmNameWhenCurrentRuleConfigIsNull() throws DistSQLException {
+ public void assertCheckTableWithInvalidAlgorithmNameWhenCurrentRuleConfigIsNull() {
TableRuleSegment tableRuleSegment = new TableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
tableRuleSegment.setTableStrategySegment(new ShardingStrategySegment("hint", "product_id", "invalid", null));
List<AbstractTableRuleSegment> rules = Collections.singletonList(tableRuleSegment);
@@ -215,7 +214,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test
- public void assertCheckNullAlgorithmNameAndAlgorithmSegment() throws DistSQLException {
+ public void assertCheckNullAlgorithmNameAndAlgorithmSegment() {
TableRuleSegment tableRuleSegment = new TableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
AlgorithmSegment databaseAlgorithmSegment = new AlgorithmSegment("inline", newProperties("algorithm-expression", "ds_${product_id% 2}"));
tableRuleSegment.setTableStrategySegment(new ShardingStrategySegment("standard", "product_id", null, databaseAlgorithmSegment));
@@ -224,7 +223,7 @@ public final class ShardingRuleStatementCheckerTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertCheckNullAlgorithmNameAndNullAlgorithmSegment() throws DistSQLException {
+ public void assertCheckNullAlgorithmNameAndNullAlgorithmSegment() {
TableRuleSegment tableRuleSegment = new TableRuleSegment("t_product", Arrays.asList("ds_0", "ds_1"));
tableRuleSegment.setTableStrategySegment(new ShardingStrategySegment("standard", "product_id", null, null));
List<AbstractTableRuleSegment> rules = Collections.singletonList(tableRuleSegment);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java
index 8e4f7a8794c..7ae0b94351a 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
@@ -54,18 +53,18 @@ public final class AlterDefaultShardingStrategyStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidStrategyType() throws DistSQLException {
+ public void assertExecuteWithInvalidStrategyType() {
updater.checkSQLStatement(database, new AlterDefaultShardingStrategyStatement("TABLE", "invalidType", null, "order_id_algorithm", null), new ShardingRuleConfiguration());
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertExecuteWithoutCurrentConfiguration() throws DistSQLException {
+ public void assertExecuteWithoutCurrentConfiguration() {
AlterDefaultShardingStrategyStatement statement = new AlterDefaultShardingStrategyStatement("TABLE", "standard", "order_id", "order_id_algorithm", null);
updater.checkSQLStatement(database, statement, null);
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertExecuteWithNotExist() throws DistSQLException {
+ public void assertExecuteWithNotExist() {
AlterDefaultShardingStrategyStatement statement = new AlterDefaultShardingStrategyStatement("TABLE", "standard", "order_id", "order_id_algorithm", null);
ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
currentRuleConfig.setDefaultTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "orderAlgorithm"));
@@ -74,7 +73,7 @@ public final class AlterDefaultShardingStrategyStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithUnmatchedStrategy() throws DistSQLException {
+ public void assertExecuteWithUnmatchedStrategy() {
AlterDefaultShardingStrategyStatement statement = new AlterDefaultShardingStrategyStatement("TABLE", "standard", "order_id,user_id", "order_id_algorithm", null);
ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
currentRuleConfig.setDefaultTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "orderAlgorithm"));
@@ -83,7 +82,7 @@ public final class AlterDefaultShardingStrategyStatementUpdaterTest {
}
@Test
- public void assertAlterDefaultTableShardingStrategy() throws DistSQLException {
+ public void assertAlterDefaultTableShardingStrategy() {
AlterDefaultShardingStrategyStatement statement = new AlterDefaultShardingStrategyStatement("TABLE", "standard", "order_id", "order_id_algorithm", null);
ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
currentRuleConfig.setDefaultTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "orderAlgorithm"));
@@ -97,7 +96,7 @@ public final class AlterDefaultShardingStrategyStatementUpdaterTest {
}
@Test
- public void assertAlterDefaultDatabaseShardingStrategy() throws DistSQLException {
+ public void assertAlterDefaultDatabaseShardingStrategy() {
AlgorithmSegment databaseAlgorithmSegment = getAutoCreativeAlgorithmSegment("inline", newProperties("algorithm-expression", "ds_${user_id% 2}"));
AlterDefaultShardingStrategyStatement statement = new AlterDefaultShardingStrategyStatement("DATABASE", "standard", "user_id", null, databaseAlgorithmSegment);
ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAlgorithmStatementUpdaterTest.java
index 7dac6900238..5c033b8f30e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAlgorithmStatementUpdaterTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
@@ -38,8 +37,8 @@ import org.mockito.junit.MockitoJUnitRunner;
import java.util.Arrays;
import java.util.Properties;
-import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
@@ -56,7 +55,7 @@ public final class AlterShardingAlgorithmStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicate() throws DistSQLException {
+ public void assertExecuteWithDuplicate() {
Properties props = new Properties();
props.put("input_key", "input_value");
ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("input_algorithm_name", new AlgorithmSegment("input_algorithm_name", props));
@@ -64,7 +63,7 @@ public final class AlterShardingAlgorithmStatementUpdaterTest {
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertExecuteWithNotExist() throws DistSQLException {
+ public void assertExecuteWithNotExist() {
Properties props = new Properties();
props.put("input_key", "input_value");
ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("not_exist_algorithm_name", new AlgorithmSegment("input_algorithm_name", props));
@@ -74,7 +73,7 @@ public final class AlterShardingAlgorithmStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithm() throws DistSQLException {
+ public void assertExecuteWithInvalidAlgorithm() {
Properties props = new Properties();
props.put("input_key", "input_value");
ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("exist_algorithm_name", new AlgorithmSegment("input_algorithm_name", props));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAuditorStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAuditorStatementUpdaterTest.java
index 152e4fe2671..7409578c74e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAuditorStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAuditorStatementUpdaterTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
@@ -39,8 +38,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Properties;
-import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
@@ -57,13 +56,13 @@ public final class AlterShardingAuditorStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicate() throws DistSQLException {
+ public void assertExecuteWithDuplicate() {
ShardingAuditorSegment auditorSegment = new ShardingAuditorSegment("input_auditor_name", new AlgorithmSegment("DML_SHARDING_CONDITIONS", createProperties()));
updater.checkSQLStatement(database, new AlterShardingAuditorStatement(Arrays.asList(auditorSegment, auditorSegment)), null);
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertExecuteWithNotExist() throws DistSQLException {
+ public void assertExecuteWithNotExist() {
Properties props = createProperties();
ShardingAuditorSegment auditorSegment = new ShardingAuditorSegment("not_exist_auditor_name", new AlgorithmSegment("DML_SHARDING_CONDITIONS", props));
ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
@@ -72,7 +71,7 @@ public final class AlterShardingAuditorStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithm() throws DistSQLException {
+ public void assertExecuteWithInvalidAlgorithm() {
Properties props = createProperties();
ShardingAuditorSegment auditorSegment = new ShardingAuditorSegment("exist_auditor_name", new AlgorithmSegment("INVALID_TYPE", props));
ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingKeyGeneratorStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingKeyGeneratorStatementUpdaterTest.java
index c4e4df7e801..ff46eb62dde 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingKeyGeneratorStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingKeyGeneratorStatementUpdaterTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
@@ -39,8 +38,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Properties;
-import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
@@ -57,13 +56,13 @@ public final class AlterShardingKeyGeneratorStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicate() throws DistSQLException {
+ public void assertExecuteWithDuplicate() {
ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("input_key_generator_name", new AlgorithmSegment("snowflake", createProperties()));
updater.checkSQLStatement(database, new AlterShardingKeyGeneratorStatement(Arrays.asList(keyGeneratorSegment, keyGeneratorSegment)), null);
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertExecuteWithNotExist() throws DistSQLException {
+ public void assertExecuteWithNotExist() {
Properties props = createProperties();
ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("not_exist_key_generator_name", new AlgorithmSegment("snowflake", props));
ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
@@ -72,7 +71,7 @@ public final class AlterShardingKeyGeneratorStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithm() throws DistSQLException {
+ public void assertExecuteWithInvalidAlgorithm() {
Properties props = createProperties();
ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("exist_key_generator_name", new AlgorithmSegment("INVALID_TYPE", props));
ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
index ce7c1ce761b..97e4ea979c5 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResource;
import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
@@ -78,7 +77,7 @@ public final class AlterShardingTableRuleStatementUpdaterTest {
}
@Test
- public void assertUpdate() throws DistSQLException {
+ public void assertUpdate() {
AlterShardingTableRuleStatement statement = new AlterShardingTableRuleStatement(Arrays.asList(createCompleteAutoTableRule("t_order_item"), createCompleteTableRule("t_order")));
updater.checkSQLStatement(database, statement, currentRuleConfig);
ShardingRuleConfiguration toBeAlteredRuleConfig = updater.buildToBeAlteredRuleConfiguration(statement);
@@ -103,7 +102,7 @@ public final class AlterShardingTableRuleStatementUpdaterTest {
}
@Test
- public void assertUpdateWithDifferentCase() throws DistSQLException {
+ public void assertUpdateWithDifferentCase() {
AlterShardingTableRuleStatement statement = new AlterShardingTableRuleStatement(Arrays.asList(createCompleteAutoTableRule("T_ORDER_ITEM"), createCompleteTableRule("T_ORDER")));
updater.checkSQLStatement(database, statement, currentRuleConfig);
ShardingRuleConfiguration toBeAlteredRuleConfig = updater.buildToBeAlteredRuleConfiguration(statement);
@@ -128,7 +127,7 @@ public final class AlterShardingTableRuleStatementUpdaterTest {
}
@Test
- public void assertUpdateTableType() throws DistSQLException {
+ public void assertUpdateTableType() {
AlterShardingTableRuleStatement statement = new AlterShardingTableRuleStatement(Arrays.asList(createCompleteAutoTableRule("t_order"), createCompleteTableRule("t_order_item")));
updater.checkSQLStatement(database, statement, currentRuleConfig);
ShardingRuleConfiguration toBeAlteredRuleConfig = updater.buildToBeAlteredRuleConfiguration(statement);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java
index a9ac41e1361..1162285cd31 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
@@ -54,18 +53,18 @@ public final class CreateDefaultShardingStrategyStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidStrategyType() throws DistSQLException {
+ public void assertExecuteWithInvalidStrategyType() {
updater.checkSQLStatement(database, new CreateDefaultShardingStrategyStatement("TABLE", "invalidType", null, "order_id_algorithm", null), new ShardingRuleConfiguration());
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertExecuteWithoutCurrentConfiguration() throws DistSQLException {
+ public void assertExecuteWithoutCurrentConfiguration() {
CreateDefaultShardingStrategyStatement statement = new CreateDefaultShardingStrategyStatement("TABLE", "standard", "order_id", "order_id_algorithm", null);
updater.checkSQLStatement(database, statement, null);
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithExist() throws DistSQLException {
+ public void assertExecuteWithExist() {
CreateDefaultShardingStrategyStatement statement = new CreateDefaultShardingStrategyStatement("TABLE", "standard", "order_id", "order_id_algorithm", null);
ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
currentRuleConfig.setDefaultTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "orderAlgorithm"));
@@ -74,7 +73,7 @@ public final class CreateDefaultShardingStrategyStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithUnmatchedStrategy() throws DistSQLException {
+ public void assertExecuteWithUnmatchedStrategy() {
CreateDefaultShardingStrategyStatement statement = new CreateDefaultShardingStrategyStatement("TABLE", "standard", "order_id,user_id", "order_id_algorithm", null);
ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
currentRuleConfig.setDefaultTableShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "orderAlgorithm"));
@@ -83,7 +82,7 @@ public final class CreateDefaultShardingStrategyStatementUpdaterTest {
}
@Test
- public void assertCreateDefaultTableShardingStrategy() throws DistSQLException {
+ public void assertCreateDefaultTableShardingStrategy() {
CreateDefaultShardingStrategyStatement statement = new CreateDefaultShardingStrategyStatement("TABLE", "standard", "order_id", "order_id_algorithm", null);
ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
currentRuleConfig.setDefaultDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("order_id", "orderAlgorithm"));
@@ -97,7 +96,7 @@ public final class CreateDefaultShardingStrategyStatementUpdaterTest {
}
@Test
- public void assertCreateDefaultDatabaseShardingStrategy() throws DistSQLException {
+ public void assertCreateDefaultDatabaseShardingStrategy() {
AlgorithmSegment databaseAlgorithmSegment = getAutoCreativeAlgorithmSegment("inline", newProperties("algorithm-expression", "ds_${user_id% 2}"));
CreateDefaultShardingStrategyStatement statement = new CreateDefaultShardingStrategyStatement("DATABASE", "standard", "user_id", null, databaseAlgorithmSegment);
ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAlgorithmStatementUpdaterTest.java
index e189fae6494..92b4a5d65be 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAlgorithmStatementUpdaterTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -53,7 +52,7 @@ public final class CreateShardingAlgorithmStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicate() throws DistSQLException {
+ public void assertExecuteWithDuplicate() {
Properties props = new Properties();
props.put("inputKey", "inputValue");
ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("inputAlgorithmName", new AlgorithmSegment("inputAlgorithmName", props));
@@ -61,7 +60,7 @@ public final class CreateShardingAlgorithmStatementUpdaterTest {
}
@Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithExist() throws DistSQLException {
+ public void assertExecuteWithExist() {
Properties props = new Properties();
props.put("inputKey", "inputValue");
ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("existAlgorithmName", new AlgorithmSegment("inputAlgorithmName", props));
@@ -71,7 +70,7 @@ public final class CreateShardingAlgorithmStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithoutRuleConfiguration() throws DistSQLException {
+ public void assertExecuteWithoutRuleConfiguration() {
Properties props = new Properties();
props.put("inputKey", "inputValue");
ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("inputAlgorithmName", new AlgorithmSegment("inputAlgorithmName", props));
@@ -79,7 +78,7 @@ public final class CreateShardingAlgorithmStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithm() throws DistSQLException {
+ public void assertExecuteWithInvalidAlgorithm() {
Properties props = new Properties();
props.put("inputKey", "inputValue");
ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("inputAlgorithmName", new AlgorithmSegment("inputAlgorithmName", props));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAuditorStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAuditorStatementUpdaterTest.java
index 91afda62b5f..45b9a075ca5 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAuditorStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAuditorStatementUpdaterTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateAlgorithmException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -53,13 +52,13 @@ public final class CreateShardingAuditorStatementUpdaterTest {
}
@Test(expected = DuplicateAlgorithmException.class)
- public void assertExecuteWithDuplicate() throws DistSQLException {
+ public void assertExecuteWithDuplicate() {
ShardingAuditorSegment auditorSegment = new ShardingAuditorSegment("sharding_key_required_auditor", new AlgorithmSegment("DML_SHARDING_CONDITIONS", new Properties()));
updater.checkSQLStatement(database, createSQLStatement(auditorSegment, auditorSegment), null);
}
@Test(expected = DuplicateAlgorithmException.class)
- public void assertExecuteWithExist() throws DistSQLException {
+ public void assertExecuteWithExist() {
ShardingAuditorSegment auditorSegment = new ShardingAuditorSegment("sharding_key_required_auditor", new AlgorithmSegment("DML_SHARDING_CONDITIONS", new Properties()));
ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
ruleConfig.getAuditors().put("sharding_key_required_auditor", new AlgorithmConfiguration("DML_SHARDING_CONDITIONS", new Properties()));
@@ -67,7 +66,7 @@ public final class CreateShardingAuditorStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithm() throws DistSQLException {
+ public void assertExecuteWithInvalidAlgorithm() {
ShardingAuditorSegment auditorSegment = new ShardingAuditorSegment("invalid_auditor", new AlgorithmSegment("INVALID_ALGORITHM", new Properties()));
ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
updater.checkSQLStatement(database, createSQLStatement(auditorSegment), ruleConfig);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingBindingTableRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingBindingTableRuleStatementUpdaterTest.java
index 069875bdaec..dfd9ebdb16b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingBindingTableRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingBindingTableRuleStatementUpdaterTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.distsql.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -44,19 +43,19 @@ public final class CreateShardingBindingTableRuleStatementUpdaterTest {
private final CreateShardingBindingTableRuleStatementUpdater updater = new CreateShardingBindingTableRuleStatementUpdater();
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentTableRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentTableRule() {
updater.checkSQLStatement(database, createSQLStatement(), new ShardingRuleConfiguration());
}
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithDuplicateTables() throws DistSQLException {
+ public void assertCheckSQLStatementWithDuplicateTables() {
List<BindingTableRuleSegment> segments = Arrays.asList(new BindingTableRuleSegment("t_order,t_order_item"), new BindingTableRuleSegment("t_order,t_order_item"));
CreateShardingBindingTableRulesStatement statement = new CreateShardingBindingTableRulesStatement(segments);
updater.checkSQLStatement(database, statement, getCurrentRuleConfig());
}
@Test(expected = DuplicateRuleException.class)
- public void assertCheckSQLStatementWithDifferentCaseDuplicateTables() throws DistSQLException {
+ public void assertCheckSQLStatementWithDifferentCaseDuplicateTables() {
List<BindingTableRuleSegment> segments = Arrays.asList(new BindingTableRuleSegment("T_ORDER,T_ORDER_ITEM"), new BindingTableRuleSegment("t_order,t_order_item"));
CreateShardingBindingTableRulesStatement statement = new CreateShardingBindingTableRulesStatement(segments);
updater.checkSQLStatement(database, statement, getCurrentRuleConfig());
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingKeyGeneratorStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingKeyGeneratorStatementUpdaterTest.java
index d3ef9993364..ce19e33c954 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingKeyGeneratorStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingKeyGeneratorStatementUpdaterTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateAlgorithmException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -53,13 +52,13 @@ public final class CreateShardingKeyGeneratorStatementUpdaterTest {
}
@Test(expected = DuplicateAlgorithmException.class)
- public void assertExecuteWithDuplicate() throws DistSQLException {
+ public void assertExecuteWithDuplicate() {
ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("uuid_key_generator", new AlgorithmSegment("uuid", new Properties()));
updater.checkSQLStatement(database, createSQLStatement(keyGeneratorSegment, keyGeneratorSegment), null);
}
@Test(expected = DuplicateAlgorithmException.class)
- public void assertExecuteWithExist() throws DistSQLException {
+ public void assertExecuteWithExist() {
ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("uuid_key_generator", new AlgorithmSegment("uuid", new Properties()));
ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
ruleConfig.getKeyGenerators().put("uuid_key_generator", new AlgorithmConfiguration("uuid", new Properties()));
@@ -67,7 +66,7 @@ public final class CreateShardingKeyGeneratorStatementUpdaterTest {
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithm() throws DistSQLException {
+ public void assertExecuteWithInvalidAlgorithm() {
ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("invalid_key_generator", new AlgorithmSegment("INVALID_ALGORITHM", new Properties()));
ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
updater.checkSQLStatement(database, createSQLStatement(keyGeneratorSegment), ruleConfig);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
index 95dcb5d49ee..fb0183d0463 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
@@ -91,7 +91,7 @@ public final class CreateShardingTableRuleStatementUpdaterTest {
}
@Test
- public void assertUpdate() throws DistSQLException {
+ public void assertUpdate() {
CreateShardingTableRuleStatement statement = new CreateShardingTableRuleStatement(Arrays.asList(createCompleteAutoTableRule(), createCompleteTableRule()));
updater.checkSQLStatement(database, statement, currentRuleConfig);
ShardingRuleConfiguration toBeAlteredRuleConfig = updater.buildToBeCreatedRuleConfiguration(statement);
@@ -131,7 +131,7 @@ public final class CreateShardingTableRuleStatementUpdaterTest {
}
@Test
- public void assertCheckCreateShardingStatement() throws DistSQLException {
+ public void assertCheckCreateShardingStatement() {
String sql = "CREATE SHARDING TABLE RULE t_order("
+ "RESOURCES(ds_0,ds_1),"
+ "SHARDING_COLUMN=order_id,"
@@ -142,7 +142,7 @@ public final class CreateShardingTableRuleStatementUpdaterTest {
}
@Test(expected = DistSQLException.class)
- public void assertCheckCreateShardingStatementThrows() throws DistSQLException {
+ public void assertCheckCreateShardingStatementThrows() {
String sql = "CREATE SHARDING TABLE RULE t_order("
+ "RESOURCES(ds_0,ds_1),"
+ "SHARDING_COLUMN=order_id,"
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropDefaultShardingStrategyStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropDefaultShardingStrategyStatementUpdaterTest.java
index 80f2c71c121..fc5726dc5fa 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropDefaultShardingStrategyStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropDefaultShardingStrategyStatementUpdaterTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.distsql.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -41,17 +40,17 @@ public final class DropDefaultShardingStrategyStatementUpdaterTest {
private ShardingSphereDatabase database;
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentRule() {
updater.checkSQLStatement(database, new DropDefaultShardingStrategyStatement(false, "TABLE"), null);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutExistedAlgorithm() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutExistedAlgorithm() {
updater.checkSQLStatement(database, createSQLStatement("table"), new ShardingRuleConfiguration());
}
@Test
- public void assertCheckSQLStatementWithIfExists() throws DistSQLException {
+ public void assertCheckSQLStatementWithIfExists() {
updater.checkSQLStatement(database, new DropDefaultShardingStrategyStatement(true, "table"), new ShardingRuleConfiguration());
updater.checkSQLStatement(database, new DropDefaultShardingStrategyStatement(true, "table"), null);
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorStatementUpdaterTest.java
index 132820695f0..e2de6d9c787 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorStatementUpdaterTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.AlgorithmInUsedException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -55,12 +54,12 @@ public final class DropShardingAuditorStatementUpdaterTest {
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertExecuteWithNotExist() throws DistSQLException {
+ public void assertExecuteWithNotExist() {
updater.checkSQLStatement(database, createSQLStatement("sharding_key_required_auditor"), new ShardingRuleConfiguration());
}
@Test
- public void assertExecuteWithNotExistWithIfExists() throws DistSQLException {
+ public void assertExecuteWithNotExistWithIfExists() {
DropShardingAuditorStatement sqlStatement = new DropShardingAuditorStatement(true, Collections.singletonList("sharding_key_required_auditor"));
updater.checkSQLStatement(database, sqlStatement, new ShardingRuleConfiguration());
}
@@ -74,7 +73,7 @@ public final class DropShardingAuditorStatementUpdaterTest {
}
@Test(expected = AlgorithmInUsedException.class)
- public void assertExecuteWithUsed() throws DistSQLException {
+ public void assertExecuteWithUsed() {
ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
currentRuleConfig.getAuditors().put("sharding_key_required_auditor", new AlgorithmConfiguration("DML_SHARDING_CONDITIONS", null));
currentRuleConfig.getAutoTables().add(createShardingAutoTableRuleConfiguration());
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java
index c8be8e6e3d0..3b8379f4fcb 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.distsql.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -38,8 +37,8 @@ import java.util.Collections;
import java.util.stream.Collectors;
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;
@RunWith(MockitoJUnitRunner.class)
@@ -51,17 +50,17 @@ public final class DropShardingBindingTableRuleStatementUpdaterTest {
private ShardingSphereDatabase database;
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentRule() {
updater.checkSQLStatement(database, createSQLStatement(), null);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutExistedBindingTableRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutExistedBindingTableRule() {
updater.checkSQLStatement(database, createSQLStatement(), new ShardingRuleConfiguration());
}
@Test
- public void assertCheckSQLStatementWithIfExists() throws DistSQLException {
+ public void assertCheckSQLStatementWithIfExists() {
updater.checkSQLStatement(database, createSQLStatement(true, "t_1,t_2"), null);
ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
shardingRuleConfig.setBindingTableGroups(Collections.singletonList("t_3,t_4"));
@@ -90,7 +89,7 @@ public final class DropShardingBindingTableRuleStatementUpdaterTest {
}
@Test
- public void assertDropSpecifiedCurrentRuleConfiguration() throws DistSQLException {
+ public void assertDropSpecifiedCurrentRuleConfiguration() {
ShardingRuleConfiguration currentRuleConfig = createCurrentRuleConfiguration();
currentRuleConfig.getBindingTableGroups().add("t_1,t_2");
DropShardingBindingTableRulesStatement sqlStatement = createSQLStatement("t_1,t_2");
@@ -101,7 +100,7 @@ public final class DropShardingBindingTableRuleStatementUpdaterTest {
}
@Test
- public void assertDropRulesCurrentRuleConfigurationWithNoOrder() throws DistSQLException {
+ public void assertDropRulesCurrentRuleConfigurationWithNoOrder() {
ShardingRuleConfiguration currentRuleConfig = createCurrentRuleConfiguration();
currentRuleConfig.getBindingTableGroups().add("t_1,t_2,t_3");
DropShardingBindingTableRulesStatement sqlStatement = createSQLStatement("t_3,t_2,t_1");
@@ -113,7 +112,7 @@ public final class DropShardingBindingTableRuleStatementUpdaterTest {
}
@Test
- public void assertDropRulesCurrentRuleConfigurationWithDifferentCase() throws DistSQLException {
+ public void assertDropRulesCurrentRuleConfigurationWithDifferentCase() {
ShardingRuleConfiguration currentRuleConfig = createCurrentRuleConfiguration();
currentRuleConfig.getBindingTableGroups().add("t_1,t_2,t_3");
DropShardingBindingTableRulesStatement sqlStatement = createSQLStatement("T_3,T_2,T_1");
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java
index 6785565e142..b247715cf26 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.distsql.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -45,17 +44,17 @@ public final class DropShardingBroadcastTableRuleStatementUpdaterTest {
private final DropShardingBroadcastTableRuleStatementUpdater updater = new DropShardingBroadcastTableRuleStatementUpdater();
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutCurrentRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutCurrentRule() {
updater.checkSQLStatement(database, createSQLStatement("t_order"), null);
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithoutExistBroadcastTableRule() throws DistSQLException {
+ public void assertCheckSQLStatementWithoutExistBroadcastTableRule() {
updater.checkSQLStatement(database, createSQLStatement("t_order"), new ShardingRuleConfiguration());
}
@Test
- public void assertCheckSQLStatementWithIfExists() throws DistSQLException {
+ public void assertCheckSQLStatementWithIfExists() {
updater.checkSQLStatement(database, createSQLStatement(true, "t_order"), new ShardingRuleConfiguration());
updater.checkSQLStatement(database, createSQLStatement(true, "t_order"), null);
}
@@ -68,7 +67,7 @@ public final class DropShardingBroadcastTableRuleStatementUpdaterTest {
}
@Test(expected = MissingRequiredRuleException.class)
- public void assertCheckSQLStatementWithBroadcastTableRuleAreNotTheSame() throws DistSQLException {
+ public void assertCheckSQLStatementWithBroadcastTableRuleAreNotTheSame() {
updater.checkSQLStatement(database, createSQLStatement("t_order_item"), createCurrentRuleConfiguration());
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java
index 4a847f96441..57f85c48a0d 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.sharding.distsql.update;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.AlgorithmInUsedException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -55,12 +54,12 @@ public final class DropShardingKeyGeneratorStatementUpdaterTest {
}
@Test(expected = MissingRequiredAlgorithmException.class)
- public void assertExecuteWithNotExist() throws DistSQLException {
+ public void assertExecuteWithNotExist() {
updater.checkSQLStatement(database, createSQLStatement("uuid_key_generator"), new ShardingRuleConfiguration());
}
@Test
- public void assertExecuteWithNotExistWithIfExists() throws DistSQLException {
+ public void assertExecuteWithNotExistWithIfExists() {
DropShardingKeyGeneratorStatement sqlStatement = new DropShardingKeyGeneratorStatement(true, Collections.singletonList("uuid_key_generator"));
updater.checkSQLStatement(database, sqlStatement, new ShardingRuleConfiguration());
}
@@ -74,7 +73,7 @@ public final class DropShardingKeyGeneratorStatementUpdaterTest {
}
@Test(expected = AlgorithmInUsedException.class)
- public void assertExecuteWithUsed() throws DistSQLException {
+ public void assertExecuteWithUsed() {
ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
currentRuleConfig.getKeyGenerators().put("uuid_key_generator", new AlgorithmConfiguration("UUID", null));
currentRuleConfig.getAutoTables().add(createShardingAutoTableRuleConfiguration());
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/GlobalRuleRALUpdater.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/GlobalRuleRALUpdater.java
index e74cd58bdd6..424c5419aeb 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/GlobalRuleRALUpdater.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/GlobalRuleRALUpdater.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.infra.distsql.update;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.util.spi.annotation.SingletonSPI;
import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPI;
@@ -34,7 +33,6 @@ public interface GlobalRuleRALUpdater extends TypedSPI {
*
* @param metaData meta data
* @param sqlStatement SQL statement
- * @throws DistSQLException definition violation exception
*/
- void executeUpdate(ShardingSphereMetaData metaData, SQLStatement sqlStatement) throws DistSQLException;
+ void executeUpdate(ShardingSphereMetaData metaData, SQLStatement sqlStatement);
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RuleDefinitionUpdater.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RuleDefinitionUpdater.java
index c869a07d1f4..0c5caef2698 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RuleDefinitionUpdater.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RuleDefinitionUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.infra.distsql.update;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.util.spi.annotation.SingletonSPI;
import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPI;
@@ -39,9 +38,8 @@ public interface RuleDefinitionUpdater<T extends SQLStatement, R extends RuleCon
* @param database database
* @param sqlStatement SQL statement
* @param currentRuleConfig current rule configuration
- * @throws DistSQLException definition violation exception
*/
- void checkSQLStatement(ShardingSphereDatabase database, T sqlStatement, R currentRuleConfig) throws DistSQLException;
+ void checkSQLStatement(ShardingSphereDatabase database, T sqlStatement, R currentRuleConfig);
/**
* Get rule configuration class.
diff --git a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/AlterTrafficRuleStatementUpdater.java b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/AlterTrafficRuleStatementUpdater.java
index fc7bd1327ff..7224c0096a1 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/AlterTrafficRuleStatementUpdater.java
+++ b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/AlterTrafficRuleStatementUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.traffic.distsql.handler.update;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.GlobalRuleRALUpdater;
@@ -49,18 +48,18 @@ import java.util.stream.Collectors;
public final class AlterTrafficRuleStatementUpdater implements GlobalRuleRALUpdater {
@Override
- public void executeUpdate(final ShardingSphereMetaData metaData, final SQLStatement sqlStatement) throws DistSQLException {
+ public void executeUpdate(final ShardingSphereMetaData metaData, final SQLStatement sqlStatement) {
AlterTrafficRuleStatement statement = (AlterTrafficRuleStatement) sqlStatement;
check(metaData.getGlobalRuleMetaData(), statement);
replaceNewRule(metaData.getGlobalRuleMetaData(), statement);
}
- private void check(final ShardingSphereRuleMetaData ruleMetaData, final AlterTrafficRuleStatement sqlStatement) throws DistSQLException {
+ private void check(final ShardingSphereRuleMetaData ruleMetaData, final AlterTrafficRuleStatement sqlStatement) {
checkRuleNames(ruleMetaData, sqlStatement);
checkAlgorithmNames(sqlStatement);
}
- private void checkRuleNames(final ShardingSphereRuleMetaData ruleMetaData, final AlterTrafficRuleStatement sqlStatement) throws DistSQLException {
+ private void checkRuleNames(final ShardingSphereRuleMetaData ruleMetaData, final AlterTrafficRuleStatement sqlStatement) {
Collection<String> notExistRuleNames = getNotExistRuleNames(ruleMetaData, sqlStatement);
ShardingSpherePreconditions.checkState(notExistRuleNames.isEmpty(), () -> new MissingRequiredRuleException("Traffic", notExistRuleNames));
}
@@ -71,7 +70,7 @@ public final class AlterTrafficRuleStatementUpdater implements GlobalRuleRALUpda
return sqlStatement.getSegments().stream().map(TrafficRuleSegment::getName).filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toSet());
}
- private void checkAlgorithmNames(final AlterTrafficRuleStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithmNames(final AlterTrafficRuleStatement sqlStatement) {
Collection<String> invalidAlgorithmNames = getInvalidAlgorithmNames(sqlStatement);
ShardingSpherePreconditions.checkState(invalidAlgorithmNames.isEmpty(), () -> new InvalidAlgorithmConfigurationException("Traffic", invalidAlgorithmNames));
}
diff --git a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/CreateTrafficRuleStatementUpdater.java b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/CreateTrafficRuleStatementUpdater.java
index 1a9f86df874..33ac19aedbe 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/CreateTrafficRuleStatementUpdater.java
+++ b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/CreateTrafficRuleStatementUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.traffic.distsql.handler.update;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.update.GlobalRuleRALUpdater;
@@ -49,18 +48,18 @@ import java.util.stream.Collectors;
public final class CreateTrafficRuleStatementUpdater implements GlobalRuleRALUpdater {
@Override
- public void executeUpdate(final ShardingSphereMetaData metaData, final SQLStatement sqlStatement) throws DistSQLException {
+ public void executeUpdate(final ShardingSphereMetaData metaData, final SQLStatement sqlStatement) {
CreateTrafficRuleStatement statement = (CreateTrafficRuleStatement) sqlStatement;
check(metaData.getGlobalRuleMetaData(), statement);
replaceNewRule(metaData.getGlobalRuleMetaData(), statement);
}
- private void check(final ShardingSphereRuleMetaData ruleMetaData, final CreateTrafficRuleStatement sqlStatement) throws DistSQLException {
+ private void check(final ShardingSphereRuleMetaData ruleMetaData, final CreateTrafficRuleStatement sqlStatement) {
checkRuleNames(ruleMetaData, sqlStatement);
checkAlgorithmNames(sqlStatement);
}
- private void checkRuleNames(final ShardingSphereRuleMetaData ruleMetaData, final CreateTrafficRuleStatement sqlStatement) throws DistSQLException {
+ private void checkRuleNames(final ShardingSphereRuleMetaData ruleMetaData, final CreateTrafficRuleStatement sqlStatement) {
Collection<String> inUsedRuleNames = getInUsedRuleNames(ruleMetaData, sqlStatement);
ShardingSpherePreconditions.checkState(inUsedRuleNames.isEmpty(), () -> new DuplicateRuleException("Traffic", inUsedRuleNames));
}
@@ -71,7 +70,7 @@ public final class CreateTrafficRuleStatementUpdater implements GlobalRuleRALUpd
return sqlStatement.getSegments().stream().map(TrafficRuleSegment::getName).filter(currentRuleNames::contains).collect(Collectors.toSet());
}
- private void checkAlgorithmNames(final CreateTrafficRuleStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithmNames(final CreateTrafficRuleStatement sqlStatement) {
Collection<String> invalidAlgorithmNames = getInvalidAlgorithmNames(sqlStatement);
ShardingSpherePreconditions.checkState(invalidAlgorithmNames.isEmpty(), () -> new InvalidAlgorithmConfigurationException("Traffic", invalidAlgorithmNames));
}
diff --git a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/DropTrafficRuleStatementUpdater.java b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/DropTrafficRuleStatementUpdater.java
index fe77cd8e759..50c4efe38c3 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/DropTrafficRuleStatementUpdater.java
+++ b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/update/DropTrafficRuleStatementUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.traffic.distsql.handler.update;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.GlobalRuleRALUpdater;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
@@ -42,17 +41,17 @@ import java.util.stream.Collectors;
public final class DropTrafficRuleStatementUpdater implements GlobalRuleRALUpdater {
@Override
- public void executeUpdate(final ShardingSphereMetaData metaData, final SQLStatement sqlStatement) throws DistSQLException {
+ public void executeUpdate(final ShardingSphereMetaData metaData, final SQLStatement sqlStatement) {
DropTrafficRuleStatement statement = (DropTrafficRuleStatement) sqlStatement;
check(metaData.getGlobalRuleMetaData(), statement);
replaceNewRule(metaData.getGlobalRuleMetaData(), statement);
}
- private void check(final ShardingSphereRuleMetaData ruleMetaData, final DropTrafficRuleStatement sqlStatement) throws DistSQLException {
+ private void check(final ShardingSphereRuleMetaData ruleMetaData, final DropTrafficRuleStatement sqlStatement) {
checkRuleNames(ruleMetaData, sqlStatement);
}
- private void checkRuleNames(final ShardingSphereRuleMetaData ruleMetaData, final DropTrafficRuleStatement sqlStatement) throws DistSQLException {
+ private void checkRuleNames(final ShardingSphereRuleMetaData ruleMetaData, final DropTrafficRuleStatement sqlStatement) {
if (sqlStatement.isIfExists()) {
return;
}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-distsql/shardingsphere-transaction-distsql-handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/update/AlterTransactionRuleStatementUpdaterTest.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-distsql/shardingsphere-transaction-distsql-handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/update/AlterTransactionRuleStatemen [...]
index 60de25cf464..c0f9b3bb74a 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-distsql/shardingsphere-transaction-distsql-handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/update/AlterTransactionRuleStatementUpdaterTest.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-distsql/shardingsphere-transaction-distsql-handler/src/test/java/org/apache/shardingsphere/transaction/distsql/handler/update/AlterTransactionRuleStatementUpdaterTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.transaction.distsql.handler.update;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -48,7 +47,7 @@ import static org.mockito.Mockito.when;
public final class AlterTransactionRuleStatementUpdaterTest {
@Test
- public void assertExecuteWithXA() throws DistSQLException {
+ public void assertExecuteWithXA() {
AlterTransactionRuleStatementUpdater updater = new AlterTransactionRuleStatementUpdater();
ShardingSphereMetaData metaData = createMetaData();
updater.executeUpdate(metaData, new AlterTransactionRuleStatement("XA", new TransactionProviderSegment("Atomikos", createProperties())));
@@ -63,7 +62,7 @@ public final class AlterTransactionRuleStatementUpdaterTest {
}
@Test
- public void assertExecuteWithLocal() throws DistSQLException {
+ public void assertExecuteWithLocal() {
AlterTransactionRuleStatementUpdater updater = new AlterTransactionRuleStatementUpdater();
ShardingSphereMetaData metaData = createMetaData();
updater.executeUpdate(metaData, new AlterTransactionRuleStatement("LOCAL", new TransactionProviderSegment("", new Properties())));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/DatabaseDiscoveryRuleConfigurationImportChecker.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/DatabaseDiscoveryRuleConfigurationImportChecker.java
index e9dfa786853..4d05e78710d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/DatabaseDiscoveryRuleConfigurationImportChecker.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/DatabaseDiscoveryRuleConfigurationImportChecker.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.check
import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.factory.DatabaseDiscoveryProviderAlgorithmFactory;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
@@ -43,9 +42,8 @@ public final class DatabaseDiscoveryRuleConfigurationImportChecker {
*
* @param database database
* @param currentRuleConfig current rule configuration
- * @throws DistSQLException definition violation exception
*/
- public void check(final ShardingSphereDatabase database, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void check(final ShardingSphereDatabase database, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
if (null == database || null == currentRuleConfig) {
return;
}
@@ -54,14 +52,14 @@ public final class DatabaseDiscoveryRuleConfigurationImportChecker {
checkDiscoverTypeAndHeartbeat(databaseName, currentRuleConfig);
}
- private void checkResources(final String databaseName, final ShardingSphereDatabase database, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkResources(final String databaseName, final ShardingSphereDatabase database, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Collection<String> requireResources = new LinkedHashSet<>();
currentRuleConfig.getDataSources().forEach(each -> requireResources.addAll(each.getDataSourceNames()));
Collection<String> notExistResources = database.getResource().getNotExistedResources(requireResources);
ShardingSpherePreconditions.checkState(notExistResources.isEmpty(), () -> new MissingRequiredResourcesException(databaseName, notExistResources));
}
- private void checkDiscoverTypeAndHeartbeat(final String databaseName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDiscoverTypeAndHeartbeat(final String databaseName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
Collection<String> invalidInput = currentRuleConfig.getDiscoveryTypes().values().stream().map(AlgorithmConfiguration::getType)
.filter(each -> !DatabaseDiscoveryProviderAlgorithmFactory.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(invalidInput.isEmpty(), () -> new InvalidAlgorithmConfigurationException(DB_DISCOVERY.toLowerCase(), invalidInput));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ReadwriteSplittingRuleConfigurationImportChecker.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ReadwriteSplittingRuleConfigurationImportChecker.java
index 5214b5e0d50..d67e3209073 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ReadwriteSplittingRuleConfigurationImportChecker.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ReadwriteSplittingRuleConfigurationImportChecker.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.checker;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -41,9 +40,8 @@ public final class ReadwriteSplittingRuleConfigurationImportChecker {
*
* @param database database
* @param currentRuleConfig current rule configuration
- * @throws DistSQLException definition violation exception
*/
- public void check(final ShardingSphereDatabase database, final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void check(final ShardingSphereDatabase database, final ReadwriteSplittingRuleConfiguration currentRuleConfig) {
if (null == database || null == currentRuleConfig) {
return;
}
@@ -52,7 +50,7 @@ public final class ReadwriteSplittingRuleConfigurationImportChecker {
checkLoadBalancers(currentRuleConfig);
}
- private void checkResources(final String databaseName, final ShardingSphereDatabase database, final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkResources(final String databaseName, final ShardingSphereDatabase database, final ReadwriteSplittingRuleConfiguration currentRuleConfig) {
Collection<String> requireResources = new LinkedHashSet<>();
Collection<String> requireDiscoverableResources = new LinkedHashSet<>();
currentRuleConfig.getDataSources().forEach(each -> {
@@ -80,7 +78,7 @@ public final class ReadwriteSplittingRuleConfigurationImportChecker {
.map(each -> ((DataSourceContainedRule) each).getDataSourceMapper().keySet()).flatMap(Collection::stream).collect(Collectors.toCollection(LinkedHashSet::new));
}
- private void checkLoadBalancers(final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkLoadBalancers(final ReadwriteSplittingRuleConfiguration currentRuleConfig) {
Collection<String> notExistedLoadBalancers = currentRuleConfig.getLoadBalancers().values().stream().map(AlgorithmConfiguration::getType)
.filter(each -> !ReadQueryLoadBalanceAlgorithmFactory.contains(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedLoadBalancers.isEmpty(), () -> new InvalidAlgorithmConfigurationException("Load balancers", notExistedLoadBalancers));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java
index 7077950bd1b..b9cc7826252 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.check
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithm;
import org.apache.shardingsphere.infra.datanode.DataNode;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
@@ -65,9 +64,8 @@ public final class ShardingRuleConfigurationImportChecker {
*
* @param database database
* @param currentRuleConfig current rule configuration
- * @throws DistSQLException definition violation exception
*/
- public void check(final ShardingSphereDatabase database, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void check(final ShardingSphereDatabase database, final ShardingRuleConfiguration currentRuleConfig) {
if (null == database || null == currentRuleConfig) {
return;
}
@@ -78,7 +76,7 @@ public final class ShardingRuleConfigurationImportChecker {
checkShardingAlgorithms(currentRuleConfig);
}
- private void checkLogicTables(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkLogicTables(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> tablesLogicTables = currentRuleConfig.getTables().stream().map(ShardingTableRuleConfiguration::getLogicTable).collect(Collectors.toList());
Collection<String> autoTablesLogicTables = currentRuleConfig.getAutoTables().stream().map(ShardingAutoTableRuleConfiguration::getLogicTable).collect(Collectors.toList());
Collection<String> allLogicTables = new LinkedList<>();
@@ -89,15 +87,15 @@ public final class ShardingRuleConfigurationImportChecker {
ShardingSpherePreconditions.checkState(duplicatedLogicTables.isEmpty(), () -> new DuplicateRuleException(SHARDING, databaseName, duplicatedLogicTables));
}
- private void checkShardingAlgorithms(final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkShardingAlgorithms(final ShardingRuleConfiguration currentRuleConfig) {
checkInvalidAlgorithms(SHARDING, currentRuleConfig.getShardingAlgorithms().values());
}
- private void checkKeyGenerators(final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkKeyGenerators(final ShardingRuleConfiguration currentRuleConfig) {
checkInvalidAlgorithms(KEY_GENERATOR, currentRuleConfig.getKeyGenerators().values());
}
- private void checkInvalidAlgorithms(final String algorithmType, final Collection<AlgorithmConfiguration> algorithmConfigs) throws DistSQLException {
+ private void checkInvalidAlgorithms(final String algorithmType, final Collection<AlgorithmConfiguration> algorithmConfigs) {
Collection<String> invalidAlgorithms = algorithmConfigs.stream()
.filter(each -> !TypedSPIRegistry.findRegisteredService(ALGORITHM_TYPE_MAP.get(algorithmType), each.getType(), each.getProps()).isPresent())
.map(AlgorithmConfiguration::getType).collect(Collectors.toList());
@@ -121,7 +119,7 @@ public final class ShardingRuleConfigurationImportChecker {
return actualDataNodes.stream().map(each -> new DataNode(each).getDataSourceName()).collect(Collectors.toList());
}
- private void checkResources(final String databaseName, final ShardingSphereDatabase database, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkResources(final String databaseName, final ShardingSphereDatabase database, final ShardingRuleConfiguration currentRuleConfig) {
Collection<String> requiredResource = getRequiredResources(currentRuleConfig);
Collection<String> notExistedResources = database.getResource().getNotExistedResources(requiredResource);
Collection<String> logicResources = getLogicResources(database);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationHandler.java
index 214513b0b4a..c67e7ba8103 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationHandler.java
@@ -104,25 +104,21 @@ public final class ImportDatabaseConfigurationHandler extends UpdatableRALBacken
}
private void checkDatabase(final String databaseName, final File file) {
- Preconditions.checkNotNull(databaseName, String.format("Property `databaseName` in file `%s` is required.", file.getName()));
+ Preconditions.checkNotNull(databaseName, "Property `databaseName` in file `%s` is required", file.getName());
if (ProxyContext.getInstance().databaseExists(databaseName)) {
- Preconditions.checkState(ProxyContext.getInstance().getDatabase(databaseName).getResource().getDataSources().isEmpty(), "Database `%s` exists and is not empty.", databaseName);
+ Preconditions.checkState(ProxyContext.getInstance().getDatabase(databaseName).getResource().getDataSources().isEmpty(), "Database `%s` exists and is not empty", databaseName);
}
}
private void checkDataSource(final Map<String, YamlProxyDataSourceConfiguration> dataSources, final File file) {
- Preconditions.checkState(!dataSources.isEmpty(), "Data sources configuration in file `%s` is required.", file.getName());
+ Preconditions.checkState(!dataSources.isEmpty(), "Data source configurations in file `%s` is required", file.getName());
}
private void addDatabase(final String databaseName) throws SQLException {
ProxyContext.getInstance().getContextManager().addDatabaseAndPersist(databaseName);
}
- private void dropDatabase(final String databaseName) {
- ProxyContext.getInstance().getContextManager().dropDatabaseAndPersist(databaseName);
- }
-
- private void addResources(final String databaseName, final Map<String, YamlProxyDataSourceConfiguration> yamlDataSourceMap) throws DistSQLException {
+ private void addResources(final String databaseName, final Map<String, YamlProxyDataSourceConfiguration> yamlDataSourceMap) {
Map<String, DataSourceProperties> dataSourcePropsMap = new LinkedHashMap<>(yamlDataSourceMap.size(), 1);
for (Entry<String, YamlProxyDataSourceConfiguration> entry : yamlDataSourceMap.entrySet()) {
dataSourcePropsMap.put(entry.getKey(), DataSourcePropertiesCreator.create(HikariDataSource.class.getName(), dataSourceConfigSwapper.swap(entry.getValue())));
@@ -135,7 +131,7 @@ public final class ImportDatabaseConfigurationHandler extends UpdatableRALBacken
}
}
- private void addRules(final String databaseName, final Collection<YamlRuleConfiguration> yamlRuleConfigs) throws DistSQLException {
+ private void addRules(final String databaseName, final Collection<YamlRuleConfiguration> yamlRuleConfigs) {
if (yamlRuleConfigs.isEmpty()) {
return;
}
@@ -169,4 +165,8 @@ public final class ImportDatabaseConfigurationHandler extends UpdatableRALBacken
ProxyContext.getInstance().getContextManager().renewMetaDataContexts(metaDataContexts);
metaDataContexts.getPersistService().getDatabaseRulePersistService().persist(metaDataContexts.getMetaData().getActualDatabaseName(databaseName), ruleConfigs);
}
+
+ private void dropDatabase(final String databaseName) {
+ ProxyContext.getInstance().getContextManager().dropDatabaseAndPersist(databaseName);
+ }
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetReadwriteSplittingStatusHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetReadwriteSplittingStatusHandler.java
index ca300edbdb8..5872c9116d0 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetReadwriteSplittingStatusHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetReadwriteSplittingStatusHandler.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.dialect.exception.syntax.database.NoDatabaseSel
import org.apache.shardingsphere.dialect.exception.syntax.database.UnknownDatabaseException;
import org.apache.shardingsphere.infra.distsql.constant.ExportableConstants;
import org.apache.shardingsphere.infra.distsql.constant.ExportableItemConstants;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.metadata.database.schema.QualifiedDatabase;
import org.apache.shardingsphere.infra.rule.identifier.type.exportable.RuleExportEngine;
@@ -59,7 +58,7 @@ public final class SetReadwriteSplittingStatusHandler extends UpdatableRALBacken
private static final String DISABLE = "DISABLE";
@Override
- protected void update(final ContextManager contextManager) throws DistSQLException {
+ protected void update(final ContextManager contextManager) {
String databaseName = getSqlStatement().getDatabase().isPresent() ? getSqlStatement().getDatabase().get().getIdentifier().getValue() : getConnectionSession().getDatabaseName();
String toBeUpdatedResource = getSqlStatement().getResourceName();
checkModeAndPersistRepository(contextManager);
@@ -117,12 +116,12 @@ public final class SetReadwriteSplittingStatusHandler extends UpdatableRALBacken
.collect(Collectors.toMap(QualifiedDatabase::getDataSourceName, QualifiedDatabase::getGroupName, (value1, value2) -> String.join(",", value1, value2)));
}
- private void checkEnable(final ContextManager contextManager, final String databaseName, final Map<String, String> disabledResources, final String toBeEnabledResource) throws DistSQLException {
+ private void checkEnable(final ContextManager contextManager, final String databaseName, final Map<String, String> disabledResources, final String toBeEnabledResource) {
checkResourceExists(contextManager, databaseName, toBeEnabledResource);
checkIsNotDisabled(disabledResources.keySet(), toBeEnabledResource);
}
- private void checkResourceExists(final ContextManager contextManager, final String databaseName, final String toBeDisabledResource) throws DistSQLException {
+ private void checkResourceExists(final ContextManager contextManager, final String databaseName, final String toBeDisabledResource) {
Collection<String> notExistedResources = contextManager
.getMetaDataContexts().getMetaData().getDatabase(databaseName).getResource().getNotExistedResources(Collections.singleton(toBeDisabledResource));
ShardingSpherePreconditions.checkState(notExistedResources.isEmpty(), () -> new MissingRequiredResourcesException(databaseName, Collections.singleton(toBeDisabledResource)));
@@ -133,7 +132,7 @@ public final class SetReadwriteSplittingStatusHandler extends UpdatableRALBacken
}
private void checkDisable(final ContextManager contextManager, final String databaseName, final Collection<String> disabledResources, final String toBeDisabledResource,
- final Map<String, String> replicaResources) throws DistSQLException {
+ final Map<String, String> replicaResources) {
checkResourceExists(contextManager, databaseName, toBeDisabledResource);
checkIsDisabled(replicaResources, disabledResources, toBeDisabledResource);
checkIsReplicaResource(replicaResources, toBeDisabledResource);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AddResourceBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AddResourceBackendHandler.java
index dcbbb2ec193..39be51f0e13 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AddResourceBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AddResourceBackendHandler.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResource
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
import org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesValidator;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.DuplicateResourceException;
import org.apache.shardingsphere.infra.distsql.exception.resource.InvalidResourcesException;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
@@ -59,7 +58,7 @@ public final class AddResourceBackendHandler extends DatabaseRequiredBackendHand
}
@Override
- public ResponseHeader execute(final String databaseName, final AddResourceStatement sqlStatement) throws DistSQLException {
+ public ResponseHeader execute(final String databaseName, final AddResourceStatement sqlStatement) {
checkSQLStatement(databaseName, sqlStatement);
Map<String, DataSourceProperties> dataSourcePropsMap = ResourceSegmentsConverter.convert(databaseType, sqlStatement.getDataSources());
DatabaseType storeType = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabase(databaseName).getResource().getDatabaseType();
@@ -73,7 +72,7 @@ public final class AddResourceBackendHandler extends DatabaseRequiredBackendHand
return new UpdateResponseHeader(sqlStatement);
}
- private void checkSQLStatement(final String databaseName, final AddResourceStatement sqlStatement) throws DistSQLException {
+ private void checkSQLStatement(final String databaseName, final AddResourceStatement sqlStatement) {
Collection<String> dataSourceNames = new ArrayList<>(sqlStatement.getDataSources().size());
Collection<String> duplicateDataSourceNames = new HashSet<>(sqlStatement.getDataSources().size(), 1);
for (DataSourceSegment each : sqlStatement.getDataSources()) {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterResourceBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterResourceBackendHandler.java
index 34a2344c0e5..c9e470b7793 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterResourceBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterResourceBackendHandler.java
@@ -28,7 +28,6 @@ import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
import org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
import org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesValidator;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.DuplicateResourceException;
import org.apache.shardingsphere.infra.distsql.exception.resource.InvalidResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
@@ -66,7 +65,7 @@ public final class AlterResourceBackendHandler extends DatabaseRequiredBackendHa
}
@Override
- public ResponseHeader execute(final String databaseName, final AlterResourceStatement sqlStatement) throws DistSQLException {
+ public ResponseHeader execute(final String databaseName, final AlterResourceStatement sqlStatement) {
checkSQLStatement(databaseName, sqlStatement);
Map<String, DataSourceProperties> dataSourcePropsMap = ResourceSegmentsConverter.convert(databaseType, sqlStatement.getDataSources());
validator.validate(dataSourcePropsMap, databaseType);
@@ -79,14 +78,14 @@ public final class AlterResourceBackendHandler extends DatabaseRequiredBackendHa
return new UpdateResponseHeader(sqlStatement);
}
- private void checkSQLStatement(final String databaseName, final AlterResourceStatement sqlStatement) throws DistSQLException {
+ private void checkSQLStatement(final String databaseName, final AlterResourceStatement sqlStatement) {
Collection<String> toBeAlteredResourceNames = getToBeAlteredResourceNames(sqlStatement);
checkToBeAlteredDuplicateResourceNames(toBeAlteredResourceNames);
checkResourceNameExisted(databaseName, toBeAlteredResourceNames);
checkDatabase(databaseName, sqlStatement);
}
- private void checkDatabase(final String databaseName, final AlterResourceStatement sqlStatement) throws DistSQLException {
+ private void checkDatabase(final String databaseName, final AlterResourceStatement sqlStatement) {
Map<String, DataSource> resources = ProxyContext.getInstance().getDatabase(databaseName).getResource().getDataSources();
Collection<String> invalid = sqlStatement.getDataSources().stream().collect(Collectors.toMap(DataSourceSegment::getName, each -> each)).entrySet().stream()
.filter(each -> !isIdenticalDatabase(each.getValue(), resources.get(each.getKey()))).map(Entry::getKey).collect(Collectors.toSet());
@@ -97,7 +96,7 @@ public final class AlterResourceBackendHandler extends DatabaseRequiredBackendHa
return sqlStatement.getDataSources().stream().map(DataSourceSegment::getName).collect(Collectors.toList());
}
- private void checkToBeAlteredDuplicateResourceNames(final Collection<String> resourceNames) throws DistSQLException {
+ private void checkToBeAlteredDuplicateResourceNames(final Collection<String> resourceNames) {
Collection<String> duplicateResourceNames = getDuplicateResourceNames(resourceNames);
ShardingSpherePreconditions.checkState(duplicateResourceNames.isEmpty(), () -> new DuplicateResourceException(duplicateResourceNames));
}
@@ -106,7 +105,7 @@ public final class AlterResourceBackendHandler extends DatabaseRequiredBackendHa
return resourceNames.stream().filter(each -> resourceNames.stream().filter(each::equals).count() > 1).collect(Collectors.toList());
}
- private void checkResourceNameExisted(final String databaseName, final Collection<String> resourceNames) throws DistSQLException {
+ private void checkResourceNameExisted(final String databaseName, final Collection<String> resourceNames) {
Map<String, DataSource> resources = ProxyContext.getInstance().getDatabase(databaseName).getResource().getDataSources();
Collection<String> notExistedResourceNames = resourceNames.stream().filter(each -> !resources.containsKey(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedResourceNames.isEmpty(), () -> new MissingRequiredResourcesException(databaseName, notExistedResourceNames));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/DropResourceBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/DropResourceBackendHandler.java
index 20dd3546126..4646a6e8ead 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/DropResourceBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/DropResourceBackendHandler.java
@@ -22,7 +22,6 @@ import com.google.common.collect.Multimap;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropResourceStatement;
import org.apache.shardingsphere.infra.datanode.DataNode;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.InvalidResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.resource.ResourceInUsedException;
@@ -57,7 +56,7 @@ public final class DropResourceBackendHandler extends DatabaseRequiredBackendHan
}
@Override
- public ResponseHeader execute(final String databaseName, final DropResourceStatement sqlStatement) throws DistSQLException {
+ public ResponseHeader execute(final String databaseName, final DropResourceStatement sqlStatement) {
Collection<String> toBeDroppedResourceNames = sqlStatement.getNames();
check(databaseName, toBeDroppedResourceNames, sqlStatement.isIgnoreSingleTables(), sqlStatement.isIfExists());
try {
@@ -70,20 +69,20 @@ public final class DropResourceBackendHandler extends DatabaseRequiredBackendHan
}
private void check(final String databaseName, final Collection<String> toBeDroppedResourceNames,
- final boolean ignoreSingleTables, final boolean allowNotExist) throws DistSQLException {
+ final boolean ignoreSingleTables, final boolean allowNotExist) {
if (!allowNotExist) {
checkResourceNameExisted(databaseName, toBeDroppedResourceNames);
}
checkResourceNameNotInUse(databaseName, toBeDroppedResourceNames, ignoreSingleTables);
}
- private void checkResourceNameExisted(final String databaseName, final Collection<String> resourceNames) throws DistSQLException {
+ private void checkResourceNameExisted(final String databaseName, final Collection<String> resourceNames) {
Map<String, DataSource> resources = ProxyContext.getInstance().getDatabase(databaseName).getResource().getDataSources();
Collection<String> notExistedResourceNames = resourceNames.stream().filter(each -> !resources.containsKey(each)).collect(Collectors.toList());
ShardingSpherePreconditions.checkState(notExistedResourceNames.isEmpty(), () -> new MissingRequiredResourcesException(databaseName, notExistedResourceNames));
}
- private void checkResourceNameNotInUse(final String databaseName, final Collection<String> toBeDroppedResourceNames, final boolean ignoreSingleTables) throws DistSQLException {
+ private void checkResourceNameNotInUse(final String databaseName, final Collection<String> toBeDroppedResourceNames, final boolean ignoreSingleTables) {
Multimap<String, String> inUsedMultimap = getInUsedResources(databaseName);
Collection<String> inUsedResourceNames = inUsedMultimap.keySet();
inUsedResourceNames.retainAll(toBeDroppedResourceNames);
@@ -97,7 +96,7 @@ public final class DropResourceBackendHandler extends DatabaseRequiredBackendHan
}
}
- private void checkResourceNameNotInUseIgnoreSingleTableRule(final Collection<String> inUsedResourceNames, final Multimap<String, String> inUsedMultimap) throws DistSQLException {
+ private void checkResourceNameNotInUseIgnoreSingleTableRule(final Collection<String> inUsedResourceNames, final Multimap<String, String> inUsedMultimap) {
for (String each : inUsedResourceNames) {
Collection<String> inUsedRules = inUsedMultimap.get(each);
inUsedRules.remove(SingleTableRule.class.getSimpleName());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/AlterDefaultSingleTableRuleStatementUpdater.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/AlterDefaultSingleTableRuleStatementUpdater.java
index 89a23106db2..530e3fc3837 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/AlterDefaultSingleTableRuleStatementUpdater.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/AlterDefaultSingleTableRuleStatementUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.rule;
import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterDefaultSingleTableRuleStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionAlterUpdater;
@@ -36,24 +35,24 @@ public final class AlterDefaultSingleTableRuleStatementUpdater implements RuleDe
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
- final AlterDefaultSingleTableRuleStatement sqlStatement, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
+ final AlterDefaultSingleTableRuleStatement sqlStatement, final SingleTableRuleConfiguration currentRuleConfig) {
String databaseName = database.getName();
checkConfigurationExist(databaseName, currentRuleConfig);
checkResourceExist(database, sqlStatement);
checkDefaultResourceExist(databaseName, currentRuleConfig);
}
- private void checkConfigurationExist(final String databaseName, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkConfigurationExist(final String databaseName, final SingleTableRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkNotNull(currentRuleConfig, () -> new MissingRequiredRuleException(databaseName, "single table"));
}
- private void checkResourceExist(final ShardingSphereDatabase database, final AlterDefaultSingleTableRuleStatement sqlStatement) throws DistSQLException {
+ private void checkResourceExist(final ShardingSphereDatabase database, final AlterDefaultSingleTableRuleStatement sqlStatement) {
Set<String> resourceNames = database.getResource().getDataSources().keySet();
ShardingSpherePreconditions.checkState(resourceNames.contains(sqlStatement.getDefaultResource()),
() -> new MissingRequiredResourcesException(database.getName(), Collections.singleton(sqlStatement.getDefaultResource())));
}
- private void checkDefaultResourceExist(final String databaseName, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDefaultResourceExist(final String databaseName, final SingleTableRuleConfiguration currentRuleConfig) {
ShardingSpherePreconditions.checkState(currentRuleConfig.getDefaultDataSource().isPresent(), () -> new MissingRequiredRuleException("single table", databaseName));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/CreateDefaultSingleTableRuleStatementUpdater.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/CreateDefaultSingleTableRuleStatementUpdater.java
index 1df04211f2b..a7d1f08249a 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/CreateDefaultSingleTableRuleStatementUpdater.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/CreateDefaultSingleTableRuleStatementUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.rule;
import org.apache.shardingsphere.distsql.parser.statement.rdl.create.CreateDefaultSingleTableRuleStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
@@ -35,19 +34,18 @@ import java.util.Collections;
public final class CreateDefaultSingleTableRuleStatementUpdater implements RuleDefinitionCreateUpdater<CreateDefaultSingleTableRuleStatement, SingleTableRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final CreateDefaultSingleTableRuleStatement sqlStatement,
- final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final CreateDefaultSingleTableRuleStatement sqlStatement, final SingleTableRuleConfiguration currentRuleConfig) {
checkResourceExist(database, sqlStatement);
checkDefaultResourceDuplicate(database.getName(), currentRuleConfig);
}
- private void checkResourceExist(final ShardingSphereDatabase database, final CreateDefaultSingleTableRuleStatement sqlStatement) throws DistSQLException {
+ private void checkResourceExist(final ShardingSphereDatabase database, final CreateDefaultSingleTableRuleStatement sqlStatement) {
Collection<String> resourceNames = database.getResource().getDataSources().keySet();
ShardingSpherePreconditions.checkState(resourceNames.contains(sqlStatement.getDefaultResource()),
() -> new MissingRequiredResourcesException(database.getName(), Collections.singleton(sqlStatement.getDefaultResource())));
}
- private void checkDefaultResourceDuplicate(final String databaseName, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDefaultResourceDuplicate(final String databaseName, final SingleTableRuleConfiguration currentRuleConfig) {
if (null != currentRuleConfig) {
ShardingSpherePreconditions.checkState(!currentRuleConfig.getDefaultDataSource().isPresent(), () -> new DuplicateRuleException("default single table rule", databaseName));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java
index d53404771d9..07c323afc53 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.rule;
import org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropDefaultSingleTableRuleStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredRuleException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -31,13 +30,11 @@ import org.apache.shardingsphere.singletable.config.SingleTableRuleConfiguration
public final class DropDefaultSingleTableRuleStatementUpdater implements RuleDefinitionDropUpdater<DropDefaultSingleTableRuleStatement, SingleTableRuleConfiguration> {
@Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final DropDefaultSingleTableRuleStatement sqlStatement, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
+ public void checkSQLStatement(final ShardingSphereDatabase database, final DropDefaultSingleTableRuleStatement sqlStatement, final SingleTableRuleConfiguration currentRuleConfig) {
checkCurrentRuleConfiguration(database.getName(), sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String databaseName,
- final DropDefaultSingleTableRuleStatement sqlStatement, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final DropDefaultSingleTableRuleStatement sqlStatement, final SingleTableRuleConfiguration currentRuleConfig) {
if (!sqlStatement.isIfExists()) {
ShardingSpherePreconditions.checkState(null != currentRuleConfig && currentRuleConfig.getDefaultDataSource().isPresent(),
() -> new MissingRequiredRuleException("single table", databaseName));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/RuleDefinitionBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/RuleDefinitionBackendHandler.java
index b0bbdaf7c8a..c98c5775eeb 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/RuleDefinitionBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/rule/RuleDefinitionBackendHandler.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.rule;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.distsql.parser.statement.rdl.RuleDefinitionStatement;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionAlterUpdater;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
@@ -54,7 +53,7 @@ public final class RuleDefinitionBackendHandler<T extends RuleDefinitionStatemen
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
- protected ResponseHeader execute(final String databaseName, final T sqlStatement) throws DistSQLException {
+ protected ResponseHeader execute(final String databaseName, final T sqlStatement) {
RuleDefinitionUpdater ruleDefinitionUpdater = RuleDefinitionUpdaterFactory.getInstance(sqlStatement);
Class<? extends RuleConfiguration> ruleConfigClass = ruleDefinitionUpdater.getRuleConfigurationClass();
ShardingSphereDatabase database = ProxyContext.getInstance().getDatabase(databaseName);
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 058ec3a6e53..f23ed65a64c 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
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.distsql.parser.segment.URLBasedDataSourceSegmen
import org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResourceStatement;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesValidator;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.DuplicateResourceException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResource;
@@ -100,7 +99,7 @@ public final class AddResourceBackendHandlerTest extends ProxyContextRestorer {
}
@Test(expected = DuplicateResourceException.class)
- public void assertExecuteWithDuplicateResourceNames() throws DistSQLException {
+ public void assertExecuteWithDuplicateResourceNames() {
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/handler/distsql/rdl/resource/AlterResourceBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterResourceBackendHandlerTest.java
index f8929fe6794..95e37d1f263 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterResourceBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/AlterResourceBackendHandlerTest.java
@@ -24,7 +24,6 @@ import org.apache.shardingsphere.distsql.parser.segment.URLBasedDataSourceSegmen
import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterResourceStatement;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesValidator;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.exception.resource.DuplicateResourceException;
import org.apache.shardingsphere.infra.distsql.exception.resource.InvalidResourcesException;
import org.apache.shardingsphere.infra.distsql.exception.resource.MissingRequiredResourcesException;
@@ -95,7 +94,7 @@ public final class AlterResourceBackendHandlerTest extends ProxyContextRestorer
}
@Test
- public void assertExecute() throws DistSQLException {
+ public void assertExecute() {
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
ProxyContext.init(contextManager);
@@ -105,12 +104,12 @@ public final class AlterResourceBackendHandlerTest extends ProxyContextRestorer
}
@Test(expected = DuplicateResourceException.class)
- public void assertExecuteWithDuplicateResourceNames() throws DistSQLException {
+ public void assertExecuteWithDuplicateResourceNames() {
alterResourceBackendHandler.execute("test_db", createAlterResourceStatementWithDuplicateResourceNames());
}
@Test(expected = MissingRequiredResourcesException.class)
- public void assertExecuteWithNotExistedResourceNames() throws DistSQLException {
+ public void assertExecuteWithNotExistedResourceNames() {
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/handler/distsql/rdl/resource/DropResourceBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/DropResourceBackendHandlerTest.java
index 07f9b24cc42..514535429a4 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/DropResourceBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/DropResourceBackendHandlerTest.java
@@ -159,7 +159,7 @@ public final class DropResourceBackendHandlerTest extends ProxyContextRestorer {
}
@Test(expected = DistSQLException.class)
- public void assertResourceNameInUseWithIfExists() throws DistSQLException {
+ public void assertResourceNameInUseWithIfExists() {
when(ruleMetaData.getRules()).thenReturn(Collections.singleton(shadowRule));
when(shadowRule.getType()).thenReturn("ShadowRule");
when(shadowRule.getDataSourceMapper()).thenReturn(Collections.singletonMap("", Collections.singleton("foo_ds")));