3838import org .apache .hadoop .yarn .server .timelineservice .storage .FileSystemTimelineWriterImpl ;
3939import org .apache .hadoop .yarn .server .timelineservice .storage .TimelineWriter ;
4040import org .apache .hadoop .yarn .server .utils .BuilderUtils ;
41- import org .junit .Assert ;
42- import org .junit .Test ;
41+ import org .junit .jupiter . api . Assertions ;
42+ import org .junit .jupiter . api . Test ;
4343import org .mockito .ArgumentMatchers ;
4444import org .mockito .Mockito ;
4545
@@ -105,12 +105,12 @@ public void testDSAppMasterAllocateHandler() throws Exception {
105105
106106 // first allocate a single container, everything should be fine
107107 handler .onContainersAllocated (containers );
108- Assert .assertEquals ("Wrong container allocation count" , 1 ,
109- master .getAllocatedContainers ());
110- Assert .assertEquals ("Incorrect number of threads launched" , 1 ,
111- master .threadsLaunched );
112- Assert .assertEquals ("Incorrect YARN Shell IDs" ,
113- Arrays .asList ("1" ), master .yarnShellIds );
108+ Assertions .assertEquals (1
109+ , master .getAllocatedContainers (), "Wrong container allocation count" );
110+ Assertions .assertEquals (1
111+ , master .threadsLaunched , "Incorrect number of threads launched" );
112+ Assertions .assertEquals (
113+ Arrays .asList ("1" ), master .yarnShellIds , "Incorrect YARN Shell IDs" );
114114
115115 // now send 3 extra containers
116116 containers .clear ();
@@ -121,14 +121,14 @@ public void testDSAppMasterAllocateHandler() throws Exception {
121121 ContainerId id4 = BuilderUtils .newContainerId (1 , 1 , 1 , 4 );
122122 containers .add (generateContainer (id4 ));
123123 handler .onContainersAllocated (containers );
124- Assert .assertEquals ("Wrong final container allocation count" , 2 ,
125- master .getAllocatedContainers ());
124+ Assertions .assertEquals (2
125+ , master .getAllocatedContainers (), "Wrong final container allocation count" );
126126
127- Assert .assertEquals ("Incorrect number of threads launched" , 2 ,
128- master .threadsLaunched );
127+ Assertions .assertEquals (2
128+ , master .threadsLaunched , "Incorrect number of threads launched" );
129129
130- Assert .assertEquals ("Incorrect YARN Shell IDs" ,
131- Arrays .asList ("1" , "2" ), master .yarnShellIds );
130+ Assertions .assertEquals (
131+ Arrays .asList ("1" , "2" ), master .yarnShellIds , "Incorrect YARN Shell IDs" );
132132 // make sure we handle completion events correctly
133133 List <ContainerStatus > status = new ArrayList <>();
134134 status .add (generateContainerStatus (id1 , ContainerExitStatus .SUCCESS ));
@@ -137,25 +137,25 @@ public void testDSAppMasterAllocateHandler() throws Exception {
137137 status .add (generateContainerStatus (id4 , ContainerExitStatus .ABORTED ));
138138 handler .onContainersCompleted (status );
139139
140- Assert .assertEquals ("Unexpected number of completed containers" ,
141- targetContainers , master .getNumCompletedContainers ());
142- Assert .assertTrue ("Master didn't finish containers as expected" ,
143- master .getDone ());
140+ Assertions .assertEquals (
141+ targetContainers , master .getNumCompletedContainers (), "Unexpected number of completed containers" );
142+ Assertions .assertTrue (
143+ master .getDone (), "Master didn't finish containers as expected" );
144144
145145 // test for events from containers we know nothing about
146146 // these events should be ignored
147147 status = new ArrayList <>();
148148 ContainerId id5 = BuilderUtils .newContainerId (1 , 1 , 1 , 5 );
149149 status .add (generateContainerStatus (id5 , ContainerExitStatus .ABORTED ));
150- Assert .assertEquals ("Unexpected number of completed containers" ,
151- targetContainers , master .getNumCompletedContainers ());
152- Assert .assertTrue ("Master didn't finish containers as expected" ,
153- master .getDone ());
150+ Assertions .assertEquals (
151+ targetContainers , master .getNumCompletedContainers (), "Unexpected number of completed containers" );
152+ Assertions .assertTrue (
153+ master .getDone (), "Master didn't finish containers as expected" );
154154 status .add (generateContainerStatus (id5 , ContainerExitStatus .SUCCESS ));
155- Assert .assertEquals ("Unexpected number of completed containers" ,
156- targetContainers , master .getNumCompletedContainers ());
157- Assert .assertTrue ("Master didn't finish containers as expected" ,
158- master .getDone ());
155+ Assertions .assertEquals (
156+ targetContainers , master .getNumCompletedContainers (), "Unexpected number of completed containers" );
157+ Assertions .assertTrue (
158+ master .getDone (), "Master didn't finish containers as expected" );
159159 }
160160
161161 private Container generateContainer (ContainerId cid ) {
@@ -200,15 +200,15 @@ private void runTimelineClientInDSAppMaster(boolean v1Enabled,
200200 private void validateAppMasterTimelineService (boolean v1Enabled ,
201201 boolean v2Enabled , ApplicationMaster appMaster ) {
202202 if (v1Enabled ) {
203- Assert .assertEquals (appMaster .appSubmitterUgi ,
203+ Assertions .assertEquals (appMaster .appSubmitterUgi ,
204204 ((TimelineClientImpl )appMaster .timelineClient ).getUgi ());
205205 } else {
206- Assert .assertNull (appMaster .timelineClient );
206+ Assertions .assertNull (appMaster .timelineClient );
207207 }
208208 if (v2Enabled ) {
209- Assert .assertNotNull (appMaster .timelineV2Client );
209+ Assertions .assertNotNull (appMaster .timelineV2Client );
210210 } else {
211- Assert .assertNull (appMaster .timelineV2Client );
211+ Assertions .assertNull (appMaster .timelineV2Client );
212212 }
213213 }
214214
@@ -227,7 +227,7 @@ private ApplicationMaster createAppMasterWithStartedTimelineService(
227227 private Configuration getTimelineServiceConf (boolean v1Enabled ,
228228 boolean v2Enabled ) {
229229 Configuration conf = new YarnConfiguration (new Configuration (false ));
230- Assert .assertFalse (YarnConfiguration .timelineServiceEnabled (conf ));
230+ Assertions .assertFalse (YarnConfiguration .timelineServiceEnabled (conf ));
231231
232232 if (v1Enabled || v2Enabled ) {
233233 conf .setBoolean (YarnConfiguration .TIMELINE_SERVICE_ENABLED , true );
0 commit comments