Package org.libreplan.business.workingday

Examples of org.libreplan.business.workingday.EffortDuration


    @Test
    public void returnsTheMinOfCalendars() {
        ICalendar minOf = CombinedWorkHours
                .minOf(hours(4), hours(2), hours(7));
        EffortDuration duration = minOf.getCapacityOn(wholeDay(new LocalDate(
                2000, 3, 3)));
        assertThat(duration, equalTo(EffortDuration.hours(2)));
    }
View Full Code Here


    @Test
    public void testCapacityOnBasic() {
        BaseCalendar calendar = createBasicCalendar();

        EffortDuration wednesdayHours = calendar
                .getCapacityOn(wholeDay(WEDNESDAY_LOCAL_DATE));
        assertThat(wednesdayHours, equalTo(hours(8)));

        EffortDuration sundayHours = calendar
                .getCapacityOn(wholeDay(SUNDAY_LOCAL_DATE));
        assertThat(sundayHours, equalTo(zero()));
    }
View Full Code Here

    @Test
    public void testCapacityOnChristmas() {
        BaseCalendar calendar = createChristmasCalendar();

        EffortDuration duration = calendar
                .getCapacityOn(wholeDay(CHRISTMAS_DAY_LOCAL_DATE));
        assertThat(duration, equalTo(EffortDuration.zero()));
    }
View Full Code Here

    @Test
    public void testCapacityOnDerivedBasicCalendar() {
        BaseCalendar calendar = createBasicCalendar().newDerivedCalendar();

        EffortDuration wednesdayHours = calendar
                .getCapacityOn(wholeDay(WEDNESDAY_LOCAL_DATE));
        assertThat(wednesdayHours, equalTo(hours(8)));

        EffortDuration sundayHours = calendar
                .getCapacityOn(wholeDay(SUNDAY_LOCAL_DATE));
        assertThat(sundayHours, equalTo(zero()));
    }
View Full Code Here

    @Test
    public void testCapacityOnDerivedChristmasCalendar() {
        BaseCalendar calendar = createChristmasCalendar().newDerivedCalendar();

        EffortDuration hours = calendar
                .getCapacityOn(wholeDay(CHRISTMAS_DAY_LOCAL_DATE));
        assertThat(hours, equalTo(EffortDuration.zero()));
    }
View Full Code Here

        CalendarException day = CalendarException.create(WEDNESDAY_LOCAL_DATE,
                hours(4), createCalendarExceptionType());
        calendar.addExceptionDay(day);

        EffortDuration mondayHours = calendar
                .getCapacityOn(wholeDay(MONDAY_LOCAL_DATE));
        assertThat(mondayHours, equalTo(hours(8)));

        EffortDuration wednesdayHours = calendar
                .getCapacityOn(wholeDay(WEDNESDAY_LOCAL_DATE));
        assertThat(wednesdayHours, equalTo(hours(4)));

        EffortDuration sundayHours = calendar
                .getCapacityOn(wholeDay(SUNDAY_LOCAL_DATE));
        assertThat(sundayHours, equalTo(zero()));
    }
View Full Code Here

        CalendarException day = CalendarException.create(
                CHRISTMAS_DAY_LOCAL_DATE, hours(4),
                createCalendarExceptionType());
        calendar.addExceptionDay(day);

        EffortDuration hours = calendar
                .getCapacityOn(wholeDay(CHRISTMAS_DAY_LOCAL_DATE));
        assertThat(hours, equalTo(hours(4)));
    }
View Full Code Here

    }

    @Test
    public void theCapacityEffortIsMultipliedByTheCapacityOfTheResourceCalendar() {
        ResourceCalendar calendar = createBasicResourceCalendar(2);
        EffortDuration duration = calendar.getCapacityOn(PartialDay
                .wholeDay(FUTURE));
        assertThat(duration, equalTo(capacityForEveryDay.getStandardEffort()
                .multiplyBy(2)));
    }
View Full Code Here

    @Test
    public void asDurationOnDoesntChangeWithTheCapacityOfTheResourceCalendar() {
        ResourceCalendar[] calendars = { createBasicResourceCalendar(),
                createBasicResourceCalendar(2), createBasicResourceCalendar(3) };
        for (ResourceCalendar each : calendars) {
            EffortDuration duration = each.asDurationOn(
                    PartialDay.wholeDay(FUTURE),
                    ResourcesPerDay.amount(1));
            assertThat(duration,
                    equalTo(capacityForEveryDay.getStandardEffort()));
        }
View Full Code Here

        return result;
    }

    private void addToResult(SortedMap<LocalDate, EffortDuration> result,
            LocalDate date, EffortDuration duration) {
        EffortDuration current = result.get(date) != null ? result.get(date)
                : zero();
        result.put(date, current.plus(duration));
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.workingday.EffortDuration

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.