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

panjuan 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 962dcdc50ed Unify normal username for database access (#19526)
962dcdc50ed is described below

commit 962dcdc50edc00b31eeddc2bdc99b01003ec529f
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jul 25 18:55:02 2022 +0800

    Unify normal username for database access (#19526)
    
    * For code format
    
    * Unify normal username for database access
    
    * Unify normal username for database access
---
 ...mProvidedShardingRuleConfigurationCheckerTest.java |  2 +-
 ...AlgorithmProviderConfigurationYamlSwapperTest.java |  2 +-
 .../atomic/storage/DockerStorageContainer.java        |  4 +++-
 .../container/atomic/storage/impl/MySQLContainer.java |  5 -----
 .../atomic/storage/impl/OpenGaussContainer.java       |  5 -----
 .../atomic/storage/impl/PostgreSQLContainer.java      |  5 -----
 .../src/test/resources/env/mysql/initdb.sql           |  6 +++---
 .../src/test/resources/env/opengauss/initdb.sql       | 19 +------------------
 .../src/test/resources/env/postgresql/initdb.sql      |  2 +-
 .../cases/savepoint/PostgreSQLSavePointTestCase.java  |  2 +-
 10 files changed, 11 insertions(+), 41 deletions(-)

diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/checker/AlgorithmProvidedShardingRuleConfigurationCheckerTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/checker/AlgorithmProvidedShardingRuleConfigurationCheckerTest.java
index 9813618549c..01805ec023f 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/checker/AlgorithmProvidedShardingRuleConfigurationCheckerTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/checker/AlgorithmProvidedShardingRuleConfigurationCheckerTest.java
@@ -78,7 +78,7 @@ public final class 
AlgorithmProvidedShardingRuleConfigurationCheckerTest {
         return result;
     }
     
-    private ShardingTableRuleConfiguration 
createShardingTableRuleConfiguration(final ShardingStrategyConfiguration 
shardingStrategyConfig, 
+    private ShardingTableRuleConfiguration 
createShardingTableRuleConfiguration(final ShardingStrategyConfiguration 
shardingStrategyConfig,
                                                                                
 final ShardingAuditStrategyConfiguration shardingAuditStrategyConfig,
                                                                                
 final KeyGenerateStrategyConfiguration keyGenerateStrategyConfig) {
         ShardingTableRuleConfiguration result = new 
ShardingTableRuleConfiguration("foo_tbl");
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapperTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapperTest.java
index e8a24deaa4b..f6100c803ff 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapperTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapperTest.java
@@ -91,7 +91,7 @@ public final class 
ShardingRuleAlgorithmProviderConfigurationYamlSwapperTest {
         yamlKeyGenerateStrategyConfiguration.setColumn("foo_column");
         
result.setDefaultKeyGenerateStrategy(yamlKeyGenerateStrategyConfiguration);
         
result.setDefaultAuditStrategy(mock(YamlShardingAuditStrategyConfiguration.class));
-
+        
         result.setDefaultShardingColumn("foo_column");
         return result;
     }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
index 285045515d7..86ca66474c9 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/DockerStorageContainer.java
@@ -123,7 +123,9 @@ public abstract class DockerStorageContainer extends 
DockerITContainer implement
      */
     public abstract String getRootUsername();
     
-    protected abstract String getNormalUsername();
+    protected final String getNormalUsername() {
+        return "normal_user";
+    }
     
     /**
      * Get database port.
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
index d969c297551..66386399b33 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/MySQLContainer.java
@@ -48,11 +48,6 @@ public final class MySQLContainer extends 
DockerStorageContainer {
         return "root";
     }
     
-    @Override
-    protected String getNormalUsername() {
-        return "scaling";
-    }
-    
     @Override
     public int getPort() {
         return 3306;
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
index 558eaa7b43d..86631671296 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/OpenGaussContainer.java
@@ -48,11 +48,6 @@ public final class OpenGaussContainer extends 
DockerStorageContainer {
         return "root";
     }
     
-    @Override
-    protected String getNormalUsername() {
-        return "scaling";
-    }
-    
     @Override
     public int getPort() {
         return 5432;
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/PostgreSQLContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/PostgreSQLContainer.java
index 5e4cb7a301f..d7bb1e0882c 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/PostgreSQLContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/impl/PostgreSQLContainer.java
@@ -47,11 +47,6 @@ public final class PostgreSQLContainer extends 
DockerStorageContainer {
         return "root";
     }
     
-    @Override
-    protected String getNormalUsername() {
-        return "scaling";
-    }
-    
     @Override
     public int getPort() {
         return 5432;
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
index 3f0521e8464..3b9acb988da 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
@@ -20,6 +20,6 @@ CREATE DATABASE scaling_it_1;
 CREATE DATABASE scaling_it_2;
 CREATE DATABASE scaling_it_3;
 CREATE DATABASE scaling_it_4;
-CREATE USER IF NOT EXISTS 'scaling'@'%' IDENTIFIED BY 'Root@123';
-GRANT Replication Client, Replication Slave, Select, Insert, Update, Delete, 
Index ON *.* TO `scaling`@`%`;
-GRANT Create, Drop ON TABLE *.* TO scaling;
+CREATE USER IF NOT EXISTS 'normal_user'@'%' IDENTIFIED BY 'Root@123';
+GRANT Replication Client, Replication Slave, Select, Insert, Update, Delete, 
Index ON *.* TO `normal_user`@`%`;
+GRANT Create, Drop ON TABLE *.* TO normal_user;
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/initdb.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/initdb.sql
index 0d5b1ef5605..8cde3f6c18a 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/initdb.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/opengauss/initdb.sql
@@ -1,20 +1,3 @@
-/*
- * 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
@@ -35,7 +18,7 @@ CREATE DATABASE scaling_it_1;
 CREATE DATABASE scaling_it_2;
 CREATE DATABASE scaling_it_3;
 CREATE DATABASE scaling_it_4;
-CREATE USER scaling WITH ENCRYPTED PASSWORD 'Root@123';
+CREATE USER normal_user WITH ENCRYPTED PASSWORD 'Root@123';
 CREATE DATABASE scaling;
 ALTER ROLE scaling CREATEDB REPLICATION;
 GRANT CREATE, CONNECT ON DATABASE scaling_it_0 TO scaling;
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql
index 10951d2bc63..204594ea494 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql
@@ -19,7 +19,7 @@ CREATE DATABASE scaling_it_1;
 CREATE DATABASE scaling_it_2;
 CREATE DATABASE scaling_it_3;
 CREATE DATABASE scaling_it_4;
-CREATE USER scaling WITH ENCRYPTED PASSWORD 'Root@123';
+CREATE USER normal_user WITH ENCRYPTED PASSWORD 'Root@123';
 CREATE DATABASE scaling;
 ALTER ROLE scaling CREATEDB REPLICATION;
 GRANT CREATE, CONNECT ON DATABASE scaling_it_0 TO scaling;
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java
index 48bc91016f3..b0c6a4cc574 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java
@@ -60,7 +60,7 @@ public final class PostgreSQLSavePointTestCase extends 
BaseSavePointTestCase {
             conn.rollback(new PSQLSavepoint("point1"));
             Assert.fail("Expect exception, but no exception report.");
         } catch (SQLException ex) {
-            // TODO can not run to get the correct result in JDBC mode. 
+            // TODO can not run to get the correct result in JDBC mode.
             Assert.assertTrue(ex.getMessage().endsWith("ERROR: ROLLBACK TO 
SAVEPOINT can only be used in transaction blocks"));
         }
         try {

Reply via email to