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 9f7da2c8375 Support DistSQL IT for Standalone mode (#20615)
9f7da2c8375 is described below

commit 9f7da2c83756ea34445a2c8f9e52908be62c1f96
Author: zhaojinchao <[email protected]>
AuthorDate: Sun Aug 28 23:31:18 2022 +0800

    Support DistSQL IT for Standalone mode (#20615)
    
    * Fix it fail
    
    * add
    
    * Support DistSQL IT at Standalone mode
    
    * Ignore mode
    
    * Revise code format
---
 .../impl/ShardingSphereProxyStandaloneContainer.java    |  2 +-
 .../container/compose/ComposedContainerRegistry.java    |  1 +
 ...a => JdbcStandaloneParameterizedArrayGenerator.java} |  4 ++--
 .../param/array/ParameterizedArrayFactory.java          | 16 ++++++++++++++--
 ... => ProxyStandaloneParameterizedArrayGenerator.java} | 17 ++++++-----------
 .../src/test/resources/env/it-env.properties            |  2 +-
 6 files changed, 25 insertions(+), 17 deletions(-)

diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyStandaloneContainer.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyStandaloneContainer.java
index 72f5a99eae2..a9474b79d7e 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyStandaloneContainer.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/adapter/impl/ShardingSphereProxyStandaloneContainer.java
@@ -70,7 +70,7 @@ public final class ShardingSphereProxyStandaloneContainer 
extends DockerITContai
         withExposedPorts(3307);
         mountConfigurationFiles();
         setWaitStrategy(new JdbcConnectionWaitStrategy(() -> 
DriverManager.getConnection(
-                DataSourceEnvironment.getURL(databaseType, getHost(), 
getMappedPort(3307), config.getProxyDataSourceName()), "root", "Root@123")));
+                DataSourceEnvironment.getURL(databaseType, getHost(), 
getMappedPort(3307), config.getProxyDataSourceName()), "proxy", "Proxy@123")));
     }
     
     private void mountConfigurationFiles() {
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/ComposedContainerRegistry.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/ComposedContainerRegistry.java
index 40f71b04fdc..b9d4293e6cc 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/ComposedContainerRegistry.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/ComposedContainerRegistry.java
@@ -68,6 +68,7 @@ public final class ComposedContainerRegistry implements 
AutoCloseable {
             closeActualDataSourceMap(each.getActualDataSourceMap());
             closeContainer(each);
         }
+        composedContainers.clear();
     }
     
     @SneakyThrows
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/StandaloneParameterizedArrayGenerator.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/JdbcStandaloneParameterizedArrayGenerator.java
similarity index 95%
copy from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/StandaloneParameterizedArrayGenerator.java
copy to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/JdbcStandaloneParameterizedArrayGenerator.java
index cbc50d624c0..3a39d05d7be 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/StandaloneParameterizedArrayGenerator.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/JdbcStandaloneParameterizedArrayGenerator.java
@@ -30,10 +30,10 @@ import java.util.Collection;
 import java.util.Collections;
 
 /**
- * Parameterized array generator for standalone mode.
+ * JDBC Parameterized array generator for standalone mode.
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class StandaloneParameterizedArrayGenerator {
+public final class JdbcStandaloneParameterizedArrayGenerator {
     
     private static final Collection<String> ADAPTERS = 
Collections.singleton("jdbc");
     
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ParameterizedArrayFactory.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ParameterizedArrayFactory.java
index 8056cdd2a77..ac450d7b26d 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ParameterizedArrayFactory.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ParameterizedArrayFactory.java
@@ -45,7 +45,11 @@ public final class ParameterizedArrayFactory {
         Collection<AssertionParameterizedArray> result = new LinkedList<>();
         for (String each : ENV.getRunModes()) {
             if ("Standalone".equalsIgnoreCase(each)) {
-                
result.addAll(StandaloneParameterizedArrayGenerator.getAssertionParameterized(sqlCommandType));
+                if (distSQLCommandType(sqlCommandType)) {
+                    
result.addAll(ProxyStandaloneParameterizedArrayGenerator.getAssertionParameterized(sqlCommandType));
+                } else {
+                    
result.addAll(JdbcStandaloneParameterizedArrayGenerator.getAssertionParameterized(sqlCommandType));
+                }
             } else if ("Cluster".equalsIgnoreCase(each)) {
                 
result.addAll(ClusterParameterizedArrayGenerator.getAssertionParameterized(sqlCommandType));
             }
@@ -63,11 +67,19 @@ public final class ParameterizedArrayFactory {
         Collection<ParameterizedArray> result = new LinkedList<>();
         for (String each : ENV.getRunModes()) {
             if ("Standalone".equalsIgnoreCase(each)) {
-                
result.addAll(StandaloneParameterizedArrayGenerator.getCaseParameterized(sqlCommandType));
+                if (distSQLCommandType(sqlCommandType)) {
+                    
result.addAll(ProxyStandaloneParameterizedArrayGenerator.getCaseParameterized(sqlCommandType));
+                } else {
+                    
result.addAll(JdbcStandaloneParameterizedArrayGenerator.getCaseParameterized(sqlCommandType));
+                }
             } else if ("Cluster".equalsIgnoreCase(each)) {
                 
result.addAll(ClusterParameterizedArrayGenerator.getCaseParameterized(sqlCommandType));
             }
         }
         return result;
     }
+    
+    private static boolean distSQLCommandType(final SQLCommandType 
sqlCommandType) {
+        return SQLCommandType.RDL == sqlCommandType || SQLCommandType.RAL == 
sqlCommandType || SQLCommandType.RQL == sqlCommandType;
+    }
 }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/StandaloneParameterizedArrayGenerator.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ProxyStandaloneParameterizedArrayGenerator.java
similarity index 71%
rename from 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/StandaloneParameterizedArrayGenerator.java
rename to 
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ProxyStandaloneParameterizedArrayGenerator.java
index cbc50d624c0..ff9d31164e9 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/StandaloneParameterizedArrayGenerator.java
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ProxyStandaloneParameterizedArrayGenerator.java
@@ -19,25 +19,18 @@ package 
org.apache.shardingsphere.test.integration.framework.param.array;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
 import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
 import 
org.apache.shardingsphere.test.integration.env.runtime.IntegrationTestEnvironment;
 import 
org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
 import 
org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
 
 import java.util.Collection;
-import java.util.Collections;
 
 /**
- * Parameterized array generator for standalone mode.
+ * PROXY Parameterized array generator for standalone mode.
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class StandaloneParameterizedArrayGenerator {
-    
-    private static final Collection<String> ADAPTERS = 
Collections.singleton("jdbc");
-    
-    private static final Collection<DatabaseType> DATABASE_TYPES = 
Collections.singleton(DatabaseTypeFactory.getInstance("H2"));
+public final class ProxyStandaloneParameterizedArrayGenerator {
     
     private static final IntegrationTestEnvironment ENV = 
IntegrationTestEnvironment.getInstance();
     
@@ -48,7 +41,8 @@ public final class StandaloneParameterizedArrayGenerator {
      * @return assertion parameterized array
      */
     public static Collection<AssertionParameterizedArray> 
