Package org.libreplan.business.calendars.entities

Examples of org.libreplan.business.calendars.entities.BaseCalendar


        calendar.getCapacityWithOvertime(null);
    }

    @Test
    public void getCapacityWithOvertimeOnReturnsTheCapacityForThatDay() {
        BaseCalendar calendar = createBasicCalendar();
        Capacity capacitySet = Capacity.create(hours(8))
                .overAssignableWithoutLimit();

        calendar.setCapacityAt(Days.MONDAY, capacitySet);
        assertThat(calendar.getCapacityWithOvertime(MONDAY_LOCAL_DATE),
                equalTo(capacitySet));
    }
View Full Code Here


                equalTo(capacitySet));
    }

    @Test
    public void asDurationOnRespectsTheNotOverAssignablePropertyOfCalendarData() {
        BaseCalendar calendar = createBasicCalendar();
        calendar.setCapacityAt(Days.MONDAY, Capacity.create(hours(8))
                .notOverAssignableWithoutLimit());

        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(1)), equalTo(hours(8)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(2)), equalTo(hours(8)));
    }
View Full Code Here

                ResourcesPerDay.amount(2)), equalTo(hours(8)));
    }

    @Test
    public void DurationOnRespectsTheExtraEffortPropertyOfCalendarData() {
        BaseCalendar calendar = createBasicCalendar();
        calendar.setCapacityAt(Days.MONDAY, Capacity.create(hours(8))
                .withAllowedExtraEffort(hours(2)));

        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(1)), equalTo(hours(8)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(2)), equalTo(hours(10)));

    }
View Full Code Here

                createCalendarExceptionType()));
    }

    @Test
    public void asDurationOnRespectsAnOverAssignableCalendarException() {
        BaseCalendar calendar = createBasicCalendar();
        addExceptionOn(calendar, MONDAY_LOCAL_DATE, Capacity.create(hours(1))
                .overAssignableWithoutLimit());

        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(1)), equalTo(hours(1)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(2)), equalTo(hours(2)));
    }
View Full Code Here

                ResourcesPerDay.amount(2)), equalTo(hours(2)));
    }

    @Test
    public void asDurationOnRespectsANotOverAssignableCalendarException() {
        BaseCalendar calendar = createBasicCalendar();
        addExceptionOn(calendar, MONDAY_LOCAL_DATE, Capacity.create(hours(1))
                .notOverAssignableWithoutLimit());
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(1)), equalTo(hours(1)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(2)), equalTo(hours(1)));
    }
View Full Code Here

                ResourcesPerDay.amount(2)), equalTo(hours(1)));
    }

    @Test
    public void asDurationOnRespectsCapacityExtraEffort() {
        BaseCalendar calendar = createBasicCalendar();
        addExceptionOn(calendar, MONDAY_LOCAL_DATE, Capacity.create(hours(2))
                .withAllowedExtraEffort(hours(3)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(1)), equalTo(hours(2)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(2)), equalTo(hours(4)));
        assertThat(calendar.asDurationOn(
                PartialDay.wholeDay(MONDAY_LOCAL_DATE),
                ResourcesPerDay.amount(3)), equalTo(hours(5)));
    }
View Full Code Here

                ResourcesPerDay.amount(3)), equalTo(hours(5)));
    }

    @Test
    public void canWorkOnRespectsTheCapacityOfTheException() {
        BaseCalendar calendar = createBasicCalendar();
        addExceptionOn(calendar, MONDAY_LOCAL_DATE, Capacity.create(hours(0))
                .withAllowedExtraEffort(hours(0)));

        assertFalse(calendar.canWorkOn(MONDAY_LOCAL_DATE));
    }
View Full Code Here

        assertFalse(calendar.canWorkOn(MONDAY_LOCAL_DATE));
    }

    @Test
    public void canWorkOnRespectsIsOverAssignable() {
        BaseCalendar calendar = createBasicCalendar();
        addExceptionOn(calendar, MONDAY_LOCAL_DATE, Capacity.create(hours(0))
                .overAssignableWithoutLimit());

        assertTrue(calendar.canWorkOn(MONDAY_LOCAL_DATE));
    }
View Full Code Here

        assertTrue(calendar.canWorkOn(MONDAY_LOCAL_DATE));
    }

    @Test
    public void canWorkOnRespectsCalendarData() {
        BaseCalendar calendar = createBasicCalendar();
        calendar.setCapacityAt(Days.MONDAY, Capacity.create(hours(0))
                .overAssignableWithoutLimit());

        assertTrue(calendar.canWorkOn(MONDAY_LOCAL_DATE));

        calendar.setCapacityAt(Days.MONDAY, Capacity.create(hours(0))
                .notOverAssignableWithoutLimit());
        assertFalse(calendar.canWorkOn(MONDAY_LOCAL_DATE));
    }
View Full Code Here

        assertFalse(calendar.canWorkOn(MONDAY_LOCAL_DATE));
    }

    @Test
    public void theAvailabilityTimeLineTakesIntoAccountTheDaysItCannotWorkDueToCalendarData() {
        BaseCalendar calendar = createBasicCalendar();
        calendar.setCapacityAt(Days.MONDAY, Capacity.create(hours(0))
                .notOverAssignableWithoutLimit());

        AvailabilityTimeLine availability = calendar.getAvailability();
        assertFalse(availability.isValid(MONDAY_LOCAL_DATE));
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.calendars.entities.BaseCalendar

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.