@Test public void testUpdateReservationExceedsGangSize() { ReservationUpdateRequest request = createSimpleReservationUpdateRequest(1, 1, 1, 5, 4); Resource resource = Resource.newInstance(512, 1, 1); when(plan.getTotalCapacity()).thenReturn(resource); 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 size of the largest gang in the reservation refinition")); Assert.assertTrue(message.contains("exceed the capacity available ")); LOG.info(message); } }
public Plan validateReservationUpdateRequest( ReservationSystem reservationSystem, ReservationUpdateRequest request) throws YarnException { ReservationId reservationId = request.getReservationId(); Plan plan = validateReservation(reservationSystem, reservationId, AuditConstants.UPDATE_RESERVATION_REQUEST); validateReservationDefinition(reservationId, request.getReservationDefinition(), plan, AuditConstants.UPDATE_RESERVATION_REQUEST); return plan; }
ReservationInputValidator { public Plan validateReservationUpdateRequest( ReservationSystem reservationSystem, ReservationUpdateRequest request) throws YarnException { ReservationId reservationId = request.getReservationId(); Plan plan = validateReservation(reservationSystem, reservationId, AuditConstants.UPDATE_RESERVATION_REQUEST); validateReservationDefinition(reservationId, request.getReservationDefinition(), plan, AuditConstants.UPDATE_RESERVATION_REQUEST); return plan; } }
ReservationInputValidator { public Plan validateReservationUpdateRequest( ReservationSystem reservationSystem, ReservationUpdateRequest request) throws YarnException { ReservationId reservationId = request.getReservationId(); Plan plan = validateReservation(reservationSystem, reservationId, AuditConstants.UPDATE_RESERVATION_REQUEST); validateReservationDefinition(reservationId, request.getReservationDefinition(), plan, AuditConstants.UPDATE_RESERVATION_REQUEST); return plan; } ReservationInputValidator(Clock clock); }
ReservationInputValidator { public Plan validateReservationUpdateRequest( ReservationSystem reservationSystem, ReservationUpdateRequest request) throws YarnException { ReservationId reservationId = request.getReservationId(); Plan plan = validateReservation(reservationSystem, reservationId, AuditConstants.UPDATE_RESERVATION_REQUEST); validateReservationDefinition(reservationId, request.getReservationDefinition(), plan, AuditConstants.UPDATE_RESERVATION_REQUEST); return plan; } ReservationInputValidator(Clock clock); Plan validateReservationSubmissionRequest(
      ReservationSystem reservationSystem,
      ReservationSubmissionRequest request, ReservationId reservationId); Plan validateReservationUpdateRequest(
      ReservationSystem reservationSystem, ReservationUpdateRequest request); Plan validateReservationDeleteRequest(
      ReservationSystem reservationSystem, ReservationDeleteRequest request); }
ReservationInputValidator { public Plan validateReservationUpdateRequest( ReservationSystem reservationSystem, ReservationUpdateRequest request) throws YarnException { ReservationId reservationId = request.getReservationId(); Plan plan = validateReservation(reservationSystem, reservationId, AuditConstants.UPDATE_RESERVATION_REQUEST); validateReservationDefinition(reservationId, request.getReservationDefinition(), plan, AuditConstants.UPDATE_RESERVATION_REQUEST); return plan; } ReservationInputValidator(Clock clock); Plan validateReservationSubmissionRequest(
      ReservationSystem reservationSystem,
      ReservationSubmissionRequest request, ReservationId reservationId); Plan validateReservationUpdateRequest(
      ReservationSystem reservationSystem, ReservationUpdateRequest request); Plan validateReservationDeleteRequest(
      ReservationSystem reservationSystem, ReservationDeleteRequest request);  }