Skip to content

Commit 199e549

Browse files
committed
HADOOP-19427. Upgrade JUnit from 4 to 5 in hadoop-compat-bench.
1 parent 71aa0e4 commit 199e549

File tree

5 files changed

+53
-28
lines changed

5 files changed

+53
-28
lines changed

hadoop-tools/hadoop-compat-bench/pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,31 @@
6969
<artifactId>mockito-inline</artifactId>
7070
<scope>test</scope>
7171
</dependency>
72+
<dependency>
73+
<groupId>org.junit.jupiter</groupId>
74+
<artifactId>junit-jupiter-api</artifactId>
75+
<scope>test</scope>
76+
</dependency>
77+
<dependency>
78+
<groupId>org.junit.jupiter</groupId>
79+
<artifactId>junit-jupiter-engine</artifactId>
80+
<scope>test</scope>
81+
</dependency>
82+
<dependency>
83+
<groupId>org.junit.jupiter</groupId>
84+
<artifactId>junit-jupiter-params</artifactId>
85+
<scope>test</scope>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.junit.platform</groupId>
89+
<artifactId>junit-platform-launcher</artifactId>
90+
<scope>test</scope>
91+
</dependency>
92+
<dependency>
93+
<groupId>org.junit.vintage</groupId>
94+
<artifactId>junit-vintage-engine</artifactId>
95+
<scope>test</scope>
96+
</dependency>
7297
</dependencies>
7398

7499
<build>

hadoop-tools/hadoop-compat-bench/src/test/java/org/apache/hadoop/fs/compat/common/TestHdfsCompatDefaultSuites.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import org.apache.hadoop.fs.compat.hdfs.HdfsCompatMiniCluster;
2222
import org.apache.hadoop.fs.compat.hdfs.HdfsCompatTestCommand;
2323
import org.apache.hadoop.conf.Configuration;
24-
import org.junit.Assert;
25-
import org.junit.Test;
24+
import org.junit.jupiter.api.Assertions;
25+
import org.junit.jupiter.api.Test;
2626

