예제 #1
0
 @Test
 @Transactional
 @Ignore("FIXME pending review after rename to libreplan")
 public void testRemove() {
   Order order = createValidOrder();
   orderModel.setPlanningState(createPlanningStateFor(order));
   orderModel.save();
   assertTrue(orderDAO.exists(order.getId()));
   orderModel.remove(order);
   assertFalse(orderDAO.exists(order.getId()));
 }
예제 #2
0
 @Test
 @Transactional
 @Ignore("FIXME pending review after rename to libreplan")
 public void testCreationUsingPrepareForCreate() {
   Order order = givenOrderFromPrepareForCreate();
   orderModel.save();
   assertTrue(orderDAO.exists(order.getId()));
 }
예제 #3
0
 @Test
 @Transactional
 @Ignore("FIXME pending review after rename to libreplan")
 public void testFind() throws InstanceNotFoundException {
   Order order = createValidOrder();
   orderModel.setPlanningState(createPlanningStateFor(order));
   orderModel.save();
   assertThat(orderDAO.find(order.getId()), notNullValue());
 }
예제 #4
0
 @Test
 @Transactional
 @Ignore("FIXME pending review after rename to libreplan")
 public void testCreation() throws ValidationException {
   Order order = createValidOrder();
   order.setCustomer(createValidExternalCompany());
   orderModel.setPlanningState(createPlanningStateFor(order));
   orderModel.save();
   assertTrue(orderDAO.exists(order.getId()));
 }
 private Order givenValidOrderWithValidOrderLinesAlreadyStored() {
   Order order = givenOrder();
   jiraOrderElementSynchronizer.syncOrderElementsWithJiraIssues(issues, order);
   order.dontPoseAsTransientObjectAnymore();
   orderDAO.saveWithoutValidating(order);
   orderDAO.flush();
   try {
     return orderDAO.find(order.getId());
   } catch (InstanceNotFoundException e) {
     return null;
   }
 }
예제 #6
0
 @Test
 @Transactional
 @Ignore("FIXME pending review after rename to libreplan")
 public void createOrderWithScheduledOrderLine() {
   Order order = givenOrderFromPrepareForCreate();
   OrderElement line = OrderLine.createOrderLineWithUnfixedPercentage(20);
   order.add(line);
   line.setName(UUID.randomUUID().toString());
   line.setCode(UUID.randomUUID().toString());
   assert line.getSchedulingState().isSomewhatScheduled();
   orderModel.save();
   assertTrue(orderDAO.exists(order.getId()));
   TaskSource lineTaskSource = line.getTaskSource();
   assertTrue(taskSourceDAO.exists(lineTaskSource.getId()));
 }
  private Order givenValidOrderAlreadyStored() {
    Order order = Order.create();
    order.setCode(UUID.randomUUID().toString());
    order.setName("Order name " + UUID.randomUUID());
    order.setInitDate(new Date());
    order.setCalendar(configurationDAO.getConfiguration().getDefaultCalendar());
    OrderVersion version = setupVersionUsing(scenarioManager, order);
    order.useSchedulingDataFor(version);

    orderDAO.save(order);
    orderDAO.flush();
    try {
      return orderDAO.find(order.getId());
    } catch (InstanceNotFoundException e) {
      return null;
    }
  }