Search in sources :

Example 36 with CenterBO

use of org.mifos.customers.center.business.CenterBO in project head by mifos.

the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithMfiJoiningDateInPast.

@Test
public void canCreateCenterWithMfiJoiningDateInPast() 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 aWeekAgo = new DateTime().minusWeeks(1);
    CenterBO center = new CenterBuilder().withName(centerName).with(weeklyMeeting).with(existingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekAgo).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()));
}
Also used : OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) 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 37 with CenterBO

use of org.mifos.customers.center.business.CenterBO in project head by mifos.

the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithMinimalDetails.

@Test
public void canCreateCenterWithMinimalDetails() 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 today = new DateTime();
    Address noAddress = null;
    String noExternalId = null;
    CenterBO center = new CenterBuilder().withName(centerName).with(weeklyMeeting).with(existingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(today).with(noAddress).withExternalId(noExternalId).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.getExternalId(), is(nullValue()));
    assertThat(center.getAddress(), is(nullValue()));
}
Also used : AddressBuilder.anAddress(org.mifos.domain.builders.AddressBuilder.anAddress) Address(org.mifos.framework.business.util.Address) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) 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 38 with CenterBO

use of org.mifos.customers.center.business.CenterBO 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 39 with CenterBO

use of org.mifos.customers.center.business.CenterBO 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()));
}
Also used : GroupBuilder(org.mifos.domain.builders.GroupBuilder) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) GroupBO(org.mifos.customers.group.business.GroupBO) Test(org.junit.Test)

Example 40 with CenterBO

use of org.mifos.customers.center.business.CenterBO 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"));
}
Also used : PersonnelBuilder(org.mifos.domain.builders.PersonnelBuilder) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) GroupBuilder(org.mifos.domain.builders.GroupBuilder) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) GroupBO(org.mifos.customers.group.business.GroupBO) Test(org.junit.Test)

Aggregations

CenterBO (org.mifos.customers.center.business.CenterBO)117 Test (org.junit.Test)91 CenterBuilder (org.mifos.domain.builders.CenterBuilder)82 DateTime (org.joda.time.DateTime)47 MeetingBO (org.mifos.application.meeting.business.MeetingBO)46 GroupBO (org.mifos.customers.group.business.GroupBO)45 ArrayList (java.util.ArrayList)43 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)43 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)39 GroupBuilder (org.mifos.domain.builders.GroupBuilder)35 CustomerException (org.mifos.customers.exceptions.CustomerException)22 OfficeBO (org.mifos.customers.office.business.OfficeBO)21 ClientBO (org.mifos.customers.client.business.ClientBO)19 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)19 UserContext (org.mifos.security.util.UserContext)18 CalendarEventBuilder (org.mifos.domain.builders.CalendarEventBuilder)15 ClientBuilder (org.mifos.domain.builders.ClientBuilder)13 LocalDate (org.joda.time.LocalDate)12 Ignore (org.junit.Ignore)12 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)12