2727
public class TestHdfsCompatDefaultSuites {
2828
@Test
@@ -35,7 +35,7 @@ public void testSuiteAll() throws Exception {
3535
HdfsCompatCommand cmd = new HdfsCompatTestCommand(uri, "ALL", conf);
3636
cmd.initialize();
3737
HdfsCompatReport report = cmd.apply();
38-
Assert.assertEquals(0, report.getFailedCase().size());
38+
Assertions.assertEquals(0, report.getFailedCase().size());
3939
new HdfsCompatTool(conf).printReport(report, System.out);
4040
} finally {
4141
cluster.shutdown();
@@ -52,7 +52,7 @@ public void testSuiteTpcds() throws Exception {
5252
HdfsCompatCommand cmd = new HdfsCompatTestCommand(uri, "TPCDS", conf);
5353
cmd.initialize();
5454
HdfsCompatReport report = cmd.apply();
55-
Assert.assertEquals(0, report.getFailedCase().size());
55+
Assertions.assertEquals(0, report.getFailedCase().size());
5656
new HdfsCompatTool(conf).printReport(report, System.out);
5757
} finally {
5858
cluster.shutdown();

hadoop-tools/hadoop-compat-bench/src/test/java/org/apache/hadoop/fs/compat/common/TestHdfsCompatFsCommand.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
import org.apache.hadoop.fs.compat.cases.HdfsCompatMkdirTestCases;
2626
import org.apache.hadoop.fs.FileSystem;
2727
import org.apache.hadoop.fs.Path;
28-
import org.junit.Assert;
29-
import org.junit.Test;
28+
import org.junit.jupiter.api.Assertions;
29+
import org.junit.jupiter.api.Test;
3030

3131
import java.io.IOException;
3232
import java.lang.reflect.Field;
@@ -47,8 +47,8 @@ public void testDfsCompatibility() throws Exception {
4747
HdfsCompatCommand cmd = new TestCommand(uri, suite, conf);
4848
cmd.initialize();
4949
HdfsCompatReport report = cmd.apply();
50-
Assert.assertEquals(7, report.getPassedCase().size());
51-
Assert.assertEquals(0, report.getFailedCase().size());
50+
Assertions.assertEquals(7, report.getPassedCase().size());
51+
Assertions.assertEquals(0, report.getFailedCase().size());
5252
show(conf, report);
5353
} finally {
5454
if (cluster != null) {
@@ -65,8 +65,8 @@ public void testLocalFsCompatibility() throws Exception {
6565
HdfsCompatCommand cmd = new TestCommand(uri, suite, conf);
6666
cmd.initialize();
6767
HdfsCompatReport report = cmd.apply();
68-
Assert.assertEquals(1, report.getPassedCase().size());
69-
Assert.assertEquals(6, report.getFailedCase().size());
68+
Assertions.assertEquals(1, report.getPassedCase().size());
69+
Assertions.assertEquals(6, report.getFailedCase().size());
7070
show(conf, report);
7171
cleanup(cmd, conf);
7272
}
@@ -79,8 +79,8 @@ public void testFsCompatibilityWithSuite() throws Exception {
7979
HdfsCompatCommand cmd = new TestCommand(uri, suite, conf);
8080
cmd.initialize();
8181
HdfsCompatReport report = cmd.apply();
82-
Assert.assertEquals(0, report.getPassedCase().size());
83-
Assert.assertEquals(6, report.getFailedCase().size());
82+
Assertions.assertEquals(0, report.getPassedCase().size());
83+
Assertions.assertEquals(6, report.getFailedCase().size());
8484
show(conf, report);
8585
cleanup(cmd, conf);
8686
}

hadoop-tools/hadoop-compat-bench/src/test/java/org/apache/hadoop/fs/compat/common/TestHdfsCompatInterfaceCoverage.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@
2020

2121
import org.apache.hadoop.fs.compat.cases.HdfsCompatBasics;
2222
import org.apache.hadoop.fs.FileSystem;
23-
import org.junit.Assert;
24-
import org.junit.Ignore;
25-
import org.junit.Test;
23+
import org.junit.jupiter.api.Assertions;
24+
import org.junit.jupiter.api.Test;
25+
import org.junit.jupiter.api.Disabled;
2626

2727
import java.lang.reflect.Method;
2828
import java.util.HashSet;
2929
import java.util.Set;
3030

3131
public class TestHdfsCompatInterfaceCoverage {
3232
@Test
33-
@Ignore
33+
@Disabled
3434
public void testFsCompatibility() {
3535
Set<String> publicMethods = getPublicInterfaces(FileSystem.class);
3636
Set<String> targets = getTargets(HdfsCompatBasics.class);
3737
for (String publicMethod : publicMethods) {
38-
Assert.assertTrue("Method not tested: " + publicMethod,
39-
targets.contains(publicMethod));
38+
Assertions.assertTrue(
39+
targets.contains(publicMethod), "Method not tested: " + publicMethod);
4040
}
4141
}
4242

hadoop-tools/hadoop-compat-bench/src/test/java/org/apache/hadoop/fs/compat/common/TestHdfsCompatShellCommand.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
import org.apache.hadoop.fs.compat.hdfs.HdfsCompatTestCommand;
2525
import org.apache.hadoop.fs.compat.hdfs.HdfsCompatTestShellScope;
2626
import org.apache.hadoop.conf.Configuration;
27-
import org.junit.After;
28-
import org.junit.Assert;
29-
import org.junit.Before;
30-
import org.junit.Test;
27+
import org.junit.jupiter.api.AfterEach;
28+
import org.junit.jupiter.api.Assertions;
29+
import org.junit.jupiter.api.BeforeEach;
30+
import org.junit.jupiter.api.Test;
3131

3232
import java.io.File;
3333
import java.io.IOException;
@@ -36,13 +36,13 @@
3636
public class TestHdfsCompatShellCommand {
3737
private HdfsCompatMiniCluster cluster;
3838

39-
@Before
39+
@BeforeEach
4040
public void runCluster() throws IOException {
4141
this.cluster = new HdfsCompatMiniCluster();
4242
this.cluster.start();
4343
}
4444

45-
@After
45+
@AfterEach
4646
public void shutdownCluster() {
4747
this.cluster.shutdown();
4848
this.cluster = null;
@@ -55,8 +55,8 @@ public void testDfsCompatibility() throws Exception {
5555
HdfsCompatCommand cmd = new TestCommand(uri, conf);
5656
cmd.initialize();
5757
HdfsCompatReport report = cmd.apply();
58-
Assert.assertEquals(3, report.getPassedCase().size());
59-
Assert.assertEquals(0, report.getFailedCase().size());
58+
Assertions.assertEquals(3, report.getPassedCase().size());
59+
Assertions.assertEquals(0, report.getFailedCase().size());
6060
show(conf, report);
6161
}
6262

@@ -67,8 +67,8 @@ public void testSkipCompatibility() throws Exception {
6767
HdfsCompatCommand cmd = new TestSkipCommand(uri, conf);
6868
cmd.initialize();
6969
HdfsCompatReport report = cmd.apply();
70-
Assert.assertEquals(2, report.getPassedCase().size());
71-
Assert.assertEquals(0, report.getFailedCase().size());
70+
Assertions.assertEquals(2, report.getPassedCase().size());
71+
Assertions.assertEquals(0, report.getFailedCase().size());
7272
show(conf, report);
7373
}
7474

0 commit comments

Comments
 (0)