@Override
  public GetAllResourceProfilesResponse getResourceProfiles(
      GetAllResourceProfilesRequest request) throws YarnException, IOException {
    if (request == null) {
      routerMetrics.incrGetResourceProfilesFailedRetrieved();
      String msg = "Missing getResourceProfiles request.";
      RouterAuditLogger.logFailure(user.getShortUserName(), GET_RESOURCEPROFILES, UNKNOWN,
          TARGET_CLIENT_RM_SERVICE, msg);
      RouterServerUtil.logAndThrowException(msg, null);
    }
    long startTime = clock.getTime();
    ClientMethod remoteMethod = new ClientMethod("getResourceProfiles",
        new Class[] {GetAllResourceProfilesRequest.class}, new Object[] {request});
    Collection<GetAllResourceProfilesResponse> resourceProfiles = null;
    try {
      resourceProfiles = invokeConcurrent(remoteMethod, GetAllResourceProfilesResponse.class);
    } catch (Exception ex) {
      routerMetrics.incrGetResourceProfilesFailedRetrieved();
      String msg = "Unable to get resource profiles due to exception.";
      RouterAuditLogger.logFailure(user.getShortUserName(), GET_RESOURCEPROFILES, UNKNOWN,
          TARGET_CLIENT_RM_SERVICE, msg);
      RouterServerUtil.logAndThrowException("Unable to get resource profiles due to exception.",
          ex);
    }
    long stopTime = clock.getTime();
    routerMetrics.succeededGetResourceProfilesRetrieved(stopTime - startTime);
    RouterAuditLogger.logSuccess(user.getShortUserName(), GET_RESOURCEPROFILES,
        TARGET_CLIENT_RM_SERVICE);
    return RouterYarnClientUtils.mergeClusterResourceProfilesResponse(resourceProfiles);
  }
@Test
  public void testGetResourceProfiles() throws Exception {
    LOG.info("Test FederationClientInterceptor : Get Resource Profiles request.");

    // null request
    LambdaTestUtils.intercept(YarnException.class, "Missing getResourceProfiles request.",
        () -> interceptor.getResourceProfiles(null));

    // normal request
    GetAllResourceProfilesRequest request = GetAllResourceProfilesRequest.newInstance();
    GetAllResourceProfilesResponse response = interceptor.getResourceProfiles(request);

    Assert.assertNotNull(response);
    Map<String, Resource> resProfiles = response.getResourceProfiles();

    Resource maxResProfiles = resProfiles.get("maximum");
    Assert.assertEquals(32768, maxResProfiles.getMemorySize());
    Assert.assertEquals(16, maxResProfiles.getVirtualCores());

    Resource defaultResProfiles = resProfiles.get("default");
    Assert.assertEquals(8192, defaultResProfiles.getMemorySize());
    Assert.assertEquals(8, defaultResProfiles.getVirtualCores());

    Resource minimumResProfiles = resProfiles.get("minimum");
    Assert.assertEquals(4096, minimumResProfiles.getMemorySize());
    Assert.assertEquals(4, minimumResProfiles.getVirtualCores());
  }