Skip to content

Commit a414df2

Browse files
slfan1989ayushtkn
andauthored
HADOOP-19617 - [JDK17] Remove JUnit4 Dependency - Common. (#7849)
* HADOOP-19617 - [JDK17] Remove JUnit4 Dependency - Common. Co-authored-by: Ayush Saxena <[email protected]> Reviewed-by: Ayush Saxena <[email protected]> Signed-off-by: Shilun Fan <[email protected]>
1 parent 3df1975 commit a414df2

File tree

12 files changed

+91
-101
lines changed

12 files changed

+91
-101
lines changed

hadoop-common-project/hadoop-auth/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@
4141
<artifactId>hadoop-annotations</artifactId>
4242
<scope>provided</scope>
4343
</dependency>
44-
<dependency>
45-
<groupId>junit</groupId>
46-
<artifactId>junit</artifactId>
47-
<scope>test</scope>
48-
</dependency>
4944
<dependency>
5045
<groupId>org.mockito</groupId>
5146
<artifactId>mockito-core</artifactId>

hadoop-common-project/hadoop-common/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,6 @@
162162
<artifactId>reload4j</artifactId>
163163
<scope>compile</scope>
164164
</dependency>
165-
<dependency>
166-
<groupId>junit</groupId>
167-
<artifactId>junit</artifactId>
168-
<scope>test</scope>
169-
</dependency>
170165
<dependency>
171166
<groupId>org.assertj</groupId>
172167
<artifactId>assertj-core</artifactId>

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractContractEtagTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.nio.charset.StandardCharsets;
2222

2323
import org.assertj.core.api.Assertions;
24-
import org.junit.Assume;
2524
import org.junit.jupiter.api.Test;
2625
import org.slf4j.Logger;
2726
import org.slf4j.LoggerFactory;
@@ -34,6 +33,7 @@
3433

3534
import static org.apache.hadoop.fs.CommonPathCapabilities.ETAGS_AVAILABLE;
3635
import static org.apache.hadoop.fs.CommonPathCapabilities.ETAGS_PRESERVED_IN_RENAME;
36+
import static org.assertj.core.api.Assumptions.assumeThat;
3737

3838
/**
3939
* For filesystems which support etags, validate correctness
@@ -132,9 +132,9 @@ public void testEtagConsistencyAcrossRename() throws Throwable {
132132
describe("Verify that when a file is renamed, the etag remains unchanged");
133133
final Path path = methodPath();
134134
final FileSystem fs = getFileSystem();
135-
Assume.assumeTrue(
136-
"Filesystem does not declare that etags are preserved across renames",
137-
fs.hasPathCapability(path, ETAGS_PRESERVED_IN_RENAME));
135+
assumeThat(fs.hasPathCapability(path, ETAGS_PRESERVED_IN_RENAME))
136+
.withFailMessage("Filesystem does not declare that etags are preserved across renames")
137+
.isTrue();
138138
Path src = new Path(path, "src");
139139
Path dest = new Path(path, "dest");
140140

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/rawlocal/TestRawlocalContractAppend.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
package org.apache.hadoop.fs.contract.rawlocal;
2020

21-
import org.junit.Assume;
22-
2321
import org.apache.hadoop.conf.Configuration;
2422
import org.apache.hadoop.fs.Path;
2523
import org.apache.hadoop.fs.contract.AbstractContractAppendTest;
2624
import org.apache.hadoop.fs.contract.AbstractFSContract;
2725

26+
import static org.assertj.core.api.Assumptions.assumeThat;
27+
2828
public class TestRawlocalContractAppend extends AbstractContractAppendTest {
2929

3030
@Override
@@ -36,7 +36,7 @@ protected AbstractFSContract createContract(Configuration conf) {
3636
public void testRenameFileBeingAppended() throws Throwable {
3737
// Renaming a file while its handle is open is not supported on Windows.
3838
// Thus, this test should be skipped on Windows.
39-
Assume.assumeFalse(Path.WINDOWS);
39+
assumeThat(Path.WINDOWS).isFalse();
4040

4141
super.testRenameFileBeingAppended();
4242
}

hadoop-common-project/hadoop-kms/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@
3838
<artifactId>hadoop-minikdc</artifactId>
3939
<scope>test</scope>
4040
</dependency>
41-
<dependency>
42-
<groupId>junit</groupId>
43-
<artifactId>junit</artifactId>
44-
<scope>test</scope>
45-
</dependency>
4641
<dependency>
4742
<groupId>org.mockito</groupId>
4843
<artifactId>mockito-inline</artifactId>

hadoop-common-project/hadoop-kms/src/test/java/org/apache/hadoop/crypto/key/kms/server/TestKMSAudit.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ public void testAggregation() throws Exception {
118118
kmsAudit.evictCacheForTesting();
119119
String out = getAndResetLogOutput();
120120
System.out.println(out);
121-
boolean doesMatch = out.matches(
121+
String cleanedOut =
122+
out.replaceAll("fs\\.default\\.name in core-default\\.xml is deprecated\\. " +
123+
"Instead, use fs\\.defaultFS", "");
124+
boolean doesMatch = cleanedOut.matches(
122125
"OK\\[op=DECRYPT_EEK, key=k1, user=luser@REALM, accessCount=1, "
123126
+ "interval=[^m]{1,4}ms\\] testmsg"
124127
// Not aggregated !!
@@ -156,11 +159,14 @@ public void testAggregationUnauth() throws Exception {
156159
kmsAudit.evictCacheForTesting();
157160
String out = getAndResetLogOutput();
158161
System.out.println(out);
162+
String cleanedOut =
163+
out.replaceAll("fs\\.default\\.name in core-default\\.xml is deprecated\\. " +
164+
"Instead, use fs\\.defaultFS", "");
159165

160166
// The UNAUTHORIZED will trigger cache invalidation, which then triggers
161167
// the aggregated OK (accessCount=5). But the order of the UNAUTHORIZED and
162168
// the aggregated OK is arbitrary - no correctness concerns, but flaky here.
163-
boolean doesMatch = out.matches(
169+
boolean doesMatch = cleanedOut.matches(
164170
"UNAUTHORIZED\\[op=GENERATE_EEK, key=k2, user=luser@REALM\\] "
165171
+ "OK\\[op=GENERATE_EEK, key=k3, user=luser@REALM, accessCount=1,"
166172
+ " interval=[^m]{1,4}ms\\] testmsg"
@@ -169,7 +175,7 @@ public void testAggregationUnauth() throws Exception {
169175
+ "UNAUTHORIZED\\[op=GENERATE_EEK, key=k3, user=luser@REALM\\] "
170176
+ "OK\\[op=GENERATE_EEK, key=k3, user=luser@REALM, accessCount=1,"
171177
+ " interval=[^m]{1,4}ms\\] testmsg");
172-
doesMatch = doesMatch || out.matches(
178+
doesMatch = doesMatch || cleanedOut.matches(
173179
"UNAUTHORIZED\\[op=GENERATE_EEK, key=k2, user=luser@REALM\\] "
174180
+ "OK\\[op=GENERATE_EEK, key=k3, user=luser@REALM, accessCount=1,"
175181
+ " interval=[^m]{1,4}ms\\] testmsg"

hadoop-common-project/hadoop-minikdc/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@
6868
<artifactId>junit-jupiter-engine</artifactId>
6969
<scope>provided</scope>
7070
</dependency>
71-
<dependency>
72-
<groupId>org.junit.vintage</groupId>
73-
<artifactId>junit-vintage-engine</artifactId>
74-
<scope>provided</scope>
75-
</dependency>
7671
<dependency>
7772
<groupId>org.junit.platform</groupId>
7873
<artifactId>junit-platform-launcher</artifactId>

hadoop-common-project/hadoop-nfs/pom.xml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@
5353
<scope>test</scope>
5454
<type>test-jar</type>
5555
</dependency>
56-
<dependency>
57-
<groupId>junit</groupId>
58-
<artifactId>junit</artifactId>
59-
<scope>test</scope>
60-
</dependency>
6156
<dependency>
6257
<groupId>org.mockito</groupId>
6358
<artifactId>mockito-inline</artifactId>
@@ -97,6 +92,31 @@
9792
<artifactId>assertj-core</artifactId>
9893
<scope>test</scope>
9994
</dependency>
95+
<dependency>
96+
<groupId>org.assertj</groupId>
97+
<artifactId>assertj-core</artifactId>
98+
<scope>test</scope>
99+
</dependency>
100+
<dependency>
101+
<groupId>org.junit.jupiter</groupId>
102+
<artifactId>junit-jupiter-api</artifactId>
103+
<scope>test</scope>
104+
</dependency>
105+
<dependency>
106+
<groupId>org.junit.jupiter</groupId>
107+
<artifactId>junit-jupiter-params</artifactId>
108+
<scope>test</scope>
109+
</dependency>
110+
<dependency>
111+
<groupId>org.junit.jupiter</groupId>
112+
<artifactId>junit-jupiter-engine</artifactId>
113+
<scope>test</scope>
114+
</dependency>
115+
<dependency>
116+
<groupId>org.junit.platform</groupId>
117+
<artifactId>junit-platform-launcher</artifactId>
118+
<scope>provided</scope>
119+
</dependency>
100120
</dependencies>
101121

102122
<build>

0 commit comments

Comments
 (0)