This is an automated email from the ASF dual-hosted git repository.
dongzonglei 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 d367feb Add ParameterizedArray and ParameterizedArrayFactory (#8856)
d367feb is described below
commit d367feb055e8f56c6c73966fe9849d4dca2aaae1
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Jan 1 20:15:36 2021 +0800
Add ParameterizedArray and ParameterizedArrayFactory (#8856)
* Refactor IntegrateTestCases
* Refactor IntegrateTestParameters
* Refactor IntegrateTestParameters
* Rename SQLCommandType
* Rename SQLExecuteType
* Add ParameterizedArray
* Rename ParameterizedArrayFactory
* Rename package
* Rename package
* Refactor ParameterizedArrayFactory
---
.../test/integration/cases/IntegrateTestCases.java | 4 +-
.../cases/IntegrateTestCasesLoader.java | 22 +--
...egrateTestCaseType.java => SQLCommandType.java} | 4 +-
.../test/integration/engine/it/SingleIT.java | 12 +-
.../test/integration/engine/it/dcl/BaseDCLIT.java | 6 +-
.../integration/engine/it/dcl/GeneralDCLIT.java | 16 +-
.../test/integration/engine/it/ddl/BaseDDLIT.java | 6 +-
.../integration/engine/it/ddl/GeneralDDLIT.java | 16 +-
.../integration/engine/it/dml/AdditionalDMLIT.java | 28 ++--
.../test/integration/engine/it/dml/BaseDMLIT.java | 6 +-
.../test/integration/engine/it/dml/BatchDMLIT.java | 6 +-
.../integration/engine/it/dml/GeneralDMLIT.java | 16 +-
.../integration/engine/it/dql/AdditionalDQLIT.java | 20 +--
.../test/integration/engine/it/dql/BaseDQLIT.java | 6 +-
.../integration/engine/it/dql/GeneralDQLIT.java | 16 +-
.../engine/param/IntegrateTestParameters.java | 174 --------------------
.../engine/param/ParameterizedArrayFactory.java | 182 +++++++++++++++++++++
.../{SQLCaseType.java => SQLExecuteType.java} | 4 +-
.../param/domain/AssertionParameterizedArray.java | 53 ++++++
.../param/domain/CaseParameterizedArray.java | 45 +++++
.../ParameterizedArray.java} | 13 +-
21 files changed, 384 insertions(+), 271 deletions(-)
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCases.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCases.java
index 816baef..c25aab2 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCases.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCases.java
@@ -22,8 +22,8 @@ import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestC
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Collection;
import java.util.LinkedList;
-import java.util.List;
/**
* JAXB definition of integrate test cases.
@@ -33,5 +33,5 @@ import java.util.List;
public final class IntegrateTestCases {
@XmlElement(name = "test-case")
- private List<IntegrateTestCase> testCases = new LinkedList<>();
+ private final Collection<IntegrateTestCase> testCases = new LinkedList<>();
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCasesLoader.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCasesLoader.java
index 0974c74..3ed61fd 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCasesLoader.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCasesLoader.java
@@ -46,7 +46,7 @@ public final class IntegrateTestCasesLoader {
private static final IntegrateTestCasesLoader INSTANCE = new
IntegrateTestCasesLoader();
- private final Map<IntegrateTestCaseType,
Collection<IntegrateTestCaseContext>> testCaseContexts = new LinkedHashMap<>();
+ private final Map<SQLCommandType, Collection<IntegrateTestCaseContext>>
testCaseContexts = new LinkedHashMap<>();
/**
* Get singleton instance.
@@ -60,23 +60,23 @@ public final class IntegrateTestCasesLoader {
/**
* Get integrate test case contexts.
*
- * @param caseType integration test case type
+ * @param sqlCommandType SQL command type
* @return integrate test case contexts
*/
- public Collection<IntegrateTestCaseContext> getTestCaseContexts(final
IntegrateTestCaseType caseType) {
- testCaseContexts.putIfAbsent(caseType,
loadIntegrateTestCaseContexts(caseType));
- return testCaseContexts.get(caseType);
+ public Collection<IntegrateTestCaseContext> getTestCaseContexts(final
SQLCommandType sqlCommandType) {
+ testCaseContexts.putIfAbsent(sqlCommandType,
loadIntegrateTestCaseContexts(sqlCommandType));
+ return testCaseContexts.get(sqlCommandType);
}
@SneakyThrows({IOException.class, URISyntaxException.class,
JAXBException.class})
- private Collection<IntegrateTestCaseContext>
loadIntegrateTestCaseContexts(final IntegrateTestCaseType caseType) {
+ private Collection<IntegrateTestCaseContext>
loadIntegrateTestCaseContexts(final SQLCommandType sqlCommandType) {
URL url =
IntegrateTestCasesLoader.class.getClassLoader().getResource("integrate/cases/");
Preconditions.checkNotNull(url, "Can not find integrate test cases.");
- return loadIntegrateTestCaseContexts(url, caseType);
+ return loadIntegrateTestCaseContexts(url, sqlCommandType);
}
- private Collection<IntegrateTestCaseContext>
loadIntegrateTestCaseContexts(final URL url, final IntegrateTestCaseType
caseType) throws IOException, URISyntaxException, JAXBException {
- Collection<File> files = getFiles(url, caseType);
+ private Collection<IntegrateTestCaseContext>
loadIntegrateTestCaseContexts(final URL url, final SQLCommandType
sqlCommandType) throws IOException, URISyntaxException, JAXBException {
+ Collection<File> files = getFiles(url, sqlCommandType);
Preconditions.checkNotNull(files, "Can not find integrate test
cases.");
Collection<IntegrateTestCaseContext> result = new LinkedList<>();
for (File each : files) {
@@ -85,13 +85,13 @@ public final class IntegrateTestCasesLoader {
return result;
}
- private static Collection<File> getFiles(final URL url, final
IntegrateTestCaseType caseType) throws IOException, URISyntaxException {
+ private static Collection<File> getFiles(final URL url, final
SQLCommandType sqlCommandType) throws IOException, URISyntaxException {
Collection<File> result = new LinkedList<>();
Files.walkFileTree(Paths.get(url.toURI()), new
SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(final Path file, final
BasicFileAttributes basicFileAttributes) {
- if
(file.getFileName().toString().startsWith(caseType.getFilePrefix()) &&
file.getFileName().toString().endsWith(".xml")) {
+ if
(file.getFileName().toString().startsWith(sqlCommandType.getFilePrefix()) &&
file.getFileName().toString().endsWith(".xml")) {
result.add(file.toFile());
}
return FileVisitResult.CONTINUE;
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCaseType.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/SQLCommandType.java
similarity index 97%
rename from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCaseType.java
rename to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/SQLCommandType.java
index 5e6effd..065f11f 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/IntegrateTestCaseType.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/SQLCommandType.java
@@ -28,11 +28,11 @@ import
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectState
import
org.apache.shardingsphere.sql.parser.sql.common.statement.tcl.TCLStatement;
/**
- * Integrate test case type.
+ * SQL command type.
*/
@RequiredArgsConstructor
@Getter
-public enum IntegrateTestCaseType {
+public enum SQLCommandType {
/**
* Data Query Language.
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 d76eb27..3a13bfa 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
@@ -21,7 +21,7 @@ import lombok.AccessLevel;
import lombok.Getter;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
import org.apache.shardingsphere.test.integration.cases.value.SQLValue;
import org.apache.shardingsphere.test.integration.cases.dataset.DataSet;
import org.apache.shardingsphere.test.integration.cases.dataset.DataSetLoader;
@@ -46,19 +46,19 @@ public abstract class SingleIT extends BaseIT {
private final IntegrateTestCaseAssertion assertion;
- private final SQLCaseType caseType;
+ private final SQLExecuteType sqlExecuteType;
private final DataSet dataSet;
private final String sql;
- protected SingleIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final DatabaseType databaseType, final SQLCaseType
caseType, final String sql) throws IOException, JAXBException, SQLException,
ParseException {
+ protected SingleIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
+ final DatabaseType databaseType, final SQLExecuteType
sqlExecuteType, final String sql) throws IOException, JAXBException,
SQLException, ParseException {
super(scenario, databaseType);
caseIdentifier = sql;
this.assertion = assertion;
- this.caseType = caseType;
- this.sql = caseType == SQLCaseType.Literal ? getLiteralSQL(sql) : sql;
+ this.sqlExecuteType = sqlExecuteType;
+ this.sql = sqlExecuteType == SQLExecuteType.Literal ?
getLiteralSQL(sql) : sql;
dataSet = null == assertion ? null : DataSetLoader.load(parentPath,
scenario, databaseType, assertion.getExpectedDataFile());
}
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 3179eec..c061985 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
@@ -21,7 +21,7 @@ import
org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
import
org.apache.shardingsphere.infra.database.metadata.MemorizedDataSourceMetaData;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
import org.apache.shardingsphere.test.integration.engine.it.SingleIT;
import org.apache.shardingsphere.test.integration.env.EnvironmentPath;
import
org.apache.shardingsphere.test.integration.env.authority.AuthorityEnvironmentManager;
@@ -49,8 +49,8 @@ public abstract class BaseDCLIT extends SingleIT {
private final AuthorityEnvironmentManager authorityEnvironmentManager;
protected BaseDCLIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final DatabaseType databaseType, final SQLCaseType
caseType, final String sql) throws IOException, JAXBException, SQLException,
ParseException {
- super(parentPath, assertion, scenario, databaseType, caseType, sql);
+ final DatabaseType databaseType, final SQLExecuteType
sqlExecuteType, final String sql) throws IOException, JAXBException,
SQLException, ParseException {
+ super(parentPath, assertion, 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 a8051ca..8dde744 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
@@ -18,10 +18,10 @@
package org.apache.shardingsphere.test.integration.engine.it.dcl;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseType;
+import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
-import
org.apache.shardingsphere.test.integration.engine.param.IntegrateTestParameters;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
+import
org.apache.shardingsphere.test.integration.engine.param.ParameterizedArrayFactory;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
@@ -35,19 +35,19 @@ import java.util.Collection;
public final class GeneralDCLIT extends BaseDCLIT {
public GeneralDCLIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final String databaseType, final SQLCaseType caseType,
final String sql) throws IOException, JAXBException, SQLException,
ParseException {
- super(parentPath, assertion, scenario,
DatabaseTypeRegistry.getActualDatabaseType(databaseType), caseType, sql);
+ final String databaseType, final SQLExecuteType
sqlExecuteType, final String sql) throws IOException, JAXBException,
SQLException, ParseException {
+ super(parentPath, assertion, scenario,
DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
}
@Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
- return
IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DCL);
+ return
ParameterizedArrayFactory.getAssertionParameterizedArray(SQLCommandType.DCL);
}
@Test
public void assertExecuteUpdate() throws SQLException {
try (Connection connection = getTargetDataSource().getConnection()) {
- if (SQLCaseType.Literal == getCaseType()) {
+ if (SQLExecuteType.Literal == getSqlExecuteType()) {
connection.createStatement().executeUpdate(getSql());
} else {
connection.prepareStatement(getSql()).executeUpdate();
@@ -58,7 +58,7 @@ public final class GeneralDCLIT extends BaseDCLIT {
@Test
public void assertExecute() throws SQLException {
try (Connection connection = getTargetDataSource().getConnection()) {
- if (SQLCaseType.Literal == getCaseType()) {
+ if (SQLExecuteType.Literal == getSqlExecuteType()) {
connection.createStatement().execute(getSql());
} else {
connection.prepareStatement(getSql()).execute();
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 5021983..4ba6409 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
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.datanode.DataNode;
import
org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineExpressionParser;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
import
org.apache.shardingsphere.test.integration.cases.dataset.metadata.DataSetColumn;
import
org.apache.shardingsphere.test.integration.cases.dataset.metadata.DataSetIndex;
import
org.apache.shardingsphere.test.integration.cases.dataset.metadata.DataSetMetadata;
@@ -60,8 +60,8 @@ public abstract class BaseDDLIT extends SingleIT {
private final DataSetEnvironmentManager dataSetEnvironmentManager;
protected BaseDDLIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final DatabaseType databaseType, final SQLCaseType
caseType, final String sql) throws IOException, JAXBException, SQLException,
ParseException {
- super(parentPath, assertion, scenario, databaseType, caseType, sql);
+ final DatabaseType databaseType, final SQLExecuteType
sqlExecuteType, final String sql) throws IOException, JAXBException,
SQLException, ParseException {
+ super(parentPath, assertion, 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 e412577..9b7fa7e 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
@@ -18,10 +18,10 @@
package org.apache.shardingsphere.test.integration.engine.it.ddl;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseType;
+import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
-import
org.apache.shardingsphere.test.integration.engine.param.IntegrateTestParameters;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
+import
org.apache.shardingsphere.test.integration.engine.param.ParameterizedArrayFactory;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
@@ -35,20 +35,20 @@ import java.util.Collection;
public final class GeneralDDLIT extends BaseDDLIT {
public GeneralDDLIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final String databaseType, final SQLCaseType caseType,
final String sql) throws IOException, JAXBException, SQLException,
ParseException {
- super(parentPath, assertion, scenario,
DatabaseTypeRegistry.getActualDatabaseType(databaseType), caseType, sql);
+ final String databaseType, final SQLExecuteType
sqlExecuteType, final String sql) throws IOException, JAXBException,
SQLException, ParseException {
+ super(parentPath, assertion, scenario,
DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
}
@Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
- return
IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DDL);
+ return
ParameterizedArrayFactory.getAssertionParameterizedArray(SQLCommandType.DDL);
}
@SuppressWarnings("JUnitTestMethodWithNoAssertions")
@Test
public void assertExecuteUpdate() throws SQLException {
try (Connection connection = getTargetDataSource().getConnection()) {
- if (SQLCaseType.Literal == getCaseType()) {
+ if (SQLExecuteType.Literal == getSqlExecuteType()) {
connection.createStatement().executeUpdate(getSql());
} else {
connection.prepareStatement(getSql()).executeUpdate();
@@ -61,7 +61,7 @@ public final class GeneralDDLIT extends BaseDDLIT {
@Test
public void assertExecute() throws SQLException {
try (Connection connection = getTargetDataSource().getConnection()) {
- if (SQLCaseType.Literal == getCaseType()) {
+ if (SQLExecuteType.Literal == getSqlExecuteType()) {
connection.createStatement().execute(getSql());
} else {
connection.prepareStatement(getSql()).execute();
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 70fcdbd..bc36ec9 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
@@ -18,11 +18,11 @@
package org.apache.shardingsphere.test.integration.engine.it.dml;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseType;
+import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
import org.apache.shardingsphere.test.integration.cases.value.SQLValue;
-import
org.apache.shardingsphere.test.integration.engine.param.IntegrateTestParameters;
+import
org.apache.shardingsphere.test.integration.engine.param.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.env.IntegrateTestEnvironment;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
@@ -44,14 +44,14 @@ public final class AdditionalDMLIT extends BaseDMLIT {
private final IntegrateTestCaseAssertion assertion;
public AdditionalDMLIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final DatabaseType databaseType, final SQLCaseType
caseType, final String sql) throws IOException, JAXBException, SQLException,
ParseException {
- super(parentPath, assertion, scenario, databaseType, caseType, sql);
+ final DatabaseType databaseType, final
SQLExecuteType sqlExecuteType, final String sql) throws IOException,
JAXBException, SQLException, ParseException {
+ super(parentPath, assertion, scenario, databaseType, sqlExecuteType,
sql);
this.assertion = assertion;
}
@Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
- return
IntegrateTestEnvironment.getInstance().isRunAdditionalTestCases() ?
IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DML) :
Collections.emptyList();
+ return
IntegrateTestEnvironment.getInstance().isRunAdditionalTestCases() ?
ParameterizedArrayFactory.getAssertionParameterizedArray(SQLCommandType.DML) :
Collections.emptyList();
}
@Test
@@ -62,7 +62,8 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
int actualUpdateCount;
try (Connection connection = getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLCaseType.Literal == getCaseType() ?
executeUpdateForStatementWithAutoGeneratedKeys(connection) :
executeUpdateForPreparedStatementWithAutoGeneratedKeys(connection);
+ actualUpdateCount = SQLExecuteType.Literal == getSqlExecuteType()
+ ?
executeUpdateForStatementWithAutoGeneratedKeys(connection) :
executeUpdateForPreparedStatementWithAutoGeneratedKeys(connection);
}
assertDataSet(actualUpdateCount);
}
@@ -90,7 +91,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
int actualUpdateCount;
try (Connection connection = getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLCaseType.Literal == getCaseType() ?
executeUpdateForStatementWithColumnIndexes(connection) :
executeUpdateForPreparedStatementWithColumnIndexes(connection);
+ actualUpdateCount = SQLExecuteType.Literal == getSqlExecuteType()
? executeUpdateForStatementWithColumnIndexes(connection) :
executeUpdateForPreparedStatementWithColumnIndexes(connection);
}
assertDataSet(actualUpdateCount);
}
@@ -118,7 +119,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
int actualUpdateCount;
try (Connection connection = getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLCaseType.Literal == getCaseType() ?
executeUpdateForStatementWithColumnNames(connection) :
executeUpdateForPreparedStatementWithColumnNames(connection);
+ actualUpdateCount = SQLExecuteType.Literal == getSqlExecuteType()
? executeUpdateForStatementWithColumnNames(connection) :
executeUpdateForPreparedStatementWithColumnNames(connection);
}
assertDataSet(actualUpdateCount);
}
@@ -146,7 +147,8 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
int actualUpdateCount;
try (Connection connection = getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLCaseType.Literal == getCaseType() ?
executeForStatementWithoutAutoGeneratedKeys(connection) :
executeForPreparedStatementWithoutAutoGeneratedKeys(connection);
+ actualUpdateCount = SQLExecuteType.Literal == getSqlExecuteType()
+ ? executeForStatementWithoutAutoGeneratedKeys(connection)
: executeForPreparedStatementWithoutAutoGeneratedKeys(connection);
}
assertDataSet(actualUpdateCount);
}
@@ -176,7 +178,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
int actualUpdateCount;
try (Connection connection = getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLCaseType.Literal == getCaseType() ?
executeForStatementWithAutoGeneratedKeys(connection) :
executeForPreparedStatementWithAutoGeneratedKeys(connection);
+ actualUpdateCount = SQLExecuteType.Literal == getSqlExecuteType()
? executeForStatementWithAutoGeneratedKeys(connection) :
executeForPreparedStatementWithAutoGeneratedKeys(connection);
}
assertDataSet(actualUpdateCount);
}
@@ -208,7 +210,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
int actualUpdateCount;
try (Connection connection = getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLCaseType.Literal == getCaseType() ?
executeForStatementWithColumnIndexes(connection) :
executeForPreparedStatementWithColumnIndexes(connection);
+ actualUpdateCount = SQLExecuteType.Literal == getSqlExecuteType()
? executeForStatementWithColumnIndexes(connection) :
executeForPreparedStatementWithColumnIndexes(connection);
}
assertDataSet(actualUpdateCount);
}
@@ -238,7 +240,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
int actualUpdateCount;
try (Connection connection = getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLCaseType.Literal == getCaseType() ?
executeForStatementWithColumnNames(connection) :
executeForPreparedStatementWithColumnNames(connection);
+ actualUpdateCount = SQLExecuteType.Literal == getSqlExecuteType()
? executeForStatementWithColumnNames(connection) :
executeForPreparedStatementWithColumnNames(connection);
}
assertDataSet(actualUpdateCount);
}
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 b7ca7e8..d3191e9 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
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseT
import org.apache.shardingsphere.infra.datanode.DataNode;
import
org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineExpressionParser;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
import
org.apache.shardingsphere.test.integration.cases.dataset.metadata.DataSetColumn;
import
org.apache.shardingsphere.test.integration.cases.dataset.metadata.DataSetMetadata;
import org.apache.shardingsphere.test.integration.cases.dataset.row.DataSetRow;
@@ -57,8 +57,8 @@ public abstract class BaseDMLIT extends SingleIT {
private final DataSetEnvironmentManager dataSetEnvironmentManager;
protected BaseDMLIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final DatabaseType databaseType, final SQLCaseType
caseType, final String sql) throws IOException, JAXBException, SQLException,
ParseException {
- super(parentPath, assertion, scenario, databaseType, caseType, sql);
+ final DatabaseType databaseType, final SQLExecuteType
sqlExecuteType, final String sql) throws IOException, JAXBException,
SQLException, ParseException {
+ super(parentPath, assertion, 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 ea61e81..36206bb 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
@@ -18,12 +18,12 @@
package org.apache.shardingsphere.test.integration.engine.it.dml;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseType;
+import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import
org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseContext;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
import org.apache.shardingsphere.test.integration.cases.value.SQLValue;
import org.apache.shardingsphere.test.integration.engine.it.BatchIT;
-import
org.apache.shardingsphere.test.integration.engine.param.IntegrateTestParameters;
+import
org.apache.shardingsphere.test.integration.engine.param.ParameterizedArrayFactory;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
@@ -49,7 +49,7 @@ public final class BatchDMLIT extends BatchIT {
@Parameters(name = "{1} -> {2} -> {3}")
public static Collection<Object[]> getParameters() {
- return
IntegrateTestParameters.getParametersWithCase(IntegrateTestCaseType.DML);
+ return
ParameterizedArrayFactory.getCaseParameterizedArray(SQLCommandType.DML);
}
@Test
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 5b73188..20cbb00 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
@@ -18,11 +18,11 @@
package org.apache.shardingsphere.test.integration.engine.it.dml;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseType;
+import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
import org.apache.shardingsphere.test.integration.cases.value.SQLValue;
-import
org.apache.shardingsphere.test.integration.engine.param.IntegrateTestParameters;
+import
org.apache.shardingsphere.test.integration.engine.param.ParameterizedArrayFactory;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
@@ -42,14 +42,14 @@ public final class GeneralDMLIT extends BaseDMLIT {
private final IntegrateTestCaseAssertion assertion;
public GeneralDMLIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final String databaseType, final SQLCaseType caseType,
final String sql) throws IOException, JAXBException, SQLException,
ParseException {
- super(parentPath, assertion, scenario,
DatabaseTypeRegistry.getActualDatabaseType(databaseType), caseType, sql);
+ final String databaseType, final SQLExecuteType
sqlExecuteType, final String sql) throws IOException, JAXBException,
SQLException, ParseException {
+ super(parentPath, assertion, scenario,
DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
this.assertion = assertion;
}
@Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
- return
IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DML);
+ return
ParameterizedArrayFactory.getAssertionParameterizedArray(SQLCommandType.DML);
}
@Test
@@ -64,7 +64,7 @@ public final class GeneralDMLIT extends BaseDMLIT {
}
int actualUpdateCount;
try (Connection connection = getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLCaseType.Literal == getCaseType() ?
executeUpdateForStatement(connection) :
executeUpdateForPreparedStatement(connection);
+ actualUpdateCount = SQLExecuteType.Literal == getSqlExecuteType()
? executeUpdateForStatement(connection) :
executeUpdateForPreparedStatement(connection);
}
assertDataSet(actualUpdateCount);
}
@@ -96,7 +96,7 @@ public final class GeneralDMLIT extends BaseDMLIT {
}
int actualUpdateCount;
try (Connection connection = getTargetDataSource().getConnection()) {
- actualUpdateCount = SQLCaseType.Literal == getCaseType() ?
executeForStatement(connection) : executeForPreparedStatement(connection);
+ actualUpdateCount = SQLExecuteType.Literal == getSqlExecuteType()
? executeForStatement(connection) : executeForPreparedStatement(connection);
}
assertDataSet(actualUpdateCount);
}
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 213d4b5..076a41f 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
@@ -18,11 +18,11 @@
package org.apache.shardingsphere.test.integration.engine.it.dql;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseType;
+import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
import org.apache.shardingsphere.test.integration.cases.value.SQLValue;
-import
org.apache.shardingsphere.test.integration.engine.param.IntegrateTestParameters;
+import
org.apache.shardingsphere.test.integration.engine.param.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.env.IntegrateTestEnvironment;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
@@ -45,20 +45,20 @@ public final class AdditionalDQLIT extends BaseDQLIT {
private final IntegrateTestCaseAssertion assertion;
public AdditionalDQLIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final DatabaseType databaseType, final SQLCaseType
caseType, final String sql) throws IOException, JAXBException, SQLException,
ParseException {
- super(parentPath, assertion, scenario, databaseType, caseType, sql);
+ final DatabaseType databaseType, final
SQLExecuteType sqlExecuteType, final String sql) throws IOException,
JAXBException, SQLException, ParseException {
+ super(parentPath, assertion, scenario, databaseType, sqlExecuteType,
sql);
this.assertion = assertion;
}
@Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
- return
IntegrateTestEnvironment.getInstance().isRunAdditionalTestCases() ?
IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DQL) :
Collections.emptyList();
+ return
IntegrateTestEnvironment.getInstance().isRunAdditionalTestCases() ?
ParameterizedArrayFactory.getAssertionParameterizedArray(SQLCommandType.DQL) :
Collections.emptyList();
}
@Test
public void assertExecuteQueryWithResultSetTypeAndResultSetConcurrency()
throws SQLException, ParseException {
try (Connection connection = getTargetDataSource().getConnection()) {
- if (SQLCaseType.Literal == getCaseType()) {
+ if (SQLExecuteType.Literal == getSqlExecuteType()) {
assertExecuteQueryForStatementWithResultSetTypeAndResultSetConcurrency(connection);
} else {
assertExecuteQueryForPreparedStatementWithResultSetTypeAndResultSetConcurrency(connection);
@@ -88,7 +88,7 @@ public final class AdditionalDQLIT extends BaseDQLIT {
@Test
public void
assertExecuteQueryWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability()
throws SQLException, ParseException {
try (Connection connection = getTargetDataSource().getConnection()) {
- if (SQLCaseType.Literal == getCaseType()) {
+ if (SQLExecuteType.Literal == getSqlExecuteType()) {
assertExecuteQueryForStatementWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability(connection);
} else {
assertExecuteQueryForPreparedStatementWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability(connection);
@@ -120,7 +120,7 @@ public final class AdditionalDQLIT extends BaseDQLIT {
@Test
public void assertExecuteWithResultSetTypeAndResultSetConcurrency() throws
SQLException, ParseException {
try (Connection connection = getTargetDataSource().getConnection()) {
- if (SQLCaseType.Literal == getCaseType()) {
+ if (SQLExecuteType.Literal == getSqlExecuteType()) {
assertExecuteForStatementWithResultSetTypeAndResultSetConcurrency(connection);
} else {
assertExecuteForPreparedStatementWithResultSetTypeAndResultSetConcurrency(connection);
@@ -152,7 +152,7 @@ public final class AdditionalDQLIT extends BaseDQLIT {
@Test
public void
assertExecuteWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability()
throws SQLException, ParseException {
try (Connection connection = getTargetDataSource().getConnection()) {
- if (SQLCaseType.Literal == getCaseType()) {
+ if (SQLExecuteType.Literal == getSqlExecuteType()) {
assertExecuteForStatementWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability(connection);
} else {
assertExecuteForPreparedStatementWithResultSetTypeAndResultSetConcurrencyAndResultSetHoldability(connection);
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 053ac2d..85500cf 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
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.test.integration.engine.it.dql;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
import
org.apache.shardingsphere.test.integration.cases.dataset.metadata.DataSetColumn;
import
org.apache.shardingsphere.test.integration.cases.dataset.metadata.DataSetMetadata;
import org.apache.shardingsphere.test.integration.cases.dataset.row.DataSetRow;
@@ -51,8 +51,8 @@ import static org.junit.Assert.assertTrue;
public abstract class BaseDQLIT extends SingleIT {
protected BaseDQLIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final DatabaseType databaseType, final SQLCaseType
caseType, final String sql) throws IOException, JAXBException, SQLException,
ParseException {
- super(parentPath, assertion, scenario, databaseType, caseType, sql);
+ final DatabaseType databaseType, final SQLExecuteType
sqlExecuteType, final String sql) throws IOException, JAXBException,
SQLException, ParseException {
+ super(parentPath, assertion, 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 e8282c1..a8384c0 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
@@ -18,11 +18,11 @@
package org.apache.shardingsphere.test.integration.engine.it.dql;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseType;
+import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.engine.param.SQLCaseType;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
import org.apache.shardingsphere.test.integration.cases.value.SQLValue;
-import
org.apache.shardingsphere.test.integration.engine.param.IntegrateTestParameters;
+import
org.apache.shardingsphere.test.integration.engine.param.ParameterizedArrayFactory;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
@@ -43,20 +43,20 @@ public final class GeneralDQLIT extends BaseDQLIT {
private final IntegrateTestCaseAssertion assertion;
public GeneralDQLIT(final String parentPath, final
IntegrateTestCaseAssertion assertion, final String scenario,
- final String databaseType, final SQLCaseType caseType,
final String sql) throws IOException, JAXBException, SQLException,
ParseException {
- super(parentPath, assertion, scenario,
DatabaseTypeRegistry.getActualDatabaseType(databaseType), caseType, sql);
+ final String databaseType, final SQLExecuteType
sqlExecuteType, final String sql) throws IOException, JAXBException,
SQLException, ParseException {
+ super(parentPath, assertion, scenario,
DatabaseTypeRegistry.getActualDatabaseType(databaseType), sqlExecuteType, sql);
this.assertion = assertion;
}
@Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
- return
IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DQL);
+ return
ParameterizedArrayFactory.getAssertionParameterizedArray(SQLCommandType.DQL);
}
@Test
public void assertExecuteQuery() throws SQLException, ParseException {
try (Connection connection = getTargetDataSource().getConnection()) {
- if (SQLCaseType.Literal == getCaseType()) {
+ if (SQLExecuteType.Literal == getSqlExecuteType()) {
assertExecuteQueryForStatement(connection);
} else {
assertExecuteQueryForPreparedStatement(connection);
@@ -86,7 +86,7 @@ public final class GeneralDQLIT extends BaseDQLIT {
@Test
public void assertExecute() throws SQLException, ParseException {
try (Connection connection = getTargetDataSource().getConnection()) {
- if (SQLCaseType.Literal == getCaseType()) {
+ if (SQLExecuteType.Literal == getSqlExecuteType()) {
assertExecuteForStatement(connection);
} else {
assertExecuteForPreparedStatement(connection);
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/IntegrateTestParameters.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/IntegrateTestParameters.java
deleted file mode 100644
index 555a5d9..0000000
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/IntegrateTestParameters.java
+++ /dev/null
@@ -1,174 +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.engine.param;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseType;
-import
org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseContext;
-import
org.apache.shardingsphere.test.integration.cases.IntegrateTestCasesLoader;
-import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
-import org.apache.shardingsphere.test.integration.env.IntegrateTestEnvironment;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
-
-/**
- * Integrate test parameters.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-@Slf4j
-public final class IntegrateTestParameters {
-
- private static final IntegrateTestCasesLoader INTEGRATE_TEST_CASES_LOADER
= IntegrateTestCasesLoader.getInstance();
-
- private static final IntegrateTestEnvironment INTEGRATE_TEST_ENVIRONMENT =
IntegrateTestEnvironment.getInstance();
-
- /**
- * Get parameters with assertions.
- *
- * @param caseType integrate test case type
- * @return integrate test parameters
- */
- public static Collection<Object[]> getParametersWithAssertion(final
IntegrateTestCaseType caseType) {
- Map<DatabaseType, Collection<Object[]>> availableCases = new
LinkedHashMap<>();
- Map<DatabaseType, Collection<Object[]>> disabledCases = new
LinkedHashMap<>();
-
INTEGRATE_TEST_CASES_LOADER.getTestCaseContexts(caseType).forEach(testCaseContext
->
getDatabaseTypes(testCaseContext.getTestCase().getDbTypes()).forEach(databaseType
-> {
- if
(IntegrateTestEnvironment.getInstance().getDatabaseEnvironments().containsKey(databaseType))
{
- availableCases.putIfAbsent(databaseType, new LinkedList<>());
- Arrays.stream(
- SQLCaseType.values()).forEach(sqlCaseType ->
availableCases.get(databaseType).addAll(getParametersWithAssertion(databaseType,
sqlCaseType, testCaseContext)));
- } else {
- disabledCases.putIfAbsent(databaseType, new LinkedList<>());
- Arrays.stream(
- SQLCaseType.values()).forEach(sqlCaseType ->
disabledCases.get(databaseType).addAll(getParametersWithAssertion(databaseType,
sqlCaseType, testCaseContext)));
- }
- }));
- printTestPlan(availableCases, disabledCases,
calculateRunnableTestAnnotation());
- return
availableCases.values().stream().flatMap(Collection::stream).collect(Collectors.toList());
- }
-
- private static Collection<Object[]> getParametersWithAssertion(final
DatabaseType databaseType, final SQLCaseType caseType, final
IntegrateTestCaseContext testCaseContext) {
- Collection<Object[]> result = new LinkedList<>();
- if (testCaseContext.getTestCase().getAssertions().isEmpty()) {
- result.addAll(getParametersWithAssertion(testCaseContext, null,
databaseType, caseType));
- return result;
- }
- for (IntegrateTestCaseAssertion each :
testCaseContext.getTestCase().getAssertions()) {
- result.addAll(getParametersWithAssertion(testCaseContext, each,
databaseType, caseType));
- }
- return result;
- }
-
- private static Collection<Object[]> getParametersWithAssertion(final
IntegrateTestCaseContext testCaseContext,
- final
IntegrateTestCaseAssertion assertion, final DatabaseType databaseType, final
SQLCaseType caseType) {
- Collection<Object[]> result = new LinkedList<>();
- for (String each : INTEGRATE_TEST_ENVIRONMENT.getScenarios()) {
- Object[] data = new Object[6];
- data[0] = testCaseContext.getParentPath();
- data[1] = assertion;
- data[2] = each;
- data[3] = databaseType.getName();
- data[4] = caseType;
- data[5] = testCaseContext.getTestCase().getSql();
- result.add(data);
- }
- return result;
- }
-
- /**
- * Get parameters with test cases.
- *
- * @param caseType integrate test case type
- * @return integrate test parameters
- */
- public static Collection<Object[]> getParametersWithCase(final
IntegrateTestCaseType caseType) {
- Map<DatabaseType, Collection<Object[]>> availableCases = new
LinkedHashMap<>();
- Map<DatabaseType, Collection<Object[]>> disabledCases = new
LinkedHashMap<>();
-
INTEGRATE_TEST_CASES_LOADER.getTestCaseContexts(caseType).forEach(testCaseContext
->
getDatabaseTypes(testCaseContext.getTestCase().getDbTypes()).forEach(databaseType
-> {
- if
(IntegrateTestEnvironment.getInstance().getDatabaseEnvironments().containsKey(databaseType))
{
- availableCases.putIfAbsent(databaseType, new LinkedList<>());
-
availableCases.get(databaseType).addAll(getParametersWithCase(databaseType,
testCaseContext));
- } else {
- disabledCases.putIfAbsent(databaseType, new LinkedList<>());
-
disabledCases.get(databaseType).addAll(getParametersWithCase(databaseType,
testCaseContext));
- }
- }));
- printTestPlan(availableCases, disabledCases,
calculateRunnableTestAnnotation());
- return
availableCases.values().stream().flatMap(Collection::stream).collect(Collectors.toList());
- }
-
- private static Collection<Object[]> getParametersWithCase(final
DatabaseType databaseType, final IntegrateTestCaseContext testCaseContext) {
- Collection<Object[]> result = new LinkedList<>();
- for (String each : INTEGRATE_TEST_ENVIRONMENT.getScenarios()) {
- Object[] data = new Object[4];
- data[0] = testCaseContext;
- data[1] = each;
- data[2] = databaseType.getName();
- data[3] = testCaseContext.getTestCase().getSql();
- result.add(data);
- }
- return result;
- }
-
- private static Collection<DatabaseType> getDatabaseTypes(final String
databaseTypes) {
- String candidates = Strings.isNullOrEmpty(databaseTypes) ?
"H2,MySQL,Oracle,SQLServer,PostgreSQL" : databaseTypes;
- return
Splitter.on(',').trimResults().splitToList(candidates).stream().map(DatabaseTypeRegistry::getActualDatabaseType).collect(Collectors.toList());
- }
-
- private static void printTestPlan(final Map<DatabaseType,
Collection<Object[]>> availableCases, final Map<DatabaseType,
Collection<Object[]>> disabledCases, final long factor) {
- Collection<String> activePlan = new LinkedList<>();
- for (Entry<DatabaseType, Collection<Object[]>> entry :
availableCases.entrySet()) {
- activePlan.add(String.format("%s(%s)", entry.getKey().getName(),
entry.getValue().size() * factor));
- }
- Collection<String> disabledPlan = new LinkedList<>();
- for (Entry<DatabaseType, Collection<Object[]>> entry :
disabledCases.entrySet()) {
- disabledPlan.add(String.format("%s(%s)", entry.getKey().getName(),
entry.getValue().size() * factor));
- }
- log.info("[INFO] ======= Test Plan =======");
- String summary = String.format("[%s] Total: %s, Active: %s, Disabled:
%s %s",
- disabledPlan.isEmpty() ? "INFO" : "WARN",
-
(availableCases.values().stream().mapToLong(Collection::size).sum() +
disabledCases.values().stream().mapToLong(Collection::size).sum()) * factor,
- activePlan.isEmpty() ? 0 : Joiner.on(", ").join(activePlan),
disabledPlan.isEmpty() ? 0 : Joiner.on(", ").join(disabledPlan),
System.lineSeparator());
- log.info(summary);
- }
-
- @SneakyThrows(ReflectiveOperationException.class)
- private static long calculateRunnableTestAnnotation() {
- long result = 0;
- StackTraceElement[] stackTraceElements =
Thread.currentThread().getStackTrace();
- for (int i = 3; i < stackTraceElements.length; i++) {
- Class<?> callerClazz =
Class.forName(stackTraceElements[i].getClassName());
- result += Arrays.stream(callerClazz.getMethods()).filter(method ->
method.isAnnotationPresent(Test.class)).count();
- }
- return result;
- }
-}
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
new file mode 100644
index 0000000..bb9afe5
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/ParameterizedArrayFactory.java
@@ -0,0 +1,182 @@
+/*
+ * 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.engine.param;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
+import
org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseContext;
+import
org.apache.shardingsphere.test.integration.cases.IntegrateTestCasesLoader;
+import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
+import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
+import
org.apache.shardingsphere.test.integration.engine.param.domain.AssertionParameterizedArray;
+import
org.apache.shardingsphere.test.integration.engine.param.domain.CaseParameterizedArray;
+import
org.apache.shardingsphere.test.integration.engine.param.domain.ParameterizedArray;
+import org.apache.shardingsphere.test.integration.env.IntegrateTestEnvironment;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
+
+/**
+ * Parameterized array factory.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+@Slf4j
+public final class ParameterizedArrayFactory {
+
+ private static final IntegrateTestCasesLoader INTEGRATE_TEST_CASES_LOADER
= IntegrateTestCasesLoader.getInstance();
+
+ private static final IntegrateTestEnvironment INTEGRATE_TEST_ENVIRONMENT =
IntegrateTestEnvironment.getInstance();
+
+ /**
+ * Get assertion parameterized array.
+ *
+ * @param sqlCommandType SQL command type
+ * @return assertion parameterized array
+ */
+ public static Collection<Object[]> getAssertionParameterizedArray(final
SQLCommandType sqlCommandType) {
+ Map<DatabaseType, Collection<ParameterizedArray>> assertionParameters
= new LinkedHashMap<>(10, 1);
+ for (IntegrateTestCaseContext each :
INTEGRATE_TEST_CASES_LOADER.getTestCaseContexts(sqlCommandType)) {
+ Map<DatabaseType, Collection<ParameterizedArray>>
eachAssertionParameters = getAssertionParameterizedArray(each);
+ for (Entry<DatabaseType, Collection<ParameterizedArray>> entry :
eachAssertionParameters.entrySet()) {
+ assertionParameters.putIfAbsent(entry.getKey(), new
LinkedList<>());
+
assertionParameters.get(entry.getKey()).addAll(entry.getValue());
+ }
+ }
+ Map<DatabaseType, Collection<ParameterizedArray>>
availableAssertionParameters = new LinkedHashMap<>(assertionParameters.size(),
1);
+ Map<DatabaseType, Collection<ParameterizedArray>>
disabledAssertionParameters = new LinkedHashMap<>(assertionParameters.size(),
1);
+ for (Entry<DatabaseType, Collection<ParameterizedArray>> entry :
assertionParameters.entrySet()) {
+ if
(IntegrateTestEnvironment.getInstance().getDatabaseEnvironments().containsKey(entry.getKey()))
{
+ availableAssertionParameters.put(entry.getKey(),
entry.getValue());
+ } else {
+ disabledAssertionParameters.put(entry.getKey(),
entry.getValue());
+ }
+ }
+ printTestPlan(availableAssertionParameters,
disabledAssertionParameters, calculateRunnableTestAnnotation());
+ return
availableAssertionParameters.values().stream().flatMap(Collection::stream).map(ParameterizedArray::toArrays).collect(Collectors.toList());
+ }
+
+ private static Map<DatabaseType, Collection<ParameterizedArray>>
getAssertionParameterizedArray(final IntegrateTestCaseContext testCaseContext) {
+ Collection<DatabaseType> databaseTypes =
getDatabaseTypes(testCaseContext.getTestCase().getDbTypes());
+ Map<DatabaseType, Collection<ParameterizedArray>> result = new
HashMap<>(databaseTypes.size(), 1);
+ for (DatabaseType each : databaseTypes) {
+ result.putIfAbsent(each, new LinkedList<>());
+
result.get(each).addAll(getAssertionParameterizedArray(testCaseContext, each));
+ }
+ return result;
+ }
+
+ private static Collection<ParameterizedArray>
getAssertionParameterizedArray(final IntegrateTestCaseContext testCaseContext,
final DatabaseType databaseType) {
+ Collection<ParameterizedArray> result = new LinkedList<>();
+ for (SQLExecuteType each : SQLExecuteType.values()) {
+ result.addAll(getAssertionParameterizedArray(testCaseContext,
databaseType, each));
+ }
+ return result;
+ }
+
+ private static Collection<ParameterizedArray>
getAssertionParameterizedArray(final IntegrateTestCaseContext testCaseContext,
final DatabaseType databaseType, final SQLExecuteType sqlExecuteType) {
+ Collection<ParameterizedArray> result = new LinkedList<>();
+ if (testCaseContext.getTestCase().getAssertions().isEmpty()) {
+ result.addAll(getAssertionParameterizedArray(testCaseContext,
null, databaseType, sqlExecuteType));
+ return result;
+ }
+ for (IntegrateTestCaseAssertion each :
testCaseContext.getTestCase().getAssertions()) {
+ result.addAll(getAssertionParameterizedArray(testCaseContext,
each, databaseType, sqlExecuteType));
+ }
+ 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());
+ }
+
+ /**
+ * Get case parameterized array.
+ *
+ * @param sqlCommandType SQL command type
+ * @return case parameterized array
+ */
+ public static Collection<Object[]> getCaseParameterizedArray(final
SQLCommandType sqlCommandType) {
+ Map<DatabaseType, Collection<ParameterizedArray>> availableCases = new
LinkedHashMap<>();
+ Map<DatabaseType, Collection<ParameterizedArray>> disabledCases = new
LinkedHashMap<>();
+
INTEGRATE_TEST_CASES_LOADER.getTestCaseContexts(sqlCommandType).forEach(testCaseContext
->
getDatabaseTypes(testCaseContext.getTestCase().getDbTypes()).forEach(databaseType
-> {
+ if
(IntegrateTestEnvironment.getInstance().getDatabaseEnvironments().containsKey(databaseType))
{
+ availableCases.putIfAbsent(databaseType, new LinkedList<>());
+
availableCases.get(databaseType).addAll(getCaseParameterizedArray(databaseType,
testCaseContext));
+ } else {
+ disabledCases.putIfAbsent(databaseType, new LinkedList<>());
+
disabledCases.get(databaseType).addAll(getCaseParameterizedArray(databaseType,
testCaseContext));
+ }
+ }));
+ printTestPlan(availableCases, disabledCases,
calculateRunnableTestAnnotation());
+ return
availableCases.values().stream().flatMap(Collection::stream).map(ParameterizedArray::toArrays).collect(Collectors.toList());
+ }
+
+ private static Collection<ParameterizedArray>
getCaseParameterizedArray(final DatabaseType databaseType, final
IntegrateTestCaseContext testCaseContext) {
+ return INTEGRATE_TEST_ENVIRONMENT.getScenarios().stream().map(each ->
new CaseParameterizedArray(testCaseContext, each,
databaseType)).collect(Collectors.toList());
+ }
+
+ private static Collection<DatabaseType> getDatabaseTypes(final String
databaseTypes) {
+ String candidates = Strings.isNullOrEmpty(databaseTypes) ?
"H2,MySQL,Oracle,SQLServer,PostgreSQL" : databaseTypes;
+ return
Splitter.on(',').trimResults().splitToList(candidates).stream().map(DatabaseTypeRegistry::getActualDatabaseType).collect(Collectors.toList());
+ }
+
+ private static void printTestPlan(final Map<DatabaseType,
+ Collection<ParameterizedArray>> availableCaseParameters, final
Map<DatabaseType, Collection<ParameterizedArray>> disabledCaseParameters, final
long factor) {
+ Collection<String> activePlan = new LinkedList<>();
+ for (Entry<DatabaseType, Collection<ParameterizedArray>> entry :
availableCaseParameters.entrySet()) {
+ activePlan.add(String.format("%s(%s)", entry.getKey().getName(),
entry.getValue().size() * factor));
+ }
+ Collection<String> disabledPlan = new LinkedList<>();
+ for (Entry<DatabaseType, Collection<ParameterizedArray>> entry :
disabledCaseParameters.entrySet()) {
+ disabledPlan.add(String.format("%s(%s)", entry.getKey().getName(),
entry.getValue().size() * factor));
+ }
+ log.info("[INFO] ======= Test Plan =======");
+ String summary = String.format("[%s] Total: %s, Active: %s, Disabled:
%s %s",
+ disabledPlan.isEmpty() ? "INFO" : "WARN",
+
(availableCaseParameters.values().stream().mapToLong(Collection::size).sum() +
disabledCaseParameters.values().stream().mapToLong(Collection::size).sum()) *
factor,
+ activePlan.isEmpty() ? 0 : Joiner.on(", ").join(activePlan),
disabledPlan.isEmpty() ? 0 : Joiner.on(", ").join(disabledPlan),
System.lineSeparator());
+ log.info(summary);
+ }
+
+ @SneakyThrows(ReflectiveOperationException.class)
+ private static long calculateRunnableTestAnnotation() {
+ long result = 0;
+ StackTraceElement[] stackTraceElements =
Thread.currentThread().getStackTrace();
+ for (int i = 3; i < stackTraceElements.length; i++) {
+ Class<?> callerClazz =
Class.forName(stackTraceElements[i].getClassName());
+ result += Arrays.stream(callerClazz.getMethods()).filter(method ->
method.isAnnotationPresent(Test.class)).count();
+ }
+ return result;
+ }
+}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/SQLCaseType.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/SQLExecuteType.java
similarity index 94%
copy from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/SQLCaseType.java
copy to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/SQLExecuteType.java
index aa16154..5aa2f58 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/SQLCaseType.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/SQLExecuteType.java
@@ -18,9 +18,9 @@
package org.apache.shardingsphere.test.integration.engine.param;
/**
- * SQL case type.
+ * SQL execute type.
*/
-public enum SQLCaseType {
+public enum SQLExecuteType {
Literal, Placeholder
}
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
new file mode 100644
index 0000000..8d48638
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/AssertionParameterizedArray.java
@@ -0,0 +1,53 @@
+/*
+ * 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.engine.param.domain;
+
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseContext;
+import
org.apache.shardingsphere.test.integration.cases.assertion.IntegrateTestCaseAssertion;
+import org.apache.shardingsphere.test.integration.engine.param.SQLExecuteType;
+
+/**
+ * Parameterized array of assertion based integrate test.
+ */
+@RequiredArgsConstructor
+public final class AssertionParameterizedArray implements ParameterizedArray {
+
+ private final IntegrateTestCaseContext testCaseContext;
+
+ private final IntegrateTestCaseAssertion assertion;
+
+ private final String scenario;
+
+ private final DatabaseType databaseType;
+
+ private final SQLExecuteType sqlExecuteType;
+
+ @Override
+ public Object[] toArrays() {
+ Object[] result = new Object[6];
+ result[0] = testCaseContext.getParentPath();
+ result[1] = assertion;
+ result[2] = scenario;
+ result[3] = databaseType.getName();
+ result[4] = sqlExecuteType;
+ result[5] = 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
new file mode 100644
index 0000000..fa4ef51
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/CaseParameterizedArray.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.engine.param.domain;
+
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.test.integration.cases.IntegrateTestCaseContext;
+
+/**
+ * Parameterized array of case based integrate test.
+ */
+@RequiredArgsConstructor
+public final class CaseParameterizedArray implements ParameterizedArray {
+
+ private final IntegrateTestCaseContext testCaseContext;
+
+ private final String scenario;
+
+ private final DatabaseType databaseType;
+
+ @Override
+ public Object[] toArrays() {
+ Object[] result = new Object[4];
+ result[0] = testCaseContext;
+ result[1] = scenario;
+ result[2] = databaseType.getName();
+ result[3] = 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/SQLCaseType.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/ParameterizedArray.java
similarity index 76%
rename from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/SQLCaseType.java
rename to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/ParameterizedArray.java
index aa16154..64d96bf 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/SQLCaseType.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/domain/ParameterizedArray.java
@@ -15,12 +15,17 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.engine.param;
+package org.apache.shardingsphere.test.integration.engine.param.domain;
/**
- * SQL case type.
+ * Parameterized array.
*/
-public enum SQLCaseType {
+public interface ParameterizedArray {
- Literal, Placeholder
+ /**
+ * To parameterized arrays.
+ *
+ * @return parameterized arrays
+ */
+ Object[] toArrays();
}