Search in sources :

Example 16 with OfficeBuilder

use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.

the class CustomerStatusUpdateTest method updateDetailsAreSetWhenUpdatingCustomerStatus.

@Test
public void updateDetailsAreSetWhenUpdatingCustomerStatus() throws Exception {
    // setup
    OfficeBO office = new OfficeBuilder().withGlobalOfficeNum("xxx-9999").build();
    UserContext userContext = TestUtils.makeUser();
    CustomerStatusUpdate customerStatusUpdate = new CustomerStatusUpdateBuilder().build();
    // stubbing
    when(customerDao.findCustomerById(customerStatusUpdate.getCustomerId())).thenReturn(mockedCenter);
    when(mockedCenter.getOffice()).thenReturn(office);
    when(mockedCenter.getCustomerStatus()).thenReturn(new CustomerStatusEntity(CustomerStatus.CENTER_ACTIVE));
    // exercise test
    customerService.updateCustomerStatus(userContext, customerStatusUpdate);
    // verification
    verify(mockedCenter).updateDetails(userContext);
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder) CustomerStatusUpdate(org.mifos.application.servicefacade.CustomerStatusUpdate) OfficeBO(org.mifos.customers.office.business.OfficeBO) UserContext(org.mifos.security.util.UserContext) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity) CustomerStatusUpdateBuilder(org.mifos.domain.builders.CustomerStatusUpdateBuilder) Test(org.junit.Test)

Example 17 with OfficeBuilder

use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.

the class OfficeDaoHibernateIntegrationTest method createOfficeHierarchy.

private void createOfficeHierarchy() {
    // A default head office is added as seed data for integration tests along with a 'TestAreaOffice' as child
    headOffice = IntegrationTestObjectMother.findOfficeById(Short.valueOf("1"));
    regionalOffice = new OfficeBuilder().withGlobalOfficeNum("002").withName("region1").regionalOffice().withParentOffice(headOffice).build();
    IntegrationTestObjectMother.createOffice(regionalOffice);
    OfficeBO subRegionalOffice = new OfficeBuilder().withGlobalOfficeNum("003").withName("sub1-of-region1").subRegionalOffice().withParentOffice(regionalOffice).build();
    IntegrationTestObjectMother.createOffice(subRegionalOffice);
    areaOffice = new OfficeBuilder().withGlobalOfficeNum("004").withName("area-of-sub1-regional").areaOffice().withParentOffice(subRegionalOffice).build();
    IntegrationTestObjectMother.createOffice(areaOffice);
    branch1 = new OfficeBuilder().withGlobalOfficeNum("005").withName("branch1-of-area").branchOffice().withParentOffice(areaOffice).build();
    IntegrationTestObjectMother.createOffice(branch1);
    branch2 = new OfficeBuilder().withGlobalOfficeNum("006").withName("branch2-of-area").branchOffice().withParentOffice(areaOffice).build();
    IntegrationTestObjectMother.createOffice(branch2);
    branch3 = new OfficeBuilder().withGlobalOfficeNum("007").withName("branch1-of-regional").branchOffice().withParentOffice(regionalOffice).build();
    IntegrationTestObjectMother.createOffice(branch3);
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder) OfficeBO(org.mifos.customers.office.business.OfficeBO)

Example 18 with OfficeBuilder

use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.

the class PersonnelServiceFacadeWebTierTest method shouldRetrieveOfficeName.

@Test
public void shouldRetrieveOfficeName() {
    // setup
    Short officeId = Short.valueOf("3");
    OfficeBO office = new OfficeBuilder().withName("officeTestName").build();
    when(officeDao.findOfficeById(officeId)).thenReturn(office);
    // exercise test
    DefinePersonnelDto personnelDto = this.personnelServiceFacade.retrieveInfoForNewUserDefinition(officeId);
    // verification
    assertThat(personnelDto.getOfficeName(), is("officeTestName"));
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder) OfficeBO(org.mifos.customers.office.business.OfficeBO) DefinePersonnelDto(org.mifos.dto.screen.DefinePersonnelDto) Test(org.junit.Test)

Example 19 with OfficeBuilder

use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.

the class HolidayServiceIntegrationTest method createOfficeHierarchy.

public void createOfficeHierarchy() {
    headOffice = new OfficeBuilder().withGlobalOfficeNum("001").withName("headOffice").headOffice().withParentOffice(null).build();
    IntegrationTestObjectMother.createOffice(headOffice);
    regionalOffice = new OfficeBuilder().withGlobalOfficeNum("002").withName("region1").regionalOffice().withParentOffice(headOffice).build();
    IntegrationTestObjectMother.createOffice(regionalOffice);
    OfficeBO subRegionalOffice = new OfficeBuilder().withGlobalOfficeNum("003").withName("sub1-of-region1").subRegionalOffice().withParentOffice(regionalOffice).build();
    IntegrationTestObjectMother.createOffice(subRegionalOffice);
    areaOffice = new OfficeBuilder().withGlobalOfficeNum("004").withName("area-of-sub1-regional").areaOffice().withParentOffice(subRegionalOffice).build();
    IntegrationTestObjectMother.createOffice(areaOffice);
    branch1 = new OfficeBuilder().withGlobalOfficeNum("005").withName("branch1-of-area").branchOffice().withParentOffice(areaOffice).build();
    IntegrationTestObjectMother.createOffice(branch1);
    branch2 = new OfficeBuilder().withGlobalOfficeNum("006").withName("branch2-of-area").branchOffice().withParentOffice(areaOffice).build();
    IntegrationTestObjectMother.createOffice(branch2);
    branch3 = new OfficeBuilder().withGlobalOfficeNum("007").withName("branch1-of-regional").branchOffice().withParentOffice(regionalOffice).build();
    IntegrationTestObjectMother.createOffice(branch3);
    StaticHibernateUtil.flushAndClearSession();
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder) OfficeBO(org.mifos.customers.office.business.OfficeBO)

Example 20 with OfficeBuilder

use of org.mifos.domain.builders.OfficeBuilder in project head by mifos.

the class ClientServiceFacadeWebTierIntegrationTest 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)

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