private ReservationAllocation createReservationAllocation( ReservationId reservationID, int start, int[] alloc, boolean isStep, String recurrenceExp) { Map<ReservationInterval, ReservationRequest> allocations = generateAllocation(start, alloc, isStep); ReservationDefinition rDef = createSimpleReservationDefinition(start, start + alloc.length, alloc.length, allocations.values(), recurrenceExp); Map<ReservationInterval, Resource> allocs = ReservationSystemUtil.toResources(allocations); return new InMemoryReservationAllocation(reservationID, rDef, user, planName, start, start + alloc.length, allocs, resCalc, minAlloc); }
@Test public void testUpdateNonExistingReservation() { Plan plan = new InMemoryPlan(queueMetrics, policy, agent, totalCapacity, 1L, resCalc, minAlloc, maxAlloc, planName, replanner, true); ReservationId reservationID = ReservationSystemTestUtil.getNewReservationId(); // Try to update a reservation without adding int[] alloc = { 10, 10, 10, 10, 10, 10 }; int start = 100; Map<ReservationInterval, ReservationRequest> allocations = generateAllocation(start, alloc, false); ReservationDefinition rDef = createSimpleReservationDefinition(start, start + alloc.length, alloc.length, allocations.values()); ReservationAllocation rAllocation = new InMemoryReservationAllocation(reservationID, rDef, user, planName, start, start + alloc.length, allocations, resCalc, minAlloc); Assert.assertNull(plan.getReservationById(reservationID)); try { plan.updateReservation(rAllocation); Assert.fail("Update should fail as it does not exist in the plan"); } catch (IllegalArgumentException e) { Assert.assertTrue(e.getMessage().endsWith("does not exist in the plan")); } catch (PlanningException e) { Assert.fail(e.getMessage()); } Assert.assertNull(plan.getReservationById(reservationID)); }
int start = 100; Map<ReservationInterval, ReservationRequest> allocations = generateAllocation(start, alloc, false); ReservationDefinition rDef = createSimpleReservationDefinition(start, start + alloc.length,
int start = 100; Map<ReservationInterval, ReservationRequest> allocations = generateAllocation(start, alloc, false); ReservationDefinition rDef = createSimpleReservationDefinition(start, start + alloc.length,
int start = 100; Map<ReservationInterval, ReservationRequest> allocations = generateAllocation(start, alloc, false); ReservationDefinition rDef = createSimpleReservationDefinition(start, start + alloc.length, allocations = generateAllocation(start, updatedAlloc, true); rDef = createSimpleReservationDefinition(start, start + updatedAlloc.length,
int start = 100; Map<ReservationInterval, ReservationRequest> allocations1 = generateAllocation(start, alloc1, false); ReservationDefinition rDef1 = createSimpleReservationDefinition(start, start + alloc1.length, int[] alloc2 = { 0, 5, 10, 5, 0 }; Map<ReservationInterval, ReservationRequest> allocations2 = generateAllocation(start, alloc2, true); ReservationDefinition rDef2 = createSimpleReservationDefinition(start, start + alloc2.length,
int start = 100; Map<ReservationInterval, ReservationRequest> allocations = generateAllocation(start, alloc, true); ReservationDefinition rDef = createSimpleReservationDefinition(start, start + alloc.length,