Java 类org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest 实例源码

项目:hadoop    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationNoID() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .startsWith("Missing reservation id. Please try again by specifying a reservation id."));
    LOG.info(message);
  }
}
项目:hadoop    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationDoesnotExist() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId rId = ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(rId);
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message.equals(MessageFormat
            .format(
                "The specified reservation with ID: {0} is unknown. Please try again with a valid reservation.",
                rId)));
    LOG.info(message);
  }
}
项目:hadoop    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationInvalidPlan() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId reservationID =
      ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(reservationID);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .endsWith(" is not associated with any valid plan. Please try again with a valid reservation."));
    LOG.info(message);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationNoID() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .startsWith("Missing reservation id. Please try again by specifying a reservation id."));
    LOG.info(message);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationDoesnotExist() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId rId = ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(rId);
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message.equals(MessageFormat
            .format(
                "The specified reservation with ID: {0} is unknown. Please try again with a valid reservation.",
                rId)));
    LOG.info(message);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationInvalidPlan() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId reservationID =
      ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(reservationID);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .endsWith(" is not associated with any valid plan. Please try again with a valid reservation."));
    LOG.info(message);
  }
}
项目:big-c    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationNoID() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .startsWith("Missing reservation id. Please try again by specifying a reservation id."));
    LOG.info(message);
  }
}
项目:big-c    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationDoesnotExist() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId rId = ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(rId);
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message.equals(MessageFormat
            .format(
                "The specified reservation with ID: {0} is unknown. Please try again with a valid reservation.",
                rId)));
    LOG.info(message);
  }
}
项目:big-c    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationInvalidPlan() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId reservationID =
      ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(reservationID);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .endsWith(" is not associated with any valid plan. Please try again with a valid reservation."));
    LOG.info(message);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationNoID() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .startsWith("Missing reservation id. Please try again by specifying a reservation id."));
    LOG.info(message);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationDoesnotExist() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId rId = ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(rId);
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message.equals(MessageFormat
            .format(
                "The specified reservation with ID: {0} is unknown. Please try again with a valid reservation.",
                rId)));
    LOG.info(message);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationInvalidPlan() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId reservationID =
      ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(reservationID);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .endsWith(" is not associated with any valid plan. Please try again with a valid reservation."));
    LOG.info(message);
  }
}
项目:hops    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationNoID() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .startsWith("Missing reservation id. Please try again by specifying a reservation id."));
    LOG.info(message);
  }
}
项目:hops    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationDoesnotExist() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId rId = ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(rId);
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message.equals(MessageFormat
            .format(
                "The specified reservation with ID: {0} is unknown. Please try again with a valid reservation.",
                rId)));
    LOG.info(message);
  }
}
项目:hops    文件:TestReservationInputValidator.java   
@Test
public void testDeleteReservationInvalidPlan() {
  ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl();
  ReservationId reservationID =
      ReservationSystemTestUtil.getNewReservationId();
  request.setReservationId(reservationID);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationDeleteRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .endsWith(" is not associated with any valid plan. Please try again with a valid reservation."));
    LOG.info(message);
  }
}
项目:hadoop    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public ReservationDeleteResponse deleteReservation(ReservationDeleteRequest request)
    throws YarnException, IOException {
  ReservationDeleteRequestProto requestProto =
      ((ReservationDeleteRequestPBImpl) request).getProto();
  try {
    return new ReservationDeleteResponsePBImpl(proxy.deleteReservation(null,
        requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hadoop    文件:ClientRMService.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  // Check if reservation system is enabled
  checkReservationSytem(AuditConstants.DELETE_RESERVATION_REQUEST);
  ReservationDeleteResponse response =
      recordFactory.newRecordInstance(ReservationDeleteResponse.class);
  // Validate the input
  Plan plan =
      rValidator.validateReservationDeleteRequest(reservationSystem, request);
  ReservationId reservationId = request.getReservationId();
  String queueName = reservationSystem.getQueueForReservation(reservationId);
  // Check ACLs
  String user =
      checkReservationACLs(queueName,
          AuditConstants.DELETE_RESERVATION_REQUEST);
  // Try to update the reservation using default agent
  try {
    boolean result =
        plan.getReservationAgent().deleteReservation(reservationId, user,
            plan);
    if (!result) {
      String errMsg = "Could not delete reservation: " + reservationId;
      RMAuditLogger.logFailure(user,
          AuditConstants.DELETE_RESERVATION_REQUEST, errMsg,
          "ClientRMService", errMsg);
      throw RPCUtil.getRemoteException(errMsg);
    }
  } catch (PlanningException e) {
    RMAuditLogger.logFailure(user, AuditConstants.DELETE_RESERVATION_REQUEST,
        e.getMessage(), "ClientRMService",
        "Unable to delete the reservation: " + reservationId);
    throw RPCUtil.getRemoteException(e);
  }
  RMAuditLogger.logSuccess(user, AuditConstants.DELETE_RESERVATION_REQUEST,
      "ClientRMService: " + reservationId);
  return response;
}
项目:aliyun-oss-hadoop-fs    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public ReservationDeleteResponse deleteReservation(ReservationDeleteRequest request)
    throws YarnException, IOException {
  ReservationDeleteRequestProto requestProto =
      ((ReservationDeleteRequestPBImpl) request).getProto();
  try {
    return new ReservationDeleteResponsePBImpl(proxy.deleteReservation(null,
        requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:aliyun-oss-hadoop-fs    文件:RMWebServices.java   
private ReservationDeleteRequest createReservationDeleteRequest(
    ReservationDeleteRequestInfo resContext) throws IOException {

  ReservationDeleteRequest request =
      ReservationDeleteRequest.newInstance(ReservationId
          .parseReservationId(resContext.getReservationId()));

  return request;
}
项目:aliyun-oss-hadoop-fs    文件:ClientRMService.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  // Check if reservation system is enabled
  checkReservationSytem(AuditConstants.DELETE_RESERVATION_REQUEST);
  ReservationDeleteResponse response =
      recordFactory.newRecordInstance(ReservationDeleteResponse.class);
  // Validate the input
  Plan plan =
      rValidator.validateReservationDeleteRequest(reservationSystem, request);
  ReservationId reservationId = request.getReservationId();
  String queueName = reservationSystem.getQueueForReservation(reservationId);
  // Check ACLs
  String user =
      checkReservationACLs(queueName,
          AuditConstants.DELETE_RESERVATION_REQUEST);
  // Try to update the reservation using default agent
  try {
    boolean result =
        plan.getReservationAgent().deleteReservation(reservationId, user,
            plan);
    if (!result) {
      String errMsg = "Could not delete reservation: " + reservationId;
      RMAuditLogger.logFailure(user,
          AuditConstants.DELETE_RESERVATION_REQUEST, errMsg,
          "ClientRMService", errMsg);
      throw RPCUtil.getRemoteException(errMsg);
    }
  } catch (PlanningException e) {
    RMAuditLogger.logFailure(user, AuditConstants.DELETE_RESERVATION_REQUEST,
        e.getMessage(), "ClientRMService",
        "Unable to delete the reservation: " + reservationId);
    throw RPCUtil.getRemoteException(e);
  }
  RMAuditLogger.logSuccess(user, AuditConstants.DELETE_RESERVATION_REQUEST,
      "ClientRMService: " + reservationId);
  return response;
}
项目:aliyun-oss-hadoop-fs    文件:TestReservationSystemWithRMHA.java   
@Test
public void testDeleteReservationAndCheckAfterFailover() throws Exception {
  startRMs();

  addNodeCapacityToPlan(rm1, 102400, 100);

  ClientRMService clientService = rm1.getClientRMService();

  // create a reservation
  ReservationSubmissionRequest request = createReservationSubmissionRequest();
  ReservationSubmissionResponse response = null;
  try {
    response = clientService.submitReservation(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  ReservationId reservationID = response.getReservationId();
  Assert.assertNotNull(reservationID);

  // Delete the reservation
  ReservationDeleteRequest deleteRequest =
      ReservationDeleteRequest.newInstance(reservationID);
  clientService.deleteReservation(deleteRequest);

  // Do the failover
  explicitFailover();

  rm2.registerNode("127.0.0.1:1", 102400, 100);

  RMState state = rm2.getRMContext().getStateStore().loadState();
  Assert.assertNull(state.getReservationState()
      .get(ReservationSystemTestUtil.reservationQ));
}
项目:big-c    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public ReservationDeleteResponse deleteReservation(ReservationDeleteRequest request)
    throws YarnException, IOException {
  ReservationDeleteRequestProto requestProto =
      ((ReservationDeleteRequestPBImpl) request).getProto();
  try {
    return new ReservationDeleteResponsePBImpl(proxy.deleteReservation(null,
        requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:big-c    文件:ClientRMService.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  // Check if reservation system is enabled
  checkReservationSytem(AuditConstants.DELETE_RESERVATION_REQUEST);
  ReservationDeleteResponse response =
      recordFactory.newRecordInstance(ReservationDeleteResponse.class);
  // Validate the input
  Plan plan =
      rValidator.validateReservationDeleteRequest(reservationSystem, request);
  ReservationId reservationId = request.getReservationId();
  String queueName = reservationSystem.getQueueForReservation(reservationId);
  // Check ACLs
  String user =
      checkReservationACLs(queueName,
          AuditConstants.DELETE_RESERVATION_REQUEST);
  // Try to update the reservation using default agent
  try {
    boolean result =
        plan.getReservationAgent().deleteReservation(reservationId, user,
            plan);
    if (!result) {
      String errMsg = "Could not delete reservation: " + reservationId;
      RMAuditLogger.logFailure(user,
          AuditConstants.DELETE_RESERVATION_REQUEST, errMsg,
          "ClientRMService", errMsg);
      throw RPCUtil.getRemoteException(errMsg);
    }
  } catch (PlanningException e) {
    RMAuditLogger.logFailure(user, AuditConstants.DELETE_RESERVATION_REQUEST,
        e.getMessage(), "ClientRMService",
        "Unable to delete the reservation: " + reservationId);
    throw RPCUtil.getRemoteException(e);
  }
  RMAuditLogger.logSuccess(user, AuditConstants.DELETE_RESERVATION_REQUEST,
      "ClientRMService: " + reservationId);
  return response;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public ReservationDeleteResponse deleteReservation(ReservationDeleteRequest request)
    throws YarnException, IOException {
  ReservationDeleteRequestProto requestProto =
      ((ReservationDeleteRequestPBImpl) request).getProto();
  try {
    return new ReservationDeleteResponsePBImpl(proxy.deleteReservation(null,
        requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ClientRMService.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  // Check if reservation system is enabled
  checkReservationSytem(AuditConstants.DELETE_RESERVATION_REQUEST);
  ReservationDeleteResponse response =
      recordFactory.newRecordInstance(ReservationDeleteResponse.class);
  // Validate the input
  Plan plan =
      rValidator.validateReservationDeleteRequest(reservationSystem, request);
  ReservationId reservationId = request.getReservationId();
  String queueName = reservationSystem.getQueueForReservation(reservationId);
  // Check ACLs
  String user =
      checkReservationACLs(queueName,
          AuditConstants.DELETE_RESERVATION_REQUEST);
  // Try to update the reservation using default agent
  try {
    boolean result =
        plan.getReservationAgent().deleteReservation(reservationId, user,
            plan);
    if (!result) {
      String errMsg = "Could not delete reservation: " + reservationId;
      RMAuditLogger.logFailure(user,
          AuditConstants.DELETE_RESERVATION_REQUEST, errMsg,
          "ClientRMService", errMsg);
      throw RPCUtil.getRemoteException(errMsg);
    }
  } catch (PlanningException e) {
    RMAuditLogger.logFailure(user, AuditConstants.DELETE_RESERVATION_REQUEST,
        e.getMessage(), "ClientRMService",
        "Unable to delete the reservation: " + reservationId);
    throw RPCUtil.getRemoteException(e);
  }
  RMAuditLogger.logSuccess(user, AuditConstants.DELETE_RESERVATION_REQUEST,
      "ClientRMService: " + reservationId);
  return response;
}
项目:hops    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public ReservationDeleteResponse deleteReservation(ReservationDeleteRequest request)
    throws YarnException, IOException {
  ReservationDeleteRequestProto requestProto =
      ((ReservationDeleteRequestPBImpl) request).getProto();
  try {
    return new ReservationDeleteResponsePBImpl(proxy.deleteReservation(null,
        requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hops    文件:RMWebServices.java   
private ReservationDeleteRequest createReservationDeleteRequest(
    ReservationDeleteRequestInfo resContext) throws IOException {

  ReservationDeleteRequest request =
      ReservationDeleteRequest.newInstance(ReservationId
          .parseReservationId(resContext.getReservationId()));

  return request;
}
项目:hops    文件:ClientRMService.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  // Check if reservation system is enabled
  checkReservationSytem(AuditConstants.DELETE_RESERVATION_REQUEST);
  ReservationDeleteResponse response =
      recordFactory.newRecordInstance(ReservationDeleteResponse.class);
  // Validate the input
  Plan plan =
      rValidator.validateReservationDeleteRequest(reservationSystem, request);
  ReservationId reservationId = request.getReservationId();
  String queueName = reservationSystem.getQueueForReservation(reservationId);
  // Check ACLs
  String user =
      checkReservationACLs(queueName,
          AuditConstants.DELETE_RESERVATION_REQUEST, reservationId);
  // Try to update the reservation using default agent
  try {
    boolean result =
        plan.getReservationAgent().deleteReservation(reservationId, user,
            plan);
    if (!result) {
      String errMsg = "Could not delete reservation: " + reservationId;
      RMAuditLogger.logFailure(user,
          AuditConstants.DELETE_RESERVATION_REQUEST, errMsg,
          "ClientRMService", errMsg);
      throw RPCUtil.getRemoteException(errMsg);
    }
  } catch (PlanningException e) {
    RMAuditLogger.logFailure(user, AuditConstants.DELETE_RESERVATION_REQUEST,
        e.getMessage(), "ClientRMService",
        "Unable to delete the reservation: " + reservationId);
    throw RPCUtil.getRemoteException(e);
  }
  RMAuditLogger.logSuccess(user, AuditConstants.DELETE_RESERVATION_REQUEST,
      "ClientRMService: " + reservationId);
  return response;
}
项目:hops    文件:TestReservationSystemWithRMHA.java   
@Test
public void testDeleteReservationAndCheckAfterFailover() throws Exception {
  startRMs();

  addNodeCapacityToPlan(rm1, 102400, 100);

  ClientRMService clientService = rm1.getClientRMService();

  ReservationId reservationID = getNewReservation(clientService)
      .getReservationId();

  // create a reservation
  ReservationSubmissionRequest request = createReservationSubmissionRequest(
      reservationID);
  ReservationSubmissionResponse response = null;
  try {
    response = clientService.submitReservation(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  Assert.assertNotNull(reservationID);

  // Delete the reservation
  ReservationDeleteRequest deleteRequest =
      ReservationDeleteRequest.newInstance(reservationID);
  clientService.deleteReservation(deleteRequest);

  // Do the failover
  explicitFailover();

  rm2.registerNode("127.0.0.1:1", 102400, 100);

  RMState state = rm2.getRMContext().getStateStore().loadState();
  Assert.assertNull(state.getReservationState()
      .get(ReservationSystemTestUtil.reservationQ));
}
项目:hops    文件:TestYarnClient.java   
@Test
public void testReservationDelete() throws Exception {
  MiniYARNCluster cluster = setupMiniYARNCluster();
  YarnClient client = setupYarnClient(cluster);
  try {
    Clock clock = new UTCClock();
    long arrival = clock.getTime();
    long duration = 60000;
    long deadline = (long) (arrival + 1.05 * duration);
    ReservationSubmissionRequest sRequest =
        submitReservationTestHelper(client, arrival, deadline, duration);

    ReservationId reservationID = sRequest.getReservationId();
    // Delete the reservation
    ReservationDeleteRequest dRequest =
        ReservationDeleteRequest.newInstance(reservationID);
    ReservationDeleteResponse dResponse = client.deleteReservation(dRequest);
    Assert.assertNotNull(dResponse);
    System.out.println("Delete reservation response: " + dResponse);

    // List reservations, search by non-existent reservationID
    ReservationListRequest request = ReservationListRequest.newInstance(
        ReservationSystemTestUtil.reservationQ, reservationID.toString(), -1,
        -1, false);

    ReservationListResponse response =  client.listReservations(request);
    Assert.assertNotNull(response);
    Assert.assertEquals(0, response.getReservationAllocationState().size());
  } finally {
    // clean-up
    if (client != null) {
      client.stop();
    }
    cluster.stop();
  }
}
项目:hadoop    文件:YarnClientImpl.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  return rmClient.deleteReservation(request);
}
项目:hadoop    文件:ResourceMgrDelegate.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  return client.deleteReservation(request);
}
项目:hadoop    文件:TestClientRedirect.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  return null;
}
项目:scheduling-connector-for-hadoop    文件:HPCApplicationClientProtocolImpl.java   
@Override
public ReservationDeleteResponse deleteReservation(ReservationDeleteRequest arg0)
        throws YarnException, IOException {
    // TODO Auto-generated method stub
    return null;
}
项目:aliyun-oss-hadoop-fs    文件:MockResourceManagerFacade.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  throw new NotImplementedException();
}
项目:aliyun-oss-hadoop-fs    文件:RMWebServices.java   
/**
 * Function to delete a Reservation to the RM.
 *
 * @param resContext provides information to construct
 *          the ReservationDeleteRequest
 * @param hsr the servlet request
 * @return Response containing the status code
 * @throws AuthorizationException
 * @throws IOException
 * @throws InterruptedException
 */
@POST
@Path("/reservation/delete")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response deleteReservation(ReservationDeleteRequestInfo resContext,
    @Context HttpServletRequest hsr) throws AuthorizationException,
    IOException, InterruptedException {

  init();
  UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
  if (callerUGI == null) {
    throw new AuthorizationException("Unable to obtain user name, "
        + "user not authenticated");
  }
  if (UserGroupInformation.isSecurityEnabled() && isStaticUser(callerUGI)) {
    String msg = "The default static user cannot carry out this operation.";
    return Response.status(Status.FORBIDDEN).entity(msg).build();
  }

  final ReservationDeleteRequest reservation =
      createReservationDeleteRequest(resContext);

  ReservationDeleteResponseInfo resRespInfo;
  try {
    resRespInfo =
        callerUGI.doAs(
            new PrivilegedExceptionAction<ReservationDeleteResponseInfo>() {
              @Override
              public ReservationDeleteResponseInfo run() throws IOException,
                  YarnException {
                rm.getClientRMService().deleteReservation(reservation);
                return new ReservationDeleteResponseInfo();
              }
            });
  } catch (UndeclaredThrowableException ue) {
    if (ue.getCause() instanceof YarnException) {
      throw new BadRequestException(ue.getCause().getMessage());
    }
    LOG.info("Update reservation request failed", ue);
    throw ue;
  }

  return Response.status(Status.OK).entity(resRespInfo).build();
}
项目:aliyun-oss-hadoop-fs    文件:YarnClientImpl.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  return rmClient.deleteReservation(request);
}
项目:aliyun-oss-hadoop-fs    文件:ResourceMgrDelegate.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  return client.deleteReservation(request);
}
项目:aliyun-oss-hadoop-fs    文件:TestClientRedirect.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  return null;
}
项目:big-c    文件:YarnClientImpl.java   
@Override
public ReservationDeleteResponse deleteReservation(
    ReservationDeleteRequest request) throws YarnException, IOException {
  return rmClient.deleteReservation(request);
}