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 f964cb2c9b7 Refacor : refacor the storage configration as the proxy 
config style (#20169)
f964cb2c9b7 is described below

commit f964cb2c9b7e9b25c788240d5847358ec5535077
Author: 孙念君 Nianjun Sun <[email protected]>
AuthorDate: Mon Aug 15 12:45:50 2022 +0800

    Refacor : refacor the storage configration as the proxy config style 
(#20169)
    
    * Refacor : refacor the storage configration as the proxy config management 
style(#19958)
    
    * Refactor : rename the mysql container factory method
    
    * Fix : fix a naming issue
    
    * Add : add H2 support in storage container factory
    
    * Fix : remove useless space
    
    * Refactor : refactor as the reviewer's suggestion
    
    * Refactor : refctor a 'return null' clause
    
    * Add : add H2 container configuration factory
    
    * Add : add H2 container configuration factory
---
 .../config/StorageContainerConfiguration.java      | 28 +++------
 .../StorageContainerConfigurationFactory.java}     | 32 +++++------
 .../impl/h2/H2ContainerConfigurationFactory.java}  | 31 +++++-----
 ...ava => MySQLContainerConfigurationFactory.java} | 34 +++++++----
 .../DefaultOpenGaussContainerConfiguration.java    | 43 --------------
 .../OpenGaussContainerConfigurationFactory.java    | 57 ++++++++++++++++++
 ...> PostgreSQLContainerConfigurationFactory.java} | 32 +++++++----
 .../atomic/storage/impl/MySQLContainer.java        |  4 +-
 .../atomic/storage/impl/OpenGaussContainer.java    |  4 +-
 .../atomic/storage/impl/PostgreSQLContainer.java   |  4 +-
 .../cases/general/CreateTableSQLGeneratorIT.java   |  4 +-
 .../container/compose/DockerComposedContainer.java |  4 +-
 ...calingStorageContainerConfigurationFactory.java | 67 ----------------------
 .../ScalingPostgreSQLContainerConfiguration.java   | 45 ---------------
 .../compose/mode/ClusterComposedContainer.java     |  4 +-
 .../compose/mode/StandaloneComposedContainer.java  |  4 +-
 16 files changed, 151 insertions(+), 246 deletions(-)

diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/StorageContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/StorageContainerConfiguration.java
index 87507020bd3..5639657abcb 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/StorageContainerConfiguration.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/StorageContainerConfiguration.java
@@ -17,31 +17,21 @@
 
 package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config;
 
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
 import java.util.Map;
 
 /**
  * Docker storage container configuration.
  */
