ApplicationHistoryClientService extends AbstractService implements
    ApplicationHistoryProtocol { @Override public GetApplicationsResponse getApplications(GetApplicationsRequest request) throws YarnException, IOException { GetApplicationsResponse response = GetApplicationsResponse.newInstance(new ArrayList<ApplicationReport>( history.getApplications(request.getLimit()).values())); return response; } ApplicationHistoryClientService(ApplicationHistoryManager history); @Private InetSocketAddress getBindAddress(); @Override CancelDelegationTokenResponse cancelDelegationToken(
      CancelDelegationTokenRequest request); @Override GetApplicationAttemptReportResponse getApplicationAttemptReport(
      GetApplicationAttemptReportRequest request); @Override GetApplicationAttemptsResponse getApplicationAttempts(
      GetApplicationAttemptsRequest request); @Override GetApplicationReportResponse getApplicationReport(
      GetApplicationReportRequest request); @Override GetApplicationsResponse getApplications(GetApplicationsRequest request); @Override GetContainerReportResponse getContainerReport(
      GetContainerReportRequest request); @Override GetContainersResponse getContainers(GetContainersRequest request); @Override GetDelegationTokenResponse getDelegationToken(
      GetDelegationTokenRequest request); @Override RenewDelegationTokenResponse renewDelegationToken(
      RenewDelegationTokenRequest request);  }
@Test public void testApplications() throws IOException, YarnException { ApplicationId appId = null; appId = ApplicationId.newInstance(0, 1); ApplicationId appId1 = ApplicationId.newInstance(0, 2); GetApplicationsRequest request = GetApplicationsRequest.newInstance(); GetApplicationsResponse response = clientService.getApplications(request); List<ApplicationReport> appReport = response.getApplicationList(); Assert.assertNotNull(appReport); Assert.assertEquals(appId, appReport.get(1).getApplicationId()); Assert.assertEquals(appId1, appReport.get(0).getApplicationId()); Configuration conf = new YarnConfiguration(); conf.setLong(YarnConfiguration.APPLICATION_HISTORY_MAX_APPS, 1); ApplicationHistoryManagerOnTimelineStore historyManager2 = new ApplicationHistoryManagerOnTimelineStore(dataManager, new ApplicationACLsManager(conf)); historyManager2.init(conf); historyManager2.start(); @SuppressWarnings("resource") ApplicationHistoryClientService clientService2 = new ApplicationHistoryClientService(historyManager2); response = clientService2.getApplications(request); appReport = response.getApplicationList(); Assert.assertNotNull(appReport); Assert.assertTrue(appReport.size() == 1); Assert.assertEquals(appId1, appReport.get(0).getApplicationId()); }