Package org.libreplan.business.orders.entities

Examples of org.libreplan.business.orders.entities.Order


                    }
                });
    }

    private Order createValidOrder() {
        Order order = Order.create();
        order.setDescription("description");
        order.setInitDate(year(2000));
        order.setName("name");
        order.setResponsible("responsible");
        order.setCode("code-" + UUID.randomUUID());
        BaseCalendar calendar = adHocTransaction
                .runOnReadOnlyTransaction(new IOnTransaction<BaseCalendar>() {

                    @Override
                    public BaseCalendar execute() {
                        BaseCalendar result = configurationDAO
                                .getConfigurationWithReadOnlyTransaction()
                                .getDefaultCalendar();
                        BaseCalendarModel.forceLoadBaseCalendar(result);
                        return result;
                    }
                });
        order.setCalendar(calendar);
        return order;
    }
View Full Code Here


    @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()));
    }
View Full Code Here

                    public Void execute() {
                        orderModel.prepareForCreate(mockDesktop());
                        return null;
                    }
                });
        Order order = orderModel.getOrder();
        order.setName("name");
        order.setCode("code");
        order.setInitDate(new Date());
        order.setCustomer(createValidExternalCompany());
        return order;
    }
View Full Code Here

    @Test
    @Transactional
    @Ignore("FIXME pending review after rename to libreplan")
    public void testCreationUsingPrepareForCreate() {
        Order order = givenOrderFromPrepareForCreate();
        orderModel.save();
        assertTrue(orderDAO.exists(order.getId()));
    }
View Full Code Here

    @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()));
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void ifAnOrderLineIsScheduledItsTypeChanges() {
        Order order = givenOrderFromPrepareForCreate();
        OrderElement line = OrderLine.createOrderLineWithUnfixedPercentage(20);
        line.useSchedulingDataFor(order.getCurrentOrderVersion());
        line.getSchedulingState().unschedule();
        order.add(line);
        assertFalse(order.getSchedulingState().isSomewhatScheduled());
        line.getSchedulingState().schedule();
        assertTrue(order.getSchedulingState().isSomewhatScheduled());
    }
View Full Code Here

            "session from tests")
    @Test
    @Transactional
    public void testListing() {
        List<Order> list = orderModel.getOrders();
        Order order = createValidOrder();
        order.setCustomer(createValidExternalCompany());
        orderModel.setPlanningState(createPlanningStateFor(order));
        orderModel.save();
        assertThat(orderModel.getOrders().size(), equalTo(list.size() + 1));
    }
View Full Code Here

    @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()));
    }
View Full Code Here

    @Test(expected = ValidationException.class)
    @Transactional
    @Ignore("FIXME pending review after rename to libreplan")
    public void shouldSendValidationExceptionIfEndDateIsBeforeThanStartingDate()
            throws ValidationException {
        Order order = createValidOrder();
        order.setDeadline(year(0));
        orderModel.setPlanningState(createPlanningStateFor(order));
        orderModel.save();
    }
View Full Code Here

    @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());
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.orders.entities.Order

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.