You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/08/27 01:56:08 UTC
[shardingsphere] branch master updated: Support DistSQL IT integration test in Standalone mode (#20556)
This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 26e75c97161 Support DistSQL IT integration test in Standalone mode (#20556)
26e75c97161 is described below
commit 26e75c971617e0cd36690f38f4579289aa4cb318
Author: zhaojinchao <zh...@apache.org>
AuthorDate: Sat Aug 27 09:56:00 2022 +0800
Support DistSQL IT integration test in Standalone mode (#20556)
* Support DistSQL IT integration test in Standalone mode
* Adjustment code style
* Fix it fail
---
.../impl/ShardingSphereProxyStandaloneContainer.java | 2 +-
.../container/compose/ComposedContainerRegistry.java | 1 +
...a => JdbcStandaloneParameterizedArrayGenerator.java} | 4 ++--
.../param/array/ParameterizedArrayFactory.java | 16 ++++++++++++++--
... => ProxyStandaloneParameterizedArrayGenerator.java} | 17 ++++++-----------
5 files changed, 24 insertions(+), 16 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);
}
}