checkAllocation(plan, alloc, start, period); checkAllocation(plan, new int[] { 0, 0 }, start, period);
checkAllocation(plan, alloc, start, period); checkAllocation(plan, updatedAlloc, start, period);
@Test public void testAddReservationAlreadyExists() { // First add a reservation Plan plan = new InMemoryPlan(queueMetrics, policy, agent, totalCapacity, 1L, resCalc, minAlloc, maxAlloc, planName, replanner, true, context); ReservationId reservationID = ReservationSystemTestUtil.getNewReservationId(); int[] alloc = { 10, 10, 10, 10, 10, 10 }; int start = 100; ReservationAllocation rAllocation = createReservationAllocation(reservationID, start, alloc); Assert.assertNull(plan.getReservationById(reservationID)); try { plan.addReservation(rAllocation, false); } catch (PlanningException e) { Assert.fail(e.getMessage()); } doAssertions(plan, rAllocation); checkAllocation(plan, alloc, start, 0); // Try to add it again try { plan.addReservation(rAllocation, false); Assert.fail("Add should fail as it already exists"); } catch (IllegalArgumentException e) { Assert.assertTrue(e.getMessage().endsWith("already exists")); } catch (PlanningException e) { Assert.fail(e.getMessage()); } doAssertions(plan, rAllocation); }
@Test public void testAddReservation() { Plan plan = new InMemoryPlan(queueMetrics, policy, agent, totalCapacity, 1L, resCalc, minAlloc, maxAlloc, planName, replanner, true, context); ReservationId reservationID = ReservationSystemTestUtil.getNewReservationId(); int[] alloc = { 10, 10, 10, 10, 10, 10 }; int start = 100; ReservationAllocation rAllocation = createReservationAllocation(reservationID, start, alloc); Assert.assertNull(plan.getReservationById(reservationID)); try { plan.addReservation(rAllocation, false); } catch (PlanningException e) { Assert.fail(e.getMessage()); } doAssertions(plan, rAllocation); checkAllocation(plan, alloc, start, 0); }
checkAllocation(plan, alloc1, start, 0); checkAllocation(plan, alloc1, start, 0);
checkAllocation(plan, alloc, start, period);