@Test public void testGetApplicationAttempts() throws Exception { final ApplicationId appId = ApplicationId.newInstance(0, 1); Collection<ApplicationAttemptReport> appAttempts; if (callerUGI == null) { appAttempts = historyManager.getApplicationAttempts(appId).values(); } else { try { appAttempts = callerUGI.doAs( new PrivilegedExceptionAction<Collection<ApplicationAttemptReport>> () { @Override public Collection<ApplicationAttemptReport> run() throws Exception { return historyManager.getApplicationAttempts(appId).values(); } }); if (callerUGI != null && callerUGI.getShortUserName().equals("user3")) { Assert.fail(); } } catch (AuthorizationException e) { if (callerUGI != null && callerUGI.getShortUserName().equals("user3")) { return; } throw e; } } Assert.assertNotNull(appAttempts); Assert.assertEquals(SCALE, appAttempts.size()); }
@Override public Map<ApplicationAttemptId, ApplicationAttemptReport> getApplicationAttempts(ApplicationId appId) throws YarnException, IOException { ApplicationReportExt app = getApplication( appId, ApplicationReportField.USER_AND_ACLS); checkAccess(app); TimelineEntities entities = timelineDataManager.getEntities( AppAttemptMetricsConstants.ENTITY_TYPE, new NameValuePair( AppAttemptMetricsConstants.PARENT_PRIMARY_FILTER, appId .toString()), null, null, null, null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map<ApplicationAttemptId, ApplicationAttemptReport> appAttempts = new LinkedHashMap<ApplicationAttemptId, ApplicationAttemptReport>(); for (TimelineEntity entity : entities.getEntities()) { ApplicationAttemptReport appAttempt = convertToApplicationAttemptReport(entity); appAttempts.put(appAttempt.getApplicationAttemptId(), appAttempt); } return appAttempts; }
ApplicationHistoryManagerOnTimelineStore extends AbstractService implements
    ApplicationHistoryManager { @Override public Map<ApplicationAttemptId, ApplicationAttemptReport> getApplicationAttempts(ApplicationId appId) throws YarnException, IOException { ApplicationReportExt app = getApplication( appId, ApplicationReportField.USER_AND_ACLS); checkAccess(app); TimelineEntities entities = timelineDataManager.getEntities( AppAttemptMetricsConstants.ENTITY_TYPE, new NameValuePair( AppAttemptMetricsConstants.PARENT_PRIMARY_FILTER, appId .toString()), null, null, null, null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map<ApplicationAttemptId, ApplicationAttemptReport> appAttempts = new LinkedHashMap<ApplicationAttemptId, ApplicationAttemptReport>(); for (TimelineEntity entity : entities.getEntities()) { ApplicationAttemptReport appAttempt = convertToApplicationAttemptReport(entity); appAttempts.put(appAttempt.getApplicationAttemptId(), appAttempt); } return appAttempts; } }
ApplicationHistoryManagerOnTimelineStore extends AbstractService implements
    ApplicationHistoryManager { @Override public Map<ApplicationAttemptId, ApplicationAttemptReport> getApplicationAttempts(ApplicationId appId) throws YarnException, IOException { ApplicationReportExt app = getApplication( appId, ApplicationReportField.USER_AND_ACLS); checkAccess(app); TimelineEntities entities = timelineDataManager.getEntities( AppAttemptMetricsConstants.ENTITY_TYPE, new NameValuePair( AppAttemptMetricsConstants.PARENT_PRIMARY_FILTER, appId .toString()), null, null, null, null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map<ApplicationAttemptId, ApplicationAttemptReport> appAttempts = new LinkedHashMap<ApplicationAttemptId, ApplicationAttemptReport>(); for (TimelineEntity entity : entities.getEntities()) { ApplicationAttemptReport appAttempt = convertToApplicationAttemptReport(entity); appAttempts.put(appAttempt.getApplicationAttemptId(), appAttempt); } return appAttempts; } ApplicationHistoryManagerOnTimelineStore(
      TimelineDataManager timelineDataManager,
      ApplicationACLsManager aclsManager); }
ApplicationHistoryManagerOnTimelineStore extends AbstractService implements
    ApplicationHistoryManager { @Override public Map<ApplicationAttemptId, ApplicationAttemptReport> getApplicationAttempts(ApplicationId appId) throws YarnException, IOException { ApplicationReportExt app = getApplication( appId, ApplicationReportField.USER_AND_ACLS); checkAccess(app); TimelineEntities entities = timelineDataManager.getEntities( AppAttemptMetricsConstants.ENTITY_TYPE, new NameValuePair( AppAttemptMetricsConstants.PARENT_PRIMARY_FILTER, appId .toString()), null, null, null, null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map<ApplicationAttemptId, ApplicationAttemptReport> appAttempts = new LinkedHashMap<ApplicationAttemptId, ApplicationAttemptReport>(); for (TimelineEntity entity : entities.getEntities()) { ApplicationAttemptReport appAttempt = convertToApplicationAttemptReport(entity); appAttempts.put(appAttempt.getApplicationAttemptId(), appAttempt); } return appAttempts; } ApplicationHistoryManagerOnTimelineStore(
      TimelineDataManager timelineDataManager,
      ApplicationACLsManager aclsManager); @Override ApplicationReport getApplication(ApplicationId appId); @Override Map<ApplicationId, ApplicationReport> getApplications(long appsNum); @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 Map<ApplicationAttemptId, ApplicationAttemptReport> getApplicationAttempts(ApplicationId appId) throws YarnException, IOException { ApplicationReportExt app = getApplication( appId, ApplicationReportField.USER_AND_ACLS); checkAccess(app); TimelineEntities entities = timelineDataManager.getEntities( AppAttemptMetricsConstants.ENTITY_TYPE, new NameValuePair( AppAttemptMetricsConstants.PARENT_PRIMARY_FILTER, appId .toString()), null, null, null, null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map<ApplicationAttemptId, ApplicationAttemptReport> appAttempts = new LinkedHashMap<ApplicationAttemptId, ApplicationAttemptReport>(); for (TimelineEntity entity : entities.getEntities()) { ApplicationAttemptReport appAttempt = convertToApplicationAttemptReport(entity); appAttempts.put(appAttempt.getApplicationAttemptId(), appAttempt); } return appAttempts; } ApplicationHistoryManagerOnTimelineStore(
      TimelineDataManager timelineDataManager,
      ApplicationACLsManager aclsManager); @Override ApplicationReport getApplication(ApplicationId appId); @Override Map<ApplicationId, ApplicationReport> getApplications(long appsNum); @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);  }