You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/09/14 14:34:48 UTC
[shardingsphere] branch master updated: refactor parallel executor framework for junit (#20910)
This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 541a528a6e3 refactor parallel executor framework for junit (#20910)
541a528a6e3 is described below
commit 541a528a6e3df47fb74adc253e372abe544db5d2
Author: tianhao960 <ti...@users.noreply.github.com>
AuthorDate: Wed Sep 14 22:34:40 2022 +0800
refactor parallel executor framework for junit (#20910)
* add support for test parallel run
* refactor parallel test framework #2
* refactor parallel test framework #3
* refactor parallel test framework #4
* refactor parallel test framework #5
* refactor parallel test framework #7
---
.../parser/mysql/MySQLParserParameterizedTest.java | 4 +-
.../UnsupportedMySQLParserParameterizedTest.java | 4 +-
.../OpenGaussParserParameterizedTest.java | 4 +-
...nsupportedOpenGaussParserParameterizedTest.java | 4 +-
.../oracle/OracleParserParameterizedTest.java | 4 +-
.../UnsupportedOracleParserParameterizedTest.java | 4 +-
.../PostgreSQLParserParameterizedTest.java | 4 +-
...supportedPostgreSQLParserParameterizedTest.java | 4 +-
.../parser/sql92/SQL92ParserParameterizedTest.java | 4 +-
.../UnsupportedSQL92ParserParameterizedTest.java | 4 +-
.../SQLServerParserParameterizedTest.java | 4 +-
...nsupportedSQLServerParserParameterizedTest.java | 4 +-
.../shardingsphere-integration-test-suite/pom.xml | 7 ++
.../test/integration/engine/dal/GeneralDALIT.java | 4 +-
.../test/integration/engine/dcl/GeneralDCLIT.java | 4 +-
.../test/integration/engine/ddl/GeneralDDLIT.java | 4 +-
.../integration/engine/dml/AdditionalDMLIT.java | 4 +-
.../test/integration/engine/dml/BatchDMLIT.java | 4 +-
.../test/integration/engine/dml/GeneralDMLIT.java | 4 +-
.../integration/engine/dql/AdditionalDQLIT.java | 4 +-
.../test/integration/engine/dql/GeneralDQLIT.java | 4 +-
.../test/integration/engine/ral/GeneralRALIT.java | 4 +-
.../test/integration/engine/rdl/GeneralRDLIT.java | 4 +-
.../test/integration/engine/rql/GeneralRQLIT.java | 4 +-
...ShardingSphereIntegrationTestParameterized.java | 7 +-
...DatabaseTypeParallelRunnerExecutorFactory.java} | 43 ++-------
...a => ParameterizedParallelRunnerScheduler.java} | 25 ++---
.../parallel/impl/CaseParallelRunnerExecutor.java | 28 +-----
.../impl/ScenarioParallelRunnerExecutor.java | 51 +++--------
.../shardingsphere-parser-test/pom.xml | 6 +-
.../shardingsphere-test-common/pom.xml | 5 +
.../ShardingSphereParallelTestParameterized.java | 39 ++++++++
.../DefaultParallelRunnerExecutorFactory.java | 89 ++++++++++++++++++
.../test/runner/parallel/ParallelRunner.java} | 27 +++---
.../runner/parallel/ParallelRunnerExecutor.java | 17 ++--
.../parallel/ParallelRunnerExecutorFactory.java | 52 +++++++++++
.../runner/parallel/ParallelRunnerScheduler.java | 18 ++--
.../runner/parallel/annotaion/ParallelLevel.java | 4 +-
.../annotaion/ParallelRuntimeStrategy.java | 2 +-
.../impl/DefaultParallelRunnerExecutor.java | 101 +++++++++++++++++++++
40 files changed, 420 insertions(+), 193 deletions(-)
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/test/java/org/apache/shardingsphere/sql/parser/mysql/MySQLParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/test/java/org/apache/shardingsphere/sql/parser/mysql/MySQLParserParameterizedTest.java
index 36f18d68749..82649441193 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/test/java/org/apache/shardingsphere/sql/parser/mysql/MySQLParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/test/java/org/apache/shardingsphere/sql/parser/mysql/MySQLParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.mysql;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.SQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class MySQLParserParameterizedTest extends SQLParserParameterizedTest {
public MySQLParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/test/java/org/apache/shardingsphere/sql/parser/mysql/UnsupportedMySQLParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/test/java/org/apache/shardingsphere/sql/parser/mysql/UnsupportedMySQLParserParameterizedTest.java
index 19f5fbb28c7..40c94c9e662 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/test/java/org/apache/shardingsphere/sql/parser/mysql/UnsupportedMySQLParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/test/java/org/apache/shardingsphere/sql/parser/mysql/UnsupportedMySQLParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.mysql;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.UnsupportedSQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class UnsupportedMySQLParserParameterizedTest extends UnsupportedSQLParserParameterizedTest {
public UnsupportedMySQLParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/test/java/org/apache/shardingsphere/sql/parser/opengauss/OpenGaussParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/test/java/org/apache/shardingsphere/sql/parser/opengauss/OpenGaussParserParameterizedTest.java
index d7b12144648..cbda131bc7a 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/test/java/org/apache/shardingsphere/sql/parser/opengauss/OpenGaussParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/test/java/org/apache/shardingsphere/sql/parser/opengauss/OpenGaussParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.opengauss;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.SQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class OpenGaussParserParameterizedTest extends SQLParserParameterizedTest {
public OpenGaussParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/test/java/org/apache/shardingsphere/sql/parser/opengauss/UnsupportedOpenGaussParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/test/java/org/apache/shardingsphere/sql/parser/opengauss/UnsupportedOpenGaussParserParameterizedTest.java
index e0ccb00055c..23f64773a9a 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/test/java/org/apache/shardingsphere/sql/parser/opengauss/UnsupportedOpenGaussParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/test/java/org/apache/shardingsphere/sql/parser/opengauss/UnsupportedOpenGaussParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.opengauss;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.UnsupportedSQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class UnsupportedOpenGaussParserParameterizedTest extends UnsupportedSQLParserParameterizedTest {
public UnsupportedOpenGaussParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/test/java/org/apache/shardingsphere/sql/parser/oracle/OracleParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/test/java/org/apache/shardingsphere/sql/parser/oracle/OracleParserParameterizedTest.java
index b1ed7bb71e1..c9b0f572086 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/test/java/org/apache/shardingsphere/sql/parser/oracle/OracleParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/test/java/org/apache/shardingsphere/sql/parser/oracle/OracleParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.oracle;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.SQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class OracleParserParameterizedTest extends SQLParserParameterizedTest {
public OracleParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/test/java/org/apache/shardingsphere/sql/parser/oracle/UnsupportedOracleParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/test/java/org/apache/shardingsphere/sql/parser/oracle/UnsupportedOracleParserParameterizedTest.java
index a091131fb32..0311e5321e3 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/test/java/org/apache/shardingsphere/sql/parser/oracle/UnsupportedOracleParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/test/java/org/apache/shardingsphere/sql/parser/oracle/UnsupportedOracleParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.oracle;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.UnsupportedSQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class UnsupportedOracleParserParameterizedTest extends UnsupportedSQLParserParameterizedTest {
public UnsupportedOracleParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/test/java/org/apache/shardingsphere/sql/parser/postgresql/PostgreSQLParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/test/java/org/apache/shardingsphere/sql/parser/postgresql/PostgreSQLParserParameterizedTest.java
index acc5c42ae87..f13037e52da 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/test/java/org/apache/shardingsphere/sql/parser/postgresql/PostgreSQLParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/test/java/org/apache/shardingsphere/sql/parser/postgresql/PostgreSQLParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.postgresql;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.SQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class PostgreSQLParserParameterizedTest extends SQLParserParameterizedTest {
public PostgreSQLParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/test/java/org/apache/shardingsphere/sql/parser/postgresql/UnsupportedPostgreSQLParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/test/java/org/apache/shardingsphere/sql/parser/postgresql/UnsupportedPostgreSQLParserParameterizedTest.java
index 6145f4d5cea..1eb910d9856 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/test/java/org/apache/shardingsphere/sql/parser/postgresql/UnsupportedPostgreSQLParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/test/java/org/apache/shardingsphere/sql/parser/postgresql/UnsupportedPostgreSQLParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.postgresql;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.UnsupportedSQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class UnsupportedPostgreSQLParserParameterizedTest extends UnsupportedSQLParserParameterizedTest {
public UnsupportedPostgreSQLParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/test/java/org/apache/shardingsphere/sql/parser/sql92/SQL92ParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/test/java/org/apache/shardingsphere/sql/parser/sql92/SQL92ParserParameterizedTest.java
index 826e7835bc3..1f1bcf79614 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/test/java/org/apache/shardingsphere/sql/parser/sql92/SQL92ParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/test/java/org/apache/shardingsphere/sql/parser/sql92/SQL92ParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.sql92;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.SQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class SQL92ParserParameterizedTest extends SQLParserParameterizedTest {
public SQL92ParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/test/java/org/apache/shardingsphere/sql/parser/sql92/UnsupportedSQL92ParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/test/java/org/apache/shardingsphere/sql/parser/sql92/UnsupportedSQL92ParserParameterizedTest.java
index 6fb181ced7d..9ee80cec1aa 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/test/java/org/apache/shardingsphere/sql/parser/sql92/UnsupportedSQL92ParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/test/java/org/apache/shardingsphere/sql/parser/sql92/UnsupportedSQL92ParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.sql92;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.UnsupportedSQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class UnsupportedSQL92ParserParameterizedTest extends UnsupportedSQLParserParameterizedTest {
public UnsupportedSQL92ParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/test/java/org/apache/shardingsphere/sql/parser/sqlserver/SQLServerParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/test/java/org/apache/shardingsphere/sql/parser/sqlserver/SQLServerParserParameterizedTest.java
index 1408f6a308a..4a2cdadb7dc 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/test/java/org/apache/shardingsphere/sql/parser/sqlserver/SQLServerParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/test/java/org/apache/shardingsphere/sql/parser/sqlserver/SQLServerParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.sqlserver;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.SQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class SQLServerParserParameterizedTest extends SQLParserParameterizedTest {
public SQLServerParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/test/java/org/apache/shardingsphere/sql/parser/sqlserver/UnsupportedSQLServerParserParameterizedTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/test/java/org/apache/shardingsphere/sql/parser/sqlserver/UnsupportedSQLServerParserParameterizedTest.java
index f21ee353ed7..6461165d7ce 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/test/java/org/apache/shardingsphere/sql/parser/sqlserver/UnsupportedSQLServerParserParameterizedTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/test/java/org/apache/shardingsphere/sql/parser/sqlserver/UnsupportedSQLServerParserParameterizedTest.java
@@ -17,15 +17,15 @@
package org.apache.shardingsphere.sql.parser.sqlserver;
+import org.apache.shardingsphere.test.runner.ShardingSphereParallelTestParameterized;
import org.apache.shardingsphere.test.sql.parser.parameterized.engine.UnsupportedSQLParserParameterizedTest;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.sql.SQLCaseType;
import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Collection;
-@RunWith(Parameterized.class)
+@RunWith(ShardingSphereParallelTestParameterized.class)
public final class UnsupportedSQLServerParserParameterizedTest extends UnsupportedSQLParserParameterizedTest {
public UnsupportedSQLServerParserParameterizedTest(final String sqlCaseId, final String databaseType, final SQLCaseType sqlCaseType) {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml
index bf7e64def16..afcdfb28c41 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml
@@ -61,6 +61,13 @@
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-common</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dal/GeneralDALIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dal/GeneralDALIT.java
index cdf4ee441ca..5bb9cd625e6 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dal/GeneralDALIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dal/GeneralDALIT.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.test.integration.engine.dal;
import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java
index fe55d679377..3a8aaa0183a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java
@@ -21,8 +21,8 @@ import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import org.apache.shardingsphere.test.integration.cases.SQLExecuteType;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
index f8bb5f03c50..d3d22b87992 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
@@ -21,8 +21,8 @@ import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import org.apache.shardingsphere.test.integration.cases.SQLExecuteType;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
index da66b3fdba5..fe06b269209 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
@@ -23,8 +23,8 @@ import org.apache.shardingsphere.test.integration.cases.value.SQLValue;
import org.apache.shardingsphere.test.integration.env.runtime.IntegrationTestEnvironment;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java
index c1376c20744..a3253838603 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java
@@ -24,8 +24,8 @@ import org.apache.shardingsphere.test.integration.engine.BatchITCase;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.CaseParameterizedArray;
import org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java
index 96263435aff..8feab566254 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java
@@ -22,8 +22,8 @@ import org.apache.shardingsphere.test.integration.cases.SQLExecuteType;
import org.apache.shardingsphere.test.integration.cases.value.SQLValue;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java
index 4c5d4d47b49..38e82560960 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java
@@ -23,8 +23,8 @@ import org.apache.shardingsphere.test.integration.cases.value.SQLValue;
import org.apache.shardingsphere.test.integration.env.runtime.IntegrationTestEnvironment;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java
index 062151f4f5f..d6547864f85 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java
@@ -22,8 +22,8 @@ import org.apache.shardingsphere.test.integration.cases.SQLExecuteType;
import org.apache.shardingsphere.test.integration.cases.value.SQLValue;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ral/GeneralRALIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ral/GeneralRALIT.java
index f0ddad5264b..08d2da449c8 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ral/GeneralRALIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ral/GeneralRALIT.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.test.integration.engine.ral;
import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/rdl/GeneralRDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/rdl/GeneralRDLIT.java
index b4666049e8d..568f2d65681 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/rdl/GeneralRDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/rdl/GeneralRDLIT.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.test.integration.engine.rdl;
import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/rql/GeneralRQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/rql/GeneralRQLIT.java
index 7d51dd0b0f1..0d0482d3736 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/rql/GeneralRQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/rql/GeneralRQLIT.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.test.integration.engine.rql;
import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
import org.apache.shardingsphere.test.integration.framework.param.array.ParameterizedArrayFactory;
import org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/ShardingSphereIntegrationTestParameterized.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/ShardingSphereIntegrationTestParameterized.java
index 9b077995162..d38bfa7f88e 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/ShardingSphereIntegrationTestParameterized.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/ShardingSphereIntegrationTestParameterized.java
@@ -19,8 +19,9 @@ package org.apache.shardingsphere.test.integration.framework.runner;
import org.apache.shardingsphere.test.integration.env.runtime.IntegrationTestEnvironment;
import org.apache.shardingsphere.test.integration.env.runtime.cluster.ClusterEnvironment;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.ParallelRunnerScheduler;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.apache.shardingsphere.test.integration.framework.runner.parallel.DatabaseTypeParallelRunnerExecutorFactory;
+import org.apache.shardingsphere.test.integration.framework.runner.parallel.ParameterizedParallelRunnerScheduler;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
import org.junit.runners.Parameterized;
/**
@@ -35,7 +36,7 @@ public final class ShardingSphereIntegrationTestParameterized extends Parameteri
if (ClusterEnvironment.Type.DOCKER != IntegrationTestEnvironment.getInstance().getClusterEnvironment().getType()) {
ParallelRuntimeStrategy parallelRuntimeStrategy = clazz.getAnnotation(ParallelRuntimeStrategy.class);
if (null != parallelRuntimeStrategy) {
- setScheduler(new ParallelRunnerScheduler(parallelRuntimeStrategy.value()));
+ setScheduler(new ParameterizedParallelRunnerScheduler(parallelRuntimeStrategy.value(), new DatabaseTypeParallelRunnerExecutorFactory()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerExecutorFactory.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/DatabaseTypeParallelRunnerExecutorFactory.java
similarity index 53%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerExecutorFactory.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/DatabaseTypeParallelRunnerExecutorFactory.java
index 02e4c11a966..204ae839484 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerExecutorFactory.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/DatabaseTypeParallelRunnerExecutorFactory.java
@@ -18,40 +18,19 @@
package org.apache.shardingsphere.test.integration.framework.runner.parallel;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
import org.apache.shardingsphere.test.integration.framework.runner.parallel.impl.CaseParallelRunnerExecutor;
import org.apache.shardingsphere.test.integration.framework.runner.parallel.impl.ScenarioParallelRunnerExecutor;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import org.apache.shardingsphere.test.runner.parallel.DefaultParallelRunnerExecutorFactory;
+import org.apache.shardingsphere.test.runner.parallel.ParallelRunnerExecutor;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
/**
- * Parallel runner executor factory.
+ * Database type parallel runner executor factory.
*/
-public final class ParallelRunnerExecutorFactory {
-
- private final Map<DatabaseType, ParallelRunnerExecutor> executors = new ConcurrentHashMap<>();
+public final class DatabaseTypeParallelRunnerExecutorFactory extends DefaultParallelRunnerExecutorFactory<DatabaseType> {
- /**
- * Get parallel runner executor.
- *
- * @param databaseType database type
- * @param parallelLevel parallel level
- * @return parallel runner executor
- */
- public ParallelRunnerExecutor getExecutor(final DatabaseType databaseType, final ParallelLevel parallelLevel) {
- if (executors.containsKey(databaseType)) {
- return executors.get(databaseType);
- }
- ParallelRunnerExecutor newExecutor = newInstance(parallelLevel);
- if (null != executors.putIfAbsent(databaseType, newExecutor)) {
- newExecutor.finished();
- }
- return executors.get(databaseType);
- }
-
- private ParallelRunnerExecutor newInstance(final ParallelLevel parallelLevel) {
+ @Override
+ public ParallelRunnerExecutor newInstance(final ParallelLevel parallelLevel) {
switch (parallelLevel) {
case CASE:
return new CaseParallelRunnerExecutor();
@@ -62,12 +41,4 @@ public final class ParallelRunnerExecutorFactory {
}
}
- /**
- * Get all executors.
- *
- * @return all executors
- */
- public Collection<ParallelRunnerExecutor> getAllExecutors() {
- return executors.values();
- }
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerScheduler.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParameterizedParallelRunnerScheduler.java
similarity index 61%
copy from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerScheduler.java
copy to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParameterizedParallelRunnerScheduler.java
index a7daf20bf63..ad3232cb18d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerScheduler.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParameterizedParallelRunnerScheduler.java
@@ -17,30 +17,25 @@
package org.apache.shardingsphere.test.integration.framework.runner.parallel;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.test.integration.framework.param.RunnerParameters;
import org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
-import org.junit.runners.model.RunnerScheduler;
+import org.apache.shardingsphere.test.runner.parallel.ParallelRunnerExecutorFactory;
+import org.apache.shardingsphere.test.runner.parallel.ParallelRunnerScheduler;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
/**
- * Parallel runner scheduler.
+ * Parameterized parallel runner scheduler.
*/
-@RequiredArgsConstructor
-public final class ParallelRunnerScheduler implements RunnerScheduler {
+public class ParameterizedParallelRunnerScheduler extends ParallelRunnerScheduler {
- private final ParallelLevel parallelLevel;
-
- private final ParallelRunnerExecutorFactory executorFactory = new ParallelRunnerExecutorFactory();
+ public ParameterizedParallelRunnerScheduler(final ParallelLevel parallelLevel, final ParallelRunnerExecutorFactory<DatabaseType> executorFactory) {
+ super(parallelLevel, executorFactory);
+ }
@Override
public void schedule(final Runnable childStatement) {
ParameterizedArray parameterizedArray = new RunnerParameters(childStatement).getParameterizedArray();
- executorFactory.getExecutor(parameterizedArray.getDatabaseType(), parallelLevel).execute(parameterizedArray, childStatement);
- }
-
- @Override
- public void finished() {
- executorFactory.getAllExecutors().forEach(ParallelRunnerExecutor::finished);
+ getExecutorFactory().getExecutor(parameterizedArray.getDatabaseType(), getParallelLevel()).execute(parameterizedArray, childStatement);
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/CaseParallelRunnerExecutor.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/CaseParallelRunnerExecutor.java
index 82edbeb27a1..48e31503966 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/CaseParallelRunnerExecutor.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/CaseParallelRunnerExecutor.java
@@ -17,39 +17,17 @@
package org.apache.shardingsphere.test.integration.framework.runner.parallel.impl;
-import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
-import org.apache.shardingsphere.infra.executor.kernel.thread.ExecutorServiceManager;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.ParallelRunnerExecutor;
import org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
+import org.apache.shardingsphere.test.runner.parallel.impl.DefaultParallelRunnerExecutor;
/**
* Parallel runner executor with case.
*/
-public final class CaseParallelRunnerExecutor implements ParallelRunnerExecutor {
-
- // TODO ExecutorEngine.execute and callback
- private final ExecutorServiceManager executorServiceManager = ExecutorEngine.createExecutorEngineWithCPU().getExecutorServiceManager();
-
- private final Collection<Future<?>> taskFeatures = new LinkedList<>();
+public final class CaseParallelRunnerExecutor extends DefaultParallelRunnerExecutor<ParameterizedArray> {
@Override
public void execute(final ParameterizedArray parameterizedArray, final Runnable childStatement) {
- taskFeatures.add(executorServiceManager.getExecutorService().submit(childStatement));
- }
-
- @Override
- public void finished() {
- taskFeatures.forEach(each -> {
- try {
- each.get();
- } catch (final InterruptedException | ExecutionException ignored) {
- }
- });
- executorServiceManager.getExecutorService().shutdownNow();
+ execute(childStatement);
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/ScenarioParallelRunnerExecutor.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/ScenarioParallelRunnerExecutor.java
index cac29458f2f..91d91e90d62 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/ScenarioParallelRunnerExecutor.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/impl/ScenarioParallelRunnerExecutor.java
@@ -17,53 +17,32 @@
package org.apache.shardingsphere.test.integration.framework.runner.parallel.impl;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
import lombok.EqualsAndHashCode;
-import org.apache.shardingsphere.infra.executor.kernel.thread.ExecutorServiceManager;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.ParallelRunnerExecutor;
import org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
+import org.apache.shardingsphere.test.runner.parallel.impl.DefaultParallelRunnerExecutor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
/**
* Parallel runner executor with scenario.
*/
-public final class ScenarioParallelRunnerExecutor implements ParallelRunnerExecutor {
-
- private final Map<ScenarioKey, ExecutorServiceManager> executorServiceManagers = new ConcurrentHashMap<>();
-
- private final Collection<Future<?>> taskFeatures = new LinkedList<>();
+public final class ScenarioParallelRunnerExecutor extends DefaultParallelRunnerExecutor<ParameterizedArray> {
@Override
- public void execute(final ParameterizedArray parameterizedArray, final Runnable childStatement) {
- taskFeatures.add(getExecutorService(new ScenarioKey(parameterizedArray)).getExecutorService().submit(childStatement));
- }
-
- private ExecutorServiceManager getExecutorService(final ScenarioKey scenarioKey) {
- if (executorServiceManagers.containsKey(scenarioKey)) {
- return executorServiceManagers.get(scenarioKey);
+ public ExecutorService getExecutorService(final ParameterizedArray key) {
+ ScenarioKey scenarioKey = new ScenarioKey(key);
+ if (getExecutorServiceMap().containsKey(scenarioKey)) {
+ return getExecutorServiceMap().get(scenarioKey);
}
String threadPoolNameFormat = String.join("-", "ScenarioExecutorPool", scenarioKey.toString(), "%d");
- ExecutorServiceManager newExecutorServiceManager = new ExecutorServiceManager(1, threadPoolNameFormat);
- if (null != executorServiceManagers.putIfAbsent(scenarioKey, newExecutorServiceManager)) {
- newExecutorServiceManager.close();
+ ExecutorService executorService = Executors.newFixedThreadPool(
+ Runtime.getRuntime().availableProcessors(),
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat(threadPoolNameFormat).build());
+ if (null != getExecutorServiceMap().putIfAbsent(scenarioKey, executorService)) {
+ executorService.shutdownNow();
}
- return executorServiceManagers.get(scenarioKey);
- }
-
- @Override
- public void finished() {
- taskFeatures.forEach(each -> {
- try {
- each.get();
- } catch (final InterruptedException | ExecutionException ignored) {
- }
- });
- executorServiceManagers.values().forEach(each -> each.getExecutorService().shutdownNow());
+ return getExecutorServiceMap().get(scenarioKey);
}
/**
diff --git a/shardingsphere-test/shardingsphere-parser-test/pom.xml b/shardingsphere-test/shardingsphere-parser-test/pom.xml
index 382c5d512e6..591e8e052b1 100644
--- a/shardingsphere-test/shardingsphere-parser-test/pom.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/pom.xml
@@ -102,11 +102,15 @@
<artifactId>shardingsphere-shadow-distsql-parser</artifactId>
<version>${project.version}</version>
</dependency>
-
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/shardingsphere-test/shardingsphere-test-common/pom.xml b/shardingsphere-test/shardingsphere-test-common/pom.xml
index 17506e9a841..02394fe5699 100644
--- a/shardingsphere-test/shardingsphere-test-common/pom.xml
+++ b/shardingsphere-test/shardingsphere-test-common/pom.xml
@@ -37,5 +37,10 @@
<artifactId>mockito-core</artifactId>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/ShardingSphereParallelTestParameterized.java b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/ShardingSphereParallelTestParameterized.java
new file mode 100644
index 00000000000..53f999a9f68
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/ShardingSphereParallelTestParameterized.java
@@ -0,0 +1,39 @@
+/*
+ * 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.runner;
+
+import org.apache.shardingsphere.test.runner.parallel.DefaultParallelRunnerExecutorFactory;
+import org.apache.shardingsphere.test.runner.parallel.ParallelRunnerScheduler;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelRuntimeStrategy;
+import org.junit.runners.Parameterized;
+
+/**
+ * ShardingSphere integration test parameterized.
+ */
+public final class ShardingSphereParallelTestParameterized extends Parameterized {
+
+ // CHECKSTYLE:OFF
+ public ShardingSphereParallelTestParameterized(final Class<?> clazz) throws Throwable {
+ // CHECKSTYLE:ON
+ super(clazz);
+ ParallelRuntimeStrategy parallelRuntimeStrategy = clazz.getAnnotation(ParallelRuntimeStrategy.class);
+ ParallelLevel level = null != parallelRuntimeStrategy ? parallelRuntimeStrategy.value() : ParallelLevel.DEFAULT;
+ setScheduler(new ParallelRunnerScheduler(level, new DefaultParallelRunnerExecutorFactory()));
+ }
+}
diff --git a/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/DefaultParallelRunnerExecutorFactory.java b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/DefaultParallelRunnerExecutorFactory.java
new file mode 100644
index 00000000000..c06316d7a4f
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/DefaultParallelRunnerExecutorFactory.java
@@ -0,0 +1,89 @@
+/*
+ * 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.runner.parallel;
+
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.apache.shardingsphere.test.runner.parallel.impl.DefaultParallelRunnerExecutor;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Default parallel runner executor factory.
+ */
+public class DefaultParallelRunnerExecutorFactory<T> implements ParallelRunnerExecutorFactory<T> {
+
+ private final Map<T, ParallelRunnerExecutor> executors = new ConcurrentHashMap<>();
+
+ private volatile ParallelRunnerExecutor defaultExecutor;
+
+ @Override
+ public ParallelRunnerExecutor getExecutor(final T key, final ParallelLevel parallelLevel) {
+ if (executors.containsKey(key)) {
+ return executors.get(key);
+ }
+ ParallelRunnerExecutor newExecutor = newInstance(parallelLevel);
+ if (null != executors.putIfAbsent(key, newExecutor)) {
+ newExecutor.finished();
+ }
+ return executors.get(key);
+ }
+
+ /**
+ * Get parallel runner executor.
+ *
+ * @param parallelLevel parallel level
+ * @return parallel runner executor
+ */
+ public ParallelRunnerExecutor getExecutor(final ParallelLevel parallelLevel) {
+ if (null == defaultExecutor) {
+ synchronized (DefaultParallelRunnerExecutorFactory.class) {
+ if (null == defaultExecutor) {
+ defaultExecutor = new DefaultParallelRunnerExecutor();
+ }
+ }
+ }
+ return defaultExecutor;
+ }
+
+ /**
+ * Create executor instance by parallel level.
+ *
+ * @param parallelLevel parallel level
+ * @return executor by parallel level
+ */
+ public ParallelRunnerExecutor newInstance(final ParallelLevel parallelLevel) {
+ return new DefaultParallelRunnerExecutor();
+ }
+
+ /**
+ * Get all executors.
+ *
+ * @return all executors
+ */
+ public Collection<ParallelRunnerExecutor> getAllExecutors() {
+ List<ParallelRunnerExecutor> executors = new LinkedList<>(this.executors.values());
+ if (null != defaultExecutor) {
+ executors.add(defaultExecutor);
+ }
+ return executors;
+ }
+}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerExecutor.java b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunner.java
similarity index 50%
copy from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerExecutor.java
copy to shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunner.java
index de5407f2dc6..10015ca6ae5 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerExecutor.java
+++ b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunner.java
@@ -15,25 +15,26 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.framework.runner.parallel;
+package org.apache.shardingsphere.test.runner.parallel;
-import org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.InitializationError;
/**
- * Parallel runner executor.
+ * Parallel runner for junit.
*/
-public interface ParallelRunnerExecutor {
+public class ParallelRunner extends BlockJUnit4ClassRunner {
/**
- * Execute child statement.
+ * Creates a ParallelRunner to run {@code klass}.
+ * If you now annotate a test-class with @RunWith(ParallelRunner.class) each method will run within its own thread.
*
- * @param parameterizedArray parameterized array
- * @param childStatement child statement
+ * @param klass test class
+ * @throws InitializationError if the test class is malformed.
*/
- void execute(ParameterizedArray parameterizedArray, Runnable childStatement);
-
- /**
- * Override to implement any behavior that must occur after all children have been scheduled (for example, waiting for them all to finish).
- */
- void finished();
+ public ParallelRunner(final Class<?> klass) throws InitializationError {
+ super(klass);
+ setScheduler(new ParallelRunnerScheduler(ParallelLevel.DEFAULT, new DefaultParallelRunnerExecutorFactory()));
+ }
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerExecutor.java b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunnerExecutor.java
similarity index 76%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerExecutor.java
rename to shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunnerExecutor.java
index de5407f2dc6..f7b21d7963f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerExecutor.java
+++ b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunnerExecutor.java
@@ -15,22 +15,27 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.framework.runner.parallel;
-
-import org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
+package org.apache.shardingsphere.test.runner.parallel;
/**
* Parallel runner executor.
*/
-public interface ParallelRunnerExecutor {
+public interface ParallelRunnerExecutor<T> {
+
+ /**
+ * Execute child statement.
+ *
+ * @param key executor key
+ * @param childStatement child statement
+ */
+ void execute(T key, Runnable childStatement);
/**
* Execute child statement.
*
- * @param parameterizedArray parameterized array
* @param childStatement child statement
*/
- void execute(ParameterizedArray parameterizedArray, Runnable childStatement);
+ void execute(Runnable childStatement);
/**
* Override to implement any behavior that must occur after all children have been scheduled (for example, waiting for them all to finish).
diff --git a/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunnerExecutorFactory.java b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunnerExecutorFactory.java
new file mode 100644
index 00000000000..621a0ad2de6
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunnerExecutorFactory.java
@@ -0,0 +1,52 @@
+/*
+ * 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.runner.parallel;
+
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
+import java.util.Collection;
+
+/**
+ * Parallel Runner Executor factory.
+ * @param <T> key type which bind to executor
+ */
+public interface ParallelRunnerExecutorFactory<T> {
+
+ /**
+ * Get executor factory by key and parallel level.
+ *
+ * @param key key bind to the factory
+ * @param parallelLevel parallel level
+ * @return executor by key and parallel level
+ */
+ ParallelRunnerExecutor getExecutor(T key, ParallelLevel parallelLevel);
+
+ /**
+ * Get factory by parallel level.
+ *
+ * @param parallelLevel parallel level
+ * @return executor by parallel level
+ */
+ ParallelRunnerExecutor getExecutor(ParallelLevel parallelLevel);
+
+ /**
+ * Get all executors.
+ *
+ * @return all executors
+ */
+ Collection<ParallelRunnerExecutor> getAllExecutors();
+}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerScheduler.java b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunnerScheduler.java
similarity index 57%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerScheduler.java
rename to shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunnerScheduler.java
index a7daf20bf63..70e549907d4 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/ParallelRunnerScheduler.java
+++ b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/ParallelRunnerScheduler.java
@@ -15,32 +15,32 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.framework.runner.parallel;
+package org.apache.shardingsphere.test.runner.parallel;
+import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.param.RunnerParameters;
-import org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
+import org.apache.shardingsphere.test.runner.parallel.annotaion.ParallelLevel;
import org.junit.runners.model.RunnerScheduler;
/**
* Parallel runner scheduler.
*/
@RequiredArgsConstructor
-public final class ParallelRunnerScheduler implements RunnerScheduler {
+public class ParallelRunnerScheduler implements RunnerScheduler {
+ @Getter
private final ParallelLevel parallelLevel;
- private final ParallelRunnerExecutorFactory executorFactory = new ParallelRunnerExecutorFactory();
+ @Getter
+ private final ParallelRunnerExecutorFactory executorFactory;
@Override
public void schedule(final Runnable childStatement) {
- ParameterizedArray parameterizedArray = new RunnerParameters(childStatement).getParameterizedArray();
- executorFactory.getExecutor(parameterizedArray.getDatabaseType(), parallelLevel).execute(parameterizedArray, childStatement);
+ executorFactory.getExecutor(parallelLevel).execute(childStatement);
}
@Override
public void finished() {
- executorFactory.getAllExecutors().forEach(ParallelRunnerExecutor::finished);
+ executorFactory.getAllExecutors().forEach(each -> ((ParallelRunnerExecutor) each).finished());
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/annotaion/ParallelLevel.java b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/annotaion/ParallelLevel.java
similarity index 89%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/annotaion/ParallelLevel.java
rename to shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/annotaion/ParallelLevel.java
index 17711712af1..4a3663b444c 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/annotaion/ParallelLevel.java
+++ b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/annotaion/ParallelLevel.java
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion;
+package org.apache.shardingsphere.test.runner.parallel.annotaion;
/**
* Parallel level.
*/
public enum ParallelLevel {
- CASE, SCENARIO
+ CASE, SCENARIO, DEFAULT
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/annotaion/ParallelRuntimeStrategy.java b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/annotaion/ParallelRuntimeStrategy.java
similarity index 93%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/annotaion/ParallelRuntimeStrategy.java
rename to shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/annotaion/ParallelRuntimeStrategy.java
index d66e6c2011b..5e999de9459 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/parallel/annotaion/ParallelRuntimeStrategy.java
+++ b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/annotaion/ParallelRuntimeStrategy.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.framework.runner.parallel.annotaion;
+package org.apache.shardingsphere.test.runner.parallel.annotaion;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
diff --git a/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/impl/DefaultParallelRunnerExecutor.java b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/impl/DefaultParallelRunnerExecutor.java
new file mode 100644
index 00000000000..6135264e33e
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-test-common/src/main/java/org/apache/shardingsphere/test/runner/parallel/impl/DefaultParallelRunnerExecutor.java
@@ -0,0 +1,101 @@
+/*
+ * 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.runner.parallel.impl;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import lombok.Getter;
+import org.apache.shardingsphere.test.runner.parallel.ParallelRunnerExecutor;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+/**
+ * Default parallel runner executor.
+ * @param <T> key type bind to parallel executor
+ */
+public class DefaultParallelRunnerExecutor<T> implements ParallelRunnerExecutor<T> {
+
+ private final Collection<Future<?>> taskFeatures = new LinkedList<>();
+
+ @Getter
+ private final Map<Object, ExecutorService> executorServiceMap = new ConcurrentHashMap<>();
+
+ private volatile ExecutorService defaultExecutorService;
+
+ @Override
+ public void execute(final T key, final Runnable childStatement) {
+ taskFeatures.add(getExecutorService(key).submit(childStatement));
+ }
+
+ @Override
+ public void execute(final Runnable childStatement) {
+ taskFeatures.add(getExecutorService().submit(childStatement));
+ }
+
+ private ExecutorService getExecutorService() {
+ if (null == defaultExecutorService) {
+ synchronized (DefaultParallelRunnerExecutor.class) {
+ if (null == defaultExecutorService) {
+ defaultExecutorService = Executors.newFixedThreadPool(
+ Runtime.getRuntime().availableProcessors(),
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ShardingSphere-ParallelTestThread-%d").build());
+ }
+ }
+ }
+ return defaultExecutorService;
+ }
+
+ /**
+ * Get executor service by key.
+ *
+ * @param key key bind to the executor service
+ * @return executor service
+ */
+ public ExecutorService getExecutorService(final T key) {
+ if (executorServiceMap.containsKey(key)) {
+ return executorServiceMap.get(key);
+ }
+ String threadPoolNameFormat = String.join("-", "ShardingSphere-KeyedParallelTestThread", key.toString(), "%d");
+ ExecutorService executorService = Executors.newFixedThreadPool(
+ Runtime.getRuntime().availableProcessors(),
+ new ThreadFactoryBuilder().setDaemon(true).setNameFormat(threadPoolNameFormat).build());
+ if (null != executorServiceMap.putIfAbsent(key, executorService)) {
+ executorService.shutdownNow();
+ }
+ return executorServiceMap.get(key);
+ }
+
+ @Override
+ public void finished() {
+ taskFeatures.forEach(each -> {
+ try {
+ each.get();
+ } catch (final InterruptedException | ExecutionException ignored) {
+ }
+ });
+ executorServiceMap.values().forEach(each -> each.shutdownNow());
+ if (null != defaultExecutorService) {
+ defaultExecutorService.shutdownNow();
+ }
+ }
+}