Package org.libreplan.business.orders.entities

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


        orderElementDAO.save(orderElement);
        orderElementDAO.flush();

        Long id = orderElement.getId();
        OrderLineGroup found = (OrderLineGroup) orderElementDAO.find(id);
        assertNotNull(found);

        orderElementDAO.remove(id);
        orderElementDAO.flush();
View Full Code Here


    @Transactional
    public void testFindByLabelsOnTree() throws InstanceNotFoundException {
        Label label1 = givenStoredLabel();
        Label label2 = givenStoredLabel();

        OrderLineGroup orderLineGroup = createValidOrderLineGroup();
        orderLineGroup.addLabel(label1);
        OrderElement child = orderLineGroup.getChildren().get(0);
        child.addLabel(label2);
        orderElementDAO.save(orderLineGroup);

        List<OrderElement> orderELements = orderElementDAO
                .findByLabelsAndCriteria(Collections.singleton(label1), null);
        assertEquals(1, orderELements.size());
        assertEquals(orderLineGroup.getId(), orderELements.get(0).getId());

        orderELements = orderElementDAO.findByLabelsAndCriteria(
                Collections.singleton(label2), null);
        assertEquals(1, orderELements.size());
        assertEquals(child.getId(), orderELements.get(0).getId());
View Full Code Here

    @Transactional
    public void testFindByCriteriaOnTree() throws InstanceNotFoundException {
        Criterion criterion1 = givenStoredCriterion();
        Criterion criterion2 = givenStoredCriterion();

        OrderLineGroup orderLineGroup = createValidOrderLineGroup();
        orderLineGroup.addCriterionRequirement(new DirectCriterionRequirement(
                criterion1));
        OrderElement child = orderLineGroup.getChildren().get(0);
        child.addCriterionRequirement(new DirectCriterionRequirement(criterion2));
        orderElementDAO.save(orderLineGroup);

        List<OrderElement> orderELements = orderElementDAO
                .findByLabelsAndCriteria(null,
                        Collections.singleton(criterion1));
        assertEquals(1, orderELements.size());
        assertEquals(orderLineGroup.getId(), orderELements.get(0).getId());

        orderELements = orderElementDAO.findByLabelsAndCriteria(null,
                Collections.singleton(criterion2));
        assertEquals(1, orderELements.size());
        assertEquals(child.getId(), orderELements.get(0).getId());
View Full Code Here

    @Test
    @Transactional
    public void testAddingOrderElement() {
        Order order = Order.create();
        order.useSchedulingDataFor(mockedOrderVersion);
        OrderLineGroup container = OrderLineGroup.create();
        OrderLine leaf = OrderLine.create();
        order.add(container);
        container.add(leaf);
        assertThat(order.getOrderElements().size(), equalTo(1));
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testPreservesOrder() {
        OrderLineGroup container = OrderLineGroup.create();
        container.useSchedulingDataFor(mockedOrderVersion);
        OrderLine[] created = new OrderLine[100];
        for (int i = 0; i < created.length; i++) {
            created[i] = OrderLine.create();
            container.add(created[i]);
        }
        for (int i = 0; i < created.length; i++) {
            assertThat(container.getChildren().get(i),
                    equalTo((OrderElement) created[i]));
        }
    }
View Full Code Here

    @Test
    @Transactional
    @SuppressWarnings("unchecked")
    public void ifSomeParentHasInitDateThePositionConstraintIsNotEarlierThan() {
        LocalDate initDate = new LocalDate(2005, 10, 5);
        OrderLineGroup group = OrderLineGroup.create();
        addOrderTo(group);
        group.setInitDate(asDate(initDate));
        OrderLine orderLine = OrderLine.create();
        group.add(orderLine);
        TaskSource taskSource = asTaskSource(orderLine);
        Task task = Task.createTask(taskSource);
        assertThat(task.getPositionConstraint(), allOf(
                isOfType(PositionConstraintType.START_NOT_EARLIER_THAN),
                hasValue(initDate)));
View Full Code Here

TOP

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

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.