ApplicationHistoryManagerOnTimelineStore extends AbstractService implements
    ApplicationHistoryManager { @Override public Map<ApplicationId, ApplicationReport> getApplications(long appsNum, long appStartedTimeBegin, long appStartedTimeEnd) throws YarnException, IOException { TimelineEntities entities = timelineDataManager.getEntities( ApplicationMetricsConstants.ENTITY_TYPE, null, null, appStartedTimeBegin, appStartedTimeEnd, null, null, appsNum == Long.MAX_VALUE ? this.maxLoadedApplications : appsNum, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map<ApplicationId, ApplicationReport> apps = new LinkedHashMap<ApplicationId, ApplicationReport>(); if (entities != null && entities.getEntities() != null) { for (TimelineEntity entity : entities.getEntities()) { try { ApplicationReportExt app = generateApplicationReport(entity, ApplicationReportField.ALL); apps.put(app.appReport.getApplicationId(), app.appReport); } catch (Exception e) { LOG.error("Error on generating application report for " + entity.getEntityId(), e); } } } return apps; } ApplicationHistoryManagerOnTimelineStore(
      TimelineDataManager timelineDataManager,
      ApplicationACLsManager aclsManager); @Override ApplicationReport getApplication(ApplicationId appId); @Override Map<ApplicationId, ApplicationReport> getApplications(long appsNum,
      long appStartedTimeBegin, long appStartedTimeEnd); @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);  }
@Test public void testGetApplications() throws Exception { Collection<ApplicationReport> apps = historyManager.getApplications(Long.MAX_VALUE, 0L, Long.MAX_VALUE) .values(); Assert.assertNotNull(apps); Assert.assertEquals(SCALE + 1, apps.size()); ApplicationId ignoredAppId = ApplicationId.newInstance(0, SCALE + 2); for (ApplicationReport app : apps) { Assert.assertNotEquals(ignoredAppId, app.getApplicationId()); } apps = historyManager.getApplications(Long.MAX_VALUE, 2147483653L, Long.MAX_VALUE).values(); Assert.assertNotNull(apps); Assert.assertEquals(2, apps.size()); }