use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.
the class GroupServiceFacadeWebTierIntegrationTest method createOfficeHierarchyUnderHeadOffice.
private void createOfficeHierarchyUnderHeadOffice(OfficeBO headOffice) {
areaOffice1 = new OfficeBuilder().areaOffice().withParentOffice(headOffice).withName("areaOffice1").withGlobalOfficeNum("x002").withSearchId("1.1.2").build();
IntegrationTestObjectMother.createOffice(areaOffice1);
branch1 = new OfficeBuilder().branchOffice().withParentOffice(areaOffice1).withName("branch1").withGlobalOfficeNum("x005").withSearchId("1.1.2.1").build();
IntegrationTestObjectMother.createOffice(branch1);
branch2 = new OfficeBuilder().branchOffice().withParentOffice(areaOffice1).withName("branch2").withGlobalOfficeNum("x006").withSearchId("1.1.2.2").build();
IntegrationTestObjectMother.createOffice(branch2);
}
use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.
the class CenterServiceFacadeWebTierIntegrationTest method createOfficeHierarchyUnderHeadOffice.
private void createOfficeHierarchyUnderHeadOffice(OfficeBO headOffice) {
areaOffice1 = new OfficeBuilder().areaOffice().withParentOffice(headOffice).withName("areaOffice1").withGlobalOfficeNum("x002").withSearchId("1.1.2").build();
IntegrationTestObjectMother.createOffice(areaOffice1);
branch1 = new OfficeBuilder().branchOffice().withParentOffice(areaOffice1).withName("branch1").withGlobalOfficeNum("x005").withSearchId("1.1.2.1").build();
IntegrationTestObjectMother.createOffice(branch1);
}
use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.
the class HolidayDaoHibernateIntegrationTest method createOfficeHierarchyUnderHeadOffice.
private void createOfficeHierarchyUnderHeadOffice(OfficeBO headOffice) {
areaOffice1 = new OfficeBuilder().areaOffice().withParentOffice(headOffice).withName("areaOffice1").withGlobalOfficeNum("x002").withSearchId("1.1.2").build();
IntegrationTestObjectMother.createOffice(areaOffice1);
branch1 = new OfficeBuilder().branchOffice().withParentOffice(areaOffice1).withName("branch1").withGlobalOfficeNum("x005").withSearchId("1.1.2.1").build();
IntegrationTestObjectMother.createOffice(branch1);
areaOffice2 = new OfficeBuilder().areaOffice().withParentOffice(headOffice).withName("areaOffice2").withGlobalOfficeNum("x003").withSearchId("1.1.3").build();
IntegrationTestObjectMother.createOffice(areaOffice2);
}
use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.
the class GroupTransferServiceIntegrationTest method transferingGroupToCenterWithDifferentMeetingDayOfWeekCausesFutureSchedulesToBeRegeneratedForGroupsChildren.
@Ignore
@Test
public void transferingGroupToCenterWithDifferentMeetingDayOfWeekCausesFutureSchedulesToBeRegeneratedForGroupsChildren() throws Exception {
// setup
OfficeBO branchOffice = anExistingBranchOffice(new OfficeBuilder().withGlobalOfficeNum("xxxx-003").withName("builder-branch-office1").withShortName("bf1").withSearchId("1.1.1.1."));
OfficeBO branchOffice2 = new OfficeBuilder().withParentOffice(branchOffice.getParentOffice()).branchOffice().withGlobalOfficeNum("xxxx-004").withName("builder-branch-office2").withShortName("bf1").withSearchId("1.1.1.2.").build();
IntegrationTestObjectMother.createOffice(branchOffice2);
DateTime todaySixWeeksAgo = new DateMidnight().toDateTime().minusWeeks(6);
MeetingBO weeklyMeeting = aWeeklyMeeting().withLocation("weeklyMeeting-sixWeeksAgo").startingFrom(todaySixWeeksAgo.toDate()).build();
IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
CenterBuilder centerWithWeeklyMeeting = anActiveCenter().withName("center-with-no-children").with(weeklyMeeting).with(branchOffice).withActivationDate(todaySixWeeksAgo).withLoanOfficer(anExistingLoanOfficer());
CenterBO centerWithNoChildren = anExistingActiveCenter(centerWithWeeklyMeeting);
DateTime tomorrowTwoWeeksAgo = new DateMidnight().toDateTime().minusWeeks(2).plusDays(1);
MeetingBO differentWeeklyMeeting = aWeeklyMeeting().withLocation("weeklyMeeting-tomorrow-twoWeeksAgo").withStartDate(tomorrowTwoWeeksAgo.minusWeeks(1)).build();
IntegrationTestObjectMother.saveMeeting(differentWeeklyMeeting);
CenterBuilder centerInDifferentBranchWithDifferentMeeting = centerWithWeeklyMeeting.withName("center-with-group").with(branchOffice2).with(differentWeeklyMeeting).withActivationDate(tomorrowTwoWeeksAgo);
GroupBO groupForTransfer = anExistingGroupUnderCenterInDifferentBranchAs(centerInDifferentBranchWithDifferentMeeting);
ClientBO child1 = new ClientBuilder().active().withName("client1").withParentCustomer(groupForTransfer).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(child1, child1.getCustomerMeetingValue());
// pre-verification
ClientBO client = customerDao.findClientBySystemId(child1.getGlobalCustNum());
TestUtils.assertThatAllCustomerSchedulesOccuringAfterCurrentInstallmentPeriodFallOnDayOfWeek(client, WeekDay.getJodaWeekDay(tomorrowTwoWeeksAgo.getDayOfWeek()));
// exercise test
groupForTransfer = customerDao.findGroupBySystemId(groupForTransfer.getGlobalCustNum());
groupForTransfer.setUserContext(TestUtils.makeUser());
customerService.transferGroupTo(groupForTransfer, centerWithNoChildren);
// verification
client = customerDao.findClientBySystemId(child1.getGlobalCustNum());
TestUtils.assertThatAllCustomerSchedulesOccuringBeforeOrOnCurrentInstallmentPeriodRemainUnchanged(client, WeekDay.getJodaWeekDay(tomorrowTwoWeeksAgo.getDayOfWeek()));
// TO-FIX TestUtils.assertThatAllCustomerSchedulesOccuringAfterCurrentInstallmentPeriodFallOnDayOfWeek(client, WeekDay.getJodaWeekDay(todaySixWeeksAgo.getDayOfWeek()));
}
use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.
the class ApplyHolidayChangesHelperIntegrationTest method createOfficeHolidayTestData.
private void createOfficeHolidayTestData(DateTime startDate) throws Exception {
/*
* When startDate is 'yesterday' Head Office Holiday: from 2010-02-22 thru 2010-03-01 ... repayment rule is next
* meeting date Branch Holiday:
*
* from 2010-03-08 thru 2010-03-22 ... moratorium
*
* One more holiday that should not affect any schedules
*/
// Creating Office Holidays
Set<HolidayBO> holidays;
OfficeBO headOffice = IntegrationTestObjectMother.findOfficeById(Short.valueOf("1"));
holidays = new HashSet<HolidayBO>();
holidays.add((HolidayBO) new HolidayBuilder().withName("HO Holiday").from(startDate).to(startDate.plusWeeks(1)).withRepaymentRule(RepaymentRuleTypes.NEXT_MEETING_OR_REPAYMENT).build());
headOffice.setHolidays(holidays);
IntegrationTestObjectMother.createOffice(headOffice);
OfficeBO centerOffice = testSaveCollectionSheetUtils.getCenter().getOffice();
holidays = new HashSet<HolidayBO>();
holidays.add((HolidayBO) new HolidayBuilder().withName("Center Hierarchy Holiday").from(startDate.plusWeeks(2)).to(startDate.plusWeeks(4)).withRepaymentMoratoriumRule().build());
centerOffice.setHolidays(holidays);
IntegrationTestObjectMother.createOffice(centerOffice);
// builder not setting searchId correctly due to not going thru office.save (which uses HierarchyManager)
String headOfficeSearchId = headOffice.getSearchId();
OfficeBO anotherOffice = new OfficeBuilder().withParentOffice(headOffice).withName("Another Office").withSearchId(headOfficeSearchId + "26.").withGlobalOfficeNum("n/a001").build();
holidays = new HashSet<HolidayBO>();
holidays.add((HolidayBO) new HolidayBuilder().withName("N/A").from(startDate.minusWeeks(3)).to(startDate.plusWeeks(8)).withRepaymentMoratoriumRule().build());
anotherOffice.setHolidays(holidays);
IntegrationTestObjectMother.createOffice(anotherOffice);
}
Aggregations