private static RMApp CreateRMApp(ApplicationId appId) { RMApp app = Org.Mockito.Mockito.Mock <RMApp>(); Org.Mockito.Mockito.When(app.GetApplicationId()).ThenReturn(appId); Org.Mockito.Mockito.When(app.GetName()).ThenReturn("test app"); Org.Mockito.Mockito.When(app.GetApplicationType()).ThenReturn("test app type"); Org.Mockito.Mockito.When(app.GetUser()).ThenReturn("test user"); Org.Mockito.Mockito.When(app.GetQueue()).ThenReturn("test queue"); Org.Mockito.Mockito.When(app.GetSubmitTime()).ThenReturn(int.MaxValue + 1L); Org.Mockito.Mockito.When(app.GetStartTime()).ThenReturn(int.MaxValue + 2L); Org.Mockito.Mockito.When(app.GetFinishTime()).ThenReturn(int.MaxValue + 3L); Org.Mockito.Mockito.When(app.GetDiagnostics()).ThenReturn(new StringBuilder("test diagnostics info" )); RMAppAttempt appAttempt = Org.Mockito.Mockito.Mock <RMAppAttempt>(); Org.Mockito.Mockito.When(appAttempt.GetAppAttemptId()).ThenReturn(ApplicationAttemptId .NewInstance(appId, 1)); Org.Mockito.Mockito.When(app.GetCurrentAppAttempt()).ThenReturn(appAttempt); Org.Mockito.Mockito.When(app.GetFinalApplicationStatus()).ThenReturn(FinalApplicationStatus .Undefined); Org.Mockito.Mockito.When(app.GetRMAppMetrics()).ThenReturn(new RMAppMetrics(null, 0, 0, int.MaxValue, long.MaxValue)); return(app); }
/// <exception cref="System.Exception"/> protected internal virtual RMApp StoreApp(RMStateStore store, ApplicationId appId , long submitTime, long startTime) { ApplicationSubmissionContext context = new ApplicationSubmissionContextPBImpl(); context.SetApplicationId(appId); RMApp mockApp = Org.Mockito.Mockito.Mock <RMApp>(); Org.Mockito.Mockito.When(mockApp.GetApplicationId()).ThenReturn(appId); Org.Mockito.Mockito.When(mockApp.GetSubmitTime()).ThenReturn(submitTime); Org.Mockito.Mockito.When(mockApp.GetStartTime()).ThenReturn(startTime); Org.Mockito.Mockito.When(mockApp.GetApplicationSubmissionContext()).ThenReturn(context ); Org.Mockito.Mockito.When(mockApp.GetUser()).ThenReturn("test"); store.StoreNewApplication(mockApp); return(mockApp); }
private static RMApp CreateRMApp(ApplicationId appId) { RMApp app = Org.Mockito.Mockito.Mock <RMApp>(); Org.Mockito.Mockito.When(app.GetApplicationId()).ThenReturn(appId); Org.Mockito.Mockito.When(app.GetName()).ThenReturn("test app"); Org.Mockito.Mockito.When(app.GetApplicationType()).ThenReturn("test app type"); Org.Mockito.Mockito.When(app.GetUser()).ThenReturn("test user"); Org.Mockito.Mockito.When(app.GetQueue()).ThenReturn("test queue"); Org.Mockito.Mockito.When(app.GetSubmitTime()).ThenReturn(0L); Org.Mockito.Mockito.When(app.GetStartTime()).ThenReturn(1L); Org.Mockito.Mockito.When(app.GetFinishTime()).ThenReturn(2L); Org.Mockito.Mockito.When(app.GetDiagnostics()).ThenReturn(new StringBuilder("test diagnostics info" )); Org.Mockito.Mockito.When(app.GetFinalApplicationStatus()).ThenReturn(FinalApplicationStatus .Undefined); return(app); }
public virtual void TestAppBlockRenderWithNullCurrentAppAttempt() { ApplicationId AppId = ApplicationId.NewInstance(1234L, 0); Injector injector; // init app RMApp app = Org.Mockito.Mockito.Mock <RMApp>(); Org.Mockito.Mockito.When(app.GetTrackingUrl()).ThenReturn("http://host:123"); Org.Mockito.Mockito.When(app.GetState()).ThenReturn(RMAppState.Failed); Org.Mockito.Mockito.When(app.GetApplicationId()).ThenReturn(AppId); Org.Mockito.Mockito.When(app.GetApplicationType()).ThenReturn("Type"); Org.Mockito.Mockito.When(app.GetUser()).ThenReturn("user"); Org.Mockito.Mockito.When(app.GetName()).ThenReturn("Name"); Org.Mockito.Mockito.When(app.GetQueue()).ThenReturn("queue"); Org.Mockito.Mockito.When(app.GetDiagnostics()).ThenReturn(new StringBuilder()); Org.Mockito.Mockito.When(app.GetFinalApplicationStatus()).ThenReturn(FinalApplicationStatus .Failed); Org.Mockito.Mockito.When(app.GetFinalApplicationStatus()).ThenReturn(FinalApplicationStatus .Failed); Org.Mockito.Mockito.When(app.GetStartTime()).ThenReturn(0L); Org.Mockito.Mockito.When(app.GetFinishTime()).ThenReturn(0L); Org.Mockito.Mockito.When(app.CreateApplicationState()).ThenReturn(YarnApplicationState .Failed); RMAppMetrics appMetrics = new RMAppMetrics(Resource.NewInstance(0, 0), 0, 0, 0, 0 ); Org.Mockito.Mockito.When(app.GetRMAppMetrics()).ThenReturn(appMetrics); // initialize RM Context, and create RMApp, without creating RMAppAttempt RMContext rmContext = TestRMWebApp.MockRMContext(15, 1, 2, 8); rmContext.GetRMApps()[AppId] = app; injector = WebAppTests.CreateMockInjector <RMContext>(rmContext, new _Module_76(rmContext )); AppBlock instance = injector.GetInstance <AppBlock>(); instance.Set(YarnWebParams.ApplicationId, AppId.ToString()); instance.Render(); }
public AppInfo(ResourceManager rm, RMApp app, bool hasAccess, string schemePrefix ) { // these are ok for any user to see // these are only allowed if acls allow // preemption info fields // JAXB needs this this.schemePrefix = schemePrefix; if (app != null) { string trackingUrl = app.GetTrackingUrl(); this.state = app.CreateApplicationState(); this.trackingUrlIsNotReady = trackingUrl == null || trackingUrl.IsEmpty() || YarnApplicationState .New == this.state || YarnApplicationState.NewSaving == this.state || YarnApplicationState .Submitted == this.state || YarnApplicationState.Accepted == this.state; this.trackingUI = this.trackingUrlIsNotReady ? "UNASSIGNED" : (app.GetFinishTime( ) == 0 ? "ApplicationMaster" : "History"); if (!trackingUrlIsNotReady) { this.trackingUrl = WebAppUtils.GetURLWithScheme(schemePrefix, trackingUrl); this.trackingUrlPretty = this.trackingUrl; } else { this.trackingUrlPretty = "UNASSIGNED"; } this.applicationId = app.GetApplicationId(); this.applicationType = app.GetApplicationType(); this.appIdNum = app.GetApplicationId().GetId().ToString(); this.id = app.GetApplicationId().ToString(); this.user = app.GetUser().ToString(); this.name = app.GetName().ToString(); this.queue = app.GetQueue().ToString(); this.progress = app.GetProgress() * 100; this.diagnostics = app.GetDiagnostics().ToString(); if (diagnostics == null || diagnostics.IsEmpty()) { this.diagnostics = string.Empty; } if (app.GetApplicationTags() != null && !app.GetApplicationTags().IsEmpty()) { this.applicationTags = Joiner.On(',').Join(app.GetApplicationTags()); } this.finalStatus = app.GetFinalApplicationStatus(); this.clusterId = ResourceManager.GetClusterTimeStamp(); if (hasAccess) { this.startedTime = app.GetStartTime(); this.finishedTime = app.GetFinishTime(); this.elapsedTime = Times.Elapsed(app.GetStartTime(), app.GetFinishTime()); RMAppAttempt attempt = app.GetCurrentAppAttempt(); if (attempt != null) { Container masterContainer = attempt.GetMasterContainer(); if (masterContainer != null) { this.amContainerLogsExist = true; this.amContainerLogs = WebAppUtils.GetRunningLogURL(schemePrefix + masterContainer .GetNodeHttpAddress(), ConverterUtils.ToString(masterContainer.GetId()), app.GetUser ()); this.amHostHttpAddress = masterContainer.GetNodeHttpAddress(); } ApplicationResourceUsageReport resourceReport = attempt.GetApplicationResourceUsageReport (); if (resourceReport != null) { Resource usedResources = resourceReport.GetUsedResources(); allocatedMB = usedResources.GetMemory(); allocatedVCores = usedResources.GetVirtualCores(); runningContainers = resourceReport.GetNumUsedContainers(); } resourceRequests = ((AbstractYarnScheduler)rm.GetRMContext().GetScheduler()).GetPendingResourceRequestsForAttempt (attempt.GetAppAttemptId()); } } // copy preemption info fields RMAppMetrics appMetrics = app.GetRMAppMetrics(); numAMContainerPreempted = appMetrics.GetNumAMContainersPreempted(); preemptedResourceMB = appMetrics.GetResourcePreempted().GetMemory(); numNonAMContainerPreempted = appMetrics.GetNumNonAMContainersPreempted(); preemptedResourceVCores = appMetrics.GetResourcePreempted().GetVirtualCores(); memorySeconds = appMetrics.GetMemorySeconds(); vcoreSeconds = appMetrics.GetVcoreSeconds(); } }
public virtual int Run(string[] args) { Log.Info("Starting ZKRMStateStorePerf ver." + version); int numApp = ZkPerfNumAppDefault; int numAppAttemptPerApp = ZkPerfNumAppattemptPerApp; string hostPort = null; bool launchLocalZK = true; if (args.Length == 0) { System.Console.Error.WriteLine("Missing arguments."); return(-1); } for (int i = 0; i < args.Length; i++) { // parse command line if (Sharpen.Runtime.EqualsIgnoreCase(args[i], "-appsize")) { numApp = System.Convert.ToInt32(args[++i]); } else { if (Sharpen.Runtime.EqualsIgnoreCase(args[i], "-appattemptsize")) { numAppAttemptPerApp = System.Convert.ToInt32(args[++i]); } else { if (Sharpen.Runtime.EqualsIgnoreCase(args[i], "-hostPort")) { hostPort = args[++i]; launchLocalZK = false; } else { if (Sharpen.Runtime.EqualsIgnoreCase(args[i], "-workingZnode")) { workingZnode = args[++i]; } else { System.Console.Error.WriteLine("Illegal argument: " + args[i]); return(-1); } } } } } if (launchLocalZK) { try { SetUp(); } catch (Exception e) { System.Console.Error.WriteLine("failed to setup. : " + e.Message); return(-1); } } InitStore(hostPort); long submitTime = Runtime.CurrentTimeMillis(); long startTime = Runtime.CurrentTimeMillis() + 1234; AList <ApplicationId> applicationIds = new AList <ApplicationId>(); AList <RMApp> rmApps = new AList <RMApp>(); AList <ApplicationAttemptId> attemptIds = new AList <ApplicationAttemptId>(); Dictionary <ApplicationId, ICollection <ApplicationAttemptId> > appIdsToAttemptId = new Dictionary <ApplicationId, ICollection <ApplicationAttemptId> >(); RMStateStoreTestBase.TestDispatcher dispatcher = new RMStateStoreTestBase.TestDispatcher (); store.SetRMDispatcher(dispatcher); for (int i_1 = 0; i_1 < numApp; i_1++) { ApplicationId appId = ApplicationId.NewInstance(clusterTimeStamp, i_1); applicationIds.AddItem(appId); AList <ApplicationAttemptId> attemptIdsForThisApp = new AList <ApplicationAttemptId >(); for (int j = 0; j < numAppAttemptPerApp; j++) { ApplicationAttemptId attemptId = ApplicationAttemptId.NewInstance(appId, j); attemptIdsForThisApp.AddItem(attemptId); } appIdsToAttemptId[appId] = new LinkedHashSet(attemptIdsForThisApp); Sharpen.Collections.AddAll(attemptIds, attemptIdsForThisApp); } foreach (ApplicationId appId_1 in applicationIds) { RMApp app = null; try { app = StoreApp(store, appId_1, submitTime, startTime); } catch (Exception e) { System.Console.Error.WriteLine("failed to create Application Znode. : " + e.Message ); return(-1); } WaitNotify(dispatcher); rmApps.AddItem(app); } foreach (ApplicationAttemptId attemptId_1 in attemptIds) { Org.Apache.Hadoop.Security.Token.Token <AMRMTokenIdentifier> tokenId = GenerateAMRMToken (attemptId_1, appTokenMgr); SecretKey clientTokenKey = clientToAMTokenMgr.CreateMasterKey(attemptId_1); try { StoreAttempt(store, attemptId_1, ContainerId.NewContainerId(attemptId_1, 0L).ToString (), tokenId, clientTokenKey, dispatcher); } catch (Exception e) { System.Console.Error.WriteLine("failed to create AppAttempt Znode. : " + e.Message ); return(-1); } } long storeStart = Runtime.CurrentTimeMillis(); try { store.LoadState(); } catch (Exception e) { System.Console.Error.WriteLine("failed to locaState from ZKRMStateStore. : " + e. Message); return(-1); } long storeEnd = Runtime.CurrentTimeMillis(); long loadTime = storeEnd - storeStart; string resultMsg = "ZKRMStateStore takes " + loadTime + " msec to loadState."; Log.Info(resultMsg); System.Console.Out.WriteLine(resultMsg); // cleanup try { foreach (RMApp app in rmApps) { ApplicationStateData appState = ApplicationStateData.NewInstance(app.GetSubmitTime (), app.GetStartTime(), app.GetApplicationSubmissionContext(), app.GetUser()); ApplicationId appId = app.GetApplicationId(); IDictionary m = Org.Mockito.Mockito.Mock <IDictionary>(); Org.Mockito.Mockito.When(m.Keys).ThenReturn(appIdsToAttemptId[appId_1]); appState.attempts = m; store.RemoveApplicationStateInternal(appState); } } catch (Exception e) { System.Console.Error.WriteLine("failed to cleanup. : " + e.Message); return(-1); } return(0); }
public virtual void TestFencedState() { TestZKRMStateStore.TestZKRMStateStoreTester zkTester = new TestZKRMStateStore.TestZKRMStateStoreTester (this); RMStateStore store = zkTester.GetRMStateStore(); // Move state to FENCED from ACTIVE store.UpdateFencedState(); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); long submitTime = Runtime.CurrentTimeMillis(); long startTime = submitTime + 1000; // Add a new app RMApp mockApp = Org.Mockito.Mockito.Mock <RMApp>(); ApplicationSubmissionContext context = new ApplicationSubmissionContextPBImpl(); Org.Mockito.Mockito.When(mockApp.GetSubmitTime()).ThenReturn(submitTime); Org.Mockito.Mockito.When(mockApp.GetStartTime()).ThenReturn(startTime); Org.Mockito.Mockito.When(mockApp.GetApplicationSubmissionContext()).ThenReturn(context ); Org.Mockito.Mockito.When(mockApp.GetUser()).ThenReturn("test"); store.StoreNewApplication(mockApp); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); // Add a new attempt ClientToAMTokenSecretManagerInRM clientToAMTokenMgr = new ClientToAMTokenSecretManagerInRM (); ApplicationAttemptId attemptId = ConverterUtils.ToApplicationAttemptId("appattempt_1234567894321_0001_000001" ); SecretKey clientTokenMasterKey = clientToAMTokenMgr.CreateMasterKey(attemptId); RMAppAttemptMetrics mockRmAppAttemptMetrics = Org.Mockito.Mockito.Mock <RMAppAttemptMetrics >(); Container container = new ContainerPBImpl(); container.SetId(ConverterUtils.ToContainerId("container_1234567891234_0001_01_000001" )); RMAppAttempt mockAttempt = Org.Mockito.Mockito.Mock <RMAppAttempt>(); Org.Mockito.Mockito.When(mockAttempt.GetAppAttemptId()).ThenReturn(attemptId); Org.Mockito.Mockito.When(mockAttempt.GetMasterContainer()).ThenReturn(container); Org.Mockito.Mockito.When(mockAttempt.GetClientTokenMasterKey()).ThenReturn(clientTokenMasterKey ); Org.Mockito.Mockito.When(mockAttempt.GetRMAppAttemptMetrics()).ThenReturn(mockRmAppAttemptMetrics ); Org.Mockito.Mockito.When(mockRmAppAttemptMetrics.GetAggregateAppResourceUsage()). ThenReturn(new AggregateAppResourceUsage(0, 0)); store.StoreNewApplicationAttempt(mockAttempt); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); long finishTime = submitTime + 1000; // Update attempt ApplicationAttemptStateData newAttemptState = ApplicationAttemptStateData.NewInstance (attemptId, container, store.GetCredentialsFromAppAttempt(mockAttempt), startTime , RMAppAttemptState.Finished, "testUrl", "test", FinalApplicationStatus.Succeeded , 100, finishTime, 0, 0); store.UpdateApplicationAttemptState(newAttemptState); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); // Update app ApplicationStateData appState = ApplicationStateData.NewInstance(submitTime, startTime , context, "test"); store.UpdateApplicationState(appState); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); // Remove app store.RemoveApplication(mockApp); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); // store RM delegation token; RMDelegationTokenIdentifier dtId1 = new RMDelegationTokenIdentifier(new Text("owner1" ), new Text("renewer1"), new Text("realuser1")); long renewDate1 = Runtime.CurrentTimeMillis(); dtId1.SetSequenceNumber(1111); store.StoreRMDelegationToken(dtId1, renewDate1); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); store.UpdateRMDelegationToken(dtId1, renewDate1); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); // remove delegation key; store.RemoveRMDelegationToken(dtId1); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); // store delegation master key; DelegationKey key = new DelegationKey(1234, 4321, Sharpen.Runtime.GetBytesForString ("keyBytes")); store.StoreRMDTMasterKey(key); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); // remove delegation master key; store.RemoveRMDTMasterKey(key); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); // store or update AMRMToken; store.StoreOrUpdateAMRMTokenSecretManager(null, false); NUnit.Framework.Assert.AreEqual("RMStateStore should have been in fenced state", true, store.IsFencedState()); store.Close(); }
public virtual void ApplicationStarted(RMApp app) { if (historyServiceEnabled) { dispatcher.GetEventHandler().Handle(new WritingApplicationStartEvent(app.GetApplicationId (), ApplicationStartData.NewInstance(app.GetApplicationId(), app.GetName(), app. GetApplicationType(), app.GetQueue(), app.GetUser(), app.GetSubmitTime(), app.GetStartTime ()))); } }
/// <summary>create a summary of the application's runtime.</summary> /// <param name="app"> /// /// <see cref="Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Rmapp.RMApp"/> /// whose summary is to be created, cannot /// be <code>null</code>. /// </param> public static RMAppManager.ApplicationSummary.SummaryBuilder CreateAppSummary(RMApp app) { string trackingUrl = "N/A"; string host = "N/A"; RMAppAttempt attempt = app.GetCurrentAppAttempt(); if (attempt != null) { trackingUrl = attempt.GetTrackingUrl(); host = attempt.GetHost(); } RMAppMetrics metrics = app.GetRMAppMetrics(); RMAppManager.ApplicationSummary.SummaryBuilder summary = new RMAppManager.ApplicationSummary.SummaryBuilder ().Add("appId", app.GetApplicationId()).Add("name", app.GetName()).Add("user", app .GetUser()).Add("queue", app.GetQueue()).Add("state", app.GetState()).Add("trackingUrl" , trackingUrl).Add("appMasterHost", host).Add("startTime", app.GetStartTime()).Add ("finishTime", app.GetFinishTime()).Add("finalStatus", app.GetFinalApplicationStatus ()).Add("memorySeconds", metrics.GetMemorySeconds()).Add("vcoreSeconds", metrics .GetVcoreSeconds()).Add("preemptedAMContainers", metrics.GetNumAMContainersPreempted ()).Add("preemptedNonAMContainers", metrics.GetNumNonAMContainersPreempted()).Add ("preemptedResources", metrics.GetResourcePreempted()).Add("applicationType", app .GetApplicationType()); return(summary); }
/// <exception cref="System.Exception"/> public virtual void TestPublishApplicationMetrics() { for (int i = 1; i <= 2; ++i) { ApplicationId appId = ApplicationId.NewInstance(0, i); RMApp app = CreateRMApp(appId); metricsPublisher.AppCreated(app, app.GetStartTime()); metricsPublisher.AppFinished(app, RMAppState.Finished, app.GetFinishTime()); if (i == 1) { metricsPublisher.AppACLsUpdated(app, "uers1,user2", 4L); } else { // in case user doesn't specify the ACLs metricsPublisher.AppACLsUpdated(app, null, 4L); } TimelineEntity entity = null; do { entity = store.GetEntity(appId.ToString(), ApplicationMetricsConstants.EntityType , EnumSet.AllOf <TimelineReader.Field>()); }while (entity == null || entity.GetEvents().Count < 3); // ensure three events are both published before leaving the loop // verify all the fields NUnit.Framework.Assert.AreEqual(ApplicationMetricsConstants.EntityType, entity.GetEntityType ()); NUnit.Framework.Assert.AreEqual(app.GetApplicationId().ToString(), entity.GetEntityId ()); NUnit.Framework.Assert.AreEqual(app.GetName(), entity.GetOtherInfo()[ApplicationMetricsConstants .NameEntityInfo]); NUnit.Framework.Assert.AreEqual(app.GetQueue(), entity.GetOtherInfo()[ApplicationMetricsConstants .QueueEntityInfo]); NUnit.Framework.Assert.AreEqual(app.GetUser(), entity.GetOtherInfo()[ApplicationMetricsConstants .UserEntityInfo]); NUnit.Framework.Assert.AreEqual(app.GetApplicationType(), entity.GetOtherInfo()[ApplicationMetricsConstants .TypeEntityInfo]); NUnit.Framework.Assert.AreEqual(app.GetSubmitTime(), entity.GetOtherInfo()[ApplicationMetricsConstants .SubmittedTimeEntityInfo]); if (i == 1) { NUnit.Framework.Assert.AreEqual("uers1,user2", entity.GetOtherInfo()[ApplicationMetricsConstants .AppViewAclsEntityInfo]); } else { NUnit.Framework.Assert.AreEqual(string.Empty, entity.GetOtherInfo()[ApplicationMetricsConstants .AppViewAclsEntityInfo]); NUnit.Framework.Assert.AreEqual(app.GetRMAppMetrics().GetMemorySeconds(), long.Parse (entity.GetOtherInfo()[ApplicationMetricsConstants.AppMemMetrics].ToString())); NUnit.Framework.Assert.AreEqual(app.GetRMAppMetrics().GetVcoreSeconds(), long.Parse (entity.GetOtherInfo()[ApplicationMetricsConstants.AppCpuMetrics].ToString())); } bool hasCreatedEvent = false; bool hasFinishedEvent = false; bool hasACLsUpdatedEvent = false; foreach (TimelineEvent @event in entity.GetEvents()) { if (@event.GetEventType().Equals(ApplicationMetricsConstants.CreatedEventType)) { hasCreatedEvent = true; NUnit.Framework.Assert.AreEqual(app.GetStartTime(), @event.GetTimestamp()); } else { if (@event.GetEventType().Equals(ApplicationMetricsConstants.FinishedEventType)) { hasFinishedEvent = true; NUnit.Framework.Assert.AreEqual(app.GetFinishTime(), @event.GetTimestamp()); NUnit.Framework.Assert.AreEqual(app.GetDiagnostics().ToString(), @event.GetEventInfo ()[ApplicationMetricsConstants.DiagnosticsInfoEventInfo]); NUnit.Framework.Assert.AreEqual(app.GetFinalApplicationStatus().ToString(), @event .GetEventInfo()[ApplicationMetricsConstants.FinalStatusEventInfo]); NUnit.Framework.Assert.AreEqual(YarnApplicationState.Finished.ToString(), @event. GetEventInfo()[ApplicationMetricsConstants.StateEventInfo]); } else { if (@event.GetEventType().Equals(ApplicationMetricsConstants.AclsUpdatedEventType )) { hasACLsUpdatedEvent = true; NUnit.Framework.Assert.AreEqual(4L, @event.GetTimestamp()); } } } } NUnit.Framework.Assert.IsTrue(hasCreatedEvent && hasFinishedEvent && hasACLsUpdatedEvent ); } }