Search in sources :

Example 46 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class CenterScheduleCreationUsingCustomerServiceIntegrationTest method createCenterScheduleWithWeeklyMeetingNoFeesThirdDateInSameDayHoliday.

@Test
public void createCenterScheduleWithWeeklyMeetingNoFeesThirdDateInSameDayHoliday() throws Exception {
    DateTime startDate = date(2010, 4, 5);
    //Monday
    DateTimeUtils.setCurrentMillisFixed(startDate.getMillis());
    // setup
    saveHoliday(startDate.plusWeeks(2), startDate.plusWeeks(2).plusDays(3), RepaymentRuleTypes.SAME_DAY);
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    CenterBO center = new CenterBuilder().with(weeklyMeeting).withName("Center-IntegrationTest").with(sampleBranchOffice()).withLoanOfficer(testUser()).withUserContext().build();
    List<AccountFeesEntity> noAccountFees = new ArrayList<AccountFeesEntity>();
    // exercise test
    customerService.createCenter(center, weeklyMeeting, noAccountFees);
    validateDates(center.getGlobalCustNum(), startDate, startDate.plusWeeks(1), startDate.plusWeeks(2), startDate.plusWeeks(3), startDate.plusWeeks(4), startDate.plusWeeks(5), startDate.plusWeeks(6), startDate.plusWeeks(7), startDate.plusWeeks(8), startDate.plusWeeks(9));
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 47 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class CenterScheduleCreationUsingCustomerServiceIntegrationTest method createCenterScheduleWithBiWeeklyMeetingNoFeesThirdDateInMoratorium.

@Ignore
@Test
public void createCenterScheduleWithBiWeeklyMeetingNoFeesThirdDateInMoratorium() throws Exception {
    DateTime startDate = date(2010, 4, 5);
    //Monday
    DateTimeUtils.setCurrentMillisFixed(startDate.getMillis());
    // setup
    saveHoliday(startDate.plusWeeks(4), startDate.plusWeeks(4).plusDays(3), RepaymentRuleTypes.REPAYMENT_MORATORIUM);
    StaticHibernateUtil.flushSession();
    MeetingBO biWeeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(2).startingToday().build();
    CenterBO center = new CenterBuilder().with(biWeeklyMeeting).withName("Center-IntegrationTest").with(sampleBranchOffice()).withLoanOfficer(testUser()).withUserContext().build();
    // exercise test
    customerService.createCenter(center, biWeeklyMeeting, new ArrayList<AccountFeesEntity>());
    // verification
    validateDates(center.getGlobalCustNum(), startDate, startDate.plusWeeks(2), startDate.plusWeeks(6), startDate.plusWeeks(8), startDate.plusWeeks(10), startDate.plusWeeks(12), startDate.plusWeeks(14), startDate.plusWeeks(16), startDate.plusWeeks(18), startDate.plusWeeks(20));
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 48 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class CenterScheduleCreationUsingCustomerServiceIntegrationTest method createCenterScheduleWithWeeklyMeetingNoFeesThirdDateInOneDayNextWorkingDayHoliday.

@Ignore
@Test
public void createCenterScheduleWithWeeklyMeetingNoFeesThirdDateInOneDayNextWorkingDayHoliday() throws Exception {
    DateTime startDate = date(2010, 4, 5);
    //Monday
    DateTimeUtils.setCurrentMillisFixed(startDate.getMillis());
    // setup
    saveHoliday(startDate.plusWeeks(2), startDate.plusWeeks(2), RepaymentRuleTypes.NEXT_WORKING_DAY);
    StaticHibernateUtil.flushSession();
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    CenterBO center = new CenterBuilder().with(weeklyMeeting).withName("Center-IntegrationTest").with(sampleBranchOffice()).withLoanOfficer(testUser()).withUserContext().build();
    List<AccountFeesEntity> noAccountFees = new ArrayList<AccountFeesEntity>();
    // exercise test
    customerService.createCenter(center, weeklyMeeting, noAccountFees);
    validateDates(center.getGlobalCustNum(), startDate, startDate.plusWeeks(1), startDate.plusWeeks(2).plusDays(1), startDate.plusWeeks(3), startDate.plusWeeks(4), startDate.plusWeeks(5), startDate.plusWeeks(6), startDate.plusWeeks(7), startDate.plusWeeks(8), startDate.plusWeeks(9));
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 49 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class CenterScheduleCreationUsingCustomerServiceIntegrationTest method createCenterScheduleWithWeeklyMeetingNoFeesThirdAndFourthDatesInNextMeetingHoliday.

@Ignore
@Test
public void createCenterScheduleWithWeeklyMeetingNoFeesThirdAndFourthDatesInNextMeetingHoliday() throws Exception {
    DateTime startDate = date(2010, 4, 5);
    //Monday
    DateTimeUtils.setCurrentMillisFixed(startDate.getMillis());
    // setup
    saveHoliday(startDate.plusWeeks(2), startDate.plusWeeks(3).plusDays(4), RepaymentRuleTypes.NEXT_MEETING_OR_REPAYMENT);
    StaticHibernateUtil.flushSession();
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    CenterBO center = new CenterBuilder().with(weeklyMeeting).withName("Center-IntegrationTest").with(sampleBranchOffice()).withLoanOfficer(testUser()).withUserContext().build();
    List<AccountFeesEntity> noAccountFees = new ArrayList<AccountFeesEntity>();
    // exercise test
    customerService.createCenter(center, weeklyMeeting, noAccountFees);
    validateDates(center.getGlobalCustNum(), startDate, startDate.plusWeeks(1), startDate.plusWeeks(4), startDate.plusWeeks(4), startDate.plusWeeks(4), startDate.plusWeeks(5), startDate.plusWeeks(6), startDate.plusWeeks(7), startDate.plusWeeks(8), startDate.plusWeeks(9));
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 50 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class UpdateCustomerMeetingScheduleTest method givenDayOfWeekRemainsUnchangedShouldNotRegenerateSchedules.

@Test
public void givenDayOfWeekRemainsUnchangedShouldNotRegenerateSchedules() throws Exception {
    // setup
    UserContext userContext = TestUtils.makeUser();
    MeetingBO weeklyMondayMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).occuringOnA(WeekDay.MONDAY).build();
    weeklyMondayMeeting.updateDetails(userContext);
    CustomerAccountBuilder accountBuilder = new CustomerAccountBuilder();
    CenterBO center = new CenterBuilder().active().with(weeklyMondayMeeting).withAccount(accountBuilder).build();
    // pre - verification
    assertThatAllCustomerSchedulesOccuringBeforeOrOnCurrentInstallmentPeriodRemainUnchanged(center, WeekDay.MONDAY);
    assertThatAllCustomerSchedulesOccuringAfterCurrentInstallmentPeriodFallOnDayOfWeek(center, WeekDay.MONDAY);
    // exercise test
    customerService.updateCustomerMeetingSchedule(weeklyMondayMeeting, mockedCenter);
    // verification
    assertThatAllCustomerSchedulesOccuringBeforeOrOnCurrentInstallmentPeriodRemainUnchanged(center, WeekDay.MONDAY);
    assertThatAllCustomerSchedulesOccuringAfterCurrentInstallmentPeriodFallOnDayOfWeek(center, WeekDay.MONDAY);
}
Also used : UserContext(org.mifos.security.util.UserContext) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomerAccountBuilder(org.mifos.domain.builders.CustomerAccountBuilder) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) Test(org.junit.Test)

Aggregations

MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)106 Test (org.junit.Test)74 MeetingBO (org.mifos.application.meeting.business.MeetingBO)74 CenterBuilder (org.mifos.domain.builders.CenterBuilder)73 DateTime (org.joda.time.DateTime)58 ArrayList (java.util.ArrayList)47 CenterBO (org.mifos.customers.center.business.CenterBO)43 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)38 LocalDate (org.joda.time.LocalDate)27 GroupBuilder (org.mifos.domain.builders.GroupBuilder)24 Before (org.junit.Before)21 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)20 FeeBuilder (org.mifos.domain.builders.FeeBuilder)20 OfficeBO (org.mifos.customers.office.business.OfficeBO)19 ClientBuilder (org.mifos.domain.builders.ClientBuilder)15 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)14 CalendarEventBuilder (org.mifos.domain.builders.CalendarEventBuilder)14 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)13 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)11 Ignore (org.junit.Ignore)10