Search in sources :

Example 76 with OfficeBO

use of org.mifos.customers.office.business.OfficeBO in project head by mifos.

the class CenterCreationTest method createsCenterWithCustomerAccount.

@Test
public void createsCenterWithCustomerAccount() throws Exception {
    // setup
    OfficeBO withOffice = new OfficeBO(new Short("1"), "testOffice", new Integer("1"), new Short("1"));
    CenterBO center = new CenterBuilder().withLoanOfficer(anyLoanOfficer()).with(withOffice).build();
    center.setCustomerDao(customerDao);
    List<AccountFeesEntity> accountFees = new ArrayList<AccountFeesEntity>();
    // stub
    CalendarEvent upcomingCalendarEvents = new CalendarEventBuilder().build();
    when(holidayDao.findCalendarEventsForThisYearAndNext((short) 1)).thenReturn(upcomingCalendarEvents);
    when(customerAccountFactory.create(center, accountFees, meeting, upcomingCalendarEvents)).thenReturn(customerAccount);
    when(customerAccount.getType()).thenReturn(AccountTypes.CUSTOMER_ACCOUNT);
    // exercise test
    customerService.createCenter(center, meeting, accountFees);
    // verification
    assertThat(center.getCustomerAccount(), is(customerAccount));
}
Also used : OfficeBO(org.mifos.customers.office.business.OfficeBO) ArrayList(java.util.ArrayList) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) CalendarEvent(org.mifos.calendar.CalendarEvent) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) CalendarEventBuilder(org.mifos.domain.builders.CalendarEventBuilder) Test(org.junit.Test)

Example 77 with OfficeBO

use of org.mifos.customers.office.business.OfficeBO in project head by mifos.

the class ConfigurationIntegrationTest method testAreaOfficeConfiguration.

@Test
public void testAreaOfficeConfiguration() throws Exception {
    OfficeBO areaOffice = new OfficePersistence().getOffice(TestObjectFactory.SAMPLE_AREA_OFFICE);
    OfficeConfig officeConfig = configuration.getOfficeConfig(areaOffice.getOfficeId());
    assertForAccountConfig(officeConfig.getAccountConfig());
}
Also used : OfficeBO(org.mifos.customers.office.business.OfficeBO) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) Test(org.junit.Test)

Example 78 with OfficeBO

use of org.mifos.customers.office.business.OfficeBO in project head by mifos.

the class ConfigurationIntegrationTest method testBranchOfficeConfiguration.

@Test
public void testBranchOfficeConfiguration() throws Exception {
    OfficeBO branchOffice = new OfficePersistence().getOffice(TestObjectFactory.SAMPLE_BRANCH_OFFICE);
    OfficeConfig officeConfig = configuration.getOfficeConfig(branchOffice.getOfficeId());
    assertForAccountConfig(officeConfig.getAccountConfig());
}
Also used : OfficeBO(org.mifos.customers.office.business.OfficeBO) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence) Test(org.junit.Test)

Example 79 with OfficeBO

use of org.mifos.customers.office.business.OfficeBO in project head by mifos.

the class PersonActionStrutsTest method testLoad.

@Test
public void testLoad() throws Exception {
    addActionAndMethod(Methods.load.toString());
    addRequestParameter("officeId", "1");
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    OfficeBO office = (OfficeBO) SessionUtils.getAttribute(PersonnelConstants.OFFICE, request);
    Assert.assertNotNull(office);
    Assert.assertEquals(1, office.getOfficeId().intValue());
    verifyMasterData();
    PersonActionForm personActionForm = (PersonActionForm) request.getSession().getAttribute("personActionForm");
    Assert.assertNotNull(personActionForm);
    //        Assert.assertEquals(1, personActionForm.getCustomFields().size());
    verifyForward(ActionForwards.load_success.toString());
    PersonActionForm actionForm = (PersonActionForm) request.getSession().getAttribute("personActionForm");
    Date currentDate = DateUtils.getCurrentDateWithoutTimeStamp();
    Assert.assertEquals(currentDate, DateUtils.getDateAsSentFromBrowser(actionForm.getDateOfJoiningMFI()));
}
Also used : PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) OfficeBO(org.mifos.customers.office.business.OfficeBO) Date(java.util.Date) Test(org.junit.Test)

Example 80 with OfficeBO

use of org.mifos.customers.office.business.OfficeBO in project head by mifos.

the class CustSearchActionStrutsTest method testLoadMainSearchLoBoUser.

@Test
public void testLoadMainSearchLoBoUser() throws Exception {
    OfficeBO officeBO = TestObjectFactory.getOffice(TestObjectFactory.SAMPLE_BRANCH_OFFICE);
    userContext.setId(Short.valueOf("3"));
    createGroupWithCenter();
    addActionAndMethod(Methods.loadMainSearch.toString());
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(CustomerSearchConstants.LOADFORWARDLOANOFFICER_SUCCESS);
    List<CustomerBO> customerList = (List<CustomerBO>) SessionUtils.getAttribute(CustomerSearchConstants.CUSTOMERLIST, request);
    Assert.assertNotNull(customerList);
    Assert.assertEquals(0, customerList.size());
    Assert.assertEquals(officeBO.getOfficeName(), SessionUtils.getAttribute(CustomerSearchConstants.OFFICE, request));
}
Also used : OfficeBO(org.mifos.customers.office.business.OfficeBO) CustomerBO(org.mifos.customers.business.CustomerBO) List(java.util.List) Test(org.junit.Test)

Aggregations

OfficeBO (org.mifos.customers.office.business.OfficeBO)115 Test (org.junit.Test)62 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)45 DateTime (org.joda.time.DateTime)33 ArrayList (java.util.ArrayList)31 MeetingBO (org.mifos.application.meeting.business.MeetingBO)28 UserContext (org.mifos.security.util.UserContext)25 OfficeBuilder (org.mifos.domain.builders.OfficeBuilder)23 CenterBO (org.mifos.customers.center.business.CenterBO)21 CenterBuilder (org.mifos.domain.builders.CenterBuilder)21 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)19 MifosUser (org.mifos.security.MifosUser)18 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)17 Address (org.mifos.framework.business.util.Address)17 GroupBO (org.mifos.customers.group.business.GroupBO)16 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)16 MifosRuntimeException (org.mifos.core.MifosRuntimeException)14 ClientBO (org.mifos.customers.client.business.ClientBO)14 GroupBuilder (org.mifos.domain.builders.GroupBuilder)14 AddressDto (org.mifos.dto.domain.AddressDto)13