-public interface StorageContainerConfiguration {
+@RequiredArgsConstructor
+@Getter
+public class StorageContainerConfiguration {
     
-    /**
-     * get docker container commands.
-     * 
-     * @return docker container commands
-     */
-    String[] getCommands();
+    private final String[] commands;
     
-    /**
-     * get docker container environment variables.
-     * 
-     * @return docker container environments
-     */
-    Map<String, String> getEnvs();
+    private final Map<String, String> containerEnvironments;
     
-    /**
-     * get docker container mapping resources.
-     * 
-     * @return docker container resource mapping
-     */
-    Map<String, String> getResourceMappings();
+    private final Map<String, String> mountedResources;
 }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/config/SuiteStorageContainerConfigurationFactory.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/StorageContainerConfigurationFactory.java
similarity index 63%
rename from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/config/SuiteStorageContainerConfigurationFactory.java
rename to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/StorageContainerConfigurationFactory.java
index 140a59e90fa..81987aacceb 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/config/SuiteStorageContainerConfigurationFactory.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/StorageContainerConfigurationFactory.java
@@ -15,45 +15,39 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.test.integration.container.config;
+package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.mysql.DefaultMySQLContainerConfiguration;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.opengauss.DefaultOpenGaussContainerConfiguration;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.postgresql.DefaultPostgreSQLContainerConfiguration;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.h2.H2ContainerConfigurationFactory;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.mysql.MySQLContainerConfigurationFactory;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.opengauss.OpenGaussContainerConfigurationFactory;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.postgresql.PostgreSQLContainerConfigurationFactory;
 
 /**
- * Suite storage container configuration factory.
+ * Storage container configuration factory.
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class SuiteStorageContainerConfigurationFactory {
+public final class StorageContainerConfigurationFactory {
     
     /**
      * Create new instance of storage container configuration.
-     *
+     * 
      * @param databaseType database type
-     * @param scenario scenario
      * @return created instance
      */
-    public static StorageContainerConfiguration newInstance(final DatabaseType 
databaseType, final String scenario) {
+    public static StorageContainerConfiguration newInstance(final DatabaseType 
databaseType) {
         switch (databaseType.getType()) {
             case "MySQL":
-                if ("default".equalsIgnoreCase(scenario)) {
-                    return new DefaultMySQLContainerConfiguration();
-                }
-                return new DefaultMySQLContainerConfiguration();
+                return MySQLContainerConfigurationFactory.newInstance();
             case "PostgreSQL":
-                if ("default".equalsIgnoreCase(scenario)) {
-                    return new DefaultPostgreSQLContainerConfiguration();
-                }
-                return new DefaultPostgreSQLContainerConfiguration();
+                return PostgreSQLContainerConfigurationFactory.newInstance();
             case "openGauss":
-                return new DefaultOpenGaussContainerConfiguration();
+                return OpenGaussContainerConfigurationFactory.newInstance();
             case "H2":
-                return null;
+                return H2ContainerConfigurationFactory.newInstance();
             default:
                 throw new RuntimeException(String.format("Database `%s` is 
unknown.", databaseType.getType()));
         }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/config/storage/impl/mysql/ScalingMySQLContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/h2/H2ContainerConfigurationFactory.java
similarity index 54%
rename from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/config/storage/impl/mysql/ScalingMySQLContainerConfiguration.java
rename to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/h2/H2ContainerConfigurationFactory.java
index 52fa9014dee..5787edc75df 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/config/storage/impl/mysql/ScalingMySQLContainerConfiguration.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/h2/H2ContainerConfigurationFactory.java
@@ -15,31 +15,26 @@
  * limitations under the License.
  */
 
-package 
org.apache.shardingsphere.integration.data.pipeline.framework.container.config.storage.impl.mysql;
+package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.h2;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.mysql.DefaultMySQLContainerConfiguration;
 
 import java.util.Collections;
-import java.util.Map;
 
 /**
- * Scaling mysql container configuration.
+ * H2 container configuration factory.
  */
-public final class ScalingMySQLContainerConfiguration implements 
StorageContainerConfiguration {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class H2ContainerConfigurationFactory {
     
-    @Override
-    public String[] getCommands() {
-        return new DefaultMySQLContainerConfiguration().getCommands();
-    }
-    
-    @Override
-    public Map<String, String> getEnvs() {
-        return new DefaultMySQLContainerConfiguration().getEnvs();
-    }
-    
-    @Override
-    public Map<String, String> getResourceMappings() {
-        return Collections.singletonMap("/env/mysql/my.cnf", 
"/etc/mysql/my.cnf");
+    /**
+     * Create new instance of h2 container configuration.
+     *
+     * @return created instance
+     */
+    public static StorageContainerConfiguration newInstance() {
+        return new StorageContainerConfiguration(new String[0], 
Collections.emptyMap(), Collections.emptyMap());
     }
 }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/DefaultMySQLContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/MySQLContainerConfigurationFactory.java
similarity index 62%
rename from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/DefaultMySQLContainerConfiguration.java
rename to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/MySQLContainerConfigurationFactory.java
index 4bea8b4a8f9..07d21fd7a64 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/DefaultMySQLContainerConfiguration.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/mysql/MySQLContainerConfigurationFactory.java
@@ -17,32 +17,44 @@
 
 package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.mysql;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
 
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-public class DefaultMySQLContainerConfiguration implements 
StorageContainerConfiguration {
+/**
+ * MySQL container configuration factory.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class MySQLContainerConfigurationFactory {
+    
+    /**
+     * Create new instance of mysql container configuration.
+     * 
+     * @return created instance
+     */
+    public static StorageContainerConfiguration newInstance() {
+        return new StorageContainerConfiguration(getCommands(), 
getContainerEnvironments(), getMountedResources());
+    }
     
-    @Override
-    public String[] getCommands() {
+    private static String[] getCommands() {
         // TODO need auto set server-id by generator, now always set server-id 
to 1
-        String[] commands = new String[1];
-        commands[0] = "--server-id=1";
-        return commands;
+        String[] result = new String[1];
+        result[0] = "--server-id=1";
+        return result;
     }
     
-    @Override
-    public Map<String, String> getEnvs() {
-        Map<String, String> result = new HashMap<>();
+    private static Map<String, String> getContainerEnvironments() {
+        Map<String, String> result = new HashMap<>(2, 1);
         result.put("LANG", "C.UTF-8");
         result.put("MYSQL_RANDOM_ROOT_PASSWORD", "yes");
         return result;
     }
     
-    @Override
-    public Map<String, String> getResourceMappings() {
+    private static Map<String, String> getMountedResources() {
         return Collections.singletonMap("/env/mysql/my.cnf", 
"/etc/mysql/my.cnf");
     }
 }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/DefaultOpenGaussContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/DefaultOpenGaussContainerConfiguration.java
deleted file mode 100644
index f34bda86623..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/DefaultOpenGaussContainerConfiguration.java
+++ /dev/null
@@ -1,43 +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.test.integration.env.container.atomic.storage.config.impl.opengauss;
-
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
-import org.testcontainers.shaded.com.google.common.collect.ImmutableMap;
-
-import java.util.Map;
-
-public class DefaultOpenGaussContainerConfiguration implements 
StorageContainerConfiguration {
-    
-    @Override
-    public String[] getCommands() {
-        return new String[0];
-    }
-    
-    @Override
-    public Map<String, String> getEnvs() {
-        return ImmutableMap.<String, String>builder().put("GS_PASSWORD", 
"Test@123").build();
-    }
-    
-    @Override
-    public Map<String, String> getResourceMappings() {
-        return ImmutableMap.<String, String>builder()
-                .put("/env/postgresql/postgresql.conf", 
"/usr/local/opengauss/share/postgresql/postgresql.conf.sample")
-                .put("/env/opengauss/pg_hba.conf", 
"/usr/local/opengauss/share/postgresql/pg_hba.conf.sample").build();
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/OpenGaussContainerConfigurationFactory.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/OpenGaussContainerConfigurationFactory.java
new file mode 100644
index 00000000000..b2d9614bc36
--- /dev/null
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/opengauss/OpenGaussContainerConfigurationFactory.java
@@ -0,0 +1,57 @@
+/*
+ * 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.test.integration.env.container.atomic.storage.config.impl.opengauss;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * OpenGauss container configuration factory.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class OpenGaussContainerConfigurationFactory {
+    
+    /**
+     * Create new instance of opengauss container configuration.
+     * 
+     * @return created instance
+     */
+    public static StorageContainerConfiguration newInstance() {
+        return new StorageContainerConfiguration(getCommands(), 
getContainerEnvironments(), getMountedResources());
+    }
+    
+    private static String[] getCommands() {
+        return new String[0];
+    }
+    
+    private static Map<String, String> getContainerEnvironments() {
+        return Collections.singletonMap("GS_PASSWORD", "Test@123");
+    }
+    
+    private static Map<String, String> getMountedResources() {
+        Map<String, String> result = new HashMap<>(2, 1);
+        result.put("/env/postgresql/postgresql.conf", 
"/usr/local/opengauss/share/postgresql/postgresql.conf.sample");
+        result.put("/env/opengauss/pg_hba.conf", 
"/usr/local/opengauss/share/postgresql/pg_hba.conf.sample");
+        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/config/impl/postgresql/DefaultPostgreSQLContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/PostgreSQLContainerConfigurationFactory.java
similarity index 60%
rename from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/DefaultPostgreSQLContainerConfiguration.java
rename to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/PostgreSQLContainerConfigurationFactory.java
index bca03af2de2..df319667a28 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/DefaultPostgreSQLContainerConfiguration.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/storage/config/impl/postgresql/PostgreSQLContainerConfigurationFactory.java
@@ -17,27 +17,39 @@
 
 package 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.postgresql;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
 
 import java.util.Collections;
 import java.util.Map;
 
-public class DefaultPostgreSQLContainerConfiguration implements 
StorageContainerConfiguration {
+/**
+ * PostgreSQL container configuration factory.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class PostgreSQLContainerConfigurationFactory {
+    
+    /**
+     * Create new instance of postgresql container configuration.
+     * 
+     * @return created instance
+     */
+    public static StorageContainerConfiguration newInstance() {
+        return new StorageContainerConfiguration(getCommands(), 
getContainerEnvironments(), getMountedResources());
+    }
     
-    @Override
-    public String[] getCommands() {
-        String[] commands = new String[1];
-        commands[0] = "-c config_file=/etc/postgresql/postgresql.conf";
-        return commands;
+    private static String[] getCommands() {
+        String[] result = new String[1];
+        result[0] = "-c config_file=/etc/postgresql/postgresql.conf";
+        return result;
     }
     
-    @Override
-    public Map<String, String> getEnvs() {
+    private static Map<String, String> getContainerEnvironments() {
         return Collections.singletonMap("POSTGRES_PASSWORD", "Test@123");
     }
     
-    @Override
-    public Map<String, String> getResourceMappings() {
+    private static Map<String, String> getMountedResources() {
         return Collections.singletonMap("/env/postgresql/postgresql.conf", 
"/etc/postgresql/postgresql.conf");
     }
 }
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 942125d96ef..a6ab669af19 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
@@ -39,8 +39,8 @@ public final class MySQLContainer extends 
DockerStorageContainer {
     @Override
     protected void configure() {
         setCommands(storageContainerConfiguration.getCommands());
-        addEnvs(storageContainerConfiguration.getEnvs());
-        mapResources(storageContainerConfiguration.getResourceMappings());
+        addEnvs(storageContainerConfiguration.getContainerEnvironments());
+        mapResources(storageContainerConfiguration.getMountedResources());
         super.configure();
     }
     
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 12bcd78d0b6..566a2d92eea 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
@@ -39,8 +39,8 @@ public final class OpenGaussContainer extends 
DockerStorageContainer {
     @Override
     protected void configure() {
         setCommands(storageContainerConfiguration.getCommands());
-        addEnvs(storageContainerConfiguration.getEnvs());
-        mapResources(storageContainerConfiguration.getResourceMappings());
+        addEnvs(storageContainerConfiguration.getContainerEnvironments());
+        mapResources(storageContainerConfiguration.getMountedResources());
         withPrivilegedMode(true);
         super.configure();
     }
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 0b31b805dfe..634f0941990 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
@@ -39,8 +39,8 @@ public final class PostgreSQLContainer extends 
DockerStorageContainer {
     @Override
     protected void configure() {
         setCommands(storageContainerConfiguration.getCommands());
-        addEnvs(storageContainerConfiguration.getEnvs());
-        mapResources(storageContainerConfiguration.getResourceMappings());
+        addEnvs(storageContainerConfiguration.getContainerEnvironments());
+        mapResources(storageContainerConfiguration.getMountedResources());
         super.configure();
     }
     
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
index da3cf8e61c9..ad329580a43 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/CreateTableSQLGeneratorIT.java
@@ -27,10 +27,10 @@ import 
org.apache.shardingsphere.integration.data.pipeline.cases.entity.CreateTa
 import 
org.apache.shardingsphere.integration.data.pipeline.cases.entity.CreateTableSQLGeneratorOutputEntity;
 import 
org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
 import 
org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.config.storage.ScalingStorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.param.ScalingParameterized;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainerFactory;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.StorageContainerConfigurationFactory;
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -81,7 +81,7 @@ public final class CreateTableSQLGeneratorIT {
         rootEntity = JAXB.unmarshal(
                 
Objects.requireNonNull(CreateTableSQLGeneratorIT.class.getClassLoader().getResource(parameterized.getScenario())),
 CreateTableSQLGeneratorAssertionsRootEntity.class);
         storageContainer = (DockerStorageContainer) 
StorageContainerFactory.newInstance(parameterized.getDatabaseType(), 
parameterized.getDockerImageName(), "",
-                
ScalingStorageContainerConfigurationFactory.newInstance(parameterized.getDatabaseType(),
 ""));
+                
StorageContainerConfigurationFactory.newInstance(parameterized.getDatabaseType()));
         storageContainer.start();
     }
     
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
index af20add1492..79cc4b7bc39 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
@@ -20,7 +20,6 @@ package 
org.apache.shardingsphere.integration.data.pipeline.framework.container.
 import lombok.Getter;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.config.proxy.ScalingProxyClusterContainerConfigurationFactory;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.config.storage.ScalingStorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainerFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.config.AdaptorContainerConfiguration;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.impl.ShardingSphereProxyClusterContainer;
@@ -28,6 +27,7 @@ import 
org.apache.shardingsphere.test.integration.env.container.atomic.governanc
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.governance.impl.ZookeeperContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainerFactory;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.StorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.test.integration.env.runtime.DataSourceEnvironment;
 
 /**
@@ -49,7 +49,7 @@ public final class DockerComposedContainer extends 
BaseComposedContainer {
         this.databaseType = databaseType;
         governanceContainer = getContainers().registerContainer(new 
ZookeeperContainer());
         storageContainer = 
getContainers().registerContainer((DockerStorageContainer) 
StorageContainerFactory.newInstance(databaseType, dockerImageName,
-                "", 
ScalingStorageContainerConfigurationFactory.newInstance(databaseType, "")));
+                "", 
StorageContainerConfigurationFactory.newInstance(databaseType)));
         AdaptorContainerConfiguration containerConfig = 
ScalingProxyClusterContainerConfigurationFactory.newInstance(databaseType, 
dockerImageName);
         ShardingSphereProxyClusterContainer proxyClusterContainer =
                 (ShardingSphereProxyClusterContainer) 
AdapterContainerFactory.newInstance("Cluster", "proxy", databaseType, 
storageContainer, "", containerConfig);
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/config/storage/ScalingStorageContainerConfigurationFactory.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/config/storage/ScalingStorageContainerConfigurationFactory.java
deleted file mode 100644
index e88d5eccea5..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/config/storage/ScalingStorageContainerConfigurationFactory.java
+++ /dev/null
@@ -1,67 +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.integration.data.pipeline.framework.container.config.storage;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.config.storage.impl.mysql.ScalingMySQLContainerConfiguration;
-import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.config.storage.impl.postgresql.ScalingPostgreSQLContainerConfiguration;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.mysql.DefaultMySQLContainerConfiguration;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.opengauss.DefaultOpenGaussContainerConfiguration;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.postgresql.DefaultPostgreSQLContainerConfiguration;
-
-/**
- * Scaling storage container configuration factory.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ScalingStorageContainerConfigurationFactory {
-    
-    /**
-     * Create new instance of storage container configuration.
-     *
-     * @param databaseType database type
-     * @param scenario scenario
-     * @return created instance
-     */
-    public static StorageContainerConfiguration newInstance(final DatabaseType 
databaseType, final String scenario) {
-        switch (databaseType.getType()) {
-            case "MySQL":
-                if ("default".equalsIgnoreCase(scenario)) {
-                    return new DefaultMySQLContainerConfiguration();
-                }
-                if ("".equalsIgnoreCase(scenario)) {
-                    return new ScalingMySQLContainerConfiguration();
-                }
-                return new DefaultMySQLContainerConfiguration();
-            case "PostgreSQL":
-                if ("default".equalsIgnoreCase(scenario)) {
-                    return new DefaultPostgreSQLContainerConfiguration();
-                }
-                if ("".equalsIgnoreCase(scenario)) {
-                    return new ScalingPostgreSQLContainerConfiguration();
-                }
-                return new DefaultPostgreSQLContainerConfiguration();
-            case "openGauss":
-                return new DefaultOpenGaussContainerConfiguration();
-            default:
-                throw new RuntimeException(String.format("Database `%s` is 
unknown.", databaseType.getType()));
-        }
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/config/storage/impl/postgresql/ScalingPostgreSQLContainerConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/config/storage/impl/postgresql/ScalingPostgreS
 [...]
deleted file mode 100644
index 2e979cc1a47..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/config/storage/impl/postgresql/ScalingPostgreSQLContainerConfiguration.java
+++ /dev/null
@@ -1,45 +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.integration.data.pipeline.framework.container.config.storage.impl.postgresql;
-
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.StorageContainerConfiguration;
-import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.postgresql.DefaultPostgreSQLContainerConfiguration;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * Scaling postgresql container configuration.
- */
-public final class ScalingPostgreSQLContainerConfiguration implements 
StorageContainerConfiguration {
-    
-    @Override
-    public String[] getCommands() {
-        return new DefaultPostgreSQLContainerConfiguration().getCommands();
-    }
-    
-    @Override
-    public Map<String, String> getEnvs() {
-        return new DefaultPostgreSQLContainerConfiguration().getEnvs();
-    }
-    
-    @Override
-    public Map<String, String> getResourceMappings() {
-        return Collections.singletonMap("/env/postgresql/postgresql.conf", 
"/etc/postgresql/postgresql.conf");
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/ClusterComposedContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/ClusterComposedContainer.java
index 8a5bf786f8e..868fc0c47bc 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/ClusterComposedContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/ClusterComposedContainer.java
@@ -19,7 +19,6 @@ package 
org.apache.shardingsphere.test.integration.container.compose.mode;
 
 import 
org.apache.shardingsphere.test.integration.container.compose.ComposedContainer;
 import 
org.apache.shardingsphere.test.integration.container.config.SuiteProxyClusterContainerConfigurationFactory;
-import 
org.apache.shardingsphere.test.integration.container.config.SuiteStorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.DockerITContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.ITContainers;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainer;
@@ -29,6 +28,7 @@ import 
org.apache.shardingsphere.test.integration.env.container.atomic.governanc
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.governance.GovernanceContainerFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainerFactory;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.StorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
 
 import javax.sql.DataSource;
@@ -54,7 +54,7 @@ public final class ClusterComposedContainer implements 
ComposedContainer {
         governanceContainer = 
containers.registerContainer(GovernanceContainerFactory.newInstance("ZooKeeper"));
         // TODO add more version of databases
         storageContainer = 
containers.registerContainer(StorageContainerFactory.newInstance(parameterizedArray.getDatabaseType(),
 "", scenario,
-                
SuiteStorageContainerConfigurationFactory.newInstance(parameterizedArray.getDatabaseType(),
 scenario)));
+                
StorageContainerConfigurationFactory.newInstance(parameterizedArray.getDatabaseType())));
         AdaptorContainerConfiguration containerConfig = 
SuiteProxyClusterContainerConfigurationFactory.newInstance(scenario, 
parameterizedArray.getDatabaseType());
         AdapterContainer adapterContainer = 
AdapterContainerFactory.newInstance(
                 parameterizedArray.getMode(), parameterizedArray.getAdapter(), 
parameterizedArray.getDatabaseType(), storageContainer, scenario, 
containerConfig);
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/StandaloneComposedContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/StandaloneComposedContainer.java
index 121eced7b01..5d281afd0e2 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/StandaloneComposedContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/mode/StandaloneComposedContainer.java
@@ -18,13 +18,13 @@
 package org.apache.shardingsphere.test.integration.container.compose.mode;
 
 import 
org.apache.shardingsphere.test.integration.container.compose.ComposedContainer;
-import 
org.apache.shardingsphere.test.integration.container.config.SuiteStorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.DockerITContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.ITContainers;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainerFactory;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainer;
 import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.StorageContainerFactory;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.storage.config.impl.StorageContainerConfigurationFactory;
 import 
org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
 
 import javax.sql.DataSource;
@@ -46,7 +46,7 @@ public final class StandaloneComposedContainer implements 
ComposedContainer {
         containers = new ITContainers(scenario);
         // TODO add more version of databases
         storageContainer = 
containers.registerContainer(StorageContainerFactory.newInstance(parameterizedArray.getDatabaseType(),
 "", scenario,
-                
SuiteStorageContainerConfigurationFactory.newInstance(parameterizedArray.getDatabaseType(),
 scenario)));
+                
StorageContainerConfigurationFactory.newInstance(parameterizedArray.getDatabaseType())));
         adapterContainer = containers.registerContainer(
                 
AdapterContainerFactory.newInstance(parameterizedArray.getMode(), 
parameterizedArray.getAdapter(), parameterizedArray.getDatabaseType(), 
storageContainer, scenario, null));
         if (adapterContainer instanceof DockerITContainer) {

Reply via email to