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 1ec7b6fe9d6 Remove useless codes on ShardingSpherePrivileges (#29600)
1ec7b6fe9d6 is described below

commit 1ec7b6fe9d6a27512f2742834242ad5bbd18e06c
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Sat Dec 30 06:04:05 2023 +0800

    Remove useless codes on ShardingSpherePrivileges (#29600)
---
 .../authority/model/ShardingSpherePrivileges.java  | 10 -------
 .../fixture/ShardingSpherePrivilegesFixture.java   |  8 -----
 .../privilege/DatabasePermittedPrivileges.java     |  6 ----
 .../simple/privilege/AllPermittedPrivileges.java   |  8 -----
 .../privilege/AllPermittedPrivilegesTest.java      | 35 ----------------------
 .../admin/executor/ShowDatabasesExecutorTest.java  |  3 --
 .../MySQLAuthenticationEngineTest.java             |  3 --
 7 files changed, 73 deletions(-)

diff --git 
a/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/model/ShardingSpherePrivileges.java
 
b/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/model/ShardingSpherePrivileges.java
index 26d0593e1e4..011ed077892 100644
--- 
a/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/model/ShardingSpherePrivileges.java
+++ 
b/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/model/ShardingSpherePrivileges.java
@@ -17,8 +17,6 @@
 
 package org.apache.shardingsphere.authority.model;
 
-import java.util.Collection;
-
 /**
  * ShardingSphere privileges.
  */
@@ -31,12 +29,4 @@ public interface ShardingSpherePrivileges {
      * @return has privileges or not
      */
     boolean hasPrivileges(String database);
-    
-    /**
-     * Has privileges.
-     *
-     * @param privileges privileges
-     * @return has privileges or not
-     */
-    boolean hasPrivileges(Collection<PrivilegeType> privileges);
 }
diff --git 
a/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/fixture/ShardingSpherePrivilegesFixture.java
 
b/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/fixture/ShardingSpherePrivilegesFixture.java
index 13ce13a69c2..dc3e94528fe 100644
--- 
a/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/fixture/ShardingSpherePrivilegesFixture.java
+++ 
b/kernel/authority/core/src/test/java/org/apache/shardingsphere/authority/fixture/ShardingSpherePrivilegesFixture.java
@@ -17,20 +17,12 @@
 
 package org.apache.shardingsphere.authority.fixture;
 
-import org.apache.shardingsphere.authority.model.PrivilegeType;
 import org.apache.shardingsphere.authority.model.ShardingSpherePrivileges;
 
-import java.util.Collection;
-
 public final class ShardingSpherePrivilegesFixture implements 
ShardingSpherePrivileges {
     
     @Override
     public boolean hasPrivileges(final String database) {
         return true;
     }
-    
-    @Override
-    public boolean hasPrivileges(final Collection<PrivilegeType> privileges) {
-        return true;
-    }
 }
diff --git 
a/kernel/authority/provider/database/src/main/java/org/apache/shardingsphere/authority/provider/database/privilege/DatabasePermittedPrivileges.java
 
b/kernel/authority/provider/database/src/main/java/org/apache/shardingsphere/authority/provider/database/privilege/DatabasePermittedPrivileges.java
index 99ff14766da..b3f799e1c7c 100644
--- 
a/kernel/authority/provider/database/src/main/java/org/apache/shardingsphere/authority/provider/database/privilege/DatabasePermittedPrivileges.java
+++ 
b/kernel/authority/provider/database/src/main/java/org/apache/shardingsphere/authority/provider/database/privilege/DatabasePermittedPrivileges.java
@@ -19,7 +19,6 @@ package 
org.apache.shardingsphere.authority.provider.database.privilege;
 
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.authority.constant.AuthorityConstants;
-import org.apache.shardingsphere.authority.model.PrivilegeType;
 import org.apache.shardingsphere.authority.model.ShardingSpherePrivileges;
 
 import java.util.Collection;
@@ -36,9 +35,4 @@ public final class DatabasePermittedPrivileges implements 
ShardingSpherePrivileg
     public boolean hasPrivileges(final String database) {
         return databases.contains(AuthorityConstants.SUPER_PRIVILEGE) || 
databases.contains(database);
     }
-    
-    @Override
-    public boolean hasPrivileges(final Collection<PrivilegeType> privileges) {
-        return true;
-    }
 }
diff --git 
a/kernel/authority/provider/simple/src/main/java/org/apache/shardingsphere/authority/provider/simple/privilege/AllPermittedPrivileges.java
 
b/kernel/authority/provider/simple/src/main/java/org/apache/shardingsphere/authority/provider/simple/privilege/AllPermittedPrivileges.java
index b3561cb6dd5..579ea0430f0 100644
--- 
a/kernel/authority/provider/simple/src/main/java/org/apache/shardingsphere/authority/provider/simple/privilege/AllPermittedPrivileges.java
+++ 
b/kernel/authority/provider/simple/src/main/java/org/apache/shardingsphere/authority/provider/simple/privilege/AllPermittedPrivileges.java
@@ -17,11 +17,8 @@
 
 package org.apache.shardingsphere.authority.provider.simple.privilege;
 
-import org.apache.shardingsphere.authority.model.PrivilegeType;
 import org.apache.shardingsphere.authority.model.ShardingSpherePrivileges;
 
-import java.util.Collection;
-
 /**
  * All permitted privileges.
  */
@@ -31,9 +28,4 @@ public final class AllPermittedPrivileges implements 
ShardingSpherePrivileges {
     public boolean hasPrivileges(final String database) {
         return true;
     }
-    
-    @Override
-    public boolean hasPrivileges(final Collection<PrivilegeType> privileges) {
-        return true;
-    }
 }
diff --git 
a/kernel/authority/provider/simple/src/test/java/org/apache/shardingsphere/authority/provider/simple/privilege/AllPermittedPrivilegesTest.java
 
b/kernel/authority/provider/simple/src/test/java/org/apache/shardingsphere/authority/provider/simple/privilege/AllPermittedPrivilegesTest.java
deleted file mode 100644
index 552cc651e31..00000000000
--- 
a/kernel/authority/provider/simple/src/test/java/org/apache/shardingsphere/authority/provider/simple/privilege/AllPermittedPrivilegesTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.authority.provider.simple.privilege;
-
-import org.apache.shardingsphere.authority.model.ShardingSpherePrivileges;
-import org.junit.jupiter.api.Test;
-
-import java.util.Collections;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-class AllPermittedPrivilegesTest {
-    
-    @Test
-    void assertFindPrivileges() {
-        ShardingSpherePrivileges actual = new AllPermittedPrivileges();
-        assertTrue(actual.hasPrivileges("testSchema"));
-        assertTrue(actual.hasPrivileges(Collections.emptyList()));
-    }
-}
diff --git 
a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowDatabasesExecutorTest.java
 
b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowDatabasesExecutorTest.java
index 1cc8d31cb76..5b9e3b0298d 100644
--- 
a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowDatabasesExecutorTest.java
+++ 
b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowDatabasesExecutorTest.java
@@ -57,7 +57,6 @@ import java.util.stream.IntStream;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyCollection;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
@@ -200,8 +199,6 @@ class ShowDatabasesExecutorTest {
     private ShardingSpherePrivileges mockPrivileges() {
         ShardingSpherePrivileges result = mock(ShardingSpherePrivileges.class);
         when(result.hasPrivileges(anyString())).thenReturn(true);
-        when(result.hasPrivileges(anyCollection())).thenReturn(true);
-        when(result.hasPrivileges(anyCollection())).thenReturn(true);
         return result;
     }
     
diff --git 
a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
 
b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
index 328ad0b762a..a922952f079 100644
--- 
a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
+++ 
b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
@@ -81,7 +81,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyCollection;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
@@ -189,8 +188,6 @@ class MySQLAuthenticationEngineTest {
     private ShardingSpherePrivileges mockPrivileges() {
         ShardingSpherePrivileges result = mock(ShardingSpherePrivileges.class);
         when(result.hasPrivileges(anyString())).thenReturn(true);
-        when(result.hasPrivileges(anyCollection())).thenReturn(true);
-        when(result.hasPrivileges(anyCollection())).thenReturn(true);
         return result;
     }
     

Reply via email to