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

zhaojinchao 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 4e96d755a9a Remove useless param databases in 
AuthorityRegistryProvider. (#28108)
4e96d755a9a is described below

commit 4e96d755a9a7b422173a8489ec5502bb0cf34044
Author: Raigor <[email protected]>
AuthorDate: Wed Aug 16 11:03:18 2023 +0800

    Remove useless param databases in AuthorityRegistryProvider. (#28108)
---
 .../shardingsphere/authority/spi/AuthorityRegistryProvider.java     | 5 +----
 .../database/DatabasePermittedAuthorityRegistryProvider.java        | 4 +---
 .../provider/simple/AllPermittedAuthorityRegistryProvider.java      | 4 +---
 .../org/apache/shardingsphere/authority/rule/AuthorityRule.java     | 6 ++----
 .../shardingsphere/authority/rule/builder/AuthorityRuleBuilder.java | 2 +-
 .../shardingsphere/authority/checker/AuthorityCheckerTest.java      | 4 ++--
 .../database/DatabasePermittedAuthorityRegistryProviderTest.java    | 2 +-
 .../org/apache/shardingsphere/authority/rule/AuthorityRuleTest.java | 5 ++---
 .../proxy/backend/handler/ProxyBackendHandlerFactoryTest.java       | 2 +-
 .../handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java   | 2 +-
 .../distsql/ral/queryable/ExportStorageNodesExecutorTest.java       | 2 +-
 .../pipeline/scenario/migration/api/impl/MigrationJobAPITest.java   | 2 --
 12 files changed, 14 insertions(+), 26 deletions(-)

diff --git 
a/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/spi/AuthorityRegistryProvider.java
 
b/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/spi/AuthorityRegistryProvider.java
index 14a854d86cf..7678600a617 100644
--- 
a/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/spi/AuthorityRegistryProvider.java
+++ 
b/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/spi/AuthorityRegistryProvider.java
@@ -18,12 +18,10 @@
 package org.apache.shardingsphere.authority.spi;
 
 import org.apache.shardingsphere.authority.model.AuthorityRegistry;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI;
 
 import java.util.Collection;
-import java.util.Map;
 
 /**
  * Authority registry provider.
@@ -33,9 +31,8 @@ public interface AuthorityRegistryProvider extends TypedSPI {
     /**
      * Build authority registry.
      *
-     * @param databases databases
      * @param users users
      * @return built authority registry
      */
-    AuthorityRegistry build(Map<String, ShardingSphereDatabase> databases, 
Collection<ShardingSphereUser> users);
+    AuthorityRegistry build(Collection<ShardingSphereUser> users);
 }
diff --git 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/provider/database/DatabasePermittedAuthorityRegistryProvider.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/provider/database/DatabasePermittedAuthorityRegistryProvider.java
index f3367c92088..a2c77eaf2e5 100644
--- 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/provider/database/DatabasePermittedAuthorityRegistryProvider.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/provider/database/DatabasePermittedAuthorityRegistryProvider.java
@@ -21,12 +21,10 @@ import 
org.apache.shardingsphere.authority.model.AuthorityRegistry;
 import 
org.apache.shardingsphere.authority.provider.database.builder.DatabasePrivilegeBuilder;
 import 
org.apache.shardingsphere.authority.registry.UserPrivilegeMapAuthorityRegistry;
 import org.apache.shardingsphere.authority.spi.AuthorityRegistryProvider;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Map;
 import java.util.Properties;
 
 /**
@@ -44,7 +42,7 @@ public final class DatabasePermittedAuthorityRegistryProvider 
implements Authori
     }
     
     @Override
-    public AuthorityRegistry build(final Map<String, ShardingSphereDatabase> 
databases, final Collection<ShardingSphereUser> users) {
+    public AuthorityRegistry build(final Collection<ShardingSphereUser> users) 
{
         return new 
UserPrivilegeMapAuthorityRegistry(DatabasePrivilegeBuilder.build(users, props));
     }
     
diff --git 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/provider/simple/AllPermittedAuthorityRegistryProvider.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/provider/simple/AllPermittedAuthorityRegistryProvider.java
index 203e59ef819..4714cbf1cac 100644
--- 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/provider/simple/AllPermittedAuthorityRegistryProvider.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/provider/simple/AllPermittedAuthorityRegistryProvider.java
@@ -20,12 +20,10 @@ package org.apache.shardingsphere.authority.provider.simple;
 import org.apache.shardingsphere.authority.model.AuthorityRegistry;
 import 
org.apache.shardingsphere.authority.registry.AllPermittedAuthorityRegistry;
 import org.apache.shardingsphere.authority.spi.AuthorityRegistryProvider;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Map;
 
 /**
  * All permitted authority registry provider.
@@ -33,7 +31,7 @@ import java.util.Map;
 public final class AllPermittedAuthorityRegistryProvider implements 
AuthorityRegistryProvider {
     
     @Override
-    public AuthorityRegistry build(final Map<String, ShardingSphereDatabase> 
databases, final Collection<ShardingSphereUser> users) {
+    public AuthorityRegistry build(final Collection<ShardingSphereUser> users) 
{
         return new AllPermittedAuthorityRegistry();
     }
     
diff --git 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
index 667b9831365..134ec950a90 100644
--- 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
@@ -22,13 +22,11 @@ import 
org.apache.shardingsphere.authority.config.AuthorityRuleConfiguration;
 import org.apache.shardingsphere.authority.model.AuthorityRegistry;
 import org.apache.shardingsphere.authority.model.ShardingSpherePrivileges;
 import org.apache.shardingsphere.authority.spi.AuthorityRegistryProvider;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import org.apache.shardingsphere.infra.rule.identifier.scope.GlobalRule;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 
-import java.util.Map;
 import java.util.Optional;
 
 /**
@@ -41,10 +39,10 @@ public final class AuthorityRule implements GlobalRule {
     
     private final AuthorityRegistry authorityRegistry;
     
-    public AuthorityRule(final AuthorityRuleConfiguration ruleConfig, final 
Map<String, ShardingSphereDatabase> databases) {
+    public AuthorityRule(final AuthorityRuleConfiguration ruleConfig) {
         configuration = ruleConfig;
         AuthorityRegistryProvider provider = 
TypedSPILoader.getService(AuthorityRegistryProvider.class, 
ruleConfig.getAuthorityProvider().getType(), 
ruleConfig.getAuthorityProvider().getProps());
-        authorityRegistry = provider.build(databases, ruleConfig.getUsers());
+        authorityRegistry = provider.build(ruleConfig.getUsers());
     }
     
     /**
diff --git 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/builder/AuthorityRuleBuilder.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/builder/AuthorityRuleBuilder.java
index b6209ef7e3c..e85c7891134 100644
--- 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/builder/AuthorityRuleBuilder.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/rule/builder/AuthorityRuleBuilder.java
@@ -33,7 +33,7 @@ public final class AuthorityRuleBuilder implements 
GlobalRuleBuilder<AuthorityRu
     
     @Override
     public AuthorityRule build(final AuthorityRuleConfiguration ruleConfig, 
final Map<String, ShardingSphereDatabase> databases, final 
ConfigurationProperties props) {
-        return new AuthorityRule(ruleConfig, databases);
+        return new AuthorityRule(ruleConfig);
     }
     
     @Override
diff --git 
a/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
 
b/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
index f10307cd19b..bb7d9a1e9be 100644
--- 
a/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
+++ 
b/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
@@ -40,13 +40,13 @@ class AuthorityCheckerTest {
     void assertCheckIsAuthorizedDatabase() {
         Collection<ShardingSphereUser> users = Collections.singleton(new 
ShardingSphereUser("root", "", "localhost"));
         AuthorityRuleConfiguration ruleConfig = new 
AuthorityRuleConfiguration(users, new AlgorithmConfiguration("ALL_PERMITTED", 
new Properties()), null);
-        assertTrue(new AuthorityChecker(new AuthorityRule(ruleConfig, 
Collections.emptyMap()), new Grantee("root", "localhost")).isAuthorized("db0"));
+        assertTrue(new AuthorityChecker(new AuthorityRule(ruleConfig), new 
Grantee("root", "localhost")).isAuthorized("db0"));
     }
     
     @Test
     void assertCheckPrivileges() {
         Collection<ShardingSphereUser> users = Collections.singleton(new 
ShardingSphereUser("root", "", "localhost"));
-        AuthorityRule rule = new AuthorityRule(new 
AuthorityRuleConfiguration(users, new AlgorithmConfiguration("ALL_PERMITTED", 
new Properties()), null), Collections.emptyMap());
+        AuthorityRule rule = new AuthorityRule(new 
AuthorityRuleConfiguration(users, new AlgorithmConfiguration("ALL_PERMITTED", 
new Properties()), null));
         AuthorityChecker authorityChecker = new AuthorityChecker(rule, new 
Grantee("root", "localhost"));
         authorityChecker.checkPrivileges(null, mock(SelectStatement.class));
         authorityChecker.checkPrivileges(null, mock(InsertStatement.class));
diff --git 
a/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/provider/database/DatabasePermittedAuthorityRegistryProviderTest.java
 
b/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/provider/database/DatabasePermittedAuthorityRegistryProviderTest.java
index 7b2fe394098..13a1ff928a4 100644
--- 
a/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/provider/database/DatabasePermittedAuthorityRegistryProviderTest.java
+++ 
b/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/provider/database/DatabasePermittedAuthorityRegistryProviderTest.java
@@ -40,7 +40,7 @@ class DatabasePermittedAuthorityRegistryProviderTest {
         Properties props = PropertiesBuilder.build(
                 new 
Property(DatabasePermittedAuthorityRegistryProvider.PROP_USER_DATABASE_MAPPINGS,
 "root@localhost=test, [email protected]=db_dal_admin, user1@=test, user1@=test1, 
user1@=*"));
         AuthorityRegistryProvider provider = 
TypedSPILoader.getService(AuthorityRegistryProvider.class, 
"DATABASE_PERMITTED", props);
-        AuthorityRegistry actual = provider.build(Collections.emptyMap(), 
Collections.singletonList(new ShardingSphereUser("user1", "", "127.0.0.2")));
+        AuthorityRegistry actual = 
provider.build(Collections.singletonList(new ShardingSphereUser("user1", "", 
"127.0.0.2")));
         Optional<ShardingSpherePrivileges> privileges = 
actual.findPrivileges(new Grantee("user1", "127.0.0.2"));
         assertTrue(privileges.isPresent());
         assertTrue(privileges.get().hasPrivileges("test"));
diff --git 
a/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/rule/AuthorityRuleTest.java
 
b/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/rule/AuthorityRuleTest.java
index 582e9ac25c7..ad8d7078f71 100644
--- 
a/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/rule/AuthorityRuleTest.java
+++ 
b/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/rule/AuthorityRuleTest.java
@@ -24,14 +24,13 @@ import 
org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import org.junit.jupiter.api.Test;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.LinkedList;
 import java.util.Optional;
 import java.util.Properties;
 
 import static org.hamcrest.CoreMatchers.is;
-import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 class AuthorityRuleTest {
@@ -59,6 +58,6 @@ class AuthorityRuleTest {
         Collection<ShardingSphereUser> users = new LinkedList<>();
         users.add(new ShardingSphereUser("root", "root", "localhost"));
         users.add(new ShardingSphereUser("admin", "123456", "localhost"));
-        return new AuthorityRule(new AuthorityRuleConfiguration(users, new 
AlgorithmConfiguration("ALL_PERMITTED", new Properties()), null), 
Collections.emptyMap());
+        return new AuthorityRule(new AuthorityRuleConfiguration(users, new 
AlgorithmConfiguration("ALL_PERMITTED", new Properties()), null));
     }
 }
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
index 1c74cabe0a5..8e7cc3a984b 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
@@ -109,7 +109,7 @@ class ProxyBackendHandlerFactoryTest {
         when(result.getMetaDataContexts()).thenReturn(metaDataContexts);
         when(metaDataContexts.getMetaData().getProps()).thenReturn(new 
ConfigurationProperties(new Properties()));
         RuleMetaData globalRuleMetaData = new RuleMetaData(Arrays.asList(
-                new AuthorityRule(new 
DefaultAuthorityRuleConfigurationBuilder().build(), Collections.emptyMap()),
+                new AuthorityRule(new 
DefaultAuthorityRuleConfigurationBuilder().build()),
                 new SQLParserRule(new 
DefaultSQLParserRuleConfigurationBuilder().build()),
                 new TransactionRule(new 
DefaultTransactionRuleConfigurationBuilder().build(), Collections.emptyMap())));
         
when(metaDataContexts.getMetaData().getGlobalRuleMetaData()).thenReturn(globalRuleMetaData);
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java
index cf427b8c192..9843649e50e 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportMetaDataExecutorTest.java
@@ -162,7 +162,7 @@ class ExportMetaDataExecutorTest {
     private ContextManager mockContextManager() {
         MetaDataContexts metaDataContexts = new 
MetaDataContexts(mock(MetaDataPersistService.class), new 
ShardingSphereMetaData(Collections.singletonMap(database.getName(), database),
                 new ResourceMetaData(Collections.emptyMap()),
-                new RuleMetaData(Arrays.asList(new AuthorityRule(new 
DefaultAuthorityRuleConfigurationBuilder().build(), Collections.emptyMap()),
+                new RuleMetaData(Arrays.asList(new AuthorityRule(new 
DefaultAuthorityRuleConfigurationBuilder().build()),
                         new GlobalClockRule(new 
DefaultGlobalClockRuleConfigurationBuilder().build(), 
Collections.singletonMap(database.getName(), database)))),
                 new ConfigurationProperties(PropertiesBuilder.build(new 
Property(ConfigurationPropertyKey.SQL_SHOW.getKey(), "true")))));
         InstanceContext instanceContext = new InstanceContext(
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java
index 0d57fd3d2df..aeff63e5c8a 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ExportStorageNodesExecutorTest.java
@@ -152,7 +152,7 @@ class ExportStorageNodesExecutorTest {
         ContextManager result = mock(ContextManager.class, RETURNS_DEEP_STUBS);
         MetaDataContexts metaDataContexts = new 
MetaDataContexts(mock(MetaDataPersistService.class), new 
ShardingSphereMetaData(Collections.singletonMap(database.getName(), database),
                 new ResourceMetaData(Collections.emptyMap()),
-                new RuleMetaData(Collections.singleton(new AuthorityRule(new 
DefaultAuthorityRuleConfigurationBuilder().build(), Collections.emptyMap()))),
+                new RuleMetaData(Collections.singleton(new AuthorityRule(new 
DefaultAuthorityRuleConfigurationBuilder().build()))),
                 new ConfigurationProperties(PropertiesBuilder.build(new 
Property(ConfigurationPropertyKey.SQL_SHOW.getKey(), "true")))));
         when(result.getMetaDataContexts()).thenReturn(metaDataContexts);
         return result;
diff --git 
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java
 
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java
index a403d46c492..4598b363cc5 100644
--- 
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java
+++ 
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/scenario/migration/api/impl/MigrationJobAPITest.java
@@ -58,7 +58,6 @@ import org.apache.shardingsphere.test.mock.AutoMockExtension;
 import org.apache.shardingsphere.test.mock.StaticMockSettings;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 
@@ -298,7 +297,6 @@ class MigrationJobAPITest {
     }
     
     @Test
-    @Disabled("FIX ME")
     void assertCreateJobConfig() throws SQLException {
         initIntPrimaryEnvironment();
         SourceTargetEntry sourceTargetEntry = new 
SourceTargetEntry("logic_db", new DataNode("ds_0", "t_order"), "t_order");

Reply via email to