Browse Source

HDFS-12431. Upgrade JUnit from 4 to 5 in hadoop-hdfs Part1. (#7383)

Co-authored-by: Chris Nauroth <cnauroth@apache.org>
Co-authored-by: He Xiaoqiao <hexiaoqiao@apache.org>
Co-authored-by: Jian Zhang <keepromise@apache.org>
Reviewed-by: Chris Nauroth <cnauroth@apache.org>
Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
Reviewed-by: Jian Zhang <keepromise@apache.org>
Signed-off-by: Shilun Fan <slfan1989@apache.org>
slfan1989 2 months ago
parent
commit
6e7511c8ac

+ 4 - 4
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestListFilesInDFS.java

@@ -19,8 +19,8 @@ package org.apache.hadoop.hdfs;
 
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.TestListFiles;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 
 /**
  * This class tests the FileStatus API.
@@ -29,7 +29,7 @@ public class TestListFilesInDFS extends TestListFiles {
 
   private static MiniDFSCluster cluster;
 
-  @BeforeClass
+  @BeforeAll
   public static void testSetUp() throws Exception {
     setTestPaths(new Path("/tmp/TestListFilesInDFS"));
     cluster = new MiniDFSCluster.Builder(conf).build();
@@ -37,7 +37,7 @@ public class TestListFilesInDFS extends TestListFiles {
     fs.delete(TEST_DIR, true);
   }
   
-  @AfterClass
+  @AfterAll
   public static void testShutdown() throws Exception {
     if (cluster != null) {
       fs.close();

+ 8 - 8
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/crypto/TestHdfsCryptoStreams.java

@@ -31,10 +31,10 @@ import org.apache.hadoop.fs.crypto.CryptoFSDataOutputStream;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
 
 public class TestHdfsCryptoStreams extends CryptoStreamsTestBase {
   private static MiniDFSCluster dfsCluster;
@@ -43,7 +43,7 @@ public class TestHdfsCryptoStreams extends CryptoStreamsTestBase {
   private static Path path;
   private static Path file;
 
-  @BeforeClass
+  @BeforeAll
   public static void init() throws Exception {
     Configuration conf = new HdfsConfiguration();
     dfsCluster = new MiniDFSCluster.Builder(conf).build();
@@ -52,14 +52,14 @@ public class TestHdfsCryptoStreams extends CryptoStreamsTestBase {
     codec = CryptoCodec.getInstance(conf);
   }
 
-  @AfterClass
+  @AfterAll
   public static void shutdown() throws Exception {
     if (dfsCluster != null) {
       dfsCluster.shutdown();
     }
   }
 
-  @Before
+  @BeforeEach
   @Override
   public void setUp() throws IOException {
     ++pathCount;
@@ -70,7 +70,7 @@ public class TestHdfsCryptoStreams extends CryptoStreamsTestBase {
     super.setUp();
   }
 
-  @After
+  @AfterEach
   public void cleanUp() throws IOException {
     fs.delete(path, true);
   }