24
24
import static org .apache .hadoop .hdfs .qjournal .QJMTestUtil .writeTxns ;
25
25
import static org .apache .hadoop .hdfs .qjournal .client .SpyQJournalUtil .spyGetJournaledEdits ;
26
26
import 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 ;
32
32
import static org .mockito .ArgumentMatchers .eq ;
33
33
import java .io .Closeable ;
34
34
import java .io .File ;
46
46
import org .apache .hadoop .hdfs .server .common .Util ;
47
47
import org .apache .hadoop .hdfs .server .protocol .RemoteEditLogManifest ;
48
48
import org .apache .hadoop .net .MockDomainNameResolver ;
49
+ import org .apache .hadoop .test .TestName ;
49
50
import org .apache .hadoop .thirdparty .com .google .common .util .concurrent .ListenableFuture ;
50
51
import org .apache .hadoop .thirdparty .com .google .common .util .concurrent .SettableFuture ;
51
52
import org .apache .hadoop .util .Lists ;
53
+ import org .junit .jupiter .api .extension .RegisterExtension ;
52
54
import org .mockito .stubbing .Answer ;
53
55
import org .slf4j .Logger ;
54
56
import org .slf4j .LoggerFactory ;
69
71
import org .apache .hadoop .io .IOUtils ;
70
72
import org .apache .hadoop .ipc .ProtobufRpcEngine2 ;
71
73
import 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 ;
77
78
import org .mockito .Mockito ;
78
79
import org .mockito .stubbing .Stubber ;
79
80
@@ -98,10 +99,11 @@ public class TestQuorumJournalManager {
98
99
GenericTestUtils .setLogLevel (ProtobufRpcEngine2 .LOG , Level .TRACE );
99
100
}
100
101
101
- @ Rule
102
+ @ SuppressWarnings ("checkstyle:VisibilityModifier" )
103
+ @ RegisterExtension
102
104
public TestName name = new TestName ();
103
105
104
- @ Before
106
+ @ BeforeEach
105
107
public void setup () throws Exception {
106
108
conf = new Configuration ();
107
109
if (!name .getMethodName ().equals ("testSelectThreadCounts" )) {
@@ -127,7 +129,7 @@ public void setup() throws Exception {
127
129
assertEquals (1 , qjm .getLoggerSetForTests ().getEpoch ());
128
130
}
129
131
130
- @ After
132
+ @ AfterEach
131
133
public void shutdown () throws IOException , InterruptedException ,
132
134
TimeoutException {
133
135
IOUtils .cleanupWithLogger (LOG , toClose .toArray (new Closeable [0 ]));
@@ -808,7 +810,8 @@ public void testNewerVersionOfSegmentWins2() throws Exception {
808
810
}
809
811
}
810
812
811
- @ Test (timeout =20000 )
813
+ @ Test
814
+ @ Timeout (value = 20 )
812
815
public void testCrashBetweenSyncLogAndPersistPaxosData () throws Exception {
813
816
JournalFaultInjector faultInjector =
814
817
JournalFaultInjector .instance = Mockito .mock (JournalFaultInjector .class );
@@ -1073,8 +1076,8 @@ public void testSelectThreadCounts() throws Exception {
1073
1076
.filter ((t ) -> t .getName ().contains (expectedName )).count ();
1074
1077
// The number of threads for the stopped jn shouldn't be more than the
1075
1078
// 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 );
1078
1081
}
1079
1082
1080
1083
@ Test
0 commit comments