2020
2121import static org .apache .hadoop .fs .CreateFlag .CREATE ;
2222import static org .apache .hadoop .fs .CreateFlag .OVERWRITE ;
23- import static org .junit .jupiter .api .Assertions .assertTrue ;
2423import static org .junit .jupiter .api .Assertions .assertEquals ;
24+ import static org .junit .jupiter .api .Assertions .assertNotSame ;
25+ import static org .junit .jupiter .api .Assertions .assertNull ;
26+ import static org .junit .jupiter .api .Assertions .assertTrue ;
27+ import static org .junit .jupiter .api .Assertions .fail ;
2528import static org .mockito .ArgumentMatchers .any ;
2629import static org .mockito .ArgumentMatchers .anyBoolean ;
2730import static org .mockito .ArgumentMatchers .isA ;
8689import org .apache .hadoop .yarn .server .nodemanager .executor .LocalizerStartContext ;
8790import org .apache .hadoop .yarn .server .nodemanager .recovery .NMStateStoreService ;
8891import org .junit .jupiter .api .AfterAll ;
89- import org .junit .jupiter .api .Assertions ;
9092import org .junit .jupiter .api .BeforeEach ;
9193import org .junit .jupiter .api .Test ;
9294import org .junit .jupiter .api .Timeout ;
@@ -170,7 +172,7 @@ public void testDirPermissions() throws Exception {
170172 for (String dir : localDirs ) {
171173 FileStatus stats = lfs .getFileStatus (
172174 new Path (new Path (dir , ContainerLocalizer .USERCACHE ), user ));
173- Assertions . assertEquals (userCachePerm , stats .getPermission ());
175+ assertEquals (userCachePerm , stats .getPermission ());
174176 }
175177
176178 for (String dir : localDirs ) {
@@ -179,12 +181,12 @@ public void testDirPermissions() throws Exception {
179181 Path appCachePath = new Path (userCachePath ,
180182 ContainerLocalizer .APPCACHE );
181183 FileStatus stats = lfs .getFileStatus (appCachePath );
182- Assertions . assertEquals (appCachePerm , stats .getPermission ());
184+ assertEquals (appCachePerm , stats .getPermission ());
183185 stats = lfs .getFileStatus (
184186 new Path (userCachePath , ContainerLocalizer .FILECACHE ));
185- Assertions . assertEquals (fileCachePerm , stats .getPermission ());
187+ assertEquals (fileCachePerm , stats .getPermission ());
186188 stats = lfs .getFileStatus (new Path (appCachePath , appId ));
187- Assertions . assertEquals (appDirPerm , stats .getPermission ());
189+ assertEquals (appDirPerm , stats .getPermission ());
188190 }
189191
190192 String [] permissionsArray = { "000" , "111" , "555" , "710" , "777" };
@@ -198,7 +200,7 @@ public void testDirPermissions() throws Exception {
198200
199201 for (String dir : logDirs ) {
200202 FileStatus stats = lfs .getFileStatus (new Path (dir , appId ));
201- Assertions . assertEquals (logDirPerm , stats .getPermission ());
203+ assertEquals (logDirPerm , stats .getPermission ());
202204 lfs .delete (new Path (dir , appId ), true );
203205 }
204206 }
@@ -311,7 +313,7 @@ private void testLaunchContainerCopyFiles(boolean https) throws Exception {
311313 lfs .delete (workDir , true );
312314 try {
313315 lfs .getFileStatus (workDir );
314- Assertions . fail ("Expected FileNotFoundException on " + workDir );
316+ fail ("Expected FileNotFoundException on " + workDir );
315317 } catch (FileNotFoundException e ) {
316318 // expected
317319 }
@@ -327,33 +329,33 @@ private void testLaunchContainerCopyFiles(boolean https) throws Exception {
327329 Path finalTrustorePath = new Path (workDir ,
328330 ContainerLaunch .TRUSTSTORE_FILE );
329331
330- Assertions . assertTrue (lfs .getFileStatus (workDir ).isDirectory ());
331- Assertions . assertTrue (lfs .getFileStatus (finalScriptPath ).isFile ());
332- Assertions . assertTrue (lfs .getFileStatus (finalTokensPath ).isFile ());
332+ assertTrue (lfs .getFileStatus (workDir ).isDirectory ());
333+ assertTrue (lfs .getFileStatus (finalScriptPath ).isFile ());
334+ assertTrue (lfs .getFileStatus (finalTokensPath ).isFile ());
333335 if (https ) {
334- Assertions . assertTrue (lfs .getFileStatus (finalKeystorePath ).isFile ());
335- Assertions . assertTrue (lfs .getFileStatus (finalTrustorePath ).isFile ());
336+ assertTrue (lfs .getFileStatus (finalKeystorePath ).isFile ());
337+ assertTrue (lfs .getFileStatus (finalTrustorePath ).isFile ());
336338 } else {
337339 try {
338340 lfs .getFileStatus (finalKeystorePath );
339- Assertions . fail ("Expected FileNotFoundException on " + finalKeystorePath );
341+ fail ("Expected FileNotFoundException on " + finalKeystorePath );
340342 } catch (FileNotFoundException e ) {
341343 // expected
342344 }
343345 try {
344346 lfs .getFileStatus (finalTrustorePath );
345- Assertions . fail ("Expected FileNotFoundException on " + finalKeystorePath );
347+ fail ("Expected FileNotFoundException on " + finalKeystorePath );
346348 } catch (FileNotFoundException e ) {
347349 // expected
348350 }
349351 }
350352
351- Assertions . assertEquals ("script" , readStringFromPath (lfs , finalScriptPath ));
352- Assertions . assertEquals ("tokens" , readStringFromPath (lfs , finalTokensPath ));
353+ assertEquals ("script" , readStringFromPath (lfs , finalScriptPath ));
354+ assertEquals ("tokens" , readStringFromPath (lfs , finalTokensPath ));
353355 if (https ) {
354- Assertions . assertEquals ("keystore" , readStringFromPath (lfs ,
356+ assertEquals ("keystore" , readStringFromPath (lfs ,
355357 finalKeystorePath ));
356- Assertions . assertEquals ("truststore" , readStringFromPath (lfs ,
358+ assertEquals ("truststore" , readStringFromPath (lfs ,
357359 finalTrustorePath ));
358360 }
359361 }
@@ -389,8 +391,8 @@ public void testContainerLaunchError()
389391 public Object answer (InvocationOnMock invocationOnMock )
390392 throws Throwable {
391393 String diagnostics = (String ) invocationOnMock .getArguments ()[0 ];
392- assertTrue (
393- diagnostics . contains ( "No such file or directory" ), "Invalid Diagnostics message: " + diagnostics );
394+ assertTrue (diagnostics . contains ( "No such file or directory" ),
395+ "Invalid Diagnostics message: " + diagnostics );
394396 return null ;
395397 }
396398 }
@@ -415,10 +417,9 @@ public Object answer(InvocationOnMock invocationOnMock)
415417 ContainerDiagnosticsUpdateEvent event =
416418 (ContainerDiagnosticsUpdateEvent ) invocationOnMock
417419 .getArguments ()[0 ];
418- assertTrue (
419- event .getDiagnosticsUpdate ().contains ("No such file or directory" ), "Invalid Diagnostics message: "
420- + event .getDiagnosticsUpdate ()
421- );
420+ assertTrue (event .getDiagnosticsUpdate ().contains ("No such file or directory" ),
421+ "Invalid Diagnostics message: "
422+ + event .getDiagnosticsUpdate ());
422423 return null ;
423424 }
424425 }).when (container ).handle (any (ContainerDiagnosticsUpdateEvent .class ));
@@ -466,7 +467,7 @@ public Object answer(InvocationOnMock invocationOnMock)
466467 .setLocalDirs (localDirs )
467468 .setLogDirs (logDirs )
468469 .build ());
469- Assertions . assertNotSame (0 , ret );
470+ assertNotSame (0 , ret );
470471 } finally {
471472 mockExec .deleteAsUser (new DeletionAsUserContext .Builder ()
472473 .setUser (appSubmitter )
@@ -602,7 +603,7 @@ public ContainerLocalizer createContainerLocalizer(String user,
602603 .build ());
603604
604605 } catch (IOException e ) {
605- Assertions . fail ("StartLocalizer failed to copy token file: "
606+ fail ("StartLocalizer failed to copy token file: "
606607 + StringUtils .stringifyException (e ));
607608 } finally {
608609 mockExec .deleteAsUser (new DeletionAsUserContext .Builder ()
@@ -857,7 +858,7 @@ public void testAllocateNumaMemoryResource() throws Exception {
857858 ContainerId .fromString ("container_1481156246874_0001_01_000004" ));
858859 when (mockContainer .getResource ())
859860 .thenReturn (Resource .newInstance (80000 , 2 ));
860- Assertions . assertNull (numaResourceAllocator .allocateNumaNodes (mockContainer ));
861+ assertNull (numaResourceAllocator .allocateNumaNodes (mockContainer ));
861862
862863 // allocates node 1 for memory and cpu
863864 testAllocateNumaResource ("container_1481156246874_0001_01_000005" ,
@@ -884,7 +885,7 @@ public void testAllocateNumaCpusResource() throws Exception {
884885 when (mockContainer .getContainerId ()).thenReturn (
885886 ContainerId .fromString ("container_1481156246874_0001_01_000004" ));
886887 when (mockContainer .getResource ()).thenReturn (Resource .newInstance (2048 , 2 ));
887- Assertions . assertNull (numaResourceAllocator .allocateNumaNodes (mockContainer ));
888+ assertNull (numaResourceAllocator .allocateNumaNodes (mockContainer ));
888889
889890 // allocates node 1 for memory and cpu
890891 testAllocateNumaResource ("container_1481156246874_0001_01_000005" ,
@@ -935,7 +936,7 @@ public void testReacquireContainer() throws Exception {
935936 .thenReturn (Resource .newInstance (1024 , 2 ));
936937
937938 // returns null since there are no sufficient resources available for the request
938- Assertions . assertNull (numaResourceAllocator .allocateNumaNodes (mockContainer ));
939+ assertNull (numaResourceAllocator .allocateNumaNodes (mockContainer ));
939940 }
940941
941942 @ Test
@@ -944,7 +945,7 @@ public void testConcatStringCommands() {
944945 assertEquals (containerExecutor .concatStringCommands (null , new String []{"hello" })[0 ],
945946 new String []{"hello" }[0 ]);
946947 // test both array of string as null
947- Assertions . assertNull (containerExecutor .concatStringCommands (null , null ));
948+ assertNull (containerExecutor .concatStringCommands (null , null ));
948949 // test case when both arrays are not null and of equal length
949950 String [] res = containerExecutor .concatStringCommands (new String []{"one" },
950951 new String []{"two" });
0 commit comments