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 56f0884  Add RuleDefinitionStatement and ResourceDefinitionStatement 
(#11154)
56f0884 is described below

commit 56f0884033bc0e689983f69a9f59e4e3fb5985e6
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jul 5 01:04:01 2021 +0800

    Add RuleDefinitionStatement and ResourceDefinitionStatement (#11154)
    
    * Add RuleDefinitionStatement and ResourceDefinitionStatement
    
    * Refactor RuleDefinitionBackendHandler
    
    * Fix test cases
---
 ...eStatement.java => ResourceDefinitionStatement.java} |  8 +++-----
 ...pRuleStatement.java => RuleDefinitionStatement.java} |  8 +++-----
 .../parser/statement/rdl/alter/AlterRuleStatement.java  |  4 ++--
 .../statement/rdl/create/AddResourceStatement.java      |  4 ++--
 .../statement/rdl/create/CreateRuleStatement.java       |  4 ++--
 .../statement/rdl/drop/DropResourceStatement.java       |  4 ++--
 .../parser/statement/rdl/drop/DropRuleStatement.java    |  4 ++--
 ...ache.shardingsphere.infra.distsql.query.RQLResultSet | 17 -----------------
 ...ingsphere.infra.distsql.update.RuleDefinitionUpdater | 17 -----------------
 ...ingsphere.infra.distsql.update.RuleDefinitionUpdater | 17 -----------------
 .../text/distsql/rdl/RDLBackendHandlerFactory.java      |  3 ++-
 .../distsql/rdl/rule/RuleDefinitionBackendHandler.java  |  4 ++--
 .../text/distsql/DistSQLBackendHandlerFactoryTest.java  |  6 ++++--
 13 files changed, 24 insertions(+), 76 deletions(-)

diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/ResourceDefinitionStatement.java
similarity index 77%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
copy to 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/ResourceDefinitionStatement.java
index 8be4819..5a33bdb 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/ResourceDefinitionStatement.java
@@ -15,12 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.parser.statement.rdl.drop;
-
-import org.apache.shardingsphere.distsql.parser.statement.rdl.RDLStatement;
+package org.apache.shardingsphere.distsql.parser.statement.rdl;
 
 /**
- * Drop rule statement.
+ * Resource definition statement.
  */
