You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2023/03/02 22:30:20 UTC
[shardingsphere] branch master updated: Revert "Upgrade AbstractMigrationE2EIT to junit 5 (#24427)" (#24431)
This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new e4b40816f59 Revert "Upgrade AbstractMigrationE2EIT to junit 5 (#24427)" (#24431)
e4b40816f59 is described below
commit e4b40816f59b71af778510c6a7b9456f74ab9a8a
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Mar 3 06:30:04 2023 +0800
Revert "Upgrade AbstractMigrationE2EIT to junit 5 (#24427)" (#24431)
---
.../general/MySQLMigrationGeneralE2EIT.java | 53 ++++++++--------
.../general/PostgreSQLMigrationGeneralE2EIT.java | 57 ++++++++---------
.../migration/general/RulesMigrationE2EIT.java | 49 +++++++--------
.../primarykey/IndexesMigrationE2EIT.java | 71 +++++++++-------------
.../primarykey/MariaDBMigrationE2EIT.java | 56 ++++++++---------
.../primarykey/TextPrimaryKeyMigrationE2EIT.java | 70 +++++++++++----------
.../sql/parser/internal/InternalSQLParserIT.java | 2 +-
.../internal/InternalUnsupportedSQLParserIT.java | 3 +-
8 files changed, 166 insertions(+), 195 deletions(-)
diff --git a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
index 38bb0d02b5a..4904d4c15d4 100644
--- a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
+++ b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
@@ -30,30 +30,45 @@ import org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTyp
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineTestParameter;
import org.apache.shardingsphere.test.e2e.data.pipeline.util.DataSourceExecuteUtil;
-import org.junit.jupiter.api.condition.EnabledIf;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.ArgumentsProvider;
-import org.junit.jupiter.params.provider.ArgumentsSource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
import java.sql.SQLException;
import java.time.LocalDateTime;
+import java.util.Collection;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.Assert.assertTrue;
+@RunWith(Parameterized.class)
@Slf4j
public final class MySQLMigrationGeneralE2EIT extends AbstractMigrationE2EIT {
+ private final PipelineTestParameter testParam;
+
public MySQLMigrationGeneralE2EIT(final PipelineTestParameter testParam) {
super(testParam);
+ this.testParam = testParam;
+ }
+
+ @Parameters(name = "{0}")
+ public static Collection<PipelineTestParameter> getTestParameters() {
+ Collection<PipelineTestParameter> result = new LinkedList<>();
+ if (PipelineBaseE2EIT.ENV.getItEnvType() == PipelineEnvTypeEnum.NONE) {
+ return result;
+ }
+ MySQLDatabaseType databaseType = new MySQLDatabaseType();
+ for (String each : PipelineBaseE2EIT.ENV.listStorageContainerImages(databaseType)) {
+ result.add(new PipelineTestParameter(databaseType, each, "env/scenario/general/mysql.xml"));
+ }
+ return result;
}
@Override
@@ -61,10 +76,8 @@ public final class MySQLMigrationGeneralE2EIT extends AbstractMigrationE2EIT {
return "t_order_copy";
}
- @ParameterizedTest(name = "{0}")
- @EnabledIf("isEnabled")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
- public void assertMigrationSuccess(final PipelineTestParameter testParam) throws SQLException, InterruptedException {
+ @Test
+ public void assertMigrationSuccess() throws SQLException, InterruptedException {
log.info("assertMigrationSuccess testParam:{}", testParam);
initEnvironment(testParam.getDatabaseType(), new MigrationJobType());
addMigrationProcessConfig();
@@ -100,10 +113,6 @@ public final class MySQLMigrationGeneralE2EIT extends AbstractMigrationE2EIT {
log.info("{} E2E IT finished, database type={}, docker image={}", this.getClass().getName(), testParam.getDatabaseType(), testParam.getStorageContainerImage());
}
- private static boolean isEnabled() {
- return PipelineBaseE2EIT.ENV.getItEnvType() != PipelineEnvTypeEnum.NONE;
- }
-
private void assertMigrationSuccessById(final String jobId, final String algorithmType) throws SQLException, InterruptedException {
List<Map<String, Object>> jobStatus = waitIncrementTaskFinished(String.format("SHOW MIGRATION STATUS '%s'", jobId));
for (Map<String, Object> each : jobStatus) {
@@ -112,14 +121,4 @@ public final class MySQLMigrationGeneralE2EIT extends AbstractMigrationE2EIT {
}
assertCheckMigrationSuccess(jobId, algorithmType);
}
-
- private static class TestCaseArgumentsProvider implements ArgumentsProvider {
-
- @Override
- public Stream<? extends Arguments> provideArguments(final ExtensionContext extensionContext) {
- MySQLDatabaseType databaseType = new MySQLDatabaseType();
- return PipelineBaseE2EIT.ENV.listStorageContainerImages(databaseType).stream()
- .map(each -> Arguments.of(new PipelineTestParameter(databaseType, each, "env/scenario/general/mysql.xml"))).collect(Collectors.toList()).stream();
- }
- }
}
diff --git a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
index 12507aab006..2a4893bd0a4 100644
--- a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
+++ b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
@@ -30,27 +30,28 @@ import org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTyp
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineTestParameter;
import org.apache.shardingsphere.test.e2e.data.pipeline.util.DataSourceExecuteUtil;
-import org.junit.jupiter.api.condition.EnabledIf;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.ArgumentsProvider;
-import org.junit.jupiter.params.provider.ArgumentsSource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
-import java.util.stream.Stream;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.Assert.assertTrue;
+@RunWith(Parameterized.class)
@Slf4j
public final class PostgreSQLMigrationGeneralE2EIT extends AbstractMigrationE2EIT {
+ private final PipelineTestParameter testParam;
+
public PostgreSQLMigrationGeneralE2EIT(final PipelineTestParameter testParam) {
super(testParam);
+ this.testParam = testParam;
}
@Override
@@ -58,10 +59,23 @@ public final class PostgreSQLMigrationGeneralE2EIT extends AbstractMigrationE2EI
return "t_order_copy";
}
- @ParameterizedTest(name = "{0}")
- @EnabledIf("isEnabled")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
- public void assertMigrationSuccess(final PipelineTestParameter testParam) throws SQLException, InterruptedException {
+ @Parameters(name = "{0}")
+ public static Collection<PipelineTestParameter> getTestParameters() {
+ Collection<PipelineTestParameter> result = new LinkedList<>();
+ if (PipelineBaseE2EIT.ENV.getItEnvType() == PipelineEnvTypeEnum.NONE) {
+ return result;
+ }
+ for (String each : PipelineBaseE2EIT.ENV.listStorageContainerImages(new PostgreSQLDatabaseType())) {
+ result.add(new PipelineTestParameter(new PostgreSQLDatabaseType(), each, "env/scenario/general/postgresql.xml"));
+ }
+ for (String each : PipelineBaseE2EIT.ENV.listStorageContainerImages(new OpenGaussDatabaseType())) {
+ result.add(new PipelineTestParameter(new OpenGaussDatabaseType(), each, "env/scenario/general/postgresql.xml"));
+ }
+ return result;
+ }
+
+ @Test
+ public void assertMigrationSuccess() throws SQLException, InterruptedException {
log.info("assertMigrationSuccess testParam:{}", testParam);
initEnvironment(testParam.getDatabaseType(), new MigrationJobType());
addMigrationProcessConfig();
@@ -113,23 +127,4 @@ public final class PostgreSQLMigrationGeneralE2EIT extends AbstractMigrationE2EI
waitIncrementTaskFinished(String.format("SHOW MIGRATION STATUS '%s'", jobId));
assertCheckMigrationSuccess(jobId, "DATA_MATCH");
}
-
- private static boolean isEnabled() {
- return PipelineBaseE2EIT.ENV.getItEnvType() != PipelineEnvTypeEnum.NONE;
- }
-
- private static class TestCaseArgumentsProvider implements ArgumentsProvider {
-
- @Override
- public Stream<? extends Arguments> provideArguments(final ExtensionContext extensionContext) {
- Collection<Arguments> result = new LinkedList<>();
- for (String each : PipelineBaseE2EIT.ENV.listStorageContainerImages(new PostgreSQLDatabaseType())) {
- result.add(Arguments.of(new PipelineTestParameter(new PostgreSQLDatabaseType(), each, "env/scenario/general/postgresql.xml")));
- }
- for (String each : PipelineBaseE2EIT.ENV.listStorageContainerImages(new OpenGaussDatabaseType())) {
- result.add(Arguments.of(new PipelineTestParameter(new OpenGaussDatabaseType(), each, "env/scenario/general/postgresql.xml")));
- }
- return result.stream();
- }
- }
}
diff --git a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/RulesMigrationE2EIT.java b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/RulesMigrationE2EIT.java
index 020bededc01..06154ae35d4 100644
--- a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/RulesMigrationE2EIT.java
+++ b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/RulesMigrationE2EIT.java
@@ -26,19 +26,16 @@ import org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.Abstract
import org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTypeEnum;
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineTestParameter;
-import org.junit.jupiter.api.condition.EnabledIf;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.ArgumentsProvider;
-import org.junit.jupiter.params.provider.ArgumentsSource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
import java.sql.Connection;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Callable;
-import java.util.stream.Stream;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@@ -48,6 +45,7 @@ import static org.hamcrest.Matchers.is;
* 1) no any rule.
* 2) only encrypt rule.
*/
+@RunWith(Parameterized.class)
@Slf4j
public final class RulesMigrationE2EIT extends AbstractMigrationE2EIT {
@@ -55,21 +53,31 @@ public final class RulesMigrationE2EIT extends AbstractMigrationE2EIT {
super(testParam);
}
+ @Parameters(name = "{0}")
+ public static Collection<PipelineTestParameter> getTestParameters() {
+ Collection<PipelineTestParameter> result = new LinkedList<>();
+ if (PipelineBaseE2EIT.ENV.getItEnvType() == PipelineEnvTypeEnum.NONE) {
+ return result;
+ }
+ List<String> versions = PipelineBaseE2EIT.ENV.listStorageContainerImages(new MySQLDatabaseType());
+ if (versions.isEmpty()) {
+ return result;
+ }
+ result.add(new PipelineTestParameter(new MySQLDatabaseType(), versions.get(0), "env/scenario/primary_key/text_primary_key/mysql.xml"));
+ return result;
+ }
+
@Override
protected String getSourceTableOrderName() {
return "t_order";
}
- @ParameterizedTest(name = "{0}")
- @EnabledIf("isEnabled")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
+ @Test
public void assertNoRuleMigrationSuccess() throws Exception {
assertMigrationSuccess(null);
}
- @ParameterizedTest(name = "{0}")
- @EnabledIf("isEnabled")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
+ @Test
public void assertOnlyEncryptRuleMigrationSuccess() throws Exception {
assertMigrationSuccess(() -> {
createTargetOrderTableEncryptRule();
@@ -97,19 +105,4 @@ public final class RulesMigrationE2EIT extends AbstractMigrationE2EIT {
proxyExecuteWithLog("REFRESH TABLE METADATA", 1);
assertThat(getTargetTableRecordsCount(getSourceTableOrderName()), is(PipelineBaseE2EIT.TABLE_INIT_ROW_COUNT));
}
-
- private static boolean isEnabled() {
- return PipelineBaseE2EIT.ENV.getItEnvType() != PipelineEnvTypeEnum.NONE && !PipelineBaseE2EIT.ENV.listStorageContainerImages(new MySQLDatabaseType()).isEmpty();
- }
-
- private static class TestCaseArgumentsProvider implements ArgumentsProvider {
-
- @Override
- public Stream<? extends Arguments> provideArguments(final ExtensionContext extensionContext) {
- Collection<Arguments> result = new LinkedList<>();
- List<String> versions = PipelineBaseE2EIT.ENV.listStorageContainerImages(new MySQLDatabaseType());
- result.add(Arguments.of(new PipelineTestParameter(new MySQLDatabaseType(), versions.get(0), "env/scenario/primary_key/text_primary_key/mysql.xml")));
- return result.stream();
- }
- }
}
diff --git a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
index 827e90f3345..aace00f413a 100644
--- a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
+++ b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
@@ -29,12 +29,10 @@ import org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.Abstract
import org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTypeEnum;
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineTestParameter;
-import org.junit.jupiter.api.condition.EnabledIf;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.ArgumentsProvider;
-import org.junit.jupiter.params.provider.ArgumentsSource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -42,11 +40,10 @@ import java.sql.SQLException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
-import java.util.stream.Stream;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.Assert.assertTrue;
/**
* E2E IT for different types of indexes, includes:
@@ -55,6 +52,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* 3) multiple columns primary key, first column type is VARCHAR.
* 4) multiple columns unique key, first column type is BIGINT.
*/
+@RunWith(Parameterized.class)
@Slf4j
public final class IndexesMigrationE2EIT extends AbstractMigrationE2EIT {
@@ -68,14 +66,29 @@ public final class IndexesMigrationE2EIT extends AbstractMigrationE2EIT {
super(testParam);
}
+ @Parameters(name = "{0}")
+ public static Collection<PipelineTestParameter> getTestParameters() {
+ Collection<PipelineTestParameter> result = new LinkedList<>();
+ if (PipelineBaseE2EIT.ENV.getItEnvType() == PipelineEnvTypeEnum.NONE) {
+ return result;
+ }
+ List<String> mysqlVersion = PipelineBaseE2EIT.ENV.listStorageContainerImages(new MySQLDatabaseType());
+ if (!mysqlVersion.isEmpty()) {
+ result.add(new PipelineTestParameter(new MySQLDatabaseType(), mysqlVersion.get(0), "env/common/none.xml"));
+ }
+ List<String> postgresqlVersion = PipelineBaseE2EIT.ENV.listStorageContainerImages(new PostgreSQLDatabaseType());
+ if (!postgresqlVersion.isEmpty()) {
+ result.add(new PipelineTestParameter(new PostgreSQLDatabaseType(), postgresqlVersion.get(0), "env/common/none.xml"));
+ }
+ return result;
+ }
+
@Override
protected String getSourceTableOrderName() {
return "t_order";
}
- @ParameterizedTest(name = "{0}")
- @EnabledIf("isEnabled")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
+ @Test
public void assertNoUniqueKeyMigrationSuccess() throws SQLException, InterruptedException {
String sql;
String consistencyCheckAlgorithmType;
@@ -92,9 +105,7 @@ public final class IndexesMigrationE2EIT extends AbstractMigrationE2EIT {
assertMigrationSuccess(sql, "user_id", new UUIDKeyGenerateAlgorithm(), consistencyCheckAlgorithmType);
}
- @ParameterizedTest(name = "{0}")
- @EnabledIf("isEnabled")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
+ @Test
public void assertMultiPrimaryKeyMigrationSuccess() throws SQLException, InterruptedException {
String sql;
String consistencyCheckAlgorithmType;
@@ -107,9 +118,7 @@ public final class IndexesMigrationE2EIT extends AbstractMigrationE2EIT {
assertMigrationSuccess(sql, "user_id", new UUIDKeyGenerateAlgorithm(), consistencyCheckAlgorithmType);
}
- @ParameterizedTest(name = "{0}")
- @EnabledIf("isEnabled")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
+ @Test
public void assertMultiUniqueKeyMigrationSuccess() throws SQLException, InterruptedException {
String sql;
String consistencyCheckAlgorithmType;
@@ -122,9 +131,7 @@ public final class IndexesMigrationE2EIT extends AbstractMigrationE2EIT {
assertMigrationSuccess(sql, "user_id", new SnowflakeKeyGenerateAlgorithm(), consistencyCheckAlgorithmType);
}
- @ParameterizedTest(name = "{0}")
- @EnabledIf("isEnabled")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
+ @Test
public void assertSpecialTypeSingleColumnUniqueKeyMigrationSuccess() throws SQLException, InterruptedException {
String sql;
String consistencyCheckAlgorithmType;
@@ -167,27 +174,7 @@ public final class IndexesMigrationE2EIT extends AbstractMigrationE2EIT {
commitMigrationByJobId(jobId);
proxyExecuteWithLog("REFRESH TABLE METADATA", 1);
assertThat(getTargetTableRecordsCount(getSourceTableOrderName()), is(PipelineBaseE2EIT.TABLE_INIT_ROW_COUNT + 1));
- assertTrue(listJobId().isEmpty());
- }
-
- private static boolean isEnabled() {
- return PipelineBaseE2EIT.ENV.getItEnvType() != PipelineEnvTypeEnum.NONE;
- }
-
- private static class TestCaseArgumentsProvider implements ArgumentsProvider {
-
- @Override
- public Stream<? extends Arguments> provideArguments(final ExtensionContext extensionContext) {
- Collection<Arguments> result = new LinkedList<>();
- List<String> mysqlVersion = PipelineBaseE2EIT.ENV.listStorageContainerImages(new MySQLDatabaseType());
- if (!mysqlVersion.isEmpty()) {
- result.add(Arguments.of(new PipelineTestParameter(new MySQLDatabaseType(), mysqlVersion.get(0), "env/common/none.xml")));
- }
- List<String> postgresqlVersion = PipelineBaseE2EIT.ENV.listStorageContainerImages(new PostgreSQLDatabaseType());
- if (!postgresqlVersion.isEmpty()) {
- result.add(Arguments.of(new PipelineTestParameter(new PostgreSQLDatabaseType(), postgresqlVersion.get(0), "env/common/none.xml")));
- }
- return result.stream();
- }
+ List<String> lastJobIds = listJobId();
+ assertTrue(lastJobIds.isEmpty());
}
}
diff --git a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
index 2390e43cada..3317211d3fe 100644
--- a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
+++ b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.primarykey;
+import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm;
@@ -26,39 +27,51 @@ import org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.Abstract
import org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTypeEnum;
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineTestParameter;
-import org.junit.jupiter.api.condition.EnabledIf;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.ArgumentsProvider;
-import org.junit.jupiter.params.provider.ArgumentsSource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
-import java.util.stream.Stream;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.Assert.assertTrue;
+@RunWith(Parameterized.class)
+@Slf4j
public final class MariaDBMigrationE2EIT extends AbstractMigrationE2EIT {
public MariaDBMigrationE2EIT(final PipelineTestParameter testParam) {
super(testParam);
}
+ @Parameters(name = "{0}")
+ public static Collection<PipelineTestParameter> getTestParameters() {
+ Collection<PipelineTestParameter> result = new LinkedList<>();
+ if (PipelineBaseE2EIT.ENV.getItEnvType() == PipelineEnvTypeEnum.NONE) {
+ return result;
+ }
+ List<String> versions = PipelineBaseE2EIT.ENV.listStorageContainerImages(new MySQLDatabaseType());
+ if (versions.isEmpty()) {
+ return result;
+ }
+ // TODO use MariaDBDatabaseType
+ result.add(new PipelineTestParameter(new MySQLDatabaseType(), versions.get(0), "env/common/none.xml"));
+ return result;
+ }
+
@Override
protected String getSourceTableOrderName() {
return "t_order";
}
- @ParameterizedTest(name = "{0}")
- @EnabledIf("isEnabled")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
- public void assertMigrationSuccess(final PipelineTestParameter testParam) throws SQLException, InterruptedException {
+ @Test
+ public void assertMigrationSuccess() throws SQLException, InterruptedException {
initEnvironment(getDatabaseType(), new MigrationJobType());
String sqlPattern = "CREATE TABLE `%s` (`order_id` VARCHAR(64) NOT NULL, `user_id` INT NOT NULL, `status` varchar(255), PRIMARY KEY (`order_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
sourceExecuteWithLog(String.format(sqlPattern, getSourceTableOrderName()));
@@ -80,22 +93,7 @@ public final class MariaDBMigrationE2EIT extends AbstractMigrationE2EIT {
commitMigrationByJobId(jobId);
proxyExecuteWithLog("REFRESH TABLE METADATA", 1);
assertThat(getTargetTableRecordsCount(getSourceTableOrderName()), is(PipelineBaseE2EIT.TABLE_INIT_ROW_COUNT + 1));
- assertTrue(listJobId().isEmpty());
- }
-
- private static boolean isEnabled() {
- return PipelineBaseE2EIT.ENV.getItEnvType() != PipelineEnvTypeEnum.NONE && !PipelineBaseE2EIT.ENV.listStorageContainerImages(new MySQLDatabaseType()).isEmpty();
- }
-
- private static class TestCaseArgumentsProvider implements ArgumentsProvider {
-
- @Override
- public Stream<? extends Arguments> provideArguments(final ExtensionContext extensionContext) {
- Collection<Arguments> result = new LinkedList<>();
- List<String> versions = PipelineBaseE2EIT.ENV.listStorageContainerImages(new MySQLDatabaseType());
- // TODO use MariaDBDatabaseType
- result.add(Arguments.of(new PipelineTestParameter(new MySQLDatabaseType(), versions.get(0), "env/common/none.xml")));
- return result.stream();
- }
+ List<String> lastJobIds = listJobId();
+ assertTrue(lastJobIds.isEmpty());
}
}
diff --git a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
index b8558fe35f1..09d0c883c75 100644
--- a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
+++ b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
@@ -29,38 +29,58 @@ import org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTyp
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
import org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineTestParameter;
import org.apache.shardingsphere.test.e2e.env.container.atomic.util.DatabaseTypeUtil;
-import org.junit.jupiter.api.condition.EnabledIf;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.ArgumentsProvider;
-import org.junit.jupiter.params.provider.ArgumentsSource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
-import java.util.stream.Stream;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.Assert.assertTrue;
+@RunWith(Parameterized.class)
@Slf4j
-public final class TextPrimaryKeyMigrationE2EIT extends AbstractMigrationE2EIT {
+public class TextPrimaryKeyMigrationE2EIT extends AbstractMigrationE2EIT {
+
+ private final PipelineTestParameter testParam;
public TextPrimaryKeyMigrationE2EIT(final PipelineTestParameter testParam) {
super(testParam);
+ this.testParam = testParam;
}
@Override
protected String getSourceTableOrderName() {
- return DatabaseTypeUtil.isMySQL(getDatabaseType()) ? "T_ORDER" : "t_order";
+ if (DatabaseTypeUtil.isMySQL(getDatabaseType())) {
+ return "T_ORDER";
+ }
+ return "t_order";
}
- @ParameterizedTest(name = "{0}")
- @EnabledIf("isEnabled")
- @ArgumentsSource(TestCaseArgumentsProvider.class)
- public void assertTextPrimaryMigrationSuccess(final PipelineTestParameter testParam) throws SQLException, InterruptedException {
+ @Parameters(name = "{0}")
+ public static Collection<PipelineTestParameter> getTestParameters() {
+ Collection<PipelineTestParameter> result = new LinkedList<>();
+ if (PipelineBaseE2EIT.ENV.getItEnvType() == PipelineEnvTypeEnum.NONE) {
+ return result;
+ }
+ for (String version : PipelineBaseE2EIT.ENV.listStorageContainerImages(new MySQLDatabaseType())) {
+ result.add(new PipelineTestParameter(new MySQLDatabaseType(), version, "env/scenario/primary_key/text_primary_key/mysql.xml"));
+ }
+ for (String version : PipelineBaseE2EIT.ENV.listStorageContainerImages(new PostgreSQLDatabaseType())) {
+ result.add(new PipelineTestParameter(new PostgreSQLDatabaseType(), version, "env/scenario/primary_key/text_primary_key/postgresql.xml"));
+ }
+ for (String version : PipelineBaseE2EIT.ENV.listStorageContainerImages(new OpenGaussDatabaseType())) {
+ result.add(new PipelineTestParameter(new OpenGaussDatabaseType(), version, "env/scenario/primary_key/text_primary_key/postgresql.xml"));
+ }
+ return result;
+ }
+
+ @Test
+ public void assertTextPrimaryMigrationSuccess() throws SQLException, InterruptedException {
log.info("assertTextPrimaryMigrationSuccess testParam:{}", testParam);
initEnvironment(testParam.getDatabaseType(), new MigrationJobType());
createSourceOrderTable();
@@ -82,26 +102,4 @@ public final class TextPrimaryKeyMigrationE2EIT extends AbstractMigrationE2EIT {
assertTrue(lastJobIds.isEmpty());
log.info("{} E2E IT finished, database type={}, docker image={}", this.getClass().getName(), testParam.getDatabaseType(), testParam.getStorageContainerImage());
}
-
- private static boolean isEnabled() {
- return PipelineBaseE2EIT.ENV.getItEnvType() != PipelineEnvTypeEnum.NONE;
- }
-
- private static class TestCaseArgumentsProvider implements ArgumentsProvider {
-
- @Override
- public Stream<? extends Arguments> provideArguments(final ExtensionContext extensionContext) {
- Collection<Arguments> result = new LinkedList<>();
- for (String version : PipelineBaseE2EIT.ENV.listStorageContainerImages(new MySQLDatabaseType())) {
- result.add(Arguments.of(new PipelineTestParameter(new MySQLDatabaseType(), version, "env/scenario/primary_key/text_primary_key/mysql.xml")));
- }
- for (String version : PipelineBaseE2EIT.ENV.listStorageContainerImages(new PostgreSQLDatabaseType())) {
- result.add(Arguments.of(new PipelineTestParameter(new PostgreSQLDatabaseType(), version, "env/scenario/primary_key/text_primary_key/postgresql.xml")));
- }
- for (String version : PipelineBaseE2EIT.ENV.listStorageContainerImages(new OpenGaussDatabaseType())) {
- result.add(Arguments.of(new PipelineTestParameter(new OpenGaussDatabaseType(), version, "env/scenario/primary_key/text_primary_key/postgresql.xml")));
- }
- return result.stream();
- }
- }
}
diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/InternalSQLParserIT.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/InternalSQLParserIT.java
index b0026a3686b..97701439502 100644
--- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/InternalSQLParserIT.java
+++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/InternalSQLParserIT.java
@@ -78,7 +78,7 @@ public abstract class InternalSQLParserIT {
Collection<Arguments> result = new LinkedList<>();
for (InternalSQLParserTestParameter each : SQL_CASES.generateTestParameters(Arrays.stream(databaseTypes).collect(Collectors.toSet()))) {
if (!isPlaceholderWithoutParameter(each)) {
- result.add(Arguments.of(each.getSqlCaseId(), each.getSqlCaseType(), each.getDatabaseType(), each.getVisitorType()));
+ result.add(Arguments.arguments(each.getSqlCaseId(), each.getSqlCaseType(), each.getDatabaseType(), each.getVisitorType()));
}
}
return result;
diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/InternalUnsupportedSQLParserIT.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/InternalUnsupportedSQLParserIT.java
index 8b801c065e7..c36601ee8b6 100644
--- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/InternalUnsupportedSQLParserIT.java
+++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/InternalUnsupportedSQLParserIT.java
@@ -58,7 +58,8 @@ public abstract class InternalUnsupportedSQLParserIT {
}
private Collection<Arguments> getTestParameters(final Collection<String> databaseTypes) {
- return SQL_CASES.generateTestParameters(databaseTypes).stream().map(each -> Arguments.of(each.getSqlCaseId(), each.getSqlCaseType(), each.getDatabaseType())).collect(Collectors.toList());
+ return SQL_CASES.generateTestParameters(databaseTypes).stream()
+ .map(each -> Arguments.arguments(each.getSqlCaseId(), each.getSqlCaseType(), each.getDatabaseType())).collect(Collectors.toList());
}
}
}