Search in sources :

Example 51 with QueryResult

use of org.mifos.framework.hibernate.helper.QueryResult in project head by mifos.

the class CustomerPersistenceIntegrationTest method testSearchWithCancelLoanAccounts.

@SuppressWarnings("unchecked")
@Test
public void testSearchWithCancelLoanAccounts() throws Exception {
    groupAccount = getLoanAccount();
    PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
    groupAccount.changeStatus(AccountState.LOAN_CANCELLED, AccountStateFlag.LOAN_WITHDRAW.getValue(), "WITHDRAW LOAN ACCOUNT", loggedInUser);
    TestObjectFactory.updateObject(groupAccount);
    StaticHibernateUtil.flushSession();
    groupAccount = TestObjectFactory.getObject(LoanBO.class, groupAccount.getAccountId());
    center = TestObjectFactory.getCustomer(center.getCustomerId());
    group = TestObjectFactory.getCustomer(group.getCustomerId());
    QueryResult queryResult = new CustomerPersistence().search(group.getGlobalCustNum(), Short.valueOf("3"), Short.valueOf("1"), Short.valueOf("1"), filters);
    Assert.assertNotNull(queryResult);
    Assert.assertEquals(1, queryResult.getSize());
    List results = queryResult.get(0, 10);
    Assert.assertEquals(1, results.size());
    CustomerSearchDto customerSearchDto = (CustomerSearchDto) results.get(0);
    Assert.assertEquals(0, customerSearchDto.getLoanGlobalAccountNum().size());
}
Also used : QueryResult(org.mifos.framework.hibernate.helper.QueryResult) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) LoanBO(org.mifos.accounts.loan.business.LoanBO) CustomerSearchDto(org.mifos.customers.business.CustomerSearchDto) List(java.util.List) Test(org.junit.Test)

Example 52 with QueryResult

use of org.mifos.framework.hibernate.helper.QueryResult in project head by mifos.

the class PersonnelBusinessServiceIntegrationTest method testSearch.

@Test
public void testSearch() throws Exception {
    personnel = createPersonnel();
    QueryResult queryResult = personnelBusinessService.search(personnel.getUserName(), Short.valueOf("1"));
    Assert.assertNotNull(queryResult);
    Assert.assertEquals(1, queryResult.getSize());
    Assert.assertEquals(1, queryResult.get(0, 10).size());
}
Also used : QueryResult(org.mifos.framework.hibernate.helper.QueryResult) Test(org.junit.Test)

Example 53 with QueryResult

use of org.mifos.framework.hibernate.helper.QueryResult in project head by mifos.

the class CenterPersistenceIntegrationTest method testSearch.

@Test
public void testSearch() throws Exception {
    String centerName = "NewCenter";
    center = TestObjectFactory.createWeeklyFeeCenter(centerName, getMeeting());
    QueryResult queryResult = new CenterPersistence().search(center.getDisplayName(), Short.valueOf("1"));
    Assert.assertNotNull(queryResult);
    Assert.assertEquals(1, queryResult.getSize());
    Assert.assertEquals(1, queryResult.get(0, 10).size());
}
Also used : QueryResult(org.mifos.framework.hibernate.helper.QueryResult) Test(org.junit.Test)

Aggregations

QueryResult (org.mifos.framework.hibernate.helper.QueryResult)53 Test (org.junit.Test)30 HibernateSearchException (org.mifos.framework.exceptions.HibernateSearchException)16 PersistenceException (org.mifos.framework.exceptions.PersistenceException)14 ArrayList (java.util.ArrayList)13 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)10 QueryInputs (org.mifos.framework.hibernate.helper.QueryInputs)10 Param (org.mifos.customers.util.helpers.Param)9 MifosRuntimeException (org.mifos.core.MifosRuntimeException)7 UserContext (org.mifos.security.util.UserContext)7 MifosUser (org.mifos.security.MifosUser)5 CustomerPersistence (org.mifos.customers.persistence.CustomerPersistence)4 List (java.util.List)3 Query (org.hibernate.Query)3 Session (org.hibernate.Session)3 AccountSearchResultsDto (org.mifos.accounts.util.helpers.AccountSearchResultsDto)3 CustomerSearchDto (org.mifos.customers.business.CustomerSearchDto)3 CustomerException (org.mifos.customers.exceptions.CustomerException)3 CustomerSearchResultDto (org.mifos.dto.domain.CustomerSearchResultDto)3 Date (java.sql.Date)2