Search in sources :

Example 11 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.

the class CollectionSheetServiceFacadeWebTierTest method shouldPopulateDtoWithActiveBranches.

@Test
public void shouldPopulateDtoWithActiveBranches() throws Exception {
    // setup
    final Short branchId = userContext.getBranchId();
    final Short branchId2 = Short.valueOf("2");
    final Short levelId = OfficeLevel.BRANCHOFFICE.getValue();
    // we typcially don't try to mock/stub value objects (DTO) as they have
    // no behaviour so just use as you would in production code.
    OfficeDetailsDto officeStub1 = new OfficeDetailsDto(branchId, "branchName1", levelId, 1);
    OfficeDetailsDto officeStub2 = new OfficeDetailsDto(branchId2, "branchName2", levelId, 1);
    List<OfficeDetailsDto> activeOffices = Arrays.asList(officeStub1, officeStub2);
    // stub interaction with DAO/Persistence layer.
    when(officePersistence.getActiveOffices(branchId)).thenReturn(activeOffices);
    // exercise test
    CollectionSheetEntryFormDto formDto = collectionSheetServiceFacadeWebTier.loadAllActiveBranchesAndSubsequentDataIfApplicable(userContext);
    // verification
    assertThat(formDto.getActiveBranchesList(), is(activeOffices));
}
Also used : OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) Test(org.junit.Test)

Example 12 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.

the class CollectionSheetServiceFacadeWebTierTest method shouldPopulateDtoWithValueToForceFormToRefreshedWhenMoreDropdownDataNeedsToBeFetched.

@Test
public void shouldPopulateDtoWithValueToForceFormToRefreshedWhenMoreDropdownDataNeedsToBeFetched() throws Exception {
    // setup
    final Short branchId = userContext.getBranchId();
    final Short branchId2 = Short.valueOf("2");
    final Short levelId = OfficeLevel.BRANCHOFFICE.getValue();
    OfficeDetailsDto officeStub1 = new OfficeDetailsDto(branchId, "branchName1", levelId, Integer.valueOf(1));
    OfficeDetailsDto officeStub2 = new OfficeDetailsDto(branchId2, "branchName2", levelId, Integer.valueOf(1));
    List<OfficeDetailsDto> activeOffices = Arrays.asList(officeStub1, officeStub2);
    // stub interaction with DAO/Persistence layer.
    when(officePersistence.getActiveOffices(branchId)).thenReturn(activeOffices);
    // exercise test
    CollectionSheetEntryFormDto formDto = collectionSheetServiceFacadeWebTier.loadAllActiveBranchesAndSubsequentDataIfApplicable(userContext);
    // verification
    assertThat(formDto.getReloadFormAutomatically(), is(Constants.YES));
}
Also used : OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) Test(org.junit.Test)

Example 13 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.

the class OfficePersistenceIntegrationTest method testGetChildOffices.

@Test
public void testGetChildOffices() throws Exception {
    OfficeBO headOffice = TestObjectFactory.getOffice(TestObjectFactory.HEAD_OFFICE);
    List<OfficeDetailsDto> officeList = getOfficePersistence().getChildOffices(headOffice.getSearchId());
    Assert.assertEquals(3, officeList.size());
    officeList = null;
    headOffice = null;
}
Also used : OfficeBO(org.mifos.customers.office.business.OfficeBO) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) Test(org.junit.Test)

Example 14 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.

the class OfficeListTagTest method headRegionalBranch.

private List<OfficeDetailsDto> headRegionalBranch() {
    List<OfficeDetailsDto> levels = new ArrayList<OfficeDetailsDto>();
    levels.add(new OfficeDetailsDto(null, null, OfficeLevel.HEADOFFICE.getValue(), "Head", 0));
    levels.add(new OfficeDetailsDto(null, null, OfficeLevel.REGIONALOFFICE.getValue(), "Regional", 0));
    levels.add(new OfficeDetailsDto(null, null, OfficeLevel.BRANCHOFFICE.getValue(), "Branch", 0));
    return Collections.unmodifiableList(levels);
}
Also used : ArrayList(java.util.ArrayList) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 15 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.

the class OfficeBusinessServiceIntegrationTest method testGetChildOffices.

@Test
public void testGetChildOffices() throws ServiceException {
    OfficeBO headOffice = TestObjectFactory.getOffice(TestObjectFactory.HEAD_OFFICE);
    List<OfficeDetailsDto> officeList = officeBusinessService.getChildOffices(headOffice.getSearchId());
    Assert.assertEquals(3, officeList.size());
    officeList = null;
    headOffice = null;
}
Also used : OfficeBO(org.mifos.customers.office.business.OfficeBO) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) Test(org.junit.Test)

Aggregations

OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)37 PersonnelDto (org.mifos.dto.domain.PersonnelDto)19 ArrayList (java.util.ArrayList)13 Test (org.junit.Test)13 CustomerDto (org.mifos.dto.domain.CustomerDto)10 Date (java.util.Date)7 OfficeBO (org.mifos.customers.office.business.OfficeBO)7 UserContext (org.mifos.security.util.UserContext)6 CollectionSheetEntryGridDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)5 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)5 OfficeDto (org.mifos.dto.domain.OfficeDto)5 CollectionSheetEntryDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryDto)4 MessageLookup (org.mifos.application.master.MessageLookup)4 MeetingBO (org.mifos.application.meeting.business.MeetingBO)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 MifosUser (org.mifos.security.MifosUser)4 LoanAccountDto (org.mifos.accounts.loan.util.helpers.LoanAccountDto)3 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)3 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)3 CustomValueListElementDto (org.mifos.application.master.business.CustomValueListElementDto)3