terrymanu commented on code in PR #20103:
URL: https://github.com/apache/shardingsphere/pull/20103#discussion_r944366436


##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/config/impl/DefaultProxyClusterContainerConfiguration.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * 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.adapter.config.impl;
+
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.config.AdaptorContainerConfiguration;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Proxy cluster container configuration.
+ */
+public final class DefaultProxyClusterContainerConfiguration implements 
AdaptorContainerConfiguration {

Review Comment:
   Config should be pojo, please do not use extends for configuration



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/config/AdaptorContainerConfiguration.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.adapter.config;
+
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+
+import java.util.Map;
+
+/**
+ * Adaptor container configuration.
+ */
+public interface AdaptorContainerConfiguration {
+    
+    /**
+     * Get wait strategy info.
+     * 
+     * @return waitStrategy

Review Comment:
   `waitStrategy` should be `wait strategy`



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyClusterContainer.java:
##########
@@ -47,17 +45,18 @@ public final class ShardingSphereProxyClusterContainer 
extends DockerITContainer
     
     private final String scenario;
     
-    private final String module;
+    private final AdaptorContainerConfiguration adaptorContainerConfiguration;

Review Comment:
   `adaptorContainerConfiguration` could be rename to `config`



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyClusterContainer.java:
##########
@@ -77,44 +76,13 @@ public ShardingSphereProxyClusterContainer withAgent(final 
String agentHome) {
     protected void configure() {
         withExposedPorts(3307);
         mapConfigurationFiles();
-        if (Strings.isNullOrEmpty(module)) {
-            setWaitStrategy(new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType,
-                    getHost(), getMappedPort(3307), scenario), "proxy", 
"Proxy@123")));
-        }
-        if ("scaling".equalsIgnoreCase(module)) {
-            scalingConfigure();
-        }
-    }
-    
-    private void scalingConfigure() {
-        if (DatabaseTypeUtil.isPostgreSQL(databaseType)) {
-            setWaitStrategy(
-                    new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, 
getHost(), getMappedPort(3307), "postgres"), "proxy", "Proxy@123")));
-        } else if (DatabaseTypeUtil.isMySQL(databaseType)) {
-            setWaitStrategy(new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, 
getHost(), getMappedPort(3307), ""), "proxy", "Proxy@123")));
-        }
+        // TODO in suite, dataSourceName should be scenario
+        setWaitStrategy(new JDBCConnectionWaitStrategy(() -> 
DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType,
+                getHost(), getMappedPort(3307), 
adaptorContainerConfiguration.getWaitStrategyInfo().get("dataSourceName")), 
"proxy", "Proxy@123")));
     }
     
     private void mapConfigurationFiles() {

Review Comment:
   It is better to rename to mountConfigurationFiles



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/config/impl/DefaultProxyClusterContainerConfiguration.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * 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.adapter.config.impl;
+
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import 
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.config.AdaptorContainerConfiguration;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Proxy cluster container configuration.
+ */
+public final class DefaultProxyClusterContainerConfiguration implements 
AdaptorContainerConfiguration {
+    
+    @Override
+    public Map<String, String> getWaitStrategyInfo() {
+        return Collections.singletonMap("dataSourceName", "");
+    }
+    
+    @Override
+    public Map<String, String> getResourceMappings(final String scenario, 
final DatabaseType databaseType) {
+        Map<String, String> result = new HashMap<>(4);

Review Comment:
   Please add factory with `2, 1`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to