You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2021/07/04 08:39:29 UTC
[shardingsphere] branch master updated: Remove
ShardingBroadcastTableRuleNotExistsException (#11142)
This is an automated email from the ASF dual-hosted git repository.
wuweijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new cd0324e Remove ShardingBroadcastTableRuleNotExistsException (#11142)
cd0324e is described below
commit cd0324e91b1ea3941ab82e9c3d5f510eae49401f
Author: Liang Zhang <te...@163.com>
AuthorDate: Sun Jul 4 16:39:05 2021 +0800
Remove ShardingBroadcastTableRuleNotExistsException (#11142)
---
.../update/CreateShardingBindingTableRuleStatementUpdater.java | 6 +++---
.../update/DropShardingBindingTableRuleStatementUpdater.java | 6 +++---
.../update/DropShardingBindingTableRuleStatementUpdaterTest.java | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
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 f1ae1a2..41edb4d 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
@@ -19,12 +19,12 @@ package org.apache.shardingsphere.sharding.distsql.handler.update;
import org.apache.shardingsphere.infra.distsql.update.RDLCreateUpdater;
import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException;
+import org.apache.shardingsphere.infra.exception.rule.RequiredRuleMissedException;
import org.apache.shardingsphere.infra.exception.rule.RuleDefinitionViolationException;
import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.exception.ShardingBindingTableRuleNotExistsException;
import org.apache.shardingsphere.sharding.distsql.parser.segment.BindingTableRuleSegment;
import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingBindingTableRulesStatement;
@@ -46,9 +46,9 @@ public final class CreateShardingBindingTableRuleStatementUpdater implements RDL
checkToBeCreatedDuplicateBindingTables(schemaName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws ShardingBindingTableRuleNotExistsException {
+ private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new ShardingBindingTableRuleNotExistsException(schemaName);
+ throw new RequiredRuleMissedException("Binding", schemaName);
}
}
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 1e31d6e..61235a3 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
@@ -18,10 +18,10 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
import org.apache.shardingsphere.infra.distsql.update.RDLDropUpdater;
+import org.apache.shardingsphere.infra.exception.rule.RequiredRuleMissedException;
import org.apache.shardingsphere.infra.exception.rule.RuleDefinitionViolationException;
import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.exception.ShardingBindingTableRuleNotExistsException;
import org.apache.shardingsphere.sharding.distsql.parser.statement.DropShardingBindingTableRulesStatement;
/**
@@ -35,9 +35,9 @@ public final class DropShardingBindingTableRuleStatementUpdater implements RDLDr
checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws ShardingBindingTableRuleNotExistsException {
+ private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig || currentRuleConfig.getBindingTableGroups().isEmpty()) {
- throw new ShardingBindingTableRuleNotExistsException(schemaName);
+ throw new RequiredRuleMissedException("Binding", schemaName);
}
}
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 567766e..f300015 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,12 +17,12 @@
package org.apache.shardingsphere.sharding.distsql.update;
+import org.apache.shardingsphere.infra.exception.rule.RequiredRuleMissedException;
import org.apache.shardingsphere.infra.exception.rule.RuleDefinitionViolationException;
import org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.exception.ShardingBindingTableRuleNotExistsException;
import org.apache.shardingsphere.sharding.distsql.handler.update.DropShardingBindingTableRuleStatementUpdater;
import org.apache.shardingsphere.sharding.distsql.parser.statement.DropShardingBindingTableRulesStatement;
import org.junit.Test;
@@ -34,12 +34,12 @@ public final class DropShardingBindingTableRuleStatementUpdaterTest {
private final DropShardingBindingTableRuleStatementUpdater updater = new DropShardingBindingTableRuleStatementUpdater();
- @Test(expected = ShardingBindingTableRuleNotExistsException.class)
+ @Test(expected = RequiredRuleMissedException.class)
public void assertCheckSQLStatementWithoutCurrentRule() throws RuleDefinitionViolationException {
updater.checkSQLStatement("foo", createSQLStatement(), null, mock(ShardingSphereResource.class));
}
- @Test(expected = ShardingBindingTableRuleNotExistsException.class)
+ @Test(expected = RequiredRuleMissedException.class)
public void assertCheckSQLStatementWithoutExistedBindingTableRule() throws RuleDefinitionViolationException {
updater.checkSQLStatement("foo", createSQLStatement(), new ShardingRuleConfiguration(), mock(ShardingSphereResource.class));
}