-public abstract class DropRuleStatement extends RDLStatement {
+public abstract class ResourceDefinitionStatement extends RDLStatement {
 }
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/RuleDefinitionStatement.java
similarity index 77%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
copy to 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/RuleDefinitionStatement.java
index 8be4819..4265916 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/RuleDefinitionStatement.java
@@ -15,12 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.parser.statement.rdl.drop;
-
-import org.apache.shardingsphere.distsql.parser.statement.rdl.RDLStatement;
+package org.apache.shardingsphere.distsql.parser.statement.rdl;
 
 /**
- * Drop rule statement.
+ * Rule definition statement.
  */
-public abstract class DropRuleStatement extends RDLStatement {
+public abstract class RuleDefinitionStatement extends RDLStatement {
 }
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/alter/AlterRuleStatement.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/alter/AlterRuleStatement.java
index 03a38d1..2bf4373 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/alter/AlterRuleStatement.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/alter/AlterRuleStatement.java
@@ -17,10 +17,10 @@
 
 package org.apache.shardingsphere.distsql.parser.statement.rdl.alter;
 
-import org.apache.shardingsphere.distsql.parser.statement.rdl.RDLStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.RuleDefinitionStatement;
 
 /**
  * Alter rule statement.
  */
-public abstract class AlterRuleStatement extends RDLStatement {
+public abstract class AlterRuleStatement extends RuleDefinitionStatement {
 }
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/create/AddResourceStatement.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/create/AddResourceStatement.java
index ce1ca83..17b214e 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/create/AddResourceStatement.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/create/AddResourceStatement.java
@@ -20,7 +20,7 @@ package 
org.apache.shardingsphere.distsql.parser.statement.rdl.create;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.distsql.parser.segment.DataSourceSegment;
-import org.apache.shardingsphere.distsql.parser.statement.rdl.RDLStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.ResourceDefinitionStatement;
 
 import java.util.Collection;
 
@@ -29,7 +29,7 @@ import java.util.Collection;
  */
 @RequiredArgsConstructor
 @Getter
-public final class AddResourceStatement extends RDLStatement {
+public final class AddResourceStatement extends ResourceDefinitionStatement {
     
     private final Collection<DataSourceSegment> dataSources;
 }
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/create/CreateRuleStatement.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/create/CreateRuleStatement.java
index bad3357..b8d5a3d 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/create/CreateRuleStatement.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/create/CreateRuleStatement.java
@@ -17,10 +17,10 @@
 
 package org.apache.shardingsphere.distsql.parser.statement.rdl.create;
 
-import org.apache.shardingsphere.distsql.parser.statement.rdl.RDLStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.RuleDefinitionStatement;
 
 /**
  * Create rule statement.
  */
-public abstract class CreateRuleStatement extends RDLStatement {
+public abstract class CreateRuleStatement extends RuleDefinitionStatement {
 }
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropResourceStatement.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropResourceStatement.java
index e4716f6..1e87582 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropResourceStatement.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropResourceStatement.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.distsql.parser.statement.rdl.RDLStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.ResourceDefinitionStatement;
 
 import java.util.Collection;
 
@@ -28,7 +28,7 @@ import java.util.Collection;
  */
 @RequiredArgsConstructor
 @Getter
-public final class DropResourceStatement extends RDLStatement {
+public final class DropResourceStatement extends ResourceDefinitionStatement {
     
     private final Collection<String> names;
 }
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
index 8be4819..dff7042 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
@@ -17,10 +17,10 @@
 
 package org.apache.shardingsphere.distsql.parser.statement.rdl.drop;
 
-import org.apache.shardingsphere.distsql.parser.statement.rdl.RDLStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.RuleDefinitionStatement;
 
 /**
  * Drop rule statement.
  */
-public abstract class DropRuleStatement extends RDLStatement {
+public abstract class DropRuleStatement extends RuleDefinitionStatement {
 }
diff --git 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.RQLResultSet
 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql
 [...]
index 2ab0962..71c077d 100644
--- 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.RQLResultSet
+++ 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.RQLResultSet
@@ -15,21 +15,4 @@
 # 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.readwritesplitting.distsql.handler.query.ReadwriteSplittingRuleQueryResultSet
diff --git 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater
 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.inf
 [...]
index e8ce53d..d3844dc 100644
--- 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater
+++ 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater
@@ -15,23 +15,6 @@
 # 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.readwritesplitting.distsql.handler.update.CreateReadwriteSplittingRuleStatementUpdater
 
org.apache.shardingsphere.readwritesplitting.distsql.handler.update.AlterReadwriteSplittingRuleStatementUpdater
 
org.apache.shardingsphere.readwritesplitting.distsql.handler.update.DropReadwriteSplittingRuleStatementUpdater
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater
index fc29324..a2d5402 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater
@@ -15,23 +15,6 @@
 # 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.sharding.distsql.handler.update.CreateShardingTableRuleStatementUpdater
 
org.apache.shardingsphere.sharding.distsql.handler.update.AlterShardingTableRuleStatementUpdater
 
org.apache.shardingsphere.sharding.distsql.handler.update.DropShardingTableRuleStatementUpdater
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/RDLBackendHandlerFactory.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/RDLBackendHandlerFactory.java
index bdb4a94..55b00fe 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/RDLBackendHandlerFactory.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/RDLBackendHandlerFactory.java
@@ -19,6 +19,7 @@ package 
org.apache.shardingsphere.proxy.backend.text.distsql.rdl;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.RuleDefinitionStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResourceStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropResourceStatement;
 import 
org.apache.shardingsphere.infra.context.metadata.impl.StandardMetaDataContexts;
@@ -77,6 +78,6 @@ public final class RDLBackendHandlerFactory {
         if (sqlStatement instanceof DropDatabaseStatement) {
             return new DropDatabaseBackendHandler((DropDatabaseStatement) 
sqlStatement, backendConnection);
         }
-        return new RuleDefinitionBackendHandler<>(sqlStatement, 
backendConnection);
+        return new RuleDefinitionBackendHandler<>((RuleDefinitionStatement) 
sqlStatement, backendConnection);
     }
 }
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
index 161aeda..4d8a9c5 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.rule;
 
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.RuleDefinitionStatement;
 import 
org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
 import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
@@ -32,7 +33,6 @@ import 
org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
 import 
org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
 import 
org.apache.shardingsphere.proxy.backend.text.SchemaRequiredBackendHandler;
-import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
 import java.util.Optional;
 import java.util.Properties;
@@ -42,7 +42,7 @@ import java.util.Properties;
  *
  * @param <T> type of SQL statement
  */
-public final class RuleDefinitionBackendHandler<T extends SQLStatement> 
extends SchemaRequiredBackendHandler<T> {
+public final class RuleDefinitionBackendHandler<T extends 
RuleDefinitionStatement> extends SchemaRequiredBackendHandler<T> {
     
     static {
         ShardingSphereServiceLoader.register(RuleDefinitionUpdater.class);
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
index f012d5c..6c97c02 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactoryTest.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.proxy.backend.text.distsql;
 
 import lombok.SneakyThrows;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.RuleDefinitionStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResourceStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropResourceStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowResourcesStatement;
@@ -58,6 +59,7 @@ import java.util.Collections;
 import java.util.Map;
 import java.util.Properties;
 
+import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertNull;
@@ -247,9 +249,9 @@ public final class DistSQLBackendHandlerFactoryTest {
         BackendConnection connection = mock(BackendConnection.class);
         when(connection.getSchemaName()).thenReturn("schema");
         try {
-            RDLBackendHandlerFactory.newInstance(new MySQLDatabaseType(), 
mock(ShowResourcesStatement.class), connection);
+            RDLBackendHandlerFactory.newInstance(new MySQLDatabaseType(), 
mock(RuleDefinitionStatement.class), connection);
         } catch (final SQLException ex) {
-            assertThat(ex.getMessage(), is("No Registry center to execute 
`ShowResourcesStatement` SQL"));
+            assertThat(ex.getMessage(), containsString("No Registry center to 
execute "));
         }
         setGovernanceMetaDataContexts(true);
         ResponseHeader response = 
RQLBackendHandlerFactory.newInstance(mock(ShowResourcesStatement.class), 
connection).execute();

Reply via email to