use of org.mifos.application.holiday.business.Holiday in project head by mifos.
the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method weeklyScheduledEventWithSecondThirdFourthDateInThreeWeekSameDayHolidayExpectNoAdjustment.
@Test
public void weeklyScheduledEventWithSecondThirdFourthDateInThreeWeekSameDayHolidayExpectNoAdjustment() {
Holiday threeWeekSameDay = new HolidayBuilder().from(mon_2011_07_04).to(mon_2011_07_04.plusWeeks(3)).withSameDayAsRule().build();
validateDates(new ScheduleBuilder().withHolidays(threeWeekSameDay).withWeeklyEvent(1, wed_2011_06_29.getDayOfWeek()).withStartDate(wed_2011_06_29.minusDays(1)).withNumberOfDates(5).build(), wed_2011_06_29, wed_2011_06_29.plusWeeks(1), wed_2011_06_29.plusWeeks(2), wed_2011_06_29.plusWeeks(3), wed_2011_06_29.plusWeeks(4));
}
use of org.mifos.application.holiday.business.Holiday in project head by mifos.
the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method biMonthlyByDayScheduleSecondDateInNextMeetingHolidayShouldShiftSecondDateByOneMonth.
@Test
public void biMonthlyByDayScheduleSecondDateInNextMeetingHolidayShouldShiftSecondDateByOneMonth() {
Holiday twoWeekNextWorkingDayHoliday = new HolidayBuilder().from(date(2011, 7, 4)).to(date(2011, 7, 17)).withNextMeetingRule().build();
validateDates(new ScheduleBuilder().withHolidays(twoWeekNextWorkingDayHoliday).withDayOfMonthEvent(2, 6).withStartDate(date(2011, 5, 6)).withNumberOfDates(3).build(), date(2011, 6, 6), date(2011, 8, 8), date(2011, 10, 6));
}
use of org.mifos.application.holiday.business.Holiday in project head by mifos.
the class HolidayAndWorkingDaysAndMoratoriaScheduledDateGenerationTest method biWeeklyScheduleSecondDateInNextMeetingHolidayShouldShiftSecondDateByTwoWeeks.
@Test
public void biWeeklyScheduleSecondDateInNextMeetingHolidayShouldShiftSecondDateByTwoWeeks() {
Holiday twoWeekNextWorkingDayHoliday = new HolidayBuilder().from(date(2011, 7, 11)).to(date(2011, 7, 17)).withNextMeetingRule().build();
validateDates(new ScheduleBuilder().withHolidays(twoWeekNextWorkingDayHoliday).withWeeklyEvent(2, DateTimeConstants.MONDAY).withStartDate(date(2011, 6, 27)).withNumberOfDates(3).build(), date(2011, 7, 4), date(2011, 7, 18), date(2011, 8, 1));
}
use of org.mifos.application.holiday.business.Holiday in project head by mifos.
the class SavingsScheduleIntegrationTest method createClientSavingsAccount.
public void createClientSavingsAccount() throws Exception {
meeting = new MeetingBuilder().customerMeeting().weekly().every(1).withStartDate(expectedFirstDepositDate).build();
IntegrationTestObjectMother.saveMeeting(meeting);
center = new CenterBuilder().with(meeting).withName("Center").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
IntegrationTestObjectMother.createCenter(center, meeting);
group = new GroupBuilder().withMeeting(meeting).withName("Group").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(center).build();
IntegrationTestObjectMother.createGroup(group, meeting);
client = new ClientBuilder().withMeeting(meeting).withName("Client 1").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(client, meeting);
savingsProduct = new SavingsProductBuilder().mandatory().appliesToClientsOnly().buildForIntegrationTests();
HolidayDao holidayDao = ApplicationContextProvider.getBean(HolidayDao.class);
List<Holiday> holidays = holidayDao.findAllHolidaysThisYearAndNext(client.getOfficeId());
savingsAccount = new SavingsAccountBuilder().withSavingsProduct(savingsProduct).withCustomer(client).with(holidays).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
}
use of org.mifos.application.holiday.business.Holiday in project head by mifos.
the class SavingsBOIntegrationTest method testGenerateMeetingForNextYear.
@Test
public void testGenerateMeetingForNextYear() throws Exception {
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
center = TestObjectFactory.createWeeklyFeeCenter("center1", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
SavingsTestHelper SavingsTestHelper = new SavingsTestHelper();
SavingsOfferingBO savingsOfferingBO = SavingsTestHelper.createSavingsOffering("dfasdasd1", "sad1");
savingsOfferingBO.setRecommendedAmntUnit(RecommendedAmountUnit.COMPLETE_GROUP);
SavingsBO savingsBO = SavingsTestHelper.createSavingsAccount(savingsOfferingBO, group, AccountState.SAVINGS_ACTIVE, TestUtils.makeUser());
Short LastInstallmentId = savingsBO.getLastInstallmentId();
AccountActionDateEntity lastYearLastInstallment = savingsBO.getAccountActionDate(LastInstallmentId);
Integer installmetId = lastYearLastInstallment.getInstallmentId().intValue() + (short) 1;
List<Days> workingDays = new FiscalCalendarRules().getWorkingDaysAsJodaTimeDays();
List<Holiday> holidays = new ArrayList<Holiday>();
savingsBO.generateNextSetOfMeetingDates(workingDays, holidays);
TestObjectFactory.updateObject(savingsBO);
TestObjectFactory.updateObject(center);
TestObjectFactory.updateObject(group);
TestObjectFactory.updateObject(savingsBO);
center = (CustomerBO) StaticHibernateUtil.getSessionTL().get(CustomerBO.class, center.getCustomerId());
group = (CustomerBO) StaticHibernateUtil.getSessionTL().get(CustomerBO.class, group.getCustomerId());
savingsBO = (SavingsBO) StaticHibernateUtil.getSessionTL().get(SavingsBO.class, savingsBO.getAccountId());
MeetingBO meetingBO = center.getCustomerMeeting().getMeeting();
meetingBO.setMeetingStartDate(lastYearLastInstallment.getActionDate());
List<Date> meetingDates = TestObjectFactory.getMeetingDates(group.getOfficeId(), meetingBO, 10);
meetingDates.remove(0);
Date FirstSavingInstallmetDate = savingsBO.getAccountActionDate(installmetId.shortValue()).getActionDate();
Calendar calendar2 = Calendar.getInstance();
calendar2.setTime(meetingDates.get(0));
Calendar calendar3 = Calendar.getInstance();
calendar3.setTime(FirstSavingInstallmetDate);
Assert.assertEquals(0, new GregorianCalendar(calendar3.get(Calendar.YEAR), calendar3.get(Calendar.MONTH), calendar3.get(Calendar.DATE), 0, 0, 0).compareTo(new GregorianCalendar(calendar2.get(Calendar.YEAR), calendar2.get(Calendar.MONTH), calendar2.get(Calendar.DATE), 0, 0, 0)));
}
Aggregations