Search in sources :

Example 1 with OfficeBuilder

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);
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder)

Example 2 with OfficeBuilder

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);
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder)

Example 3 with OfficeBuilder

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);
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder)

Example 4 with OfficeBuilder

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()));
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder) OfficeBO(org.mifos.customers.office.business.OfficeBO) DateMidnight(org.joda.time.DateMidnight) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ClientBO(org.mifos.customers.client.business.ClientBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) CenterBO(org.mifos.customers.center.business.CenterBO) GroupBO(org.mifos.customers.group.business.GroupBO) DateTime(org.joda.time.DateTime) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with OfficeBuilder

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);
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder) OfficeBO(org.mifos.customers.office.business.OfficeBO) HolidayBO(org.mifos.application.holiday.business.HolidayBO) HolidayBuilder(org.mifos.domain.builders.HolidayBuilder)

Aggregations

OfficeBuilder (org.mifos.domain.builders.OfficeBuilder)33 OfficeBO (org.mifos.customers.office.business.OfficeBO)23 Test (org.junit.Test)22 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)12 UserContext (org.mifos.security.util.UserContext)11 GroupBO (org.mifos.customers.group.business.GroupBO)9 GroupBuilder (org.mifos.domain.builders.GroupBuilder)9 CustomerException (org.mifos.customers.exceptions.CustomerException)7 PersonnelBuilder (org.mifos.domain.builders.PersonnelBuilder)7 CenterBuilder (org.mifos.domain.builders.CenterBuilder)6 MeetingBO (org.mifos.application.meeting.business.MeetingBO)5 CenterBO (org.mifos.customers.center.business.CenterBO)5 ClientBO (org.mifos.customers.client.business.ClientBO)4 ClientBuilder (org.mifos.domain.builders.ClientBuilder)4 GroupUpdateBuilder (org.mifos.domain.builders.GroupUpdateBuilder)4 GroupUpdate (org.mifos.dto.domain.GroupUpdate)4 DateTime (org.joda.time.DateTime)3 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)3 DateMidnight (org.joda.time.DateMidnight)2 Before (org.junit.Before)2