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

项目:hadoop    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationNoID() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationDoesnotExist() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  ReservationId rId = request.getReservationId();
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationInvalidPlan() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationNoDefinition() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  request.setReservationId(ReservationSystemTestUtil.getNewReservationId());
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .startsWith("Missing reservation definition. Please try again by specifying a reservation definition."));
    LOG.info(message);
  }
}
项目:hadoop    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidDeadline() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 0, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("The specified deadline: 0 is the past"));
    LOG.info(message);
  }
}
项目:hadoop    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidRR() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(0, 0, 1, 5, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
项目:hadoop    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationEmptyRR() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 0, 1, 5, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
项目:hadoop    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidDuration() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 3, 4);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .contains("must  be greater or equal to the minimum resource duration"));
    LOG.info(message);
  }
}
项目:hadoop    文件:TestReservationInputValidator.java   
private ReservationUpdateRequest createSimpleReservationUpdateRequest(
    int numRequests, int numContainers, long arrival, long deadline,
    long duration) {
  // create a request with a single atomic ask
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  ReservationDefinition rDef = new ReservationDefinitionPBImpl();
  rDef.setArrival(arrival);
  rDef.setDeadline(deadline);
  if (numRequests > 0) {
    ReservationRequests reqs = new ReservationRequestsPBImpl();
    rDef.setReservationRequests(reqs);
    if (numContainers > 0) {
      ReservationRequest r =
          ReservationRequest.newInstance(Resource.newInstance(1024, 1, 1),
              numContainers, 1, duration);

      reqs.setReservationResources(Collections.singletonList(r));
      reqs.setInterpreter(ReservationRequestInterpreter.R_ALL);
    }
  }
  request.setReservationDefinition(rDef);
  request.setReservationId(ReservationSystemTestUtil.getNewReservationId());
  return request;
}
项目:aliyun-oss-hadoop-fs    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationNoID() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationDoesnotExist() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  ReservationId rId = request.getReservationId();
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationInvalidPlan() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationNoDefinition() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  request.setReservationId(ReservationSystemTestUtil.getNewReservationId());
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .startsWith("Missing reservation definition. Please try again by specifying a reservation definition."));
    LOG.info(message);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidDeadline() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 0, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("The specified deadline: 0 is the past"));
    LOG.info(message);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidRR() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(0, 0, 1, 5, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationEmptyRR() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 0, 1, 5, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidDuration() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 3, 4);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .contains("must  be greater or equal to the minimum resource duration"));
    LOG.info(message);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestReservationInputValidator.java   
