Package org.libreplan.business.calendars.entities

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


    public static final LocalDate CHRISTMAS_DAY_LOCAL_DATE = new LocalDate(
            JUNE_NEXT_YEAR.getYear(), 12, 25);

    public static BaseCalendar createBasicCalendar() {
        BaseCalendar calendar = BaseCalendar.create();

        calendar.setName("test-" + UUID.randomUUID());

        Capacity eightHours = withNormalDuration(hours(8));
        calendar.setCapacityAt(Days.MONDAY, eightHours);
        calendar.setCapacityAt(Days.TUESDAY, eightHours);
        calendar.setCapacityAt(Days.WEDNESDAY, eightHours);
        calendar.setCapacityAt(Days.THURSDAY, eightHours);
        calendar.setCapacityAt(Days.FRIDAY, eightHours);
        calendar.setCapacityAt(Days.SATURDAY, Capacity.zero());
        calendar.setCapacityAt(Days.SUNDAY, Capacity.zero());

        return calendar;
    }
View Full Code Here


        calendar.addExceptionDay(christmasDay);
    }

    @Test
    public void testOnlyGivesZeroHoursWhenThereIsNoParent() {
        BaseCalendar calendar = createBasicCalendar();
        assertFalse(calendar.onlyGivesZeroHours());
        initializeAllToZeroHours(calendar);
        assertTrue(calendar.onlyGivesZeroHours());
    }
View Full Code Here

        }
    }

    @Test
    public void testOnlyGivesZeroHoursWhenThereIsParent() {
        BaseCalendar calendar = createBasicCalendar();
        initializeAllToZeroHours(calendar);
        BaseCalendar parent = createBasicCalendar();
        calendar.setParent(parent);
        assertTrue(calendar.onlyGivesZeroHours());
        calendar.setDefault(Days.MONDAY);
        assertFalse(calendar.onlyGivesZeroHours());
    }
View Full Code Here

        calendar.setDefault(Days.MONDAY);
        assertFalse(calendar.onlyGivesZeroHours());
    }

    public static BaseCalendar createChristmasCalendar() {
        BaseCalendar calendar = createBasicCalendar();
        addChristmasAsExceptionDay(calendar);
        return calendar;
    }
View Full Code Here

        return calendar;
    }

    @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

        assertThat(sundayHours, equalTo(zero()));
    }

    @Test
    public void aBaseCalendarMustBeActive() {
        BaseCalendar calendar = createBasicCalendar();
        assertTrue(calendar.isActive(new LocalDate()));
    }
View Full Code Here

        assertTrue(calendar.isActive(new LocalDate()));
    }

    @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

        assertThat(duration, equalTo(EffortDuration.zero()));
    }

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

        assertThat(derivedCalendar.getParent(), equalTo(calendar));
    }
View Full Code Here

        assertThat(derivedCalendar.getParent(), equalTo(calendar));
    }

    @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

        assertThat(sundayHours, equalTo(zero()));
    }

    @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

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.