Search in sources :

Example 16 with Holiday

use of org.mifos.application.holiday.business.Holiday in project head by mifos.

the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method weeklyScheduleMoratoriumSpansNextWorkingDayHolidayShouldIgnoreNextWorkingDayHoliday.

@Test
public void weeklyScheduleMoratoriumSpansNextWorkingDayHolidayShouldIgnoreNextWorkingDayHoliday() {
    Holiday twoWeekNextWorkingDayHoliday = new HolidayBuilder().from(mon_2011_06_27).to(mon_2011_06_27.plusWeeks(2).minusDays(1)).withNextWorkingDayRule().build();
    Holiday twoWeekMoratorium = new HolidayBuilder().from(mon_2011_06_27).to(mon_2011_06_27.plusWeeks(2).minusDays(1)).withRepaymentMoratoriumRule().build();
    /*
         * Schedule should start on the next Wednesday (2 days from the starting point).
         * The second and third unadjusted dates, being in the moratorium shift them
         * and the remaining schedule are shifted two weeks past the moratorium. Next working day is ignored.
         */
    validateDates(new ScheduleBuilder().withHolidays(twoWeekNextWorkingDayHoliday, twoWeekMoratorium).withWeeklyEvent(1, DayOfWeek.wednesday()).withNumberOfDates(6).withStartDate(mon_2011_06_20).build(), wed_2011_06_22, wed_2011_06_22.plusWeeks(3), wed_2011_06_22.plusWeeks(4), wed_2011_06_22.plusWeeks(5), wed_2011_06_22.plusWeeks(6), wed_2011_06_22.plusWeeks(7));
}
Also used : Holiday(org.mifos.application.holiday.business.Holiday) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) Test(org.junit.Test)

Example 17 with Holiday

use of org.mifos.application.holiday.business.Holiday in project head by mifos.

the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method weeklyScheduledEventWithSecondDateInOneWeekNextMeetingHolidayShouldPushOutSecondDateOneWeek.

@Test
public void weeklyScheduledEventWithSecondDateInOneWeekNextMeetingHolidayShouldPushOutSecondDateOneWeek() {
    Holiday oneWeekNextMeetingHolidayStartingJuly4th = new HolidayBuilder().from(mon_2011_07_04).to(mon_2011_07_04.plusWeeks(1)).withNextMeetingRule().build();
    validateDates(new ScheduleBuilder().withWeeklyEvent(1, wed_2011_06_29.getDayOfWeek()).withHolidays(oneWeekNextMeetingHolidayStartingJuly4th).withStartDate(wed_2011_06_29).withNumberOfDates(4).build(), wed_2011_06_29, wed_2011_06_29.plusWeeks(2), wed_2011_06_29.plusWeeks(2), wed_2011_06_29.plusWeeks(3));
}
Also used : Holiday(org.mifos.application.holiday.business.Holiday) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) Test(org.junit.Test)

Example 18 with Holiday

use of org.mifos.application.holiday.business.Holiday in project head by mifos.

the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method weeklyScheduleTwoWeekMoratoriumEnclosesSecondAndThirdScheduledDatesShouldPushSecondAndFollowingDatesTwoWeeks.

@Test
public void weeklyScheduleTwoWeekMoratoriumEnclosesSecondAndThirdScheduledDatesShouldPushSecondAndFollowingDatesTwoWeeks() {
    Holiday twoWeekMoratoriumStartingJuly4th = new HolidayBuilder().from(mon_2011_07_04).to(mon_2011_07_04.plusWeeks(2)).withRepaymentMoratoriumRule().build();
    validateDates(new ScheduleBuilder().withHolidays(twoWeekMoratoriumStartingJuly4th).withStartDate(wed_2011_06_29.minusDays(1)).withWeeklyEvent(1, wed_2011_06_29.getDayOfWeek()).withNumberOfDates(3).build(), wed_2011_06_29, wed_2011_06_29.plusWeeks(3), wed_2011_06_29.plusWeeks(4));
}
Also used : Holiday(org.mifos.application.holiday.business.Holiday) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) Test(org.junit.Test)

Example 19 with Holiday

use of org.mifos.application.holiday.business.Holiday in project head by mifos.

the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method monthlyByDayScheduleSecondDateInNextWorkingDayHolidayShouldShiftSecondDateToNextWorkingDay.

@Test
public void monthlyByDayScheduleSecondDateInNextWorkingDayHolidayShouldShiftSecondDateToNextWorkingDay() {
    Holiday twoWeekNextWorkingDayHoliday = new HolidayBuilder().from(date(2011, 7, 4)).to(date(2011, 7, 17)).withNextWorkingDayRule().build();
    validateDates(new ScheduleBuilder().withHolidays(twoWeekNextWorkingDayHoliday).withDayOfMonthEvent(1, 6).withStartDate(date(2011, 6, 6)).withNumberOfDates(3).build(), date(2011, 6, 6), date(2011, 7, 18), date(2011, 8, 8));
}
Also used : Holiday(org.mifos.application.holiday.business.Holiday) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) Test(org.junit.Test)

Example 20 with Holiday

use of org.mifos.application.holiday.business.Holiday in project head by mifos.

the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method monthlyByDayScheduleSecondDateInSameDayHolidayShouldNotShiftAnyDates.

@Test
public void monthlyByDayScheduleSecondDateInSameDayHolidayShouldNotShiftAnyDates() {
    Holiday twoWeekNextWorkingDayHoliday = new HolidayBuilder().from(date(2011, 7, 4)).to(date(2011, 7, 17)).withSameDayAsRule().build();
    validateDates(new ScheduleBuilder().withHolidays(twoWeekNextWorkingDayHoliday).withDayOfMonthEvent(1, 6).withStartDate(date(2011, 6, 6)).withNumberOfDates(3).build(), date(2011, 6, 6), date(2011, 7, 6), date(2011, 8, 8));
}
Also used : Holiday(org.mifos.application.holiday.business.Holiday) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder) Test(org.junit.Test)

Aggregations

Holiday (org.mifos.application.holiday.business.Holiday)54 Test (org.junit.Test)32 HolidayBuilder (org.mifos.domain.builders.HolidayBuilder)28 DateTime (org.joda.time.DateTime)22 ArrayList (java.util.ArrayList)16 Days (org.joda.time.Days)13 FiscalCalendarRules (org.mifos.config.FiscalCalendarRules)13 LocalDate (org.joda.time.LocalDate)10 HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration (org.mifos.schedule.internal.HolidayAndWorkingDaysAndMoratoriaScheduledDateGeneration)9 ScheduledDateGeneration (org.mifos.schedule.ScheduledDateGeneration)8 Date (java.util.Date)7 DateMidnight (org.joda.time.DateMidnight)6 Ignore (org.junit.Ignore)6 HolidayDao (org.mifos.application.holiday.persistence.HolidayDao)6 InstallmentDate (org.mifos.accounts.util.helpers.InstallmentDate)4 DateTimeService (org.mifos.framework.util.DateTimeService)4 Before (org.junit.Before)3 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)3 SavingsScheduleEntity (org.mifos.accounts.savings.business.SavingsScheduleEntity)3 MeetingBO (org.mifos.application.meeting.business.MeetingBO)3