@@ -145,8 +145,7 @@ public void setUp() {
145145
146146 stateStore = new MemoryFederationStateStore ();
147147 stateStore .init (this .getConf ());
148- FederationStateStoreFacade .getInstance ().reinitialize (stateStore ,
149- getConf ());
148+ FederationStateStoreFacade .getInstance ().reinitialize (stateStore , getConf ());
150149 stateStoreUtil = new FederationStateStoreTestUtil (stateStore );
151150
152151 interceptor .setConf (this .getConf ());
@@ -186,7 +185,7 @@ protected YarnConfiguration createConfiguration() {
186185 // chain
187186 conf .set (YarnConfiguration .ROUTER_CLIENTRM_INTERCEPTOR_CLASS_PIPELINE ,
188187 mockPassThroughInterceptorClass + "," + mockPassThroughInterceptorClass
189- + "," + TestableFederationClientInterceptor .class .getName ());
188+ + "," + TestableFederationClientInterceptor .class .getName ());
190189
191190 conf .set (YarnConfiguration .FEDERATION_POLICY_MANAGER ,
192191 UniformBroadcastPolicyManager .class .getName ());
@@ -202,15 +201,15 @@ protected YarnConfiguration createConfiguration() {
202201 */
203202 @ Test
204203 public void testGetNewApplication () throws YarnException , IOException {
205- LOG .info ("Test FederationClientInterceptor: Get New Application" );
204+ LOG .info ("Test FederationClientInterceptor: Get New Application. " );
206205
207206 GetNewApplicationRequest request = GetNewApplicationRequest .newInstance ();
208207 GetNewApplicationResponse response = interceptor .getNewApplication (request );
209208
210209 Assert .assertNotNull (response );
211210 Assert .assertNotNull (response .getApplicationId ());
212- Assert .assertTrue (response .getApplicationId ()
213- . getClusterTimestamp () == ResourceManager .getClusterTimeStamp ());
211+ Assert .assertEquals (response .getApplicationId (). getClusterTimestamp (),
212+ ResourceManager .getClusterTimeStamp ());
214213 }
215214
216215 /**
@@ -220,10 +219,9 @@ public void testGetNewApplication() throws YarnException, IOException {
220219 @ Test
221220 public void testSubmitApplication ()
222221 throws YarnException , IOException {
223- LOG .info ("Test FederationClientInterceptor: Submit Application" );
222+ LOG .info ("Test FederationClientInterceptor: Submit Application. " );
224223
225- ApplicationId appId = ApplicationId .newInstance (System .currentTimeMillis (),
226- 1 );
224+ ApplicationId appId = ApplicationId .newInstance (System .currentTimeMillis (), 1 );
227225 SubmitApplicationRequest request = mockSubmitApplicationRequest (appId );
228226
229227 SubmitApplicationResponse response = interceptor .submitApplication (request );
@@ -237,14 +235,12 @@ public void testSubmitApplication()
237235 private SubmitApplicationRequest mockSubmitApplicationRequest (
238236 ApplicationId appId ) {
239237 ContainerLaunchContext amContainerSpec = mock (ContainerLaunchContext .class );
240- ApplicationSubmissionContext context = ApplicationSubmissionContext
241- .newInstance (appId , MockApps .newAppName (), "default" ,
242- Priority .newInstance (APP_PRIORITY_ZERO ), amContainerSpec , false , false , -1 ,
243- Resources .createResource (
244- YarnConfiguration .DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB ),
245- "MockApp" );
246- SubmitApplicationRequest request = SubmitApplicationRequest
247- .newInstance (context );
238+ ApplicationSubmissionContext context = ApplicationSubmissionContext .newInstance (
239+ appId , MockApps .newAppName (), "default" ,
240+ Priority .newInstance (APP_PRIORITY_ZERO ), amContainerSpec , false , false , -1 ,
241+ Resources .createResource (YarnConfiguration .DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB ),
242+ "MockApp" );
243+ SubmitApplicationRequest request = SubmitApplicationRequest .newInstance (context );
248244 return request ;
249245 }
250246
@@ -292,17 +288,15 @@ public void testSubmitApplicationEmptyRequest()
292288 interceptor .submitApplication (null );
293289 Assert .fail ();
294290 } catch (YarnException e ) {
295- Assert .assertTrue (
296- e .getMessage ().startsWith ("Missing submitApplication request or "
297- + "applicationSubmissionContext information." ));
291+ Assert .assertTrue (e .getMessage ().startsWith ("Missing submitApplication request or "
292+ + "applicationSubmissionContext information." ));
298293 }
299294 try {
300295 interceptor .submitApplication (SubmitApplicationRequest .newInstance (null ));
301296 Assert .fail ();
302297 } catch (YarnException e ) {
303- Assert .assertTrue (
304- e .getMessage ().startsWith ("Missing submitApplication request or "
305- + "applicationSubmissionContext information." ));
298+ Assert .assertTrue (e .getMessage ().startsWith ("Missing submitApplication request or "
299+ + "applicationSubmissionContext information." ));
306300 }
307301 try {
308302 ApplicationSubmissionContext context = ApplicationSubmissionContext
@@ -312,9 +306,8 @@ public void testSubmitApplicationEmptyRequest()
312306 interceptor .submitApplication (request );
313307 Assert .fail ();
314308 } catch (YarnException e ) {
315- Assert .assertTrue (
316- e .getMessage ().startsWith ("Missing submitApplication request or "
317- + "applicationSubmissionContext information." ));
309+ Assert .assertTrue (e .getMessage ().startsWith ("Missing submitApplication request or "
310+ + "applicationSubmissionContext information." ));
318311 }
319312 }
320313
@@ -325,7 +318,7 @@ public void testSubmitApplicationEmptyRequest()
325318 @ Test
326319 public void testForceKillApplication ()
327320 throws YarnException , IOException , InterruptedException {
328- LOG .info ("Test FederationClientInterceptor: Force Kill Application" );
321+ LOG .info ("Test FederationClientInterceptor: Force Kill Application. " );
329322
330323 ApplicationId appId =
331324 ApplicationId .newInstance (System .currentTimeMillis (), 1 );
@@ -337,10 +330,8 @@ public void testForceKillApplication()
337330 Assert .assertNotNull (response );
338331 Assert .assertNotNull (stateStoreUtil .queryApplicationHomeSC (appId ));
339332
340- KillApplicationRequest requestKill =
341- KillApplicationRequest .newInstance (appId );
342- KillApplicationResponse responseKill =
343- interceptor .forceKillApplication (requestKill );
333+ KillApplicationRequest requestKill = KillApplicationRequest .newInstance (appId );
334+ KillApplicationResponse responseKill = interceptor .forceKillApplication (requestKill );
344335 Assert .assertNotNull (responseKill );
345336 }
346337
@@ -361,8 +352,8 @@ public void testForceKillApplicationNotExists()
361352 interceptor .forceKillApplication (requestKill );
362353 Assert .fail ();
363354 } catch (YarnException e ) {
364- Assert .assertTrue ( e . getMessage (). equals (
365- "Application " + appId + " does not exist in FederationStateStore." ));
355+ Assert .assertEquals ( "Application " + appId + " does not exist in FederationStateStore." ,
356+ e . getMessage ( ));
366357 }
367358 }
368359
@@ -372,19 +363,15 @@ public void testForceKillApplicationNotExists()
372363 */
373364 @ Test
374365 public void testForceKillApplicationEmptyRequest ()
375- throws YarnException , IOException , InterruptedException {
376- LOG .info (
377- "Test FederationClientInterceptor: Force Kill Application - Empty" );
378- try {
379- interceptor .forceKillApplication (null );
380- Assert .fail ();
381- } catch (YarnException e ) {
382- Assert .assertTrue (e .getMessage ().startsWith (
383- "Missing forceKillApplication request or ApplicationId." ));
384- }
366+ throws Exception {
367+ LOG .info ("Test FederationClientInterceptor: Force Kill Application - Empty." );
368+
369+ LambdaTestUtils .intercept (YarnException .class ,
370+ "Missing forceKillApplication request or ApplicationId." ,
371+ () -> interceptor .forceKillApplication (null ));
372+
385373 try {
386- interceptor
387- .forceKillApplication (KillApplicationRequest .newInstance (null ));
374+ interceptor .forceKillApplication (KillApplicationRequest .newInstance (null ));
388375 Assert .fail ();
389376 } catch (YarnException e ) {
390377 Assert .assertTrue (e .getMessage ().startsWith (
@@ -427,18 +414,15 @@ public void testGetApplicationReport()
427414 @ Test
428415 public void testGetApplicationNotExists ()
429416 throws YarnException , IOException , InterruptedException {
430- LOG .info (
431- "Test ApplicationClientProtocol: Get Application Report - Not Exists" );
432- ApplicationId appId =
433- ApplicationId .newInstance (System .currentTimeMillis (), 1 );
434- GetApplicationReportRequest requestGet =
435- GetApplicationReportRequest .newInstance (appId );
417+ LOG .info ("Test ApplicationClientProtocol: Get Application Report - Not Exists." );
418+ ApplicationId appId = ApplicationId .newInstance (System .currentTimeMillis (), 1 );
419+ GetApplicationReportRequest requestGet = GetApplicationReportRequest .newInstance (appId );
436420 try {
437421 interceptor .getApplicationReport (requestGet );
438422 Assert .fail ();
439423 } catch (YarnException e ) {
440- Assert .assertTrue ( e . getMessage (). equals (
441- "Application " + appId + " does not exist in FederationStateStore." ));
424+ Assert .assertEquals ( "Application " + appId + " does not exist in FederationStateStore." ,
425+ e . getMessage ( ));
442426 }
443427 }
444428
@@ -580,7 +564,8 @@ public void testGetApplicationAttemptEmptyRequest()
580564
581565 @ Test
582566 public void testGetClusterMetricsRequest () throws Exception {
583- LOG .info ("Test FederationClientInterceptor : Get Cluster Metrics request" );
567+ LOG .info ("Test FederationClientInterceptor : Get Cluster Metrics request." );
568+
584569 // null request
585570 LambdaTestUtils .intercept (YarnException .class , "Missing getClusterMetrics request." ,
586571 () -> interceptor .getClusterMetrics (null ));
@@ -594,10 +579,9 @@ public void testGetClusterMetricsRequest() throws Exception {
594579 ClientMethod remoteMethod = new ClientMethod ("getClusterMetrics" ,
595580 new Class [] {GetClusterMetricsRequest .class },
596581 new Object [] {GetClusterMetricsRequest .newInstance ()});
597- Map <SubClusterId , GetClusterMetricsResponse > clusterMetrics =interceptor .
598- invokeConcurrent (new ArrayList <>(), remoteMethod ,
599- GetClusterMetricsResponse .class );
600- Assert .assertEquals (true , clusterMetrics .isEmpty ());
582+ Map <SubClusterId , GetClusterMetricsResponse > clusterMetrics = interceptor .
583+ invokeConcurrent (new ArrayList <>(), remoteMethod , GetClusterMetricsResponse .class );
584+ Assert .assertTrue (clusterMetrics .isEmpty ());
601585 }
602586
603587 /**
@@ -609,8 +593,7 @@ public void testGetClusterMetricsRequest() throws Exception {
609593 public void testGetApplicationsResponse ()
610594 throws YarnException , IOException , InterruptedException {
611595 LOG .info ("Test FederationClientInterceptor: Get Applications Response" );
612- ApplicationId appId =
613- ApplicationId .newInstance (System .currentTimeMillis (), 1 );
596+ ApplicationId appId = ApplicationId .newInstance (System .currentTimeMillis (), 1 );
614597
615598 SubmitApplicationRequest request = mockSubmitApplicationRequest (appId );
616599 SubmitApplicationResponse response = interceptor .submitApplication (request );
@@ -619,11 +602,8 @@ public void testGetApplicationsResponse()
619602 Assert .assertNotNull (stateStoreUtil .queryApplicationHomeSC (appId ));
620603
621604 Set <String > appTypes = Collections .singleton ("MockApp" );
622- GetApplicationsRequest requestGet =
623- GetApplicationsRequest .newInstance (appTypes );
624-
625- GetApplicationsResponse responseGet =
626- interceptor .getApplications (requestGet );
605+ GetApplicationsRequest requestGet = GetApplicationsRequest .newInstance (appTypes );
606+ GetApplicationsResponse responseGet = interceptor .getApplications (requestGet );
627607
628608 Assert .assertNotNull (responseGet );
629609 }
@@ -636,8 +616,7 @@ public void testGetApplicationsResponse()
636616 @ Test
637617 public void testGetApplicationsNullRequest () throws Exception {
638618 LOG .info ("Test FederationClientInterceptor: Get Applications request" );
639- LambdaTestUtils .intercept (YarnException .class ,
640- "Missing getApplications request." ,
619+ LambdaTestUtils .intercept (YarnException .class , "Missing getApplications request." ,
641620 () -> interceptor .getApplications (null ));
642621 }
643622
@@ -648,11 +627,9 @@ public void testGetApplicationsNullRequest() throws Exception {
648627 */
649628 @ Test
650629 public void testGetApplicationsApplicationTypeNotExists () throws Exception {
651- LOG .info ("Test FederationClientInterceptor: Application with type does "
652- + "not exist" );
630+ LOG .info ("Test FederationClientInterceptor: Application with type does not exist." );
653631
654- ApplicationId appId =
655- ApplicationId .newInstance (System .currentTimeMillis (), 1 );
632+ ApplicationId appId = ApplicationId .newInstance (System .currentTimeMillis (), 1 );
656633
657634 SubmitApplicationRequest request = mockSubmitApplicationRequest (appId );
658635 SubmitApplicationResponse response = interceptor .submitApplication (request );
@@ -662,11 +639,8 @@ public void testGetApplicationsApplicationTypeNotExists() throws Exception{
662639
663640 Set <String > appTypes = Collections .singleton ("SPARK" );
664641
665- GetApplicationsRequest requestGet =
666- GetApplicationsRequest .newInstance (appTypes );
667-
668- GetApplicationsResponse responseGet =
669- interceptor .getApplications (requestGet );
642+ GetApplicationsRequest requestGet = GetApplicationsRequest .newInstance (appTypes );
643+ GetApplicationsResponse responseGet = interceptor .getApplications (requestGet );
670644
671645 Assert .assertNotNull (responseGet );
672646 Assert .assertTrue (responseGet .getApplicationList ().isEmpty ());
@@ -707,7 +681,7 @@ public void testGetApplicationsApplicationStateNotExists() throws Exception {
707681
708682 @ Test
709683 public void testGetClusterNodesRequest () throws Exception {
710- LOG .info ("Test FederationClientInterceptor : Get Cluster Nodeds request" );
684+ LOG .info ("Test FederationClientInterceptor : Get Cluster Nodes request" );
711685 // null request
712686 LambdaTestUtils .intercept (YarnException .class , "Missing getClusterNodes request." ,
713687 () -> interceptor .getClusterNodes (null ));
@@ -1096,7 +1070,7 @@ public void testSignalContainer() throws Exception {
10961070 RMAppAttemptState .SCHEDULED );
10971071 MockNM nm = interceptor .getMockNMs ().get (subClusterId );
10981072 nm .nodeHeartbeat (true );
1099- mockRM .waitForState (rmApp .getCurrentAppAttempt (), RMAppAttemptState .ALLOCATED );
1073+ MockRM .waitForState (rmApp .getCurrentAppAttempt (), RMAppAttemptState .ALLOCATED );
11001074 mockRM .sendAMLaunched (rmApp .getCurrentAppAttempt ().getAppAttemptId ());
11011075
11021076 ContainerId containerId = rmApp .getCurrentAppAttempt ().getMasterContainer ().getId ();
@@ -1134,10 +1108,10 @@ public void testMoveApplicationAcrossQueues() throws Exception {
11341108 mockRM .waitForState (appId , RMAppState .ACCEPTED );
11351109 RMApp rmApp = mockRM .getRMContext ().getRMApps ().get (appId );
11361110 mockRM .waitForState (rmApp .getCurrentAppAttempt ().getAppAttemptId (),
1137- RMAppAttemptState .SCHEDULED );
1111+ RMAppAttemptState .SCHEDULED );
11381112 MockNM nm = interceptor .getMockNMs ().get (subClusterId );
11391113 nm .nodeHeartbeat (true );
1140- mockRM .waitForState (rmApp .getCurrentAppAttempt (), RMAppAttemptState .ALLOCATED );
1114+ MockRM .waitForState (rmApp .getCurrentAppAttempt (), RMAppAttemptState .ALLOCATED );
11411115 mockRM .sendAMLaunched (rmApp .getCurrentAppAttempt ().getAppAttemptId ());
11421116
11431117 MoveApplicationAcrossQueuesRequest acrossQueuesRequest =
0 commit comments