You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/01/03 08:45:12 UTC
[shardingsphere] branch master updated: Add adapters property to
split jdbc and proxy IT (#8864)
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 38566ff Add adapters property to split jdbc and proxy IT (#8864)
38566ff is described below
commit 38566ff4864e010c1f73a936403bddfeff17d296
Author: Liang Zhang <te...@163.com>
AuthorDate: Sun Jan 3 16:44:38 2021 +0800
Add adapters property to split jdbc and proxy IT (#8864)
---
.../test/integration/engine/it/BaseIT.java | 32 ++++++++++---------
.../test/integration/engine/it/BatchIT.java | 6 ++--
.../test/integration/engine/it/SingleIT.java | 4 +--
.../test/integration/engine/it/dcl/BaseDCLIT.java | 4 +--
.../integration/engine/it/dcl/GeneralDCLIT.java | 8 ++---
.../test/integration/engine/it/ddl/BaseDDLIT.java | 4 +--
.../integration/engine/it/ddl/GeneralDDLIT.java | 8 ++---
.../integration/engine/it/dml/AdditionalDMLIT.java | 4 +--
.../test/integration/engine/it/dml/BaseDMLIT.java | 4 +--
.../test/integration/engine/it/dml/BatchDMLIT.java | 7 ++--
.../integration/engine/it/dml/GeneralDMLIT.java | 8 ++---
.../integration/engine/it/dql/AdditionalDQLIT.java | 4 +--
.../test/integration/engine/it/dql/BaseDQLIT.java | 4 +--
.../integration/engine/it/dql/GeneralDQLIT.java | 6 ++--
.../engine/param/ParameterizedArrayFactory.java | 37 ++++++++++++++++------
.../param/domain/AssertionParameterizedArray.java | 13 +++++---
.../param/domain/CaseParameterizedArray.java | 11 ++++---
.../integration/env/IntegrateTestEnvironment.java | 3 ++
.../resources/integrate/env-jdbc-ci.properties | 2 ++
.../resources/integrate/env-jdbc-local.properties | 2 ++
.../test/resources/integrate/env-proxy.properties | 3 ++
21 files changed, 105 insertions(+), 69 deletions(-)
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BaseIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BaseIT.java
index 7b3386d..77d4b37 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BaseIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BaseIT.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFac
import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.test.integration.env.EnvironmentPath;
-import org.apache.shardingsphere.test.integration.env.IntegrateTestEnvironment;
import org.apache.shardingsphere.test.integration.env.datasource.builder.ActualDataSourceBuilder;
import org.apache.shardingsphere.test.integration.env.datasource.builder.ProxyDataSourceBuilder;
import org.junit.After;
@@ -47,6 +46,8 @@ public abstract class BaseIT {
public static final String NOT_VERIFY_FLAG = "NOT_VERIFY";
+ private final String adapter;
+
private final String scenario;
private final DatabaseType databaseType;
@@ -57,20 +58,21 @@ public abstract class BaseIT {
static {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
- if (IntegrateTestEnvironment.getInstance().isProxyEnvironment()) {
- waitForProxyReady();
- }
}
- BaseIT(final String scenario, final DatabaseType databaseType) throws IOException, JAXBException, SQLException {
+ BaseIT(final String adapter, final String scenario, final DatabaseType databaseType) throws IOException, JAXBException, SQLException {
+ this.adapter = adapter;
this.scenario = scenario;
this.databaseType = databaseType;
actualDataSources = ActualDataSourceBuilder.createActualDataSources(scenario, databaseType);
targetDataSource = createTargetDataSource();
+ if ("proxy".equalsIgnoreCase(adapter)) {
+ waitForProxyReady();
+ }
}
private DataSource createTargetDataSource() throws SQLException, IOException {
- return IntegrateTestEnvironment.getInstance().isProxyEnvironment() ? ProxyDataSourceBuilder.build(String.format("proxy_%s", scenario), databaseType)
+ return "proxy".equalsIgnoreCase(adapter) ? ProxyDataSourceBuilder.build(String.format("proxy_%s", scenario), databaseType)
: YamlShardingSphereDataSourceFactory.createDataSource(actualDataSources, new File(EnvironmentPath.getRulesConfigurationFile(scenario)));
}
@@ -78,14 +80,7 @@ public abstract class BaseIT {
targetDataSource = createTargetDataSource();
}
- @After
- public final void tearDown() {
- if (targetDataSource instanceof ShardingSphereDataSource) {
- ((ShardingSphereDataSource) targetDataSource).getMetaDataContexts().getExecutorEngine().close();
- }
- }
-
- private static void waitForProxyReady() {
+ private void waitForProxyReady() {
int retryCount = 0;
while (!isProxyReady() && retryCount < 30) {
try {
@@ -96,7 +91,7 @@ public abstract class BaseIT {
}
}
- private static boolean isProxyReady() {
+ private boolean isProxyReady() {
try (Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:33070/proxy_db/?serverTimezone=UTC&useSSL=false&useLocalSessionState=true");
Statement statement = connection.createStatement()) {
statement.execute("SELECT 1");
@@ -105,4 +100,11 @@ public abstract class BaseIT {
}
return true;
}
+
+ @After
+ public final void tearDown() {
+ if (targetDataSource instanceof ShardingSphereDataSource) {
+ ((ShardingSphereDataSource) targetDataSource).getMetaDataContexts().getExecutorEngine().close();
+ }
+ }
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BatchIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BatchIT.java
index d469e51..930600f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BatchIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BatchIT.java
@@ -68,9 +68,9 @@ public abstract class BatchIT extends BaseIT {
private final Collection<DataSet> dataSets;
- protected BatchIT(final IntegrateTestCaseContext testCaseContext,
- final String scenario, final DatabaseType databaseType, final String sql) throws IOException, JAXBException, SQLException {
- super(scenario, databaseType);
+ protected BatchIT(final IntegrateTestCaseContext testCaseContext,
+ final String adapter, final String scenario, final DatabaseType databaseType, final String sql) throws IOException, JAXBException, SQLException {
+ super(adapter, scenario, databaseType);
this.testCaseContext = testCaseContext;
this.sql = sql;
dataSets = new LinkedList<>();
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/SingleIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/SingleIT.java
index 3a13bfa..55dd926 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/SingleIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/SingleIT.java
@@ -52,9 +52,9 @@ public abstract class SingleIT extends BaseIT {
private final String sql;
- protected SingleIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ protected SingleIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final DatabaseType databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(scenario, databaseType);
+ super(adapter, scenario, databaseType);
caseIdentifier = sql;
this.assertion = assertion;
this.sqlExecuteType = sqlExecuteType;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/BaseDCLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/BaseDCLIT.java
index 2acf5f0..044e214 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/BaseDCLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/BaseDCLIT.java
@@ -48,9 +48,9 @@ public abstract class BaseDCLIT extends SingleIT {
private final AuthorityEnvironmentManager authorityEnvironmentManager;
- protected BaseDCLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ protected BaseDCLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final DatabaseType databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(parentPath, assertion, scenario, databaseType, sqlExecuteType, sql);
+ super(parentPath, assertion, adapter, scenario, databaseType, sqlExecuteType, sql);
authorityEnvironmentManager = new AuthorityEnvironmentManager(
EnvironmentPath.getAuthorityFile(scenario), null == getActualDataSources() ? null : createInstanceDataSourceMap(), databaseType);
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/GeneralDCLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/GeneralDCLIT.java
index 8dde744..a4d9996 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/GeneralDCLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/GeneralDCLIT.java
@@ -34,12 +34,12 @@ import java.util.Collection;
public final class GeneralDCLIT extends BaseDCLIT {
- public GeneralDCLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ public GeneralDCLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final String databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(parentPath, assertion, scenario, DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
+ super(parentPath, assertion, adapter, scenario, DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
}
-
- @Parameters(name = "{2} -> {3} -> {4} -> {5}")
+
+ @Parameters(name = "{2}: {3} -> {4} -> {5} -> {6}")
public static Collection<Object[]> getParameters() {
return ParameterizedArrayFactory.getAssertionParameterizedArray(SQLCommandType.DCL);
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/ddl/BaseDDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/ddl/BaseDDLIT.java
index 4ba6409..3cec03f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/ddl/BaseDDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/ddl/BaseDDLIT.java
@@ -59,9 +59,9 @@ public abstract class BaseDDLIT extends SingleIT {
private final DataSetEnvironmentManager dataSetEnvironmentManager;
- protected BaseDDLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ protected BaseDDLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final DatabaseType databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(parentPath, assertion, scenario, databaseType, sqlExecuteType, sql);
+ super(parentPath, assertion, adapter, scenario, databaseType, sqlExecuteType, sql);
dataSetEnvironmentManager = new DataSetEnvironmentManager(EnvironmentPath.getDataSetFile(scenario), getActualDataSources());
assertNotNull("Expected affected table is required", assertion.getInitialSQL());
assertNotNull("Expected affected table is required", assertion.getInitialSQL().getAffectedTable());
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/ddl/GeneralDDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/ddl/GeneralDDLIT.java
index 9b7fa7e..5b12f1d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/ddl/GeneralDDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/ddl/GeneralDDLIT.java
@@ -34,12 +34,12 @@ import java.util.Collection;
public final class GeneralDDLIT extends BaseDDLIT {
- public GeneralDDLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ public GeneralDDLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final String databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(parentPath, assertion, scenario, DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
+ super(parentPath, assertion, adapter, scenario, DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
}
-
- @Parameters(name = "{2} -> {3} -> {4} -> {5}")
+
+ @Parameters(name = "{2}: {3} -> {4} -> {5} -> {6}")
public static Collection<Object[]> getParameters() {
return ParameterizedArrayFactory.getAssertionParameterizedArray(SQLCommandType.DDL);
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/AdditionalDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/AdditionalDMLIT.java
index bc36ec9..c1909c4 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/AdditionalDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/AdditionalDMLIT.java
@@ -43,9 +43,9 @@ public final class AdditionalDMLIT extends BaseDMLIT {
private final IntegrateTestCaseAssertion assertion;
- public AdditionalDMLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ public AdditionalDMLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final DatabaseType databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(parentPath, assertion, scenario, databaseType, sqlExecuteType, sql);
+ super(parentPath, assertion, adapter, scenario, databaseType, sqlExecuteType, sql);
this.assertion = assertion;
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/BaseDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/BaseDMLIT.java
index d3191e9..331540d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/BaseDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/BaseDMLIT.java
@@ -56,9 +56,9 @@ public abstract class BaseDMLIT extends SingleIT {
private final DataSetEnvironmentManager dataSetEnvironmentManager;
- protected BaseDMLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ protected BaseDMLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final DatabaseType databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(parentPath, assertion, scenario, databaseType, sqlExecuteType, sql);
+ super(parentPath, assertion, adapter, scenario, databaseType, sqlExecuteType, sql);
dataSetEnvironmentManager = new DataSetEnvironmentManager(EnvironmentPath.getDataSetFile(scenario), getActualDataSources());
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/BatchDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/BatchDMLIT.java
index 36206bb..475a692 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/BatchDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/BatchDMLIT.java
@@ -42,12 +42,13 @@ public final class BatchDMLIT extends BatchIT {
private final IntegrateTestCaseContext testCaseContext;
- public BatchDMLIT(final IntegrateTestCaseContext testCaseContext, final String scenario, final String databaseType, final String sql) throws IOException, JAXBException, SQLException {
- super(testCaseContext, scenario, DatabaseTypeRegistry.getActualDatabaseType(databaseType), sql);
+ public BatchDMLIT(final IntegrateTestCaseContext testCaseContext, final String adapter,
+ final String scenario, final String databaseType, final String sql) throws IOException, JAXBException, SQLException {
+ super(testCaseContext, adapter, scenario, DatabaseTypeRegistry.getActualDatabaseType(databaseType), sql);
this.testCaseContext = testCaseContext;
}
- @Parameters(name = "{1} -> {2} -> {3}")
+ @Parameters(name = "{1}: {2} -> {3} -> {4}")
public static Collection<Object[]> getParameters() {
return ParameterizedArrayFactory.getCaseParameterizedArray(SQLCommandType.DML);
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/GeneralDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/GeneralDMLIT.java
index 20cbb00..eac8a8d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/GeneralDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dml/GeneralDMLIT.java
@@ -41,13 +41,13 @@ public final class GeneralDMLIT extends BaseDMLIT {
private final IntegrateTestCaseAssertion assertion;
- public GeneralDMLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ public GeneralDMLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final String databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(parentPath, assertion, scenario, DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
+ super(parentPath, assertion, adapter, scenario, DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
this.assertion = assertion;
}
-
- @Parameters(name = "{2} -> {3} -> {4} -> {5}")
+
+ @Parameters(name = "{2}: {3} -> {4} -> {5} -> {6}")
public static Collection<Object[]> getParameters() {
return ParameterizedArrayFactory.getAssertionParameterizedArray(SQLCommandType.DML);
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/AdditionalDQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/AdditionalDQLIT.java
index 076a41f..873d9fe 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/AdditionalDQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/AdditionalDQLIT.java
@@ -44,9 +44,9 @@ public final class AdditionalDQLIT extends BaseDQLIT {
private final IntegrateTestCaseAssertion assertion;
- public AdditionalDQLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ public AdditionalDQLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final DatabaseType databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(parentPath, assertion, scenario, databaseType, sqlExecuteType, sql);
+ super(parentPath, assertion, adapter, scenario, databaseType, sqlExecuteType, sql);
this.assertion = assertion;
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/BaseDQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/BaseDQLIT.java
index 85500cf..4987279d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/BaseDQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/BaseDQLIT.java
@@ -50,9 +50,9 @@ import static org.junit.Assert.assertTrue;
public abstract class BaseDQLIT extends SingleIT {
- protected BaseDQLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ protected BaseDQLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final DatabaseType databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(parentPath, assertion, scenario, databaseType, sqlExecuteType, sql);
+ super(parentPath, assertion, adapter, scenario, databaseType, sqlExecuteType, sql);
}
@BeforeClass
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/GeneralDQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/GeneralDQLIT.java
index a8384c0..eb913d9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/GeneralDQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dql/GeneralDQLIT.java
@@ -42,13 +42,13 @@ public final class GeneralDQLIT extends BaseDQLIT {
private final IntegrateTestCaseAssertion assertion;
- public GeneralDQLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String scenario,
+ public GeneralDQLIT(final String parentPath, final IntegrateTestCaseAssertion assertion, final String adapter, final String scenario,
final String databaseType, final SQLExecuteType sqlExecuteType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
- super(parentPath, assertion, scenario, DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
+ super(parentPath, assertion, adapter, scenario, DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
this.assertion = assertion;
}
- @Parameters(name = "{2} -> {3} -> {4} -> {5}")
+ @Parameters(name = "{2}: {3} -> {4} -> {5} -> {6}")
public static Collection<Object[]> getParameters() {
return ParameterizedArrayFactory.getAssertionParameterizedArray(SQLCommandType.DQL);
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/ParameterizedArrayFactory.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/ParameterizedArrayFactory.java
index 2eaa1bb..cfe76ed 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/ParameterizedArrayFactory.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/ParameterizedArrayFactory.java
@@ -45,9 +45,9 @@ import java.util.stream.Collectors;
@Slf4j
public final class ParameterizedArrayFactory {
- private static final IntegrateTestCasesLoader INTEGRATE_TEST_CASES_LOADER = IntegrateTestCasesLoader.getInstance();
+ private static final IntegrateTestCasesLoader TEST_CASES_LOADER = IntegrateTestCasesLoader.getInstance();
- private static final IntegrateTestEnvironment INTEGRATE_TEST_ENVIRONMENT = IntegrateTestEnvironment.getInstance();
+ private static final IntegrateTestEnvironment ENV = IntegrateTestEnvironment.getInstance();
/**
* Get assertion parameterized array.
@@ -57,7 +57,7 @@ public final class ParameterizedArrayFactory {
*/
public static Collection<Object[]> getAssertionParameterizedArray(final SQLCommandType sqlCommandType) {
Collection<ParameterizedArray> result = new LinkedList<>();
- for (IntegrateTestCaseContext each : INTEGRATE_TEST_CASES_LOADER.getTestCaseContexts(sqlCommandType)) {
+ for (IntegrateTestCaseContext each : TEST_CASES_LOADER.getTestCaseContexts(sqlCommandType)) {
result.addAll(getAssertionParameterizedArray(each));
}
return toArrays(result);
@@ -85,15 +85,24 @@ public final class ParameterizedArrayFactory {
final DatabaseType databaseType, final SQLExecuteType sqlExecuteType) {
Collection<ParameterizedArray> result = new LinkedList<>();
for (IntegrateTestCaseAssertion each : testCaseContext.getTestCase().getAssertions()) {
- result.addAll(getAssertionParameterizedArray(testCaseContext, each, databaseType, sqlExecuteType));
+ result.addAll(getAssertionParameterizedArray(testCaseContext, databaseType, sqlExecuteType, each));
}
return result;
}
- private static Collection<ParameterizedArray> getAssertionParameterizedArray(final IntegrateTestCaseContext testCaseContext,
- final IntegrateTestCaseAssertion assertion, final DatabaseType databaseType, final SQLExecuteType sqlExecuteType) {
- return INTEGRATE_TEST_ENVIRONMENT.getScenarios().stream().map(
- each -> new AssertionParameterizedArray(testCaseContext, assertion, each, databaseType, sqlExecuteType)).collect(Collectors.toList());
+ private static Collection<ParameterizedArray> getAssertionParameterizedArray(final IntegrateTestCaseContext testCaseContext,
+ final DatabaseType databaseType, final SQLExecuteType sqlExecuteType, final IntegrateTestCaseAssertion assertion) {
+ Collection<ParameterizedArray> result = new LinkedList<>();
+ for (String adapter : ENV.getAdapters()) {
+ result.addAll(getAssertionParameterizedArray(testCaseContext, assertion, adapter, databaseType, sqlExecuteType));
+ }
+ return result;
+ }
+
+ private static Collection<ParameterizedArray> getAssertionParameterizedArray(final IntegrateTestCaseContext testCaseContext, final IntegrateTestCaseAssertion assertion,
+ final String adapter, final DatabaseType databaseType, final SQLExecuteType sqlExecuteType) {
+ return ENV.getScenarios().stream().map(
+ each -> new AssertionParameterizedArray(testCaseContext, assertion, adapter, each, databaseType, sqlExecuteType)).collect(Collectors.toList());
}
/**
@@ -104,7 +113,7 @@ public final class ParameterizedArrayFactory {
*/
public static Collection<Object[]> getCaseParameterizedArray(final SQLCommandType sqlCommandType) {
Collection<ParameterizedArray> result = new LinkedList<>();
- for (IntegrateTestCaseContext each : INTEGRATE_TEST_CASES_LOADER.getTestCaseContexts(sqlCommandType)) {
+ for (IntegrateTestCaseContext each : TEST_CASES_LOADER.getTestCaseContexts(sqlCommandType)) {
result.addAll(getCaseParameterizedArray(each));
}
return toArrays(result);
@@ -121,7 +130,15 @@ public final class ParameterizedArrayFactory {
}
private static Collection<ParameterizedArray> getCaseParameterizedArray(final IntegrateTestCaseContext testCaseContext, final DatabaseType databaseType) {
- return INTEGRATE_TEST_ENVIRONMENT.getScenarios().stream().map(each -> new CaseParameterizedArray(testCaseContext, each, databaseType)).collect(Collectors.toList());
+ Collection<ParameterizedArray> result = new LinkedList<>();
+ for (String adapter : ENV.getAdapters()) {
+ result.addAll(getCaseParameterizedArray(testCaseContext, adapter, databaseType));
+ }
+ return result;
+ }
+
+ private static Collection<ParameterizedArray> getCaseParameterizedArray(final IntegrateTestCaseContext testCaseContext, final String adapter, final DatabaseType databaseType) {
+ return ENV.getScenarios().stream().map(each -> new CaseParameterizedArray(testCaseContext, adapter, each, databaseType)).collect(Collectors.toList());
}
private static Collection<DatabaseType> getDatabaseTypes(final String databaseTypes) {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/AssertionParameterizedArray.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/AssertionParameterizedArray.java
index 8d48638..874aeb4 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/AssertionParameterizedArray.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/AssertionParameterizedArray.java
@@ -33,6 +33,8 @@ public final class AssertionParameterizedArray implements ParameterizedArray {
private final IntegrateTestCaseAssertion assertion;
+ private final String adapters;
+
private final String scenario;
private final DatabaseType databaseType;
@@ -41,13 +43,14 @@ public final class AssertionParameterizedArray implements ParameterizedArray {
@Override
public Object[] toArrays() {
- Object[] result = new Object[6];
+ Object[] result = new Object[7];
result[0] = testCaseContext.getParentPath();
result[1] = assertion;
- result[2] = scenario;
- result[3] = databaseType.getName();
- result[4] = sqlExecuteType;
- result[5] = testCaseContext.getTestCase().getSql();
+ result[2] = adapters;
+ result[3] = scenario;
+ result[4] = databaseType.getName();
+ result[5] = sqlExecuteType;
+ result[6] = testCaseContext.getTestCase().getSql();
return result;
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/CaseParameterizedArray.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/CaseParameterizedArray.java
index fa4ef51..d1c1e84 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/CaseParameterizedArray.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/CaseParameterizedArray.java
@@ -29,17 +29,20 @@ public final class CaseParameterizedArray implements ParameterizedArray {
private final IntegrateTestCaseContext testCaseContext;
+ private final String adapters;
+
private final String scenario;
private final DatabaseType databaseType;
@Override
public Object[] toArrays() {
- Object[] result = new Object[4];
+ Object[] result = new Object[5];
result[0] = testCaseContext;
- result[1] = scenario;
- result[2] = databaseType.getName();
- result[3] = testCaseContext.getTestCase().getSql();
+ result[1] = adapters;
+ result[2] = scenario;
+ result[3] = databaseType.getName();
+ result[4] = testCaseContext.getTestCase().getSql();
return result;
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironment.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironment.java
index 2cb5896..dcc5a4b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironment.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironment.java
@@ -40,6 +40,8 @@ public final class IntegrateTestEnvironment {
private static final IntegrateTestEnvironment INSTANCE = new IntegrateTestEnvironment();
private final String activeProfile;
+
+ private final Collection<String> adapters;
private final boolean runAdditionalTestCases;
@@ -50,6 +52,7 @@ public final class IntegrateTestEnvironment {
private IntegrateTestEnvironment() {
activeProfile = loadProperties("integrate/profile.properties").getProperty("mode");
Properties envProps = loadProperties(IntegrateTestEnvironmentType.valueFromProfileName(activeProfile).getEnvFileName());
+ adapters = Splitter.on(",").trimResults().splitToList(envProps.getProperty("adapters"));
runAdditionalTestCases = Boolean.parseBoolean(envProps.getProperty("run.additional.cases"));
scenarios = Splitter.on(",").trimResults().splitToList(envProps.getProperty("scenarios"));
databaseEnvironments = createDatabaseEnvironments(envProps);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-jdbc-ci.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-jdbc-ci.properties
index 9c7a3b6..5b1ca6f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-jdbc-ci.properties
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-jdbc-ci.properties
@@ -15,6 +15,8 @@
# limitations under the License.
#
+adapters=jdbc
+
run.additional.cases=false
#scenarios=db,tbl,dbtbl_with_replica_query,replica_query,shadow
scenarios=db,tbl,dbtbl_with_replica_query,replica_query
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-jdbc-local.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-jdbc-local.properties
index 6f6ee02..f01123a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-jdbc-local.properties
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-jdbc-local.properties
@@ -15,6 +15,8 @@
# limitations under the License.
#
+adapters=jdbc
+
run.additional.cases=false
#scenarios=db,tbl,dbtbl_with_replica_query,replica_query,shadow
scenarios=db,tbl,dbtbl_with_replica_query,replica_query
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-proxy.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-proxy.properties
index 7b8b92e..ebb2e80 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-proxy.properties
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/integrate/env-proxy.properties
@@ -15,6 +15,9 @@
# limitations under the License.
#
+adapters=proxy
+#adapters=jdbc,proxy
+
run.additional.cases=false
#scenarios=db,tbl,dbtbl_with_masterslave,masterslave,shadow
scenarios=db