Package org.libreplan.business.planner.entities

Examples of org.libreplan.business.planner.entities.DerivedDayAssignment$DetachedState


    private void givenDayAssignments(DerivedAllocation derivedAllocation,
            LocalDate start, Resource resource, int... hours) {
        dayAssignments = new ArrayList<DerivedDayAssignment>();
        for (int i = 0; i < hours.length; i++) {
            LocalDate current = start.plusDays(i);
            DerivedDayAssignment d = DerivedDayAssignment.create(current,
                    hours[i], resource, derivedAllocation);
            dayAssignments.add(d);
        }
    }
View Full Code Here


                }
                Iterator<DerivedDayAssignment> argIterator = arg.iterator();
                Iterator<DerivedDayAssignment> expectedIterator = expected
                        .iterator();
                while (argIterator.hasNext()) {
                    DerivedDayAssignment dayAssignment = argIterator.next();
                    DerivedDayAssignment expectedAssignment = expectedIterator.next();
                    Resource resource = dayAssignment.getResource();
                    Resource expectedResource = expectedAssignment
                            .getResource();
                    LocalDate day = dayAssignment.getDay();
                    LocalDate expectedDay = expectedAssignment.getDay();
                    int hours = dayAssignment.getHours();
                    int expectedHours = expectedAssignment
                                                    .getHours();
                    if (!resource.equals(expectedResource)
                            || !day.equals(expectedDay)
                            || hours != expectedHours) {
                        return false;
View Full Code Here

        LocalDate start = new LocalDate(2008, 12, 1);
        givenDayAssignments(start, worker, 8, 8, 8, 8);
        derivedAllocation.resetAssignmentsTo(dayAssignments);
        final LocalDate startInterval = start.plusDays(2);
        final LocalDate finishInterval = start.plusDays(4);
        DerivedDayAssignment newAssignment = DerivedDayAssignment.create(
                startInterval, 3, worker, derivedAllocation);
        derivedAllocation.resetAssignmentsTo(startInterval, finishInterval,
                Arrays.asList(newAssignment));
        assertThat(derivedAllocation.getAssignments(),
                compareValuesExceptParent(dayAssignments.get(0), dayAssignments
View Full Code Here

    public void whenResettingAssignmentsOnIntervalOnlyTheOnesAtTheIntervalAreAdded() {
        givenADerivedAllocation();
        LocalDate start = new LocalDate(2008, 12, 1);
        givenDayAssignments(start, worker, 8, 8, 8, 8);
        derivedAllocation.resetAssignmentsTo(dayAssignments);
        DerivedDayAssignment newAssignment = DerivedDayAssignment.create(start
                .minusDays(1), 3, worker, derivedAllocation);
        derivedAllocation.resetAssignmentsTo(start, start.plusDays(4), Arrays
                .asList(newAssignment));
        assertTrue(derivedAllocation.getAssignments().isEmpty());
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.planner.entities.DerivedDayAssignment$DetachedState

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.