@SuppressWarnings("javadoc") @Test public void testSimple() throws PlanningException { prepareBasicPlan(); ReservationDefinition rr = new ReservationDefinitionPBImpl(); rr.setArrival(5 * step); rr.setDeadline(20 * step); ReservationRequest r = ReservationRequest.newInstance( Resource.newInstance(2048, 2, 2), 10, 5, 10 * step); ReservationRequests reqs = new ReservationRequestsPBImpl(); reqs.setReservationResources(Collections.singletonList(r)); rr.setReservationRequests(reqs); ReservationId reservationID = ReservationSystemTestUtil .getNewReservationId(); agent.createReservation(reservationID, "u1", plan, rr); assertTrue("Agent-based allocation failed", reservationID != null); assertTrue("Agent-based allocation failed", plan.getAllReservations() .size() == 3); ReservationAllocation cs = plan.getReservationById(reservationID); System.out.println("--------AFTER SIMPLE ALLOCATION (queue: " + reservationID + ")----------"); System.out.println(plan.toString()); System.out.println(plan.toCumulativeString()); for (long i = 10 * step; i < 20 * step; i++) { assertTrue( "Agent-based allocation unexpected", Resources.equals(cs.getResourcesAtTime(i), Resource.newInstance(2048 * 10, 2 * 10, 2 * 10))); } }
@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);  }