Search in sources :

Example 36 with QueryResult

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

the class LegacyPersonnelDaoIntegrationTest method testSearch.

@Test
public void testSearch() throws Exception {
    branchOffice = TestObjectFactory.getOffice(TestObjectFactory.SAMPLE_BRANCH_OFFICE);
    personnel = createPersonnel(branchOffice, PersonnelLevel.LOAN_OFFICER);
    QueryResult queryResult = legacyPersonnelDao.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 37 with QueryResult

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

the class CustSearchActionStrutsTest method veryfyResults.

private void veryfyResults() throws Exception {
    QueryResult queryResult = (QueryResult) SessionUtils.getAttribute(Constants.SEARCH_RESULTS, request);
    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)

Example 38 with QueryResult

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

the class CustomerPersistenceIntegrationTest method testSearchWithoutOfficeId.

@Test
public void testSearchWithoutOfficeId() throws Exception {
    createCustomers(CustomerStatus.GROUP_ACTIVE, CustomerStatus.CLIENT_ACTIVE);
    StaticHibernateUtil.flushSession();
    QueryResult queryResult = new CustomerPersistence().search("C", Short.valueOf("0"), Short.valueOf("1"), Short.valueOf("1"), filters);
    Assert.assertNotNull(queryResult);
    Assert.assertEquals(2, queryResult.getSize());
    Assert.assertEquals(2, queryResult.get(0, 10).size());
}
Also used : QueryResult(org.mifos.framework.hibernate.helper.QueryResult) Test(org.junit.Test)

Example 39 with QueryResult

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

the class CustomerPersistenceIntegrationTest method testSearchGropAndClient.

@Test
public void testSearchGropAndClient() throws Exception {
    createCustomers(CustomerStatus.GROUP_ACTIVE, CustomerStatus.CLIENT_ACTIVE);
    StaticHibernateUtil.flushSession();
    QueryResult queryResult = new CustomerPersistence().searchGroupClient("C", Short.valueOf("1"), false);
    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 40 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)

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