public virtual void SetUp() { clock = Org.Mockito.Mockito.Mock <Clock>(); plan = Org.Mockito.Mockito.Mock <Plan>(); rSystem = Org.Mockito.Mockito.Mock <ReservationSystem>(); plans[PlanName] = plan; rrValidator = new ReservationInputValidator(clock); Org.Mockito.Mockito.When(clock.GetTime()).ThenReturn(1L); ResourceCalculator rCalc = new DefaultResourceCalculator(); Org.Apache.Hadoop.Yarn.Api.Records.Resource resource = Org.Apache.Hadoop.Yarn.Api.Records.Resource .NewInstance(10240, 10); Org.Mockito.Mockito.When(plan.GetResourceCalculator()).ThenReturn(rCalc); Org.Mockito.Mockito.When(plan.GetTotalCapacity()).ThenReturn(resource); Org.Mockito.Mockito.When(rSystem.GetQueueForReservation(Matchers.Any <ReservationId >())).ThenReturn(PlanName); Org.Mockito.Mockito.When(rSystem.GetPlan(PlanName)).ThenReturn(plan); }
internal virtual void SetReservationSystem(ReservationSystem reservationSystem) { activeServiceContext.SetReservationSystem(reservationSystem); }
/// <summary> /// Quick validation on the input to check some obvious fail conditions (fail /// fast) the input and returns the appropriate /// <see cref="Plan"/> /// associated with /// the specified /// <see cref="Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Scheduler.Queue"/> /// or throws an exception message illustrating the /// details of any validation check failures /// </summary> /// <param name="reservationSystem"> /// the /// <see cref="ReservationSystem"/> /// to validate against /// </param> /// <param name="request"> /// the /// <see cref="Org.Apache.Hadoop.Yarn.Api.Protocolrecords.ReservationDeleteRequest"/> /// defining the resources /// required over time for the request /// </param> /// <returns> /// the /// <see cref="Plan"/> /// to submit the request to /// </returns> /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> public virtual Plan ValidateReservationDeleteRequest(ReservationSystem reservationSystem , ReservationDeleteRequest request) { return(ValidateReservation(reservationSystem, request.GetReservationId(), RMAuditLogger.AuditConstants .DeleteReservationRequest)); }
internal virtual void SetReservationSystem(ReservationSystem reservationSystem) { this.reservationSystem = reservationSystem; }