use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class GroupTransferToCenterTest method transferingGroupToCenterInSameBranchCreatesActiveCustomerHierarchyBetweenGroupAndNewParent.
@Test
public void transferingGroupToCenterInSameBranchCreatesActiveCustomerHierarchyBetweenGroupAndNewParent() throws Exception {
CenterBO fromCenter = new CenterBuilder().withName("fromCenter").build();
GroupBO groupForTransfer = new GroupBuilder().withParentCustomer(fromCenter).active().build();
fromCenter.addChild(groupForTransfer);
CenterBO receivingCenter = new CenterBuilder().withName("receivingCenter").build();
// pre-verification
assertThat(receivingCenter.getActiveCustomerHierarchy(), is(nullValue()));
// exercise test
groupForTransfer.transferTo(receivingCenter);
// verification
assertThat(groupForTransfer.getActiveCustomerHierarchy(), is(notNullValue()));
assertThat(fromCenter.getActiveCustomerHierarchy(), is(nullValue()));
}
use of org.mifos.domain.builders.CenterBuilder in project head by mifos.
the class GroupTransferToCenterTest method transferingGroupToCenterInSameBranchShouldModifyGroupToHaveSameLoanOfficerAsReceivingCenter.
@Test
public void transferingGroupToCenterInSameBranchShouldModifyGroupToHaveSameLoanOfficerAsReceivingCenter() throws Exception {
PersonnelBO loanOfficer = new PersonnelBuilder().withDisplayName("old loan officer").build();
CenterBO fromCenter = new CenterBuilder().withName("fromCenter").withLoanOfficer(loanOfficer).build();
GroupBO groupForTransfer = new GroupBuilder().withParentCustomer(fromCenter).active().build();
PersonnelBO newLoanOfficer = new PersonnelBuilder().withDisplayName("loan officer").build();
CenterBO receivingCenter = new CenterBuilder().withName("receivingCenter").withLoanOfficer(newLoanOfficer).build();
// pre-verification
assertThat(receivingCenter.getPersonnel().getDisplayName(), is("loan officer"));
assertThat(groupForTransfer.getPersonnel().getDisplayName(), is("old loan officer"));
// exercise test
groupForTransfer.transferTo(receivingCenter);
// verification
assertThat(receivingCenter.getPersonnel().getDisplayName(), is("loan officer"));
assertThat(groupForTransfer.getPersonnel().getDisplayName(), is("loan officer"));
}
use of org.mifos.domain.builders.CenterBuilder 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));
}
use of org.mifos.domain.builders.CenterBuilder 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));
}
use of org.mifos.domain.builders.CenterBuilder 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));
}
Aggregations