private ReservationUpdateRequest createSimpleReservationUpdateRequest(
    int numRequests, int numContainers, long arrival, long deadline,
    long duration) {
  // create a request with a single atomic ask
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  ReservationDefinition rDef = new ReservationDefinitionPBImpl();
  rDef.setArrival(arrival);
  rDef.setDeadline(deadline);
  if (numRequests > 0) {
    ReservationRequests reqs = new ReservationRequestsPBImpl();
    rDef.setReservationRequests(reqs);
    if (numContainers > 0) {
      ReservationRequest r =
          ReservationRequest.newInstance(Resource.newInstance(1024, 1),
              numContainers, 1, duration);

      reqs.setReservationResources(Collections.singletonList(r));
      reqs.setInterpreter(ReservationRequestInterpreter.R_ALL);
    }
  }
  request.setReservationDefinition(rDef);
  request.setReservationId(ReservationSystemTestUtil.getNewReservationId());
  return request;
}
项目:big-c    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationNoID() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationDoesnotExist() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  ReservationId rId = request.getReservationId();
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationInvalidPlan() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationNoDefinition() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  request.setReservationId(ReservationSystemTestUtil.getNewReservationId());
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .startsWith("Missing reservation definition. Please try again by specifying a reservation definition."));
    LOG.info(message);
  }
}
项目:big-c    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidDeadline() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 0, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("The specified deadline: 0 is the past"));
    LOG.info(message);
  }
}
项目:big-c    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidRR() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(0, 0, 1, 5, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
项目:big-c    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationEmptyRR() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 0, 1, 5, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
项目:big-c    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidDuration() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 3, 4);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .contains("must  be greater or equal to the minimum resource duration"));
    LOG.info(message);
  }
}
项目:big-c    文件:TestReservationInputValidator.java   
private ReservationUpdateRequest createSimpleReservationUpdateRequest(
    int numRequests, int numContainers, long arrival, long deadline,
    long duration) {
  // create a request with a single atomic ask
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  ReservationDefinition rDef = new ReservationDefinitionPBImpl();
  rDef.setArrival(arrival);
  rDef.setDeadline(deadline);
  if (numRequests > 0) {
    ReservationRequests reqs = new ReservationRequestsPBImpl();
    rDef.setReservationRequests(reqs);
    if (numContainers > 0) {
      ReservationRequest r =
          ReservationRequest.newInstance(Resource.newInstance(1024, 1),
              numContainers, 1, duration);

      reqs.setReservationResources(Collections.singletonList(r));
      reqs.setInterpreter(ReservationRequestInterpreter.R_ALL);
    }
  }
  request.setReservationDefinition(rDef);
  request.setReservationId(ReservationSystemTestUtil.getNewReservationId());
  return request;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationNoID() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationDoesnotExist() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  ReservationId rId = request.getReservationId();
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationInvalidPlan() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationNoDefinition() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  request.setReservationId(ReservationSystemTestUtil.getNewReservationId());
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .startsWith("Missing reservation definition. Please try again by specifying a reservation definition."));
    LOG.info(message);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidDeadline() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 0, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("The specified deadline: 0 is the past"));
    LOG.info(message);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidRR() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(0, 0, 1, 5, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationEmptyRR() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 0, 1, 5, 3);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert.assertTrue(message
        .startsWith("No resources have been specified to reserve"));
    LOG.info(message);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationInvalidDuration() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 3, 4);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(rSystem, request);
    Assert.fail();
  } catch (YarnException e) {
    Assert.assertNull(plan);
    String message = e.getMessage();
    Assert
        .assertTrue(message
            .contains("must  be greater or equal to the minimum resource duration"));
    LOG.info(message);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestReservationInputValidator.java   
private ReservationUpdateRequest createSimpleReservationUpdateRequest(
    int numRequests, int numContainers, long arrival, long deadline,
    long duration) {
  // create a request with a single atomic ask
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  ReservationDefinition rDef = new ReservationDefinitionPBImpl();
  rDef.setArrival(arrival);
  rDef.setDeadline(deadline);
  if (numRequests > 0) {
    ReservationRequests reqs = new ReservationRequestsPBImpl();
    rDef.setReservationRequests(reqs);
    if (numContainers > 0) {
      ReservationRequest r =
          ReservationRequest.newInstance(Resource.newInstance(1024, 1),
              numContainers, 1, duration);

      reqs.setReservationResources(Collections.singletonList(r));
      reqs.setInterpreter(ReservationRequestInterpreter.R_ALL);
    }
  }
  request.setReservationDefinition(rDef);
  request.setReservationId(ReservationSystemTestUtil.getNewReservationId());
  return request;
}
项目:hops    文件:ReservationACLsTestBase.java   
private void verifyUpdateReservationFailure(String updater,
        String originalSubmitter, String queueName) throws Exception {
  ReservationId reservationId = createReservation(originalSubmitter);
  submitReservation(originalSubmitter, queueName, reservationId);

  final ReservationUpdateRequest updateRequest =
          ReservationUpdateRequest.newInstance(
                  makeSimpleReservationDefinition(), reservationId);

  ApplicationClientProtocol unauthorizedClient = getRMClientForUser(updater);
  try {
    unauthorizedClient.updateReservation(updateRequest);
    Assert.fail("Reservation updating by the enemy should fail.");
  } catch (YarnException e) {
    handleAdministerException(e, updater, queueName, ReservationACL
            .ADMINISTER_RESERVATIONS.name());
  }

  deleteReservation(originalSubmitter, reservationId);
}
项目:hops    文件:TestReservationInputValidator.java   
@Test
public void testUpdateReservationNoID() {
  ReservationUpdateRequest request = new ReservationUpdateRequestPBImpl();
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationDoesnotExist() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  ReservationId rId = request.getReservationId();
  when(rSystem.getQueueForReservation(rId)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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 testUpdateReservationInvalidPlan() {
  ReservationUpdateRequest request =
      createSimpleReservationUpdateRequest(1, 1, 1, 5, 4);
  when(rSystem.getPlan(PLAN_NAME)).thenReturn(null);
  Plan plan = null;
  try {
    plan = rrValidator.validateReservationUpdateRequest(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);
  }
}