2424import static org .apache .hadoop .hdfs .qjournal .QJMTestUtil .writeTxns ;
2525import static org .apache .hadoop .hdfs .qjournal .client .SpyQJournalUtil .spyGetJournaledEdits ;
2626import static org .apache .hadoop .hdfs .qjournal .client .TestQuorumJournalManagerUnit .futureThrows ;
27- import static org .junit .Assert .assertEquals ;
28- import static org .junit .Assert .assertFalse ;
29- import static org .junit .Assert .assertNull ;
30- import static org .junit .Assert .assertTrue ;
31- import static org .junit .Assert .fail ;
27+ import static org .junit .jupiter . api . Assertions .assertEquals ;
28+ import static org .junit .jupiter . api . Assertions .assertFalse ;
29+ import static org .junit .jupiter . api . Assertions .assertNull ;
30+ import static org .junit .jupiter . api . Assertions .assertTrue ;
31+ import static org .junit .jupiter . api . Assertions .fail ;
3232import static org .mockito .ArgumentMatchers .eq ;
3333import java .io .Closeable ;
3434import java .io .File ;
4646import org .apache .hadoop .hdfs .server .common .Util ;
4747import org .apache .hadoop .hdfs .server .protocol .RemoteEditLogManifest ;
4848import org .apache .hadoop .net .MockDomainNameResolver ;
49+ import org .apache .hadoop .test .TestName ;
4950import org .apache .hadoop .thirdparty .com .google .common .util .concurrent .ListenableFuture ;
5051import org .apache .hadoop .thirdparty .com .google .common .util .concurrent .SettableFuture ;
5152import org .apache .hadoop .util .Lists ;
53+ import org .junit .jupiter .api .extension .RegisterExtension ;
5254import org .mockito .stubbing .Answer ;
5355import org .slf4j .Logger ;
5456import org .slf4j .LoggerFactory ;
6971import org .apache .hadoop .io .IOUtils ;
7072import org .apache .hadoop .ipc .ProtobufRpcEngine2 ;
7173import org .apache .hadoop .test .GenericTestUtils ;
72- import org .junit .After ;
73- import org .junit .Before ;
74- import org .junit .Rule ;
75- import org .junit .Test ;
76- import org .junit .rules .TestName ;
74+ import org .junit .jupiter .api .AfterEach ;
75+ import org .junit .jupiter .api .BeforeEach ;
76+ import org .junit .jupiter .api .Test ;
77+ import org .junit .jupiter .api .Timeout ;
7778import org .mockito .Mockito ;
7879import org .mockito .stubbing .Stubber ;
7980
@@ -98,10 +99,11 @@ public class TestQuorumJournalManager {
9899 GenericTestUtils .setLogLevel (ProtobufRpcEngine2 .LOG , Level .TRACE );
99100 }
100101
101- @ Rule
102+ @ SuppressWarnings ("checkstyle:VisibilityModifier" )
103+ @ RegisterExtension
102104 public TestName name = new TestName ();
103105
104- @ Before
106+ @ BeforeEach
105107 public void setup () throws Exception {
106108 conf = new Configuration ();
107109 if (!name .getMethodName ().equals ("testSelectThreadCounts" )) {
@@ -127,7 +129,7 @@ public void setup() throws Exception {
127129 assertEquals (1 , qjm .getLoggerSetForTests ().getEpoch ());
128130 }
129131
130- @ After
132+ @ AfterEach
131133 public void shutdown () throws IOException , InterruptedException ,
132134 TimeoutException {
133135 IOUtils .cleanupWithLogger (LOG , toClose .toArray (new Closeable [0 ]));
@@ -808,7 +810,8 @@ public void testNewerVersionOfSegmentWins2() throws Exception {
808810 }
809811 }
810812
811- @ Test (timeout =20000 )
813+ @ Test
814+ @ Timeout (value = 20 )
812815 public void testCrashBetweenSyncLogAndPersistPaxosData () throws Exception {
813816 JournalFaultInjector faultInjector =
814817 JournalFaultInjector .instance = Mockito .mock (JournalFaultInjector .class );
@@ -1073,8 +1076,8 @@ public void testSelectThreadCounts() throws Exception {
10731076 .filter ((t ) -> t .getName ().contains (expectedName )).count ();
10741077 // The number of threads for the stopped jn shouldn't be more than the
10751078 // configured value.
1076- assertTrue ("Number of threads are : " + num ,
1077- num <= DFSConfigKeys . DFS_QJOURNAL_PARALLEL_READ_NUM_THREADS_DEFAULT );
1079+ assertTrue (num <= DFSConfigKeys . DFS_QJOURNAL_PARALLEL_READ_NUM_THREADS_DEFAULT ,
1080+ "Number of threads are : " + num );
10781081 }
10791082
10801083 @ Test
0 commit comments