@Test public void testAnyImpossible() throws PlanningException { prepareBasicPlan(); ReservationDefinition rr = new ReservationDefinitionPBImpl(); rr.setArrival(100L); rr.setDeadline(120L); ReservationRequests reqs = new ReservationRequestsPBImpl(); reqs.setInterpreter(ReservationRequestInterpreter.R_ANY); ReservationRequest r1 = ReservationRequest.newInstance( Resource.newInstance(1024, 1, 1), 35, 5, 30); ReservationRequest r2 = ReservationRequest.newInstance( Resource.newInstance(1024, 1, 1), 110, 110, 10); List<ReservationRequest> list = new ArrayList<ReservationRequest>(); list.add(r1); list.add(r2); reqs.setReservationResources(list); rr.setReservationRequests(reqs); ReservationId reservationID = ReservationSystemTestUtil .getNewReservationId(); boolean result = false; try { result = agent.createReservation(reservationID, "u1", plan, rr); fail(); } catch (PlanningException p) { } assertFalse("Agent-based allocation should have failed", result); assertTrue("Agent-based allocation should have failed", plan .getAllReservations().size() == 2); System.out.println("--------AFTER ANY IMPOSSIBLE ALLOCATION (queue: " + reservationID + ")----------"); System.out.println(plan.toString()); System.out.println(plan.toCumulativeString()); }
@Override public boolean createReservation(ReservationId reservationId, String user, Plan plan, ReservationDefinition contract) throws PlanningException { return computeAllocation(reservationId, user, plan, contract, null); }
GreedyReservationAgent implements ReservationAgent { @Override public boolean createReservation(ReservationId reservationId, String user, Plan plan, ReservationDefinition contract) throws PlanningException { return computeAllocation(reservationId, user, plan, contract, null); } }
GreedyReservationAgent implements ReservationAgent { @Override public boolean createReservation(ReservationId reservationId, String user, Plan plan, ReservationDefinition contract) throws PlanningException { return computeAllocation(reservationId, user, plan, contract, null); }  }
GreedyReservationAgent implements ReservationAgent { @Override public boolean createReservation(ReservationId reservationId, String user, Plan plan, ReservationDefinition contract) throws PlanningException { return computeAllocation(reservationId, user, plan, contract, null); }  @Override boolean createReservation(ReservationId reservationId, String user,
      Plan plan, ReservationDefinition contract); @Override boolean updateReservation(ReservationId reservationId, String user,
      Plan plan, ReservationDefinition contract); @Override boolean deleteReservation(ReservationId reservationId, String user,
      Plan plan); }
GreedyReservationAgent implements ReservationAgent { @Override public boolean createReservation(ReservationId reservationId, String user, Plan plan, ReservationDefinition contract) throws PlanningException { return computeAllocation(reservationId, user, plan, contract, null); }  @Override boolean createReservation(ReservationId reservationId, String user,
      Plan plan, ReservationDefinition contract); @Override boolean updateReservation(ReservationId reservationId, String user,
      Plan plan, ReservationDefinition contract); @Override boolean deleteReservation(ReservationId reservationId, String user,
      Plan plan);  }