This is an automated email from the ASF dual-hosted git repository.

yx9o 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 2f0a6ce11f6 Upgrade AbstractMigrationE2EIT to junit 5 (#24427)
2f0a6ce11f6 is described below

commit 2f0a6ce11f683bffbe3d010b4fa1531bfdf374ed
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Thu Mar 2 23:13:46 2023 +0800

    Upgrade AbstractMigrationE2EIT to junit 5 (#24427)
---
 .../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, 195 insertions(+), 166 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 4904d4c15d4..38bb0d02b5a 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,45 +30,30 @@ 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.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+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 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.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.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
@@ -76,8 +61,10 @@ public final class MySQLMigrationGeneralE2EIT extends 
AbstractMigrationE2EIT {
         return "t_order_copy";
     }
     
-    @Test
-    public void assertMigrationSuccess() throws SQLException, 
InterruptedException {
+    @ParameterizedTest(name = "{0}")
+    @EnabledIf("isEnabled")
+    @ArgumentsSource(TestCaseArgumentsProvider.class)
+    public void assertMigrationSuccess(final PipelineTestParameter testParam) 
throws SQLException, InterruptedException {
         log.info("assertMigrationSuccess testParam:{}", testParam);
         initEnvironment(testParam.getDatabaseType(), new MigrationJobType());
         addMigrationProcessConfig();
@@ -113,6 +100,10 @@ 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) {
@@ -121,4 +112,14 @@ 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 2a4893bd0a4..12507aab006 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,28 +30,27 @@ 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.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+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 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.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.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
@@ -59,23 +58,10 @@ public final class PostgreSQLMigrationGeneralE2EIT extends 
AbstractMigrationE2EI
         return "t_order_copy";
     }
     
-    @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 {
+    @ParameterizedTest(name = "{0}")
+    @EnabledIf("isEnabled")
+    @ArgumentsSource(TestCaseArgumentsProvider.class)
+    public void assertMigrationSuccess(final PipelineTestParameter testParam) 
throws SQLException, InterruptedException {
         log.info("assertMigrationSuccess testParam:{}", testParam);
         initEnvironment(testParam.getDatabaseType(), new MigrationJobType());
         addMigrationProcessConfig();
@@ -127,4 +113,23 @@ 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 06154ae35d4..020bededc01 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,16 +26,19 @@ 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.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+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 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;
@@ -45,7 +48,6 @@ import static org.hamcrest.Matchers.is;
  * 1) no any rule.
  * 2) only encrypt rule.
  */
-@RunWith(Parameterized.class)
 @Slf4j
 public final class RulesMigrationE2EIT extends AbstractMigrationE2EIT {
     
@@ -53,31 +55,21 @@ 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";
     }
     
-    @Test
+    @ParameterizedTest(name = "{0}")
+    @EnabledIf("isEnabled")
+    @ArgumentsSource(TestCaseArgumentsProvider.class)
     public void assertNoRuleMigrationSuccess() throws Exception {
         assertMigrationSuccess(null);
     }
     
-    @Test
+    @ParameterizedTest(name = "{0}")
+    @EnabledIf("isEnabled")
+    @ArgumentsSource(TestCaseArgumentsProvider.class)
     public void assertOnlyEncryptRuleMigrationSuccess() throws Exception {
         assertMigrationSuccess(() -> {
             createTargetOrderTableEncryptRule();
@@ -105,4 +97,19 @@ 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 aace00f413a..827e90f3345 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,10 +29,12 @@ 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.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+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 java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -40,10 +42,11 @@ 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.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * E2E IT for different types of indexes, includes:
@@ -52,7 +55,6 @@ import static org.junit.Assert.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 {
     
@@ -66,29 +68,14 @@ 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";
     }
     
-    @Test
+    @ParameterizedTest(name = "{0}")
+    @EnabledIf("isEnabled")
+    @ArgumentsSource(TestCaseArgumentsProvider.class)
     public void assertNoUniqueKeyMigrationSuccess() throws SQLException, 
InterruptedException {
         String sql;
         String consistencyCheckAlgorithmType;
@@ -105,7 +92,9 @@ public final class IndexesMigrationE2EIT extends 
AbstractMigrationE2EIT {
         assertMigrationSuccess(sql, "user_id", new UUIDKeyGenerateAlgorithm(), 
consistencyCheckAlgorithmType);
     }
     
-    @Test
+    @ParameterizedTest(name = "{0}")
+    @EnabledIf("isEnabled")
+    @ArgumentsSource(TestCaseArgumentsProvider.class)
     public void assertMultiPrimaryKeyMigrationSuccess() throws SQLException, 
InterruptedException {
         String sql;
         String consistencyCheckAlgorithmType;
@@ -118,7 +107,9 @@ public final class IndexesMigrationE2EIT extends 
AbstractMigrationE2EIT {
         assertMigrationSuccess(sql, "user_id", new UUIDKeyGenerateAlgorithm(), 
consistencyCheckAlgorithmType);
     }
     
-    @Test
+    @ParameterizedTest(name = "{0}")
+    @EnabledIf("isEnabled")
+    @ArgumentsSource(TestCaseArgumentsProvider.class)
     public void assertMultiUniqueKeyMigrationSuccess() throws SQLException, 
InterruptedException {
         String sql;
         String consistencyCheckAlgorithmType;
@@ -131,7 +122,9 @@ public final class IndexesMigrationE2EIT extends 
AbstractMigrationE2EIT {
         assertMigrationSuccess(sql, "user_id", new 
SnowflakeKeyGenerateAlgorithm(), consistencyCheckAlgorithmType);
     }
     
-    @Test
+    @ParameterizedTest(name = "{0}")
+    @EnabledIf("isEnabled")
+    @ArgumentsSource(TestCaseArgumentsProvider.class)
     public void assertSpecialTypeSingleColumnUniqueKeyMigrationSuccess() 
throws SQLException, InterruptedException {
         String sql;
         String consistencyCheckAlgorithmType;
@@ -174,7 +167,27 @@ public final class IndexesMigrationE2EIT extends 
AbstractMigrationE2EIT {
         commitMigrationByJobId(jobId);
         proxyExecuteWithLog("REFRESH TABLE METADATA", 1);
         assertThat(getTargetTableRecordsCount(getSourceTableOrderName()), 
is(PipelineBaseE2EIT.TABLE_INIT_ROW_COUNT + 1));
-        List<String> lastJobIds = listJobId();
-        assertTrue(lastJobIds.isEmpty());
+        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();
+        }
     }
 }
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 3317211d3fe..2390e43cada 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,7 +17,6 @@
 
 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;
@@ -27,51 +26,39 @@ 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.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+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 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.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.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";
     }
     
-    @Test
-    public void assertMigrationSuccess() throws SQLException, 
InterruptedException {
+    @ParameterizedTest(name = "{0}")
+    @EnabledIf("isEnabled")
+    @ArgumentsSource(TestCaseArgumentsProvider.class)
+    public void assertMigrationSuccess(final PipelineTestParameter testParam) 
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()));
@@ -93,7 +80,22 @@ public final class MariaDBMigrationE2EIT extends 
AbstractMigrationE2EIT {
         commitMigrationByJobId(jobId);
         proxyExecuteWithLog("REFRESH TABLE METADATA", 1);
         assertThat(getTargetTableRecordsCount(getSourceTableOrderName()), 
is(PipelineBaseE2EIT.TABLE_INIT_ROW_COUNT + 1));
-        List<String> lastJobIds = listJobId();
-        assertTrue(lastJobIds.isEmpty());
+        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();
+        }
     }
 }
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 09d0c883c75..b8558fe35f1 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,58 +29,38 @@ 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.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+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 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.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-@RunWith(Parameterized.class)
 @Slf4j
-public class TextPrimaryKeyMigrationE2EIT extends AbstractMigrationE2EIT {
-    
-    private final PipelineTestParameter testParam;
+public final class TextPrimaryKeyMigrationE2EIT extends AbstractMigrationE2EIT 
{
     
     public TextPrimaryKeyMigrationE2EIT(final PipelineTestParameter testParam) 
{
         super(testParam);
-        this.testParam = testParam;
     }
     
     @Override
     protected String getSourceTableOrderName() {
-        if (DatabaseTypeUtil.isMySQL(getDatabaseType())) {
-            return "T_ORDER";
-        }
-        return "t_order";
+        return DatabaseTypeUtil.isMySQL(getDatabaseType()) ? "T_ORDER" : 
"t_order";
     }
     
-    @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 {
+    @ParameterizedTest(name = "{0}")
+    @EnabledIf("isEnabled")
+    @ArgumentsSource(TestCaseArgumentsProvider.class)
+    public void assertTextPrimaryMigrationSuccess(final PipelineTestParameter 
testParam) throws SQLException, InterruptedException {
         log.info("assertTextPrimaryMigrationSuccess testParam:{}", testParam);
         initEnvironment(testParam.getDatabaseType(), new MigrationJobType());
         createSourceOrderTable();
@@ -102,4 +82,26 @@ public 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 97701439502..b0026a3686b 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.arguments(each.getSqlCaseId(), 
each.getSqlCaseType(), each.getDatabaseType(), each.getVisitorType()));
+                    result.add(Arguments.of(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 c36601ee8b6..8b801c065e7 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,8 +58,7 @@ public abstract class InternalUnsupportedSQLParserIT {
         }
         
         private Collection<Arguments> getTestParameters(final 
Collection<String> databaseTypes) {
-            return SQL_CASES.generateTestParameters(databaseTypes).stream()
-                    .map(each -> Arguments.arguments(each.getSqlCaseId(), 
each.getSqlCaseType(), each.getDatabaseType())).collect(Collectors.toList());
+            return 
SQL_CASES.generateTestParameters(databaseTypes).stream().map(each -> 
Arguments.of(each.getSqlCaseId(), each.getSqlCaseType(), 
each.getDatabaseType())).collect(Collectors.toList());
         }
     }
 }


Reply via email to