Search in sources :

Example 1 with BranchReportPersistence

use of org.mifos.reports.branchreport.persistence.BranchReportPersistence in project head by mifos.

the class BranchReportServiceIntegrationTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    branchReport = new BranchReportBO(BRANCH_ID_SHORT, RUN_DATE);
    populateClientSummary();
    populateLoanArrearSummary();
    session = StaticHibernateUtil.getSessionTL();
    //        transaction = session.beginTransaction();
    officeBusinessServiceMock = createMock(OfficeBusinessService.class);
    branchReportService = new BranchReportService(officeBusinessServiceMock, new PersonnelBusinessService(), new BranchReportPersistence());
}
Also used : PersonnelBusinessService(org.mifos.customers.personnel.business.service.PersonnelBusinessService) OfficeBusinessService(org.mifos.customers.office.business.service.OfficeBusinessService) BranchReportBO(org.mifos.reports.branchreport.BranchReportBO) BranchReportPersistence(org.mifos.reports.branchreport.persistence.BranchReportPersistence) Before(org.junit.Before)

Example 2 with BranchReportPersistence

use of org.mifos.reports.branchreport.persistence.BranchReportPersistence in project head by mifos.

the class BranchReportServiceIntegrationTest method testResultsForStaffingLevelAreSorted.

@Test
public void testResultsForStaffingLevelAreSorted() throws PersistenceException, ServiceException {
    BranchReportPersistence branchReportPersistenceMock = createMock(BranchReportPersistence.class);
    branchReportService = new BranchReportService(officeBusinessServiceMock, new PersonnelBusinessService(), branchReportPersistenceMock);
    ArrayList<BranchReportStaffingLevelSummaryBO> staffingLevelResult = new ArrayList<BranchReportStaffingLevelSummaryBO>();
    BranchReportStaffingLevelSummaryBO totalStaffSummaryBO = new BranchReportStaffingLevelSummaryBO(IS_TOTAL, "A", 1);
    staffingLevelResult.add(totalStaffSummaryBO);
    staffingLevelResult.add(new BranchReportStaffingLevelSummaryBO(IS_NOT_TOTAL, "A", 1));
    staffingLevelResult.add(new BranchReportStaffingLevelSummaryBO(IS_NOT_TOTAL, "B", 1));
    expect(branchReportPersistenceMock.getBranchReportStaffingLevelSummary(BRANCH_ID_SHORT, RUN_DATE)).andReturn(staffingLevelResult);
    replay(branchReportPersistenceMock);
    List<BranchReportStaffingLevelSummaryBO> retrievedStaffingLevel = branchReportService.getStaffingLevelSummary(BRANCH_ID, RUN_DATE_STR);
    verify(branchReportPersistenceMock);
    BranchReportStaffingLevelSummaryBO lastBO = null;
    for (BranchReportStaffingLevelSummaryBO summaryBO : retrievedStaffingLevel) {
        if (lastBO != null) {
            Assert.assertEquals(1, summaryBO.compareTo(lastBO));
        }
        lastBO = summaryBO;
    }
    Assert.assertEquals(0, totalStaffSummaryBO.compareTo(lastBO));
}
Also used : PersonnelBusinessService(org.mifos.customers.personnel.business.service.PersonnelBusinessService) ArrayList(java.util.ArrayList) BranchReportPersistence(org.mifos.reports.branchreport.persistence.BranchReportPersistence) BranchReportStaffingLevelSummaryBO(org.mifos.reports.branchreport.BranchReportStaffingLevelSummaryBO) Test(org.junit.Test)

Aggregations

PersonnelBusinessService (org.mifos.customers.personnel.business.service.PersonnelBusinessService)2 BranchReportPersistence (org.mifos.reports.branchreport.persistence.BranchReportPersistence)2 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 Test (org.junit.Test)1 OfficeBusinessService (org.mifos.customers.office.business.service.OfficeBusinessService)1 BranchReportBO (org.mifos.reports.branchreport.BranchReportBO)1 BranchReportStaffingLevelSummaryBO (org.mifos.reports.branchreport.BranchReportStaffingLevelSummaryBO)1