FederationClientInterceptor extends AbstractClientRequestInterceptor { @Override public GetApplicationReportResponse getApplicationReport( GetApplicationReportRequest request) throws YarnException, IOException { long startTime = clock.getTime(); if (request == null || request.getApplicationId() == null) { routerMetrics.incrAppsFailedRetrieved(); RouterServerUtil.logAndThrowException( "Missing getApplicationReport request or applicationId information.", null); } SubClusterId subClusterId = null; try { subClusterId = federationFacade .getApplicationHomeSubCluster(request.getApplicationId()); } catch (YarnException e) { routerMetrics.incrAppsFailedRetrieved(); RouterServerUtil .logAndThrowException("Application " + request.getApplicationId() + " does not exist in FederationStateStore", e); } ApplicationClientProtocol clientRMProxy = getClientRMProxyForSubCluster(subClusterId); GetApplicationReportResponse response = null; try { response = clientRMProxy.getApplicationReport(request); } catch (Exception e) { routerMetrics.incrAppsFailedRetrieved(); LOG.error("Unable to get the application report for " + request.getApplicationId() + "to SubCluster " + subClusterId.getId(), e); throw e; } if (response == null) { LOG.error("No response when attempting to retrieve the report of " + "the application " + request.getApplicationId() + " to SubCluster " + subClusterId.getId()); } long stopTime = clock.getTime(); routerMetrics.succeededAppsRetrieved(stopTime - startTime); return response; }  @Override void init(String userName); @Override void setNextInterceptor(ClientRequestInterceptor next); @Override GetNewApplicationResponse getNewApplication(
      GetNewApplicationRequest request); @Override SubmitApplicationResponse submitApplication(
      SubmitApplicationRequest request); @Override KillApplicationResponse forceKillApplication(
      KillApplicationRequest request); @Override GetApplicationReportResponse getApplicationReport(
      GetApplicationReportRequest request); @Override GetApplicationsResponse getApplications(GetApplicationsRequest request); @Override GetClusterMetricsResponse getClusterMetrics(
      GetClusterMetricsRequest request); @Override GetClusterNodesResponse getClusterNodes(GetClusterNodesRequest request); @Override GetQueueInfoResponse getQueueInfo(GetQueueInfoRequest request); @Override GetQueueUserAclsInfoResponse getQueueUserAcls(
      GetQueueUserAclsInfoRequest request); @Override MoveApplicationAcrossQueuesResponse moveApplicationAcrossQueues(
      MoveApplicationAcrossQueuesRequest request); @Override GetNewReservationResponse getNewReservation(
      GetNewReservationRequest request); @Override ReservationSubmissionResponse submitReservation(
      ReservationSubmissionRequest request); @Override ReservationListResponse listReservations(
      ReservationListRequest request); @Override ReservationUpdateResponse updateReservation(
      ReservationUpdateRequest request); @Override ReservationDeleteResponse deleteReservation(
      ReservationDeleteRequest request); @Override GetNodesToLabelsResponse getNodeToLabels(
      GetNodesToLabelsRequest request); @Override GetLabelsToNodesResponse getLabelsToNodes(
      GetLabelsToNodesRequest request); @Override GetClusterNodeLabelsResponse getClusterNodeLabels(
      GetClusterNodeLabelsRequest request); @Override GetApplicationAttemptReportResponse getApplicationAttemptReport(
      GetApplicationAttemptReportRequest request); @Override GetApplicationAttemptsResponse getApplicationAttempts(
      GetApplicationAttemptsRequest request); @Override GetContainerReportResponse getContainerReport(
      GetContainerReportRequest request); @Override GetContainersResponse getContainers(GetContainersRequest request); @Override GetDelegationTokenResponse getDelegationToken(
      GetDelegationTokenRequest request); @Override RenewDelegationTokenResponse renewDelegationToken(
      RenewDelegationTokenRequest request); @Override CancelDelegationTokenResponse cancelDelegationToken(
      CancelDelegationTokenRequest request); @Override FailApplicationAttemptResponse failApplicationAttempt(
      FailApplicationAttemptRequest request); @Override UpdateApplicationPriorityResponse updateApplicationPriority(
      UpdateApplicationPriorityRequest request); @Override SignalContainerResponse signalToContainer(
      SignalContainerRequest request); @Override UpdateApplicationTimeoutsResponse updateApplicationTimeouts(
      UpdateApplicationTimeoutsRequest request); @Override GetAllResourceProfilesResponse getResourceProfiles(
      GetAllResourceProfilesRequest request); @Override GetResourceProfileResponse getResourceProfile(
      GetResourceProfileRequest request); @Override GetAllResourceTypeInfoResponse getResourceTypeInfo(
      GetAllResourceTypeInfoRequest request); @Override void shutdown(); @Override GetAttributesToNodesResponse getAttributesToNodes(
      GetAttributesToNodesRequest request); @Override GetClusterNodeAttributesResponse getClusterNodeAttributes(
      GetClusterNodeAttributesRequest request); @Override GetNodesToAttributesResponse getNodesToAttributes(
      GetNodesToAttributesRequest request);  }
@Test public void testGetApplicationReport() throws YarnException, IOException, InterruptedException { LOG.info("Test FederationClientInterceptor: Get Application Report"); ApplicationId appId = ApplicationId.newInstance(System.currentTimeMillis(), 1); ApplicationSubmissionContext context = ApplicationSubmissionContext .newInstance(appId, "", "", null, null, false, false, -1, null, null); SubmitApplicationRequest request = SubmitApplicationRequest.newInstance(context); SubmitApplicationResponse response = interceptor.submitApplication(request); Assert.assertNotNull(response); Assert.assertNotNull(stateStoreUtil.queryApplicationHomeSC(appId)); GetApplicationReportRequest requestGet = GetApplicationReportRequest.newInstance(appId); GetApplicationReportResponse responseGet = interceptor.getApplicationReport(requestGet); Assert.assertNotNull(responseGet); }