@Test public void testGetApplicationReport() throws Exception { for (int i = 1; i <= 2; ++i) { final ApplicationId appId = ApplicationId.newInstance(0, i); ApplicationReport app; if (callerUGI == null) { app = historyManager.getApplication(appId); } else { app = callerUGI.doAs(new PrivilegedExceptionAction<ApplicationReport> () { @Override public ApplicationReport run() throws Exception { return historyManager.getApplication(appId); } }); } Assert.assertNotNull(app); Assert.assertEquals(appId, app.getApplicationId()); Assert.assertEquals("test app", app.getName()); Assert.assertEquals("test app type", app.getApplicationType()); Assert.assertEquals("user1", app.getUser()); Assert.assertEquals("test queue", app.getQueue()); Assert.assertEquals(Integer.MAX_VALUE + 2L, app.getStartTime()); Assert.assertEquals(Integer.MAX_VALUE + 3L, app.getFinishTime()); Assert.assertTrue(Math.abs(app.getProgress() - 1.0F) < 0.0001); if ((i == 1 && callerUGI != null && callerUGI.getShortUserName().equals("user3")) || (i == 2 && callerUGI != null && (callerUGI.getShortUserName().equals("user2") || callerUGI.getShortUserName().equals("user3")))) { Assert.assertEquals(ApplicationAttemptId.newInstance(appId, -1), app.getCurrentApplicationAttemptId()); Assert.assertEquals(ApplicationHistoryManagerOnTimelineStore.UNAVAILABLE, app.getHost()); Assert.assertEquals(-1, app.getRpcPort()); Assert.assertEquals(ApplicationHistoryManagerOnTimelineStore.UNAVAILABLE, app.getTrackingUrl()); Assert.assertEquals(ApplicationHistoryManagerOnTimelineStore.UNAVAILABLE, app.getOriginalTrackingUrl()); Assert.assertEquals("", app.getDiagnostics()); } else { Assert.assertEquals(ApplicationAttemptId.newInstance(appId, 1), app.getCurrentApplicationAttemptId()); Assert.assertEquals("test host", app.getHost()); Assert.assertEquals(100, app.getRpcPort()); Assert.assertEquals("test tracking url", app.getTrackingUrl()); Assert.assertEquals("test original tracking url", app.getOriginalTrackingUrl()); Assert.assertEquals("test diagnostics info", app.getDiagnostics()); } ApplicationResourceUsageReport applicationResourceUsageReport = app.getApplicationResourceUsageReport(); Assert.assertEquals(123, applicationResourceUsageReport.getMemorySeconds()); Assert .assertEquals(345, applicationResourceUsageReport.getVcoreSeconds()); Assert .assertEquals(345, applicationResourceUsageReport.getGcoreSeconds()); Assert.assertEquals(FinalApplicationStatus.UNDEFINED, app.getFinalApplicationStatus()); Assert.assertEquals(YarnApplicationState.FINISHED, app.getYarnApplicationState()); } }
@Override public ApplicationReport getApplication(ApplicationId appId) throws YarnException, IOException { return getApplication(appId, ApplicationReportField.ALL).appReport; }
ApplicationHistoryManagerOnTimelineStore extends AbstractService implements
    ApplicationHistoryManager { @Override public ApplicationReport getApplication(ApplicationId appId) throws YarnException, IOException { return getApplication(appId, ApplicationReportField.ALL).appReport; } }
ApplicationHistoryManagerOnTimelineStore extends AbstractService implements
    ApplicationHistoryManager { @Override public ApplicationReport getApplication(ApplicationId appId) throws YarnException, IOException { return getApplication(appId, ApplicationReportField.ALL).appReport; } ApplicationHistoryManagerOnTimelineStore(
      TimelineDataManager timelineDataManager,
      ApplicationACLsManager aclsManager); }
ApplicationHistoryManagerOnTimelineStore extends AbstractService implements
    ApplicationHistoryManager { @Override public ApplicationReport getApplication(ApplicationId appId) throws YarnException, IOException { return getApplication(appId, ApplicationReportField.ALL).appReport; } ApplicationHistoryManagerOnTimelineStore(
      TimelineDataManager timelineDataManager,
      ApplicationACLsManager aclsManager); @Override ApplicationReport getApplication(ApplicationId appId); @Override Map<ApplicationId, ApplicationReport> getAllApplications(); @Override Map<ApplicationAttemptId, ApplicationAttemptReport> getApplicationAttempts(ApplicationId appId); @Override ApplicationAttemptReport getApplicationAttempt(
      ApplicationAttemptId appAttemptId); @Override ContainerReport getContainer(ContainerId containerId); @Override ContainerReport getAMContainer(ApplicationAttemptId appAttemptId); @Override Map<ContainerId, ContainerReport> getContainers(
      ApplicationAttemptId appAttemptId); }
ApplicationHistoryManagerOnTimelineStore extends AbstractService implements
    ApplicationHistoryManager { @Override public ApplicationReport getApplication(ApplicationId appId) throws YarnException, IOException { return getApplication(appId, ApplicationReportField.ALL).appReport; } ApplicationHistoryManagerOnTimelineStore(
      TimelineDataManager timelineDataManager,
      ApplicationACLsManager aclsManager); @Override ApplicationReport getApplication(ApplicationId appId); @Override Map<ApplicationId, ApplicationReport> getAllApplications(); @Override Map<ApplicationAttemptId, ApplicationAttemptReport> getApplicationAttempts(ApplicationId appId); @Override ApplicationAttemptReport getApplicationAttempt(
      ApplicationAttemptId appAttemptId); @Override ContainerReport getContainer(ContainerId containerId); @Override ContainerReport getAMContainer(ApplicationAttemptId appAttemptId); @Override Map<ContainerId, ContainerReport> getContainers(
      ApplicationAttemptId appAttemptId);  }