@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); }
doAssertions(plan, rAllocation); checkAllocation(plan, alloc, start, period); Assert.fail(e.getMessage()); doAssertions(plan, rAllocation); checkAllocation(plan, updatedAlloc, start, period);
Assert.fail(e.getMessage()); doAssertions(plan, rAllocation); for (int i = 0; i < alloc.length; i++) { Assert.assertEquals(Resource.newInstance(1024 * (alloc[i]), (alloc[i])), Assert.fail(e.getMessage()); doAssertions(plan, rAllocation);
doAssertions(plan, rAllocation); checkAllocation(plan, alloc, start, period);
@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); }
Assert.fail(e.getMessage()); doAssertions(plan, rAllocation); for (int i = 0; i < alloc.length; i++) { Assert.assertEquals(Resource.newInstance(1024 * (alloc[i]), (alloc[i])),
Assert.fail(e.getMessage()); doAssertions(plan, rAllocation); for (int i = 0; i < alloc.length; i++) { Assert.assertEquals(Resource.newInstance(1024 * (alloc[i]), (alloc[i])), Assert.fail(e.getMessage()); doAssertions(plan, rAllocation); for (int i = 0; i < updatedAlloc.length; i++) { Assert.assertEquals(
Assert.fail(e.getMessage()); doAssertions(plan, rAllocation); Assert.fail(e.getMessage()); doAssertions(plan, rAllocation);
Assert.fail(e.getMessage()); doAssertions(plan, rAllocation); checkAllocation(plan, alloc, start, period);
Assert.fail(e.getMessage()); doAssertions(plan, rAllocation); checkAllocation(plan, alloc1, start, 0);
Assert.fail(e.getMessage()); doAssertions(plan, rAllocation); for (int i = 0; i < alloc1.length; i++) { Assert.assertEquals(
Assert.fail(e.getMessage()); doAssertions(plan, rAllocation); for (int i = 0; i < alloc.length; i++) { Assert.assertEquals(
Assert.fail(e.getMessage()); doAssertions(plan, rAllocation);