@SuppressWarnings("javadoc")
@Test
public void testSimple() throws PlanningException {

  prepareBasicPlan();
  // create a request with a single atomic ask
  ReservationDefinition rr = new ReservationDefinitionPBImpl();
  rr.setArrival(5 * step);
  rr.setDeadline(20 * step);
  rr.setRecurrenceExpression(recurrenceExpression);
  ReservationRequest r = ReservationRequest.newInstance(
      Resource.newInstance(2048, 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());
  if(allocateLeft){
    for (long i = 5 * step; i < 15 * step; i++) {
      assertTrue(
          "Agent-based allocation unexpected",
          Resources.equals(cs.getResourcesAtTime(i),
              Resource.newInstance(2048 * 10, 2 * 10)));
    }
  } else {
    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)));
    }
  }
}