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 7299303 Add shardingsphere-db-discovery-distsql-handler module
(#11114)
7299303 is described below
commit 7299303904bf3f1748fa4c3519c2624db59adde6
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Jul 2 23:18:54 2021 +0800
Add shardingsphere-db-discovery-distsql-handler module (#11114)
* Add shardingsphere-db-discovery-distsql-handler module
* Add shardingsphere-db-discovery-distsql-handler module
---
.../shardingsphere-db-discovery-core/pom.xml | 12 +---
.../DatabaseDiscoveryRuleStatementConverter.java | 70 ----------------------
....shardingsphere.infra.distsql.update.RDLUpdater | 20 -------
...shardingsphere.infra.distsql.query.RQLResultSet | 2 +-
.../shardingsphere-db-discovery-distsql/pom.xml | 1 +
.../pom.xml | 21 ++++---
.../DatabaseDiscoveryRuleStatementConverter.java | 58 ++++++++++++++++++
.../DatabaseDiscoveryRuleNotExistedException.java | 2 +-
.../InvalidDatabaseDiscoveryTypesException.java | 2 +-
.../query/DatabaseDiscoveryRuleQueryResultSet.java | 2 +-
...AlterDatabaseDiscoveryRuleStatementUpdater.java | 19 +++---
...reateDatabaseDiscoveryRuleStatementUpdater.java | 16 ++---
.../DropDatabaseDiscoveryRuleStatementUpdater.java | 4 +-
....shardingsphere.infra.distsql.update.RDLUpdater | 37 ++++++++++++
...atabaseDiscoveryRuleStatementConverterTest.java | 15 +++--
.../DatabaseDiscoveryRuleQueryResultSetTest.java | 6 +-
...rDatabaseDiscoveryRuleStatementUpdaterTest.java | 6 +-
...eDatabaseDiscoveryRuleStatementUpdaterTest.java | 4 +-
...pDatabaseDiscoveryRuleStatementUpdaterTest.java | 4 +-
.../pom.xml | 2 +-
20 files changed, 148 insertions(+), 155 deletions(-)
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/pom.xml
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/pom.xml
index 6aca1c5..29836a6 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/pom.xml
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/pom.xml
@@ -36,7 +36,7 @@
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-db-discovery-distsql-statement</artifactId>
+
<artifactId>shardingsphere-db-discovery-distsql-handler</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -44,20 +44,14 @@
<artifactId>shardingsphere-db-discovery-distsql-parser</artifactId>
<version>${project.version}</version>
</dependency>
-
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-infra-route</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-distsql-parser-statement</artifactId>
+ <artifactId>shardingsphere-db-discovery-mgr</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-db-discovery-mgr</artifactId>
+ <artifactId>shardingsphere-infra-route</artifactId>
<version>${project.version}</version>
</dependency>
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/yaml/converter/DatabaseDiscoveryRuleStatementConverter.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/yaml/converter/DatabaseDiscoveryRuleStatementConverter.java
deleted file mode 100644
index 36acb87..0000000
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/yaml/converter/DatabaseDiscoveryRuleStatementConverter.java
+++ /dev/null
@@ -1,70 +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.dbdiscovery.yaml.converter;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import
org.apache.shardingsphere.dbdiscovery.yaml.config.YamlDatabaseDiscoveryRuleConfiguration;
-import
org.apache.shardingsphere.dbdiscovery.yaml.config.rule.YamlDatabaseDiscoveryDataSourceRuleConfiguration;
-import
org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryRuleSegment;
-import
org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
-
-import java.util.Collection;
-
-/**
- * Database discovery rule statement converter.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class DatabaseDiscoveryRuleStatementConverter {
-
- /**
- * Convert database discovery rule segment to YAML database discovery rule
configuration.
- *
- * @param databaseDiscoveryRuleSegments collection of database discovery
rule segments
- * @return YAML database discovery rule configuration
- */
- public static YamlDatabaseDiscoveryRuleConfiguration convert(final
Collection<DatabaseDiscoveryRuleSegment> databaseDiscoveryRuleSegments) {
- YamlDatabaseDiscoveryRuleConfiguration result = new
YamlDatabaseDiscoveryRuleConfiguration();
- for (DatabaseDiscoveryRuleSegment each :
databaseDiscoveryRuleSegments) {
- String databaseDiscoveryType =
getDatabaseDiscoveryType(each.getName(), each.getDiscoveryTypeName());
- result.getDataSources().put(each.getName(),
buildDataSourceRuleConfiguration(databaseDiscoveryType, each));
- result.getDiscoveryTypes().put(databaseDiscoveryType,
buildDiscoveryType(each));
- }
- return result;
- }
-
- private static YamlDatabaseDiscoveryDataSourceRuleConfiguration
buildDataSourceRuleConfiguration(final String databaseDiscoveryType,
-
final DatabaseDiscoveryRuleSegment
databaseDiscoveryRuleSegment) {
- YamlDatabaseDiscoveryDataSourceRuleConfiguration result = new
YamlDatabaseDiscoveryDataSourceRuleConfiguration();
-
result.getDataSourceNames().addAll(databaseDiscoveryRuleSegment.getDataSources());
- result.setDiscoveryTypeName(databaseDiscoveryType);
- result.setProps(databaseDiscoveryRuleSegment.getProps());
- return result;
- }
-
- private static YamlShardingSphereAlgorithmConfiguration
buildDiscoveryType(final DatabaseDiscoveryRuleSegment
databaseDiscoveryRuleSegment) {
- YamlShardingSphereAlgorithmConfiguration result = new
YamlShardingSphereAlgorithmConfiguration();
- result.setType(databaseDiscoveryRuleSegment.getDiscoveryTypeName());
- result.setProps(databaseDiscoveryRuleSegment.getProps());
- return result;
- }
-
- private static String getDatabaseDiscoveryType(final String ruleName,
final String databaseDiscoveryType) {
- return String.format("%s_%s", ruleName, databaseDiscoveryType);
- }
-}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RDLUpdater
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RDLUpdater
deleted file mode 100644
index f13886f..0000000
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RDLUpdater
+++ /dev/null
@@ -1,20 +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.
-#
-
-org.apache.shardingsphere.dbdiscovery.distsql.update.CreateDatabaseDiscoveryRuleStatementUpdater
-org.apache.shardingsphere.dbdiscovery.distsql.update.AlterDatabaseDiscoveryRuleStatementUpdater
-org.apache.shardingsphere.dbdiscovery.distsql.update.DropDatabaseDiscoveryRuleStatementUpdater
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.RQLResultSet
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.RQLResultSet
index 696e633..09b4426 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.RQLResultSet
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.RQLResultSet
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.dbdiscovery.distsql.query.DatabaseDiscoveryRuleQueryResultSet
+org.apache.shardingsphere.dbdiscovery.distsql.handler.query.DatabaseDiscoveryRuleQueryResultSet
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/pom.xml
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/pom.xml
index 206daeb..b4c2237 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/pom.xml
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/pom.xml
@@ -32,5 +32,6 @@
<modules>
<module>shardingsphere-db-discovery-distsql-statement</module>
<module>shardingsphere-db-discovery-distsql-parser</module>
+ <module>shardingsphere-db-discovery-distsql-handler</module>
</modules>
</project>
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/pom.xml
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/pom.xml
similarity index 67%
copy from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/pom.xml
copy to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/pom.xml
index 206daeb..7302171 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/pom.xml
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/pom.xml
@@ -22,15 +22,22 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-db-discovery</artifactId>
+ <artifactId>shardingsphere-db-discovery-distsql</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-db-discovery-distsql</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-db-discovery-distsql-handler</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>shardingsphere-db-discovery-distsql-statement</module>
- <module>shardingsphere-db-discovery-distsql-parser</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-db-discovery-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+
<artifactId>shardingsphere-db-discovery-distsql-statement</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
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/converter/DatabaseDiscoveryRuleStatementConverter.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/converter/DatabaseDisco
[...]
new file mode 100644
index 0000000..b95026f
--- /dev/null
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/converter/DatabaseDiscoveryRuleStatementConverter.java
@@ -0,0 +1,58 @@
+/*
+ * 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.dbdiscovery.distsql.handler.converter;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
+import
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
+import
org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryRuleSegment;
+import
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+/**
+ * Database discovery rule statement converter.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DatabaseDiscoveryRuleStatementConverter {
+
+ /**
+ * Convert database discovery rule segment to database discovery rule
configuration.
+ *
+ * @param ruleSegments database discovery rule segments
+ * @return database discovery rule configuration
+ */
+ public static DatabaseDiscoveryRuleConfiguration convert(final
Collection<DatabaseDiscoveryRuleSegment> ruleSegments) {
+ Collection<DatabaseDiscoveryDataSourceRuleConfiguration> dataSources =
new LinkedList<>();
+ Map<String, ShardingSphereAlgorithmConfiguration> discoveryTypes = new
HashMap<>();
+ for (DatabaseDiscoveryRuleSegment each : ruleSegments) {
+ String type = getDatabaseDiscoveryType(each.getName(),
each.getDiscoveryTypeName());
+ dataSources.add(new
DatabaseDiscoveryDataSourceRuleConfiguration(each.getName(), new
LinkedList<>(each.getDataSources()), type));
+ discoveryTypes.put(type, new
ShardingSphereAlgorithmConfiguration(each.getDiscoveryTypeName(),
each.getProps()));
+ }
+ return new DatabaseDiscoveryRuleConfiguration(dataSources,
discoveryTypes);
+ }
+
+ private static String getDatabaseDiscoveryType(final String ruleName,
final String type) {
+ return String.format("%s_%s", ruleName, type);
+ }
+}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/exception/DatabaseDiscoveryRuleNotExistedException.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/exception/DatabaseDiscoveryRuleNotExistedException.java
similarity index 95%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/exception/DatabaseDiscoveryRuleNotExistedException.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/exception/DatabaseDiscoveryRuleNotExistedException.java
index c7533c3..b8b81ac 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/exception/DatabaseDiscoveryRuleNotExistedException.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/exception/DatabaseDiscoveryRuleNotExistedException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.distsql.exception;
+package org.apache.shardingsphere.dbdiscovery.distsql.handler.exception;
import
org.apache.shardingsphere.infra.exception.rule.RuleDefinitionViolationException;
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/exception/InvalidDatabaseDiscoveryTypesException.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/exception/InvalidDatabaseDiscoveryTypesException.java
similarity index 94%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/exception/InvalidDatabaseDiscoveryTypesException.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/exception/InvalidDatabaseDiscoveryTypesException.java
index f8cd513..0a4b66b 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/exception/InvalidDatabaseDiscoveryTypesException.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/exception/InvalidDatabaseDiscoveryTypesException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.distsql.exception;
+package org.apache.shardingsphere.dbdiscovery.distsql.handler.exception;
import
org.apache.shardingsphere.infra.exception.rule.RuleDefinitionViolationException;
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/query/DatabaseDiscoveryRuleQueryResultSet.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/query/DatabaseDiscoveryRuleQueryResultSet.java
similarity index 98%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/query/DatabaseDiscoveryRuleQueryResultSet.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/query/DatabaseDiscoveryRuleQueryResultSet.java
index 8451343..3c97af7 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/query/DatabaseDiscoveryRuleQueryResultSet.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/query/DatabaseDiscoveryRuleQueryResultSet.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.distsql.query;
+package org.apache.shardingsphere.dbdiscovery.distsql.handler.query;
import
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/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
similarity index 88%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/update/AlterDatabaseDiscoveryRuleStatementUpdater.java
rename to
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
index c614b34..24dc7f9 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/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
@@ -15,26 +15,24 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.distsql.update;
+package org.apache.shardingsphere.dbdiscovery.distsql.handler.update;
import com.google.common.base.Preconditions;
import
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
-import
org.apache.shardingsphere.dbdiscovery.distsql.exception.DatabaseDiscoveryRuleNotExistedException;
-import
org.apache.shardingsphere.dbdiscovery.distsql.exception.InvalidDatabaseDiscoveryTypesException;
+import
org.apache.shardingsphere.dbdiscovery.distsql.handler.converter.DatabaseDiscoveryRuleStatementConverter;
+import
org.apache.shardingsphere.dbdiscovery.distsql.handler.exception.DatabaseDiscoveryRuleNotExistedException;
+import
org.apache.shardingsphere.dbdiscovery.distsql.handler.exception.InvalidDatabaseDiscoveryTypesException;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryRuleSegment;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.AlterDatabaseDiscoveryRuleStatement;
import org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType;
-import
org.apache.shardingsphere.dbdiscovery.yaml.converter.DatabaseDiscoveryRuleStatementConverter;
import org.apache.shardingsphere.infra.distsql.update.RDLAlterUpdater;
import
org.apache.shardingsphere.infra.exception.rule.ResourceNotExistedException;
import
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
-import
org.apache.shardingsphere.infra.yaml.swapper.YamlRuleConfigurationSwapperEngine;
import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Optional;
import java.util.Properties;
@@ -121,12 +119,9 @@ public final class
AlterDatabaseDiscoveryRuleStatementUpdater implements RDLAlte
}
private void addRuleConfiguration(final
AlterDatabaseDiscoveryRuleStatement sqlStatement, final
DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
- Optional<DatabaseDiscoveryRuleConfiguration> toBeAlteredRuleConfig =
new YamlRuleConfigurationSwapperEngine()
-
.swapToRuleConfigurations(Collections.singleton(DatabaseDiscoveryRuleStatementConverter.convert(sqlStatement.getRules()))).stream()
- .map(each -> (DatabaseDiscoveryRuleConfiguration)
each).findFirst();
- Preconditions.checkState(toBeAlteredRuleConfig.isPresent());
-
currentRuleConfig.getDataSources().addAll(toBeAlteredRuleConfig.get().getDataSources());
-
currentRuleConfig.getDiscoveryTypes().putAll(toBeAlteredRuleConfig.get().getDiscoveryTypes());
+ DatabaseDiscoveryRuleConfiguration toBeAlteredRuleConfig =
DatabaseDiscoveryRuleStatementConverter.convert(sqlStatement.getRules());
+
currentRuleConfig.getDataSources().addAll(toBeAlteredRuleConfig.getDataSources());
+
currentRuleConfig.getDiscoveryTypes().putAll(toBeAlteredRuleConfig.getDiscoveryTypes());
}
@Override
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/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
similarity index 86%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/update/CreateDatabaseDiscoveryRuleStatementUpdater.java
rename to
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
index e331606..bbd1cce 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/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
@@ -15,29 +15,25 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.distsql.update;
+package org.apache.shardingsphere.dbdiscovery.distsql.handler.update;
-import com.google.common.base.Preconditions;
import
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
-import
org.apache.shardingsphere.dbdiscovery.distsql.exception.InvalidDatabaseDiscoveryTypesException;
+import
org.apache.shardingsphere.dbdiscovery.distsql.handler.converter.DatabaseDiscoveryRuleStatementConverter;
+import
org.apache.shardingsphere.dbdiscovery.distsql.handler.exception.InvalidDatabaseDiscoveryTypesException;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryRuleSegment;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryRuleStatement;
import org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType;
-import
org.apache.shardingsphere.dbdiscovery.yaml.converter.DatabaseDiscoveryRuleStatementConverter;
import org.apache.shardingsphere.infra.distsql.update.RDLCreateUpdater;
import
org.apache.shardingsphere.infra.exception.rule.DuplicateRuleNamesException;
import
org.apache.shardingsphere.infra.exception.rule.ResourceNotExistedException;
import
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
-import
org.apache.shardingsphere.infra.yaml.swapper.YamlRuleConfigurationSwapperEngine;
import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Map.Entry;
-import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
@@ -98,11 +94,7 @@ public final class
CreateDatabaseDiscoveryRuleStatementUpdater implements RDLCre
@Override
public DatabaseDiscoveryRuleConfiguration
buildToBeCreatedRuleConfiguration(final String schemaName, final
CreateDatabaseDiscoveryRuleStatement sqlStatement) {
- Optional<DatabaseDiscoveryRuleConfiguration> result = new
YamlRuleConfigurationSwapperEngine()
-
.swapToRuleConfigurations(Collections.singleton(DatabaseDiscoveryRuleStatementConverter.convert(sqlStatement.getRules())))
- .stream().filter(each -> each instanceof
DatabaseDiscoveryRuleConfiguration).findAny().map(each ->
(DatabaseDiscoveryRuleConfiguration) each);
- Preconditions.checkState(result.isPresent());
- return result.get();
+ return
DatabaseDiscoveryRuleStatementConverter.convert(sqlStatement.getRules());
}
@Override
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/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
similarity index 96%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/update/DropDatabaseDiscoveryRuleStatementUpdater.java
rename to
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
index 30b72ff..79965c6 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/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
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.distsql.update;
+package org.apache.shardingsphere.dbdiscovery.distsql.handler.update;
import com.google.common.base.Preconditions;
import
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
-import
org.apache.shardingsphere.dbdiscovery.distsql.exception.DatabaseDiscoveryRuleNotExistedException;
+import
org.apache.shardingsphere.dbdiscovery.distsql.handler.exception.DatabaseDiscoveryRuleNotExistedException;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.DropDatabaseDiscoveryRuleStatement;
import org.apache.shardingsphere.infra.distsql.update.RDLDropUpdater;
import
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RDLUpdater
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RDLUpdater
new file mode 100644
index 0000000..49c877f
--- /dev/null
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RDLUpdater
@@ -0,0 +1,37 @@
+#
+# 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.
+#
+
+#
+# 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.
+#
+
+org.apache.shardingsphere.dbdiscovery.distsql.handler.update.CreateDatabaseDiscoveryRuleStatementUpdater
+org.apache.shardingsphere.dbdiscovery.distsql.handler.update.AlterDatabaseDiscoveryRuleStatementUpdater
+org.apache.shardingsphere.dbdiscovery.distsql.handler.update.DropDatabaseDiscoveryRuleStatementUpdater
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/yaml/converter/DatabaseDiscoveryRuleStatementConverterTest.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/converter/DatabaseDiscoveryRuleStatementConverterTest.java
similarity index 74%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/yaml/converter/DatabaseDiscoveryRuleStatementConverterTest.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/converter/DatabaseDiscoveryRuleStatementConverterTest.java
index f2a5ab3..442727c 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/yaml/converter/DatabaseDiscoveryRuleStatementConverterTest.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/converter/DatabaseDiscoveryRuleStatementConverterTest.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.yaml.converter;
+package org.apache.shardingsphere.dbdiscovery.distsql.handler.converter;
-import
org.apache.shardingsphere.dbdiscovery.yaml.config.YamlDatabaseDiscoveryRuleConfiguration;
+import
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryRuleSegment;
import org.junit.Test;
@@ -26,25 +26,24 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Properties;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
-import static org.hamcrest.CoreMatchers.is;
public final class DatabaseDiscoveryRuleStatementConverterTest {
@Test
public void assertConvert() {
- YamlDatabaseDiscoveryRuleConfiguration
yamlDatabaseDiscoveryRuleConfiguration =
DatabaseDiscoveryRuleStatementConverter.convert(buildDatabaseDiscoveryRuleSegments());
+ DatabaseDiscoveryRuleConfiguration
yamlDatabaseDiscoveryRuleConfiguration =
DatabaseDiscoveryRuleStatementConverter.convert(createDatabaseDiscoveryRuleSegments());
assertNotNull(yamlDatabaseDiscoveryRuleConfiguration);
-
assertThat(yamlDatabaseDiscoveryRuleConfiguration.getDataSources().keySet(),
is(Collections.singleton("pr_ds")));
-
assertThat(yamlDatabaseDiscoveryRuleConfiguration.getDataSources().get("pr_ds").getDataSourceNames(),
is(Arrays.asList("resource0", "resource1")));
-
assertThat(yamlDatabaseDiscoveryRuleConfiguration.getDataSources().get("pr_ds").getDiscoveryTypeName(),
is("pr_ds_MGR"));
+
assertThat(yamlDatabaseDiscoveryRuleConfiguration.getDataSources().iterator().next().getDataSourceNames(),
is(Arrays.asList("resource0", "resource1")));
+
assertThat(yamlDatabaseDiscoveryRuleConfiguration.getDataSources().iterator().next().getDiscoveryTypeName(),
is("pr_ds_MGR"));
assertThat(yamlDatabaseDiscoveryRuleConfiguration.getDiscoveryTypes().keySet(),
is(Collections.singleton("pr_ds_MGR")));
assertThat(yamlDatabaseDiscoveryRuleConfiguration.getDiscoveryTypes().get("pr_ds_MGR").getType(),
is("MGR"));
assertThat(yamlDatabaseDiscoveryRuleConfiguration.getDiscoveryTypes().get("pr_ds_MGR").getProps().get("test"),
is("value"));
}
- private Collection<DatabaseDiscoveryRuleSegment>
buildDatabaseDiscoveryRuleSegments() {
+ private Collection<DatabaseDiscoveryRuleSegment>
createDatabaseDiscoveryRuleSegments() {
Properties props = new Properties();
props.setProperty("test", "value");
return Collections.singleton(new DatabaseDiscoveryRuleSegment("pr_ds",
Arrays.asList("resource0", "resource1"), "MGR", props));
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/query/DatabaseDiscoveryRuleQueryResultSetTest.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/query/DatabaseDiscoveryRuleQueryResultSetTest.java
similarity index 95%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/query/DatabaseDiscoveryRuleQueryResultSetTest.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/query/DatabaseDiscoveryRuleQueryResultSetTest.java
index b7bf958..5aa69ad 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/query/DatabaseDiscoveryRuleQueryResultSetTest.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/query/DatabaseDiscoveryRuleQueryResultSetTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.distsql.query;
+package org.apache.shardingsphere.dbdiscovery.distsql.handler.query;
import
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
import
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
@@ -24,6 +24,7 @@ import
org.apache.shardingsphere.infra.config.RuleConfiguration;
import
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.distsql.query.RQLResultSet;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.hamcrest.CoreMatchers;
import org.junit.Test;
import java.util.Arrays;
@@ -33,7 +34,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
@@ -49,7 +49,7 @@ public final class DatabaseDiscoveryRuleQueryResultSetTest {
RQLResultSet resultSet = new DatabaseDiscoveryRuleQueryResultSet();
resultSet.init(metaData,
mock(ShowDatabaseDiscoveryRulesStatement.class));
Collection<Object> actual = resultSet.getRowData();
- assertThat(actual.size(), is(4));
+ assertThat(actual.size(), CoreMatchers.is(4));
assertTrue(actual.contains("ms_group"));
assertTrue(actual.contains("ds_0,ds_1"));
assertTrue(actual.contains("MGR"));
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/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
similarity index 93%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/update/AlterDatabaseDiscoveryRuleStatementUpdaterTest.java
rename to
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
index 6aeaeb9..e076b33 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/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
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.distsql.update;
+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.exception.DatabaseDiscoveryRuleNotExistedException;
-import
org.apache.shardingsphere.dbdiscovery.distsql.exception.InvalidDatabaseDiscoveryTypesException;
+import
org.apache.shardingsphere.dbdiscovery.distsql.handler.exception.DatabaseDiscoveryRuleNotExistedException;
+import
org.apache.shardingsphere.dbdiscovery.distsql.handler.exception.InvalidDatabaseDiscoveryTypesException;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryRuleSegment;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.AlterDatabaseDiscoveryRuleStatement;
import
org.apache.shardingsphere.infra.exception.rule.ResourceNotExistedException;
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/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
similarity index 95%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/update/CreateDatabaseDiscoveryRuleStatementUpdaterTest.java
rename to
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
index e209a94..5f610f5 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/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
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.distsql.update;
+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.exception.InvalidDatabaseDiscoveryTypesException;
+import
org.apache.shardingsphere.dbdiscovery.distsql.handler.exception.InvalidDatabaseDiscoveryTypesException;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.segment.DatabaseDiscoveryRuleSegment;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryRuleStatement;
import
org.apache.shardingsphere.infra.exception.rule.DuplicateRuleNamesException;
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/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
similarity index 94%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/update/DropDatabaseDiscoveryRuleStatementUpdaterTest.java
rename to
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
index 26f0779..75bf795 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/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
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.distsql.update;
+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.exception.DatabaseDiscoveryRuleNotExistedException;
+import
org.apache.shardingsphere.dbdiscovery.distsql.handler.exception.DatabaseDiscoveryRuleNotExistedException;
import
org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.DropDatabaseDiscoveryRuleStatement;
import
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
import
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/pom.xml
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/pom.xml
index 51c09c3..eb269d1 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/pom.xml
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/pom.xml
@@ -21,8 +21,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>shardingsphere-db-discovery-distsql</artifactId>
<groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-db-discovery-distsql</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>shardingsphere-db-discovery-distsql-parser</artifactId>