use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class CenterScheduleCreationUsingCustomerServiceIntegrationTest method createCenterScheduleWithWeeklyMeetingNoFeesNoHoliday.
/***********************************************
* Weekly meeting, no fees
***********************************************/
@Test
public void createCenterScheduleWithWeeklyMeetingNoFeesNoHoliday() throws Exception {
DateTime startDate = date(2010, 4, 5);
//Monday
DateTimeUtils.setCurrentMillisFixed(startDate.getMillis());
// setup
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();
// exercise test
customerService.createCenter(center, weeklyMeeting, new ArrayList<AccountFeesEntity>());
// verification
StaticHibernateUtil.flushAndClearSession();
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));
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class CenterScheduleCreationUsingCustomerServiceIntegrationTest method createCenterScheduleWithWeeklyMeetingNoFeesThirdDateInMoratorium.
@Ignore
@Test
public void createCenterScheduleWithWeeklyMeetingNoFeesThirdDateInMoratorium() throws Exception {
DateTime startDate = date(2010, 4, 5);
//Monday
DateTimeUtils.setCurrentMillisFixed(startDate.getMillis());
// setup
saveHoliday(date(2010, 4, 19), date(2010, 4, 23), RepaymentRuleTypes.REPAYMENT_MORATORIUM);
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(3), startDate.plusWeeks(4), startDate.plusWeeks(5), startDate.plusWeeks(6), startDate.plusWeeks(7), startDate.plusWeeks(8), startDate.plusWeeks(9), startDate.plusWeeks(10));
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithMfiJoiningDateInFuture.
@Test
public void canCreateCenterWithMfiJoiningDateInFuture() throws Exception {
// setup
// minimal details
String centerName = "Center-IntegrationTest";
OfficeBO existingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
DateTime aWeekFromNow = new DateTime().plusWeeks(1);
CenterBO center = new CenterBuilder().withName(centerName).with(weeklyMeeting).with(existingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekFromNow).withUserContext().build();
List<AccountFeesEntity> noAccountFees = new ArrayList<AccountFeesEntity>();
// exercise test
customerService.createCenter(center, weeklyMeeting, noAccountFees);
// verification
assertThat(center.getCustomerId(), is(notNullValue()));
assertThat(center.getGlobalCustNum(), is(notNullValue()));
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method shouldCreateCenterAndRelatedCustomerAccountWithGlobalCustomerNumbersGenerated.
@Test
public void shouldCreateCenterAndRelatedCustomerAccountWithGlobalCustomerNumbersGenerated() throws Exception {
// setup
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);
// verification
assertThat(center.getCustomerId(), is(notNullValue()));
assertThat(center.getGlobalCustNum(), is(notNullValue()));
assertThat(center.getCustomerAccount(), is(notNullValue()));
assertThat(center.getCustomerAccount().getAccountId(), is(notNullValue()));
assertThat(center.getCustomerAccount().getGlobalAccountNum(), is(notNullValue()));
}
use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithMultipleInstancesOfTheSameOneTimeFee.
@Test
public void canCreateCenterWithMultipleInstancesOfTheSameOneTimeFee() throws Exception {
// minimal details
MeetingBuilder aWeeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday();
String centerName = "Center-IntegrationTest";
OfficeBO anExistingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
DateTime aWeekFromNow = new DateTime().plusWeeks(1);
CenterBO center = new CenterBuilder().withName(centerName).with(aWeeklyMeeting).with(anExistingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekFromNow).withUserContext().build();
// setup
AmountFeeBO existingWeeklyFee = new FeeBuilder().oneTime().with(aWeeklyMeeting).appliesToCenterOnly().with(anExistingBranch).build();
IntegrationTestObjectMother.saveFee(existingWeeklyFee);
AccountFeesEntity accountFee = new AccountFeesEntity(null, existingWeeklyFee, existingWeeklyFee.getFeeAmount().getAmountDoubleValue());
List<AccountFeesEntity> centerAccountFees = new ArrayList<AccountFeesEntity>();
centerAccountFees.add(accountFee);
centerAccountFees.add(accountFee);
// exercise test
customerService.createCenter(center, center.getCustomerMeetingValue(), centerAccountFees);
// verification
assertThat(center.getCustomerId(), is(notNullValue()));
assertThat(center.getGlobalCustNum(), is(notNullValue()));
assertThat(center.getCustomerAccount().getAccountFees().isEmpty(), is(false));
}
Aggregations