getAssertionParameterized(final SQLCommandType sqlCommandType) {
-        return new ParameterizedArrayGenerator(ADAPTERS, ENV.getScenarios(), 
"Standalone", DATABASE_TYPES).getAssertionParameterized(sqlCommandType);
+        return new 
ParameterizedArrayGenerator(ENV.getClusterEnvironment().getAdapters(),
+                ENV.getScenarios(), "Standalone", 
ENV.getClusterEnvironment().getDatabaseTypes()).getAssertionParameterized(sqlCommandType);
     }
     
     /**
@@ -58,6 +52,7 @@ public final class StandaloneParameterizedArrayGenerator {
      * @return case parameterized array
      */
     public static Collection<ParameterizedArray> getCaseParameterized(final 
SQLCommandType sqlCommandType) {
-        return new ParameterizedArrayGenerator(ADAPTERS, ENV.getScenarios(), 
"Standalone", DATABASE_TYPES).getCaseParameterized(sqlCommandType);
+        return new 
ParameterizedArrayGenerator(ENV.getClusterEnvironment().getAdapters(),
+                ENV.getScenarios(), "Standalone", 
ENV.getClusterEnvironment().getDatabaseTypes()).getCaseParameterized(sqlCommandType);
     }
 }
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
index 10b3d1ac720..a35b30b5c0b 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/it-env.properties
@@ -16,7 +16,7 @@
 #
 
 #it.modes=Standalone,Cluster
-it.run.modes=Standalone
+it.run.modes=
 it.run.additional.cases=false
 
 
#it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow

Reply via email to