This is an automated email from the ASF dual-hosted git repository.

zhangliang 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 491de61887e Rename `AuthorityCheckerFixture` and variable (#17906)
491de61887e is described below

commit 491de61887ebea620cf4cb199508ba0410a28804
Author: lanchengx <[email protected]>
AuthorDate: Wed May 25 20:06:02 2022 +0800

    Rename `AuthorityCheckerFixture` and variable (#17906)
    
    * Rename class and variable.
    
    * Remove redundant `if`.
    
    * Rename class and variable.
---
 .../{AuthorityCheckerFixture.java => SQLCheckerFixture.java}       | 6 +++---
 .../mysql/executor/information/SelectInformationExecutorTest.java  | 7 ++-----
 .../org.apache.shardingsphere.infra.executor.check.SQLChecker      | 2 +-
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/fixture/AuthorityCheckerFixture.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/fixture/SQLCheckerFixture.java
similarity index 92%
rename from 
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/fixture/AuthorityCheckerFixture.java
rename to 
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/fixture/SQLCheckerFixture.java
index ae3f85fc066..f1af880c15b 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/fixture/AuthorityCheckerFixture.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/fixture/SQLCheckerFixture.java
@@ -29,13 +29,13 @@ import java.util.Map;
 import java.util.function.BiPredicate;
 
 /**
- * Authority checker fixture.
+ * SQL checker fixture.
  */
-public final class AuthorityCheckerFixture implements 
SQLChecker<AuthorityRule> {
+public final class SQLCheckerFixture implements SQLChecker<AuthorityRule> {
     
     @Override
     public boolean check(final String databaseName, final Grantee grantee, 
final AuthorityRule authorityRule) {
-        return !"test".equals(databaseName);
+        return "sharding_db".equals(databaseName) || 
"empty_db".equals(databaseName);
     }
     
     @Override
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
index ca6d4483864..a57e4956d46 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
@@ -88,7 +88,7 @@ public final class SelectInformationExecutorTest extends 
ProxyContextRestorer {
         expectedResultSetMap.put("DEFAULT_COLLATION_NAME", "utf8mb4");
         Map<String, ShardingSphereDatabase> databaseMap = 
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getDatabaseMap();
         databaseMap.put("sharding_db", createDatabase(expectedResultSetMap));
-        databaseMap.put("test", createEmptyDatabase("test"));
+        databaseMap.put("database_without_authority", 
createEmptyDatabase("database_without_authority"));
         String sql = "SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, 
DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA";
         SelectInformationSchemataExecutor executor = new 
SelectInformationSchemataExecutor((SelectStatement) new 
ShardingSphereSQLParserEngine("MySQL", parserConfig).parse(sql, false), sql);
         executor.execute(connectionSession);
@@ -99,11 +99,8 @@ public final class SelectInformationExecutorTest extends 
ProxyContextRestorer {
             if ("sharding_db".equals(executor.getMergedResult().getValue(1, 
String.class))) {
                 assertThat(executor.getMergedResult().getValue(2, 
String.class), is("utf8mb4"));
                 assertThat(executor.getMergedResult().getValue(3, 
String.class), is("utf8mb4_0900_ai_ci"));
-            } else if ("test".equals(executor.getMergedResult().getValue(1, 
String.class))) {
-                assertThat(executor.getMergedResult().getValue(2, 
String.class), is(""));
-                assertThat(executor.getMergedResult().getValue(3, 
String.class), is(""));
             } else {
-                fail("expected : `sharding_db` or `test`");
+                fail("expected : `sharding_db`");
             }
         }
         assertThat(count, is(1));
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.executor.check.SQLChecker
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.executor.check.SQLChecker
index 6fe0eafab86..f7aa83a01d1 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.executor.check.SQLChecker
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.executor.check.SQLChecker
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.proxy.backend.text.admin.mysql.executor.fixture.AuthorityCheckerFixture
+org.apache.shardingsphere.proxy.backend.text.admin.mysql.executor.fixture.SQLCheckerFixture

Reply via email to