This is an automated email from the ASF dual-hosted git repository.
panjuan 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 0624404 Minor refactor for rdl exception (#10547)
0624404 is described below
commit 06244047d32a21616c748b38e7fc7af72f6a709d
Author: Haoran Meng <[email protected]>
AuthorDate: Sun May 30 13:07:42 2021 +0800
Minor refactor for rdl exception (#10547)
---
.../db/protocol/error/CommonErrorCode.java | 50 +++++++++++-----------
.../db/protocol/error/CommonErrorCodeTest.java | 8 ++--
...teSplittingRuleDataSourcesExistedException.java | 35 ---------------
.../exception/ResourceNotExistedException.java | 2 +
.../AlterDatabaseDiscoveryRuleBackendHandler.java | 2 +-
.../AlterReadwriteSplittingRuleBackendHandler.java | 2 +-
.../CreateDatabaseDiscoveryRuleBackendHandler.java | 2 +-
...CreateReadwriteSplittingRuleBackendHandler.java | 2 +-
.../rdl/impl/DropResourceBackendHandler.java | 4 +-
.../frontend/mysql/err/MySQLErrPacketFactory.java | 7 +--
.../mysql/err/MySQLErrPacketFactoryTest.java | 8 ++--
11 files changed, 42 insertions(+), 80 deletions(-)
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
index 94cf18e..08879fc 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
@@ -28,42 +28,40 @@ import lombok.RequiredArgsConstructor;
public enum CommonErrorCode implements SQLErrorCode {
CIRCUIT_BREAK_MODE(1000, "C1000", "Circuit break mode is ON."),
-
- SHARDING_TABLE_RULES_NOT_EXISTED(1101, "C1101", "Sharding table rules %s
do not exist in schema %s."),
-
- SHARDING_TABLE_RULES_IN_USED_BY_BINDING_TABLE(1102, "C1102", "Sharding
table rules %s are still used by binding table rule."),
- RESOURCE_IN_USED(1103, "C1103", "Resources %s in the rule are still in
used."),
-
- RESOURCE_NOT_EXIST(1104, "C1104", "Resources %s do not exist."),
-
- READWRITE_SPLITTING_RULES_NOT_EXIST(1105, "C1105", "Readwrite splitting
rules %s do not exist in schema %s."),
-
- ADD_REPLICA_QUERY_RULE_DATA_SOURCE_EXIST(1107, "C1107", "Data sources %s
in replica query rule already exists."),
-
- INVALID_RESOURCE(1111, "C1111", "Can not add invalid resources %s."),
-
- DUPLICATE_RESOURCE(1112, "C1112", "Duplicate resource names %s."),
-
- DUPLICATE_TABLE(1113, "C1113", "Duplicate table names %s."),
+ RESOURCE_IN_USED(1101, "C1101", "Resources %s in the rule are still in
used."),
+
+ RESOURCE_NOT_EXIST(1102, "C1102", "Resources %s do not exist in schema
%s."),
+
+ INVALID_RESOURCE(1103, "C1103", "Can not add invalid resources %s."),
+
+ DUPLICATE_RESOURCE(1104, "C1104", "Duplicate resource names %s."),
+
+ DUPLICATE_RULE_NAMES(1105, "C1105", "Duplicate rule names %s in schema
%s"),
+
+ SHARDING_TABLE_RULES_NOT_EXISTED(1106, "C1106", "Sharding table rules %s
do not exist in schema %s."),
- SHARDING_BROADCAST_EXIST(1114, "C1114", "Sharding broadcast table rules
already exists in schema %s."),
+ SHARDING_TABLE_RULES_IN_USED_BY_BINDING_TABLE(1107, "C1107", "Sharding
table rules %s are still used by binding table rule."),
+
+ DUPLICATE_TABLE(1108, "C1108", "Duplicate table names %s."),
+
+ SHARDING_BROADCAST_EXIST(1110, "C1110", "Sharding broadcast table rules
already exists in schema %s."),
- SHARDING_BINDING_TABLE_RULES_NOT_EXIST(1115, "C1115", "Sharding binding
table rules do not exist in schema %s."),
+ SHARDING_BINDING_TABLE_RULES_NOT_EXIST(1111, "C1111", "Sharding binding
table rules do not exist in schema %s."),
- SHARDING_BROADCAST_TABLE_RULES_NOT_EXIST(1116, "C1116", "Sharding
broadcast table rules do not exist in schema %s."),
+ SHARDING_BROADCAST_TABLE_RULES_NOT_EXIST(1112, "C1112", "Sharding
broadcast table rules do not exist in schema %s."),
- INVALID_LOAD_BALANCERS(1117, "C1117", "Invalid load balancers %s."),
+ READWRITE_SPLITTING_RULES_NOT_EXIST(1113, "C113", "Readwrite splitting
rules %s do not exist in schema %s."),
- INVALID_DATABASE_DISCOVERY_TYPES(1119, "C1119", "Invalid database
discovery types %s."),
+ INVALID_LOAD_BALANCERS(1114, "C1114", "Invalid load balancers %s."),
- DATABASE_DISCOVERY_RULES_NOT_EXIST(1120, "C1120", "Database discovery
rules %s do not exist in schema %s."),
+ INVALID_DATABASE_DISCOVERY_TYPES(1115, "C1115", "Invalid database
discovery types %s."),
- INVALID_ENCRYPTORS(1123, "C1123", "Invalid encryptors %s."),
+ DATABASE_DISCOVERY_RULES_NOT_EXIST(1116, "C1116", "Database discovery
rules %s do not exist in schema %s."),
- ENCRYPT_RULES_NOT_EXIST(1124, "C1124", "Encrypt rules %s do not exist in
schema %s."),
+ INVALID_ENCRYPTORS(1117, "C1117", "Invalid encryptors %s."),
- DUPLICATE_RULE_NAMES(1125, "C1125", "Duplicate rule names %s in schema
%s"),
+ ENCRYPT_RULES_NOT_EXIST(1118, "C1118", "Encrypt rules %s do not exist in
schema %s."),
SCALING_JOB_NOT_EXIST(1201, "C1201", "Scaling job %s does not exist."),
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
index f740204..34c6ec4 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/test/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCodeTest.java
@@ -33,15 +33,15 @@ public final class CommonErrorCodeTest {
@Test
public void assertSharingTableRulesNotExisted() {
-
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_NOT_EXISTED.getErrorCode(),
is(1101));
-
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_NOT_EXISTED.getSqlState(),
is("C1101"));
+
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_NOT_EXISTED.getErrorCode(),
is(1106));
+
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_NOT_EXISTED.getSqlState(),
is("C1106"));
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_NOT_EXISTED.getErrorMessage(),
is("Sharding table rules %s do not exist in schema %s."));
}
@Test
public void assertTableInUsed() {
-
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_IN_USED_BY_BINDING_TABLE.getErrorCode(),
is(1102));
-
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_IN_USED_BY_BINDING_TABLE.getSqlState(),
is("C1102"));
+
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_IN_USED_BY_BINDING_TABLE.getErrorCode(),
is(1107));
+
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_IN_USED_BY_BINDING_TABLE.getSqlState(),
is("C1107"));
assertThat(CommonErrorCode.SHARDING_TABLE_RULES_IN_USED_BY_BINDING_TABLE.getErrorMessage(),
is("Sharding table rules %s are still used by binding table rule."));
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/AddReadwriteSplittingRuleDataSourcesExistedException.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/AddReadwriteSplittingRuleDataSourcesExistedException.java
deleted file mode 100644
index 545199f..0000000
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/AddReadwriteSplittingRuleDataSourcesExistedException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.proxy.backend.exception;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-import java.util.Collection;
-
-/**
- * Add readwrite-splitting rule data source existed exception.
- */
-@RequiredArgsConstructor
-@Getter
-public final class AddReadwriteSplittingRuleDataSourcesExistedException
extends BackendException {
-
- private static final long serialVersionUID = -4169758880611482863L;
-
- private final Collection<String> ruleNames;
-}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
index 3a6d7f1..b28b9d5 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
@@ -31,5 +31,7 @@ public final class ResourceNotExistedException extends
BackendException {
private static final long serialVersionUID = 1704331180489268L;
+ private final String schemaName;
+
private final Collection<String> resourceNames;
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterDatabaseDiscoveryRuleBackendHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterDatabaseDiscoveryRuleBackendHandler.java
index bcb4a42..d224993 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterDatabaseDiscoveryRuleBackendHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterDatabaseDiscoveryRuleBackendHandler.java
@@ -106,7 +106,7 @@ public final class AlterDatabaseDiscoveryRuleBackendHandler
extends SchemaRequir
statement.getDatabaseDiscoveryRules().forEach(each ->
resources.addAll(each.getDataSources()));
Collection<String> notExistResources = resources.stream().filter(each
-> !this.isValidResource(schemaName, each)).collect(Collectors.toList());
if (!notExistResources.isEmpty()) {
- throw new ResourceNotExistedException(notExistResources);
+ throw new ResourceNotExistedException(schemaName,
notExistResources);
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterReadwriteSplittingRuleBackendHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterReadwriteSplittingRuleBackendHandler.java
index 67f2621..a990e71 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterReadwriteSplittingRuleBackendHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterReadwriteSplittingRuleBackendHandler.java
@@ -105,7 +105,7 @@ public final class
AlterReadwriteSplittingRuleBackendHandler extends SchemaRequi
});
Collection<String> notExistResources = resources.stream().filter(each
-> !this.isValidResource(schemaName, each)).collect(Collectors.toList());
if (!notExistResources.isEmpty()) {
- throw new ResourceNotExistedException(notExistResources);
+ throw new ResourceNotExistedException(schemaName,
notExistResources);
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateDatabaseDiscoveryRuleBackendHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateDatabaseDiscoveryRuleBackendHandler.java
index 5047511..ba17d46 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateDatabaseDiscoveryRuleBackendHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateDatabaseDiscoveryRuleBackendHandler.java
@@ -100,7 +100,7 @@ public final class
CreateDatabaseDiscoveryRuleBackendHandler extends SchemaRequi
sqlStatement.getDatabaseDiscoveryRules().forEach(each ->
resources.addAll(each.getDataSources()));
Collection<String> notExistResources = resources.stream().filter(each
-> !this.isValidResource(schemaName, each)).collect(Collectors.toList());
if (!notExistResources.isEmpty()) {
- throw new ResourceNotExistedException(notExistResources);
+ throw new ResourceNotExistedException(schemaName,
notExistResources);
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateReadwriteSplittingRuleBackendHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateReadwriteSplittingRuleBackendHandler.java
index 093cd0e..1900c53 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateReadwriteSplittingRuleBackendHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/CreateReadwriteSplittingRuleBackendHandler.java
@@ -89,7 +89,7 @@ public final class CreateReadwriteSplittingRuleBackendHandler
extends SchemaRequ
private void checkResources(final String schemaName, final
CreateReadwriteSplittingRuleStatement sqlStatement) {
Collection<String> notExistResources =
getResources(sqlStatement).stream().filter(each ->
!this.isValidResource(schemaName, each)).collect(Collectors.toList());
if (!notExistResources.isEmpty()) {
- throw new ResourceNotExistedException(notExistResources);
+ throw new ResourceNotExistedException(schemaName,
notExistResources);
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropResourceBackendHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropResourceBackendHandler.java
index afea73a..e31ae1f 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropResourceBackendHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropResourceBackendHandler.java
@@ -63,11 +63,11 @@ public final class DropResourceBackendHandler extends
SchemaRequiredBackendHandl
private void check(final String schemaName, final Collection<String>
resourceNames) {
Map<String, DataSource> resourceMap =
ProxyContext.getInstance().getMetaData(schemaName).getResource().getDataSources();
if (null == resourceMap || resourceMap.isEmpty()) {
- throw new ResourceNotExistedException(resourceNames);
+ throw new ResourceNotExistedException(schemaName, resourceNames);
}
Collection<String> notExistedResourceNames =
resourceNames.stream().filter(each ->
!resourceMap.containsKey(each)).collect(Collectors.toList());
if (!notExistedResourceNames.isEmpty()) {
- throw new ResourceNotExistedException(notExistedResourceNames);
+ throw new ResourceNotExistedException(schemaName,
notExistedResourceNames);
}
Collection<ShardingSphereRule> ruleConfig =
ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getRules();
Set<String> useResources = new HashSet<>();
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
index 6324d37..582b71c 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
@@ -23,7 +23,6 @@ import
org.apache.shardingsphere.db.protocol.error.CommonErrorCode;
import
org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode;
import
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket;
import
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
-import
org.apache.shardingsphere.proxy.backend.exception.AddReadwriteSplittingRuleDataSourcesExistedException;
import org.apache.shardingsphere.proxy.backend.exception.CircuitBreakException;
import
org.apache.shardingsphere.proxy.backend.exception.DBCreateExistsException;
import org.apache.shardingsphere.proxy.backend.exception.DBDropExistsException;
@@ -137,7 +136,8 @@ public final class MySQLErrPacketFactory {
exception.getSchemaName());
}
if (cause instanceof ResourceNotExistedException) {
- return new MySQLErrPacket(1, CommonErrorCode.RESOURCE_NOT_EXIST,
((ResourceNotExistedException) cause).getResourceNames());
+ return new MySQLErrPacket(1, CommonErrorCode.RESOURCE_NOT_EXIST,
((ResourceNotExistedException) cause).getResourceNames(),
+ ((ResourceNotExistedException) cause).getSchemaName());
}
if (cause instanceof ResourceInUsedException) {
return new MySQLErrPacket(1, CommonErrorCode.RESOURCE_IN_USED,
((ResourceInUsedException) cause).getResourceNames());
@@ -164,9 +164,6 @@ public final class MySQLErrPacketFactory {
return new MySQLErrPacket(1,
CommonErrorCode.READWRITE_SPLITTING_RULES_NOT_EXIST,
((ReadwriteSplittingRulesNotExistedException)
cause).getRuleNames(), ((ReadwriteSplittingRulesNotExistedException)
cause).getSchemaName());
}
- if (cause instanceof
AddReadwriteSplittingRuleDataSourcesExistedException) {
- return new MySQLErrPacket(1,
CommonErrorCode.ADD_REPLICA_QUERY_RULE_DATA_SOURCE_EXIST,
((AddReadwriteSplittingRuleDataSourcesExistedException) cause).getRuleNames());
- }
if (cause instanceof ScalingJobNotFoundException) {
return new MySQLErrPacket(1,
CommonErrorCode.SCALING_JOB_NOT_EXIST, ((ScalingJobNotFoundException)
cause).getJobId());
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
index ab8a2df..fe47a61 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
@@ -197,8 +197,8 @@ public final class MySQLErrPacketFactoryTest {
public void assertNewInstanceWithShardingTableRuleNotExistedException() {
MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new
ShardingTableRuleNotExistedException("test", Collections.singleton("tbl")));
assertThat(actual.getSequenceId(), is(1));
- assertThat(actual.getErrorCode(), is(1101));
- assertThat(actual.getSqlState(), is("C1101"));
+ assertThat(actual.getErrorCode(), is(1106));
+ assertThat(actual.getSqlState(), is("C1106"));
assertThat(actual.getErrorMessage(), is("Sharding table rules [tbl] do
not exist in schema test."));
}
@@ -206,8 +206,8 @@ public final class MySQLErrPacketFactoryTest {
public void assertNewInstanceWithTablesInUsedException() {
MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new
ShardingTableRulesInUsedException(Collections.singleton("tbl")));
assertThat(actual.getSequenceId(), is(1));
- assertThat(actual.getErrorCode(), is(1102));
- assertThat(actual.getSqlState(), is("C1102"));
+ assertThat(actual.getErrorCode(), is(1107));
+ assertThat(actual.getSqlState(), is("C1107"));
assertThat(actual.getErrorMessage(), is("Sharding table rules [tbl]
are still used by binding table rule."));
}