diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java index d57f22ccdb5..8f9cc822211 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java @@ -903,7 +903,6 @@ public int getMaxAppAttempts() { @Override public void handle(RMAppEvent event) { - this.writeLock.lock(); try { @@ -1459,8 +1458,7 @@ public void transition(RMAppImpl app, RMAppEvent event) { } } - private static final class AppRejectedTransition extends - FinalTransition{ + private static final class AppRejectedTransition extends FinalTransition { public AppRejectedTransition() { super(RMAppState.FAILED); } @@ -1502,39 +1500,51 @@ static void appAdminClientCleanUp(RMAppImpl app) { private final RMAppState finalState; - public FinalTransition(RMAppState finalState) { + FinalTransition(RMAppState finalState) { this.finalState = finalState; } + @Override public void transition(RMAppImpl app, RMAppEvent event) { app.logAggregationStartTime = app.systemClock.getTime(); + cleanAppInRMNodes(app); + recordFinishTime(app); + removeAppFromScheduler(app); + sendEventToAppManager(app, RMAppManagerEventType.APP_COMPLETED); + handleAppFinishedWithRmContext(app); + app.clearUnusedFields(); + appAdminClientCleanUp(app); + } + + private void cleanAppInRMNodes(RMAppImpl app) { for (NodeId nodeId : app.getRanNodes()) { app.handler.handle( - new RMNodeCleanAppEvent(nodeId, app.applicationId)); + new RMNodeCleanAppEvent(nodeId, app.applicationId)); } + } + + private void recordFinishTime(RMAppImpl app) { app.finishTime = app.storedFinishTime; - if (app.finishTime == 0 ) { + if (app.finishTime == 0) { app.finishTime = app.systemClock.getTime(); } + } + + private void removeAppFromScheduler(RMAppImpl app) { // Recovered apps that are completed were not added to scheduler, so no // need to remove them from scheduler. if (app.recoveredFinalState == null) { app.handler.handle(new AppRemovedSchedulerEvent(app.applicationId, - finalState)); + finalState)); } - app.handler.handle( - new RMAppManagerEvent(app.applicationId, - RMAppManagerEventType.APP_COMPLETED)); + } + private void handleAppFinishedWithRmContext(RMAppImpl app) { app.rmContext.getRMApplicationHistoryWriter() - .applicationFinished(app, finalState); + .applicationFinished(app, finalState); app.rmContext.getSystemMetricsPublisher() - .appFinished(app, finalState, app.finishTime); - // set the memory free - app.clearUnusedFields(); - - appAdminClientCleanUp(app); - }; + .appFinished(app, finalState, app.finishTime); + } } public int getNumFailedAppAttempts() { @@ -1549,7 +1559,7 @@ public int getNumFailedAppAttempts() { return completedAttempts; } - private static final class AttemptFailedTransition implements + private static final class AttemptFailedTransition implements MultipleArcTransition { private final RMAppState initialState; @@ -1812,8 +1822,8 @@ public void aggregateLogReport(NodeId nodeId, LogAggregationReport report) { == LogAggregationStatus.TIME_OUT && report.getLogAggregationStatus() == LogAggregationStatus.RUNNING) { - // If the log aggregation status got from latest nm heartbeat - // is Running, and current log aggregation status is TimeOut, + // If the log aggregation status got from latest NM heartbeat + // is RUNNING, and current log aggregation status is TIME_OUT, // based on whether there are any failure messages for this NM, // we will reset the log aggregation status as RUNNING or // RUNNING_WITH_FAILURE @@ -2137,4 +2147,16 @@ protected void onInvalidStateTransition(RMAppEventType rmAppEventType, RMAppState state){ /* TODO fail the application on the failed transition */ } + + private static void sendEventToAppManager(RMAppImpl app, + RMAppManagerEventType event) { + app.handler.handle( + new RMAppManagerEvent(app.applicationId, event)); + } + + @VisibleForTesting + public long getLogAggregationStartTime() { + return logAggregationStartTime; + } + } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java index 70887e0f4bf..6a7ce4303ba 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java @@ -18,28 +18,7 @@ package org.apache.hadoop.yarn.server.resourcemanager.rmapp; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.io.File; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - +import com.google.common.collect.Lists; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; @@ -54,7 +33,6 @@ import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod; import org.apache.hadoop.yarn.MockApps; import org.apache.hadoop.yarn.api.ApplicationConstants.Environment; -import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; @@ -111,6 +89,31 @@ import org.mockito.ArgumentCaptor; import org.mockito.Matchers; +import java.io.File; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyLong; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + @RunWith(value = Parameterized.class) public class TestRMAppTransitions { @@ -128,13 +131,15 @@ private SystemMetricsPublisher publisher; private YarnScheduler scheduler; private TestSchedulerEventDispatcher schedulerDispatcher; + private long testCaseStartTime; + private TestApplicationManagerEventDispatcher appManagerDispatcher; // ignore all the RM application attempt events private static final class TestApplicationAttemptEventDispatcher implements - EventHandler { + EventHandler { private final RMContext rmContext; - public TestApplicationAttemptEventDispatcher(RMContext rmContext) { + TestApplicationAttemptEventDispatcher(RMContext rmContext) { this.rmContext = rmContext; } @@ -158,7 +163,7 @@ public void handle(RMAppAttemptEvent event) { EventHandler { private final RMContext rmContext; - public TestApplicationEventDispatcher(RMContext rmContext) { + TestApplicationEventDispatcher(RMContext rmContext) { this.rmContext = rmContext; } @@ -181,15 +186,18 @@ public void handle(RMAppEvent event) { // ResourceManager.java private static final class TestApplicationManagerEventDispatcher implements EventHandler { + List events = Lists.newArrayList(); @Override public void handle(RMAppManagerEvent event) { + LOG.info("Handling app manager event: " + event); + events.add(event); } } // handle all the scheduler events - same as in ResourceManager.java private static final class TestSchedulerEventDispatcher implements EventHandler { - public SchedulerEvent lastSchedulerEvent; + SchedulerEvent lastSchedulerEvent; @Override public void handle(SchedulerEvent event) { @@ -243,7 +251,7 @@ public void setUp() throws Exception { ResourceScheduler resourceScheduler = mock(ResourceScheduler.class); doReturn(null).when(resourceScheduler) - .getAppResourceUsageReport((ApplicationAttemptId)Matchers.any()); + .getAppResourceUsageReport(Matchers.any()); doReturn(resourceScheduler).when(rmContext).getScheduler(); doReturn(mock(RMTimelineCollectorManager.class)).when(rmContext) @@ -254,9 +262,11 @@ public void setUp() throws Exception { rmDispatcher.register(RMAppEventType.class, new TestApplicationEventDispatcher(rmContext)); - + + appManagerDispatcher = new + TestApplicationManagerEventDispatcher(); rmDispatcher.register(RMAppManagerEventType.class, - new TestApplicationManagerEventDispatcher()); + appManagerDispatcher); schedulerDispatcher = new TestSchedulerEventDispatcher(); rmDispatcher.register(SchedulerEventType.class, @@ -264,6 +274,7 @@ public void setUp() throws Exception { rmDispatcher.init(conf); rmDispatcher.start(); + testCaseStartTime = System.currentTimeMillis(); } private ByteBuffer getTokens() throws IOException { @@ -308,13 +319,13 @@ private ByteBuffer getTokensConf() throws IOException { localRes.setTimestamp(scriptFile.lastModified()); String destinationFile = "dest_file"; Map localResources = - new HashMap(); + new HashMap<>(); localResources.put(destinationFile, localRes); return localResources; } private Map getEnvironment() { - Map userSetEnv = new HashMap(); + Map userSetEnv = new HashMap<>(); userSetEnv.put(Environment.CONTAINER_ID.name(), "user_set_container_id"); userSetEnv.put(Environment.NM_HOST.name(), "user_set_NM_HOST"); userSetEnv.put(Environment.NM_PORT.name(), "user_set_NM_PORT"); @@ -332,12 +343,12 @@ private ContainerRetryContext getContainerRetryContext() { ContainerRetryContext containerRetryContext = ContainerRetryContext .newInstance( ContainerRetryPolicy.RETRY_ON_SPECIFIC_ERROR_CODES, - new HashSet<>(Arrays.asList(Integer.valueOf(111))), 0, 0); + new HashSet<>(Arrays.asList(111)), 0, 0); return containerRetryContext; } private Map getServiceData() { - Map serviceData = new HashMap(); + Map serviceData = new HashMap<>(); String serviceName = "non_exist_auxService"; serviceData.put(serviceName, ByteBuffer.wrap(serviceName.getBytes())); return serviceData; @@ -363,15 +374,15 @@ private ContainerLaunchContext prepareContainerLaunchContext() private LogAggregationContext getLogAggregationContext() { LogAggregationContext logAggregationContext = LogAggregationContext.newInstance( - "includePattern", "excludePattern", - "rolledLogsIncludePattern", - "rolledLogsExcludePattern", - "policyClass", - "policyParameters"); + "includePattern", "excludePattern", + "rolledLogsIncludePattern", + "rolledLogsExcludePattern", + "policyClass", + "policyParameters"); return logAggregationContext; } - protected RMApp createNewTestApp(ApplicationSubmissionContext + private RMApp createNewTestApp(ApplicationSubmissionContext submissionContext) throws IOException { ApplicationId applicationId = MockApps.newAppID(appId++); String user = MockApps.newUserName(); @@ -397,7 +408,7 @@ protected RMApp createNewTestApp(ApplicationSubmissionContext RMApp application = new RMAppImpl(applicationId, rmContext, conf, name, user, queue, submissionContext, scheduler, masterService, System.currentTimeMillis(), "YARN", null, - new ArrayList()); + new ArrayList<>()); testAppStartState(applicationId, user, name, queue, application); this.rmContext.getRMApps().putIfAbsent(application.getApplicationId(), @@ -424,8 +435,8 @@ private static void testAppStartState(ApplicationId applicationId, name, application.getName()); Assert.assertEquals("application finish time is not 0 and should be", 0, application.getFinishTime()); - Assert.assertEquals("application tracking url is not correct", - null, application.getTrackingUrl()); + Assert.assertNull("application tracking url is not correct", + application.getTrackingUrl()); StringBuilder diag = application.getDiagnostics(); Assert.assertEquals("application diagnostics is not correct", 0, diag.length()); @@ -495,12 +506,13 @@ private void sendAppUpdateSavedEvent(RMApp application) { private void sendAttemptUpdateSavedEvent(RMApp application) { application.getCurrentAppAttempt().handle( - new RMAppAttemptEvent(application.getCurrentAppAttempt().getAppAttemptId(), + new RMAppAttemptEvent( + application.getCurrentAppAttempt().getAppAttemptId(), RMAppAttemptEventType.ATTEMPT_UPDATE_SAVED)); rmDispatcher.await(); } - protected RMApp testCreateAppNewSaving( + private RMApp testCreateAppNewSaving( ApplicationSubmissionContext submissionContext) throws IOException { RMApp application = createNewTestApp(submissionContext); // NEW => NEW_SAVING event RMAppEventType.START @@ -515,7 +527,7 @@ protected RMApp testCreateAppNewSaving( return application; } - protected RMApp testCreateAppSubmittedNoRecovery( + private RMApp testCreateAppSubmittedNoRecovery( ApplicationSubmissionContext submissionContext) throws IOException { RMApp application = testCreateAppNewSaving(submissionContext); // NEW_SAVING => SUBMITTED event RMAppEventType.APP_NEW_SAVED @@ -532,7 +544,7 @@ protected RMApp testCreateAppSubmittedNoRecovery( return application; } - protected RMApp testCreateAppSubmittedRecovery( + private RMApp testCreateAppSubmittedRecovery( ApplicationSubmissionContext submissionContext) throws IOException { RMApp application = createNewTestApp(submissionContext); // NEW => SUBMITTED event RMAppEventType.RECOVER @@ -550,7 +562,7 @@ protected RMApp testCreateAppSubmittedRecovery( return application; } - protected RMApp testCreateAppAccepted( + private RMApp testCreateAppAccepted( ApplicationSubmissionContext submissionContext) throws IOException { RMApp application = testCreateAppSubmittedNoRecovery(submissionContext); // SUBMITTED => ACCEPTED event RMAppEventType.APP_ACCEPTED @@ -563,7 +575,7 @@ protected RMApp testCreateAppAccepted( return application; } - protected RMApp testCreateAppRunning( + private RMApp testCreateAppRunning( ApplicationSubmissionContext submissionContext) throws IOException { RMApp application = testCreateAppAccepted(submissionContext); // ACCEPTED => RUNNING event RMAppEventType.ATTEMPT_REGISTERED @@ -577,7 +589,7 @@ protected RMApp testCreateAppRunning( return application; } - protected RMApp testCreateAppFinalSaving( + private RMApp testCreateAppFinalSaving( ApplicationSubmissionContext submissionContext) throws IOException { RMApp application = testCreateAppRunning(submissionContext); RMAppEvent finishingEvent = @@ -589,7 +601,7 @@ protected RMApp testCreateAppFinalSaving( return application; } - protected RMApp testCreateAppFinishing( + private RMApp testCreateAppFinishing( ApplicationSubmissionContext submissionContext) throws IOException { // unmanaged AMs don't use the FINISHING state assert submissionContext == null || !submissionContext.getUnmanagedAM(); @@ -603,11 +615,11 @@ protected RMApp testCreateAppFinishing( return application; } - protected RMApp testCreateAppFinished( + private RMApp testCreateAppFinished( ApplicationSubmissionContext submissionContext, String diagnostics) throws IOException { // unmanaged AMs don't use the FINISHING state - RMApp application = null; + RMApp application; if (submissionContext != null && submissionContext.getUnmanagedAM()) { application = testCreateAppRunning(submissionContext); } else { @@ -628,7 +640,8 @@ protected RMApp testCreateAppFinished( @Test public void testUnmanagedApp() throws IOException { - ApplicationSubmissionContext subContext = new ApplicationSubmissionContextPBImpl(); + ApplicationSubmissionContext subContext = + new ApplicationSubmissionContextPBImpl(); subContext.setUnmanagedAM(true); // test success path @@ -646,7 +659,8 @@ public void testUnmanagedApp() throws IOException { LOG.info("--- START: testUnmanagedAppFailPath ---"); application = testCreateAppRunning(subContext); RMAppEvent event = new RMAppFailedAttemptEvent( - application.getApplicationId(), RMAppEventType.ATTEMPT_FAILED, "", false); + application.getApplicationId(), RMAppEventType.ATTEMPT_FAILED, "", + false); application.handle(event); rmDispatcher.await(); RMAppAttempt appAttempt = application.getCurrentAppAttempt(); @@ -1034,7 +1048,8 @@ public void testAppFinalSavingToFinished() throws IOException { application.handle(event); assertAppState(RMAppState.FINAL_SAVING, application); RMAppEvent appUpdated = - new RMAppEvent(application.getApplicationId(), RMAppEventType.APP_UPDATE_SAVED); + new RMAppEvent(application.getApplicationId(), + RMAppEventType.APP_UPDATE_SAVED); application.handle(appUpdated); assertAppState(RMAppState.FINISHED, application); @@ -1042,7 +1057,7 @@ public void testAppFinalSavingToFinished() throws IOException { // finished without a proper unregister implies failed assertFinalAppStatus(FinalApplicationStatus.FAILED, application); Assert.assertTrue("Finished app missing diagnostics", application - .getDiagnostics().indexOf(diagMsg) != -1); + .getDiagnostics().indexOf(diagMsg) != -1); verifyRMAppFieldsForFinalTransitions(application); } @@ -1152,7 +1167,7 @@ public void testAppKilledKilled() throws IOException { } @Test (timeout = 30000) - public void testAppStartAfterKilled() throws IOException { + public void testAppStartAfterKilled() { LOG.info("--- START: testAppStartAfterKilled ---"); ApplicationId applicationId = MockApps.newAppID(appId++); @@ -1162,8 +1177,8 @@ public void testAppStartAfterKilled() throws IOException { @Override protected void onInvalidStateTransition(RMAppEventType rmAppEventType, RMAppState state) { - Assert.assertTrue("RMAppImpl: can't handle " + rmAppEventType - + " at state " + state, false); + Assert.fail("RMAppImpl: can't handle " + rmAppEventType + + " at state " + state); } }; @@ -1199,9 +1214,8 @@ public void testAppsRecoveringStates() throws Exception { } } - public void testRecoverApplication(ApplicationStateData appState, - RMState rmState) - throws Exception { + private void testRecoverApplication(ApplicationStateData appState, + RMState rmState) { ApplicationSubmissionContext submissionContext = appState.getApplicationSubmissionContext(); RMAppImpl application = @@ -1232,12 +1246,12 @@ public void testRecoverApplication(ApplicationStateData appState, verifyRMAppFieldsForFinalTransitions(application); } - public void createRMStateForApplications( + private void createRMStateForApplications( Map applicationState, RMAppState rmAppState) throws IOException { RMApp app = createNewTestApp(null); - ApplicationStateData appState = - ApplicationStateData.newInstance(app.getSubmitTime(), app.getStartTime(), + ApplicationStateData appState = ApplicationStateData.newInstance( + app.getSubmitTime(), app.getStartTime(), app.getUser(), app.getApplicationSubmissionContext(), rmAppState, null, app.getLaunchTime(), app.getFinishTime(), null); applicationState.put(app.getApplicationId(), appState); @@ -1249,7 +1263,8 @@ public void testGetAppReport() throws IOException { assertAppState(RMAppState.NEW, app); ApplicationReport report = app.createAndGetApplicationReport(null, true); Assert.assertNotNull(report.getApplicationResourceUsageReport()); - Assert.assertEquals(report.getApplicationResourceUsageReport(),RMServerUtils.DUMMY_APPLICATION_RESOURCE_USAGE_REPORT); + Assert.assertEquals(report.getApplicationResourceUsageReport(), + RMServerUtils.DUMMY_APPLICATION_RESOURCE_USAGE_REPORT); report = app.createAndGetApplicationReport("clientuser", true); Assert.assertNotNull(report.getApplicationResourceUsageReport()); Assert.assertTrue("bad proxy url for app", @@ -1257,6 +1272,59 @@ public void testGetAppReport() throws IOException { + "/")); } + @Test + public void testFinalTransition() throws IOException { + RMApp application = testCreateAppFinishing(null); + verifyAppBeforeFinishEvent(application); + + RMAppEvent event = new RMAppEvent(application.getApplicationId(), + RMAppEventType.ATTEMPT_FINISHED); + application.handle(event); + rmDispatcher.await(); + + verifyAppAfterFinishEvent(application); + } + + private void verifyAppBeforeFinishEvent(RMApp app) { + assertEquals(0L, ((RMAppImpl) app).getLogAggregationStartTime()); + //RMAppEventType.APP_UPDATE_SAVED sets the finish time + assertTrue(app.getFinishTime() > testCaseStartTime); + + assertTrue("App manager events should not be received!", + appManagerDispatcher.events.isEmpty()); + } + + private void verifyAppAfterFinishEvent(RMApp app) { + assertTrue( + testCaseStartTime < ((RMAppImpl) app).getLogAggregationStartTime()); + assertTrue(testCaseStartTime < app.getFinishTime()); + verifyAppCompletedEvent(app); + verifyAppRemovedEvent(app); + } + + private void verifyAppCompletedEvent(RMApp app) { + assertEquals(1, appManagerDispatcher.events.size()); + RMAppManagerEvent rmAppManagerEvent = appManagerDispatcher.events.get(0); + assertEquals(RMAppManagerEventType.APP_COMPLETED, + rmAppManagerEvent.getType()); + assertEquals(app.getApplicationId().getId(), + rmAppManagerEvent.getApplicationId().getId()); + } + + private void verifyAppRemovedEvent(RMApp app) { + SchedulerEvent lastSchedulerEvent = schedulerDispatcher.lastSchedulerEvent; + if (!(lastSchedulerEvent instanceof AppRemovedSchedulerEvent)) { + fail("First captured event " + lastSchedulerEvent + + " should be an instance of " + "AppRemovedSchedulerEvent"); + } + AppRemovedSchedulerEvent event = + (AppRemovedSchedulerEvent) lastSchedulerEvent; + assertEquals(SchedulerEventType.APP_REMOVED, event.getType()); + assertEquals(app.getApplicationId().getId(), + event.getApplicationID().getId()); + assertEquals(RMAppState.FINISHED, event.getFinalState()); + } + private void verifyApplicationFinished(RMAppState state) { ArgumentCaptor finalState = ArgumentCaptor.forClass(RMAppState.class); @@ -1271,7 +1339,7 @@ private void verifyApplicationFinished(RMAppState state) { private void verifyAppRemovedSchedulerEvent(RMAppState finalState) { Assert.assertEquals(SchedulerEventType.APP_REMOVED, schedulerDispatcher.lastSchedulerEvent.getType()); - if(schedulerDispatcher.lastSchedulerEvent instanceof + if (schedulerDispatcher.lastSchedulerEvent instanceof AppRemovedSchedulerEvent) { AppRemovedSchedulerEvent appRemovedEvent = (AppRemovedSchedulerEvent) schedulerDispatcher.lastSchedulerEvent; @@ -1284,17 +1352,17 @@ private void verifyRMAppFieldsForNonFinalTransitions(RMApp application) assertEquals(Arrays.asList("/bin/sleep 5"), application.getApplicationSubmissionContext(). getAMContainerSpec().getCommands()); - assertEquals(getLocalResources(), - application.getApplicationSubmissionContext(). - getAMContainerSpec().getLocalResources()); - if(UserGroupInformation.isSecurityEnabled()) { - assertEquals(getTokens(), - application.getApplicationSubmissionContext(). - getAMContainerSpec().getTokens()); - assertEquals(getTokensConf(), + assertEquals(getLocalResources(), application.getApplicationSubmissionContext(). - getAMContainerSpec().getTokensConf()); - } + getAMContainerSpec().getLocalResources()); + if(UserGroupInformation.isSecurityEnabled()) { + assertEquals(getTokens(), + application.getApplicationSubmissionContext(). + getAMContainerSpec().getTokens()); + assertEquals(getTokensConf(), + application.getApplicationSubmissionContext(). + getAMContainerSpec().getTokensConf()); + } assertEquals(getEnvironment(), application.getApplicationSubmissionContext(). getAMContainerSpec().getEnvironment());