Examples of BaseCalendar


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

                equalTo(zero()));
    }

    @Test
    public void testCapacityOnNewVersionCheckingLimits() {
        BaseCalendar calendar = createBasicCalendar();
        calendar.newVersion(MONDAY_LOCAL_DATE);

        calendar.setCapacityAt(Days.MONDAY, withNormalDuration(hours(1)));
        calendar.setCapacityAt(Days.SUNDAY, withNormalDuration(hours(2)));

        assertThat(calendar.getCapacityOn(wholeDay(MONDAY_LOCAL_DATE)),
                equalTo(hours(1)));

        assertThat(calendar.getCapacityOn(wholeDay(SUNDAY_LOCAL_DATE)),
                equalTo(hours(2)));

        assertThat(calendar.getCapacityOn(wholeDay(MONDAY_LOCAL_DATE
                .minusWeeks(1))),
                equalTo(hours(8)));

        assertThat(calendar.getCapacityOn(wholeDay(MONDAY_LOCAL_DATE
                .minusDays(1))),
                equalTo(zero()));
    }
View Full Code Here

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

                equalTo(zero()));
    }

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

        calendar.removeExceptionDay(CHRISTMAS_DAY_LOCAL_DATE);

        assertThat(calendar.getExceptions().size(), equalTo(0));
    }
View Full Code Here

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

        assertThat(calendar.getExceptions().size(), equalTo(0));
    }

    @Test(expected = IllegalArgumentException.class)
    public void testRemoveExceptionDayDerivedCalendar() {
        BaseCalendar calendar = createChristmasCalendar().newDerivedCalendar();

        calendar.removeExceptionDay(CHRISTMAS_DAY_LOCAL_DATE);
    }
View Full Code Here

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

        calendar.removeExceptionDay(CHRISTMAS_DAY_LOCAL_DATE);
    }

    @Test
    public void testRemoveExceptionDayNewVersionCalendar() {
        BaseCalendar calendar = createChristmasCalendar();
        calendar.newVersion(MONDAY_LOCAL_DATE);

        calendar.removeExceptionDay(CHRISTMAS_DAY_LOCAL_DATE);

        assertThat(calendar.getExceptions().size(), equalTo(0));
    }
View Full Code Here

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

        assertThat(calendar.getExceptions().size(), equalTo(0));
    }

    @Test
    public void testCapacityOnNewVersionFromChristmasCalendar() {
        BaseCalendar calendar = createChristmasCalendar();
        CalendarException day = CalendarException.create(
                CHRISTMAS_DAY_LOCAL_DATE.plusYears(1), EffortDuration.zero(),
                createCalendarExceptionType());
        calendar.addExceptionDay(day);

        calendar.newVersion(CHRISTMAS_DAY_LOCAL_DATE.plusDays(1));

        CalendarExceptionType type = createCalendarExceptionType();
        calendar.updateExceptionDay(CHRISTMAS_DAY_LOCAL_DATE.plusYears(1),
                Capacity.create(hours(8)).withAllowedExtraEffort(
                        type.getCapacity().getAllowedExtraEffort()), type);

        assertThat(calendar.getCapacityOn(wholeDay(CHRISTMAS_DAY_LOCAL_DATE
                .plusYears(1))), equalTo(hours(8)));

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

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

        }
    }

    @Test
    public void testCapacityOnTwoNewVersions() {
        BaseCalendar calendar = createBasicCalendar();
        setHoursForAllDays(calendar, 8);

        calendar.newVersion(TUESDAY_LOCAL_DATE);
        setHoursForAllDays(calendar, 4);

        calendar.newVersion(FRIDAY_LOCAL_DATE);
        setHoursForAllDays(calendar, 2);

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

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

        assertThat(calendar.getCapacityOn(wholeDay(FRIDAY_LOCAL_DATE)),
                equalTo(hours(2)));

    }
View Full Code Here

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

    }

    @Test
    public void testCapacityOnDeriveAndNewVersion() {
        BaseCalendar baseCalendar = createChristmasCalendar();

        BaseCalendar calendar = baseCalendar.newDerivedCalendar();
        setHoursForAllDays(calendar, 4);

        calendar.newVersion(WEDNESDAY_LOCAL_DATE);
        setHoursForAllDays(calendar, 2);

        assertThat(baseCalendar.getCapacityOn(wholeDay(MONDAY_LOCAL_DATE)),
                equalTo(hours(8)));

        assertThat(calendar.getCapacityOn(wholeDay(MONDAY_LOCAL_DATE)),
                equalTo(hours(4)));

        assertThat(baseCalendar.getCapacityOn(wholeDay(FRIDAY_LOCAL_DATE)),
                equalTo(hours(8)));

        assertThat(calendar.getCapacityOn(wholeDay(FRIDAY_LOCAL_DATE)),
                equalTo(hours(2)));

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

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

                equalTo(zero()));
    }

    @Test
    public void testAddExceptionToNewVersionCalendar() {
        BaseCalendar calendar = createBasicCalendar();
        calendar.newVersion(CHRISTMAS_DAY_LOCAL_DATE
                .plusDays(1));

        CalendarException day = CalendarException.create(
                CHRISTMAS_DAY_LOCAL_DATE, EffortDuration.zero(),
                createCalendarExceptionType());
        calendar.addExceptionDay(day);

        assertThat(calendar.getExceptions().size(), equalTo(1));
        assertThat(calendar.getExceptions().iterator().next().getDate(),
                equalTo(CHRISTMAS_DAY_LOCAL_DATE));
    }
View Full Code Here

Examples of org.quartz.impl.calendar.BaseCalendar

        } else {
          return null;
        }
      }
      trigger.setStartTime(date);
      trigger.computeFirstFireTime(new BaseCalendar());

      return trigger.getNextFireTime();
    } catch (ParseException e) {
      throw new RuntimeException(e);
    }
View Full Code Here

Examples of sun.util.calendar.BaseCalendar

  BaseCalendar.Date d = getGregorianCutoverDate();

  // Set the cutover year (in the Gregorian year numbering)
        gregorianCutoverYear = d.getYear();

  BaseCalendar jcal = getJulianCalendarSystem();
  d = (BaseCalendar.Date) jcal.newCalendarDate(TimeZone.NO_TIMEZONE);
  jcal.getCalendarDateFromFixedDate(d, gregorianCutoverDate - 1);
  gregorianCutoverYearJulian = d.getNormalizedYear();

  if (time < gregorianCutover) {
      // The field values are no longer valid under the new
      // cutover date.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.