From 76d5e7e6457e37e781c4c19c557e1dca9f61a746 Mon Sep 17 00:00:00 2001 From: rickchengx Date: Fri, 14 Oct 2022 18:08:06 +0800 Subject: [PATCH] [Improvement-12333][Test] Migrate all UT cases from jUnit 4 to jUnit 5 in microbench and e2e module --- .../e2e/pages/common/CodeEditor.java | 1 - .../e2e/core/TestDescription.java | 4 +- dolphinscheduler-microbench/pom.xml | 37 +++++++++---------- .../base/AbstractBaseBenchmark.java | 3 +- 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/CodeEditor.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/CodeEditor.java index fa9b269657bf..8e610fb8d5f4 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/CodeEditor.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/common/CodeEditor.java @@ -19,7 +19,6 @@ */ package org.apache.dolphinscheduler.e2e.pages.common; -import org.junit.rules.ExpectedException; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/TestDescription.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/TestDescription.java index 16f366cd832f..59ef66b7f6ae 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/TestDescription.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/TestDescription.java @@ -21,8 +21,6 @@ import static java.nio.charset.StandardCharsets.UTF_8; -import static org.junit.platform.commons.util.StringUtils.isBlank; - import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -45,7 +43,7 @@ public String getTestId() { public String getFilesystemFriendlyName() { final String contextId = context.getUniqueId(); try { - return (isBlank(contextId)) + return (contextId == null || contextId.trim().isEmpty()) ? UNKNOWN_NAME : URLEncoder.encode(contextId, UTF_8.toString()); } catch (UnsupportedEncodingException e) { diff --git a/dolphinscheduler-microbench/pom.xml b/dolphinscheduler-microbench/pom.xml index 9ee35e09d08b..59f71c50d566 100644 --- a/dolphinscheduler-microbench/pom.xml +++ b/dolphinscheduler-microbench/pom.xml @@ -15,15 +15,14 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + 4.0.0 - dolphinscheduler org.apache.dolphinscheduler + dolphinscheduler dev-SNAPSHOT - 4.0.0 dolphinscheduler-microbench jar @@ -35,6 +34,18 @@ benchmarks + + + + org.apache.dolphinscheduler + dolphinscheduler-bom + ${project.version} + pom + import + + + + @@ -51,9 +62,8 @@ - junit - junit - compile + org.junit.jupiter + junit-jupiter-api @@ -67,18 +77,6 @@ - - - - org.apache.dolphinscheduler - dolphinscheduler-bom - ${project.version} - pom - import - - - - @@ -112,5 +110,4 @@ - diff --git a/dolphinscheduler-microbench/src/main/java/org/apache/dolphinscheduler/microbench/base/AbstractBaseBenchmark.java b/dolphinscheduler-microbench/src/main/java/org/apache/dolphinscheduler/microbench/base/AbstractBaseBenchmark.java index 2059f3f26606..3fc0b67ef734 100644 --- a/dolphinscheduler-microbench/src/main/java/org/apache/dolphinscheduler/microbench/base/AbstractBaseBenchmark.java +++ b/dolphinscheduler-microbench/src/main/java/org/apache/dolphinscheduler/microbench/base/AbstractBaseBenchmark.java @@ -20,7 +20,7 @@ import java.io.File; import java.io.IOException; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Scope; @@ -122,4 +122,3 @@ private static int getForks() { } } -