Search in sources :

Example 91 with ServiceException

use of org.mifos.framework.exceptions.ServiceException in project head by mifos.

the class PersonnelBusinessServiceTest method testInvalidConnectionInGetPersonnelByUsername.

@Test
@ExpectedException(value = CustomerException.class)
public void testInvalidConnectionInGetPersonnelByUsername() throws PersistenceException {
    try {
        String shortName = "shortname";
        when(personnelPersistence.getPersonnelByUserName(shortName)).thenThrow(new PersistenceException("some exception"));
        service.getPersonnel(shortName);
        junit.framework.Assert.fail("should fail because of invalid session");
    } catch (ServiceException e) {
    }
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) Test(org.junit.Test) ExpectedException(org.springframework.test.annotation.ExpectedException)

Example 92 with ServiceException

use of org.mifos.framework.exceptions.ServiceException in project head by mifos.

the class ReportsDataServiceTest method setUp.

@Override
protected void setUp() throws Exception {
    loanPrdBusinessServiceMock = createMock(LoanPrdBusinessService.class);
    personnelBusinessServiceMock = createMock(PersonnelBusinessService.class);
    officeBusinessServiceMock = createMock(OfficeBusinessService.class);
    personnelMock = createMock(PersonnelBO.class);
    legacyLoanDaoMock = createMock(LegacyLoanDao.class);
    expectedException = new ServiceException("someServiceException");
    userId = 1;
    branchId = 2;
    localeId = 3;
    loanOfficerId = 3;
    loanProductId = 4;
    reportsDataService = new ReportsDataService();
    reportsDataService.setLoanPrdBusinessService(loanPrdBusinessServiceMock);
    reportsDataService.setPersonnelBusinessService(personnelBusinessServiceMock);
    reportsDataService.setOfficeBusinessService(officeBusinessServiceMock);
    reportsDataService.setPersonnel(personnelMock);
    reportsDataService.setlegacyLoanDao(legacyLoanDaoMock);
}
Also used : PersonnelBusinessService(org.mifos.customers.personnel.business.service.PersonnelBusinessService) ServiceException(org.mifos.framework.exceptions.ServiceException) OfficeBusinessService(org.mifos.customers.office.business.service.OfficeBusinessService) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) LoanPrdBusinessService(org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService) LegacyLoanDao(org.mifos.accounts.loan.persistance.LegacyLoanDao)

Example 93 with ServiceException

use of org.mifos.framework.exceptions.ServiceException in project head by mifos.

the class BranchReportService method getStaffingLevelSummary.

@Override
public List<BranchReportStaffingLevelSummaryBO> getStaffingLevelSummary(Integer branchId, String runDate) throws ServiceException {
    try {
        List<BranchReportStaffingLevelSummaryBO> staffingLevelSummary = branchReportPersistence.getBranchReportStaffingLevelSummary(convertIntegerToShort(branchId), ReportUtils.parseReportDate(runDate));
        Collections.sort(staffingLevelSummary);
        return staffingLevelSummary;
    } catch (PersistenceException e) {
        throw new ServiceException(e);
    } catch (ParseException e) {
        throw new ServiceException(e);
    }
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) BranchReportStaffingLevelSummaryBO(org.mifos.reports.branchreport.BranchReportStaffingLevelSummaryBO) ParseException(java.text.ParseException)

Aggregations

ServiceException (org.mifos.framework.exceptions.ServiceException)93 PersistenceException (org.mifos.framework.exceptions.PersistenceException)46 MifosRuntimeException (org.mifos.core.MifosRuntimeException)39 Test (org.junit.Test)34 ExpectedException (org.springframework.test.annotation.ExpectedException)29 ArrayList (java.util.ArrayList)24 UserContext (org.mifos.security.util.UserContext)19 AccountBO (org.mifos.accounts.business.AccountBO)17 MifosUser (org.mifos.security.MifosUser)16 LoanBO (org.mifos.accounts.loan.business.LoanBO)15 AccountBusinessService (org.mifos.accounts.business.service.AccountBusinessService)14 AccountException (org.mifos.accounts.exceptions.AccountException)13 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)13 BusinessRuleException (org.mifos.service.BusinessRuleException)11 Date (java.util.Date)8 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)7 BigDecimal (java.math.BigDecimal)6 ProductCategoryBusinessService (org.mifos.accounts.productdefinition.business.service.ProductCategoryBusinessService)6 DateTimeService (org.mifos.framework.util.DateTimeService)6 LocalDate (org.joda.time.LocalDate)5