Search in sources :

Example 11 with QueryResult

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

the class LegacyPersonnelDaoIntegrationTest method testSearchFirstNameAndLastName.

@Test
public void testSearchFirstNameAndLastName() throws Exception {
    branchOffice = TestObjectFactory.getOffice(TestObjectFactory.SAMPLE_BRANCH_OFFICE);
    personnel = createPersonnelWithName(branchOffice, PersonnelLevel.LOAN_OFFICER, new Name("Rajender", null, "singh", "saini"));
    QueryResult queryResult = legacyPersonnelDao.search(personnel.getPersonnelDetails().getName().getFirstName() + " " + personnel.getPersonnelDetails().getName().getLastName(), 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) Name(org.mifos.framework.business.util.Name) Test(org.junit.Test)

Example 12 with QueryResult

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

the class CustomerPersistenceIntegrationTest method testSearchCustForSavings.

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

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

the class CustomerPersistenceIntegrationTest method testSearchWithoutGroups.

@Test
public void testSearchWithoutGroups() throws Exception {
    createCustomers(CustomerStatus.GROUP_ACTIVE, CustomerStatus.CLIENT_ACTIVE);
    StaticHibernateUtil.flushSession();
    setCustomerSearch(CustomerLevel.GROUP, false);
    QueryResult queryResult = new CustomerPersistence().search("%", 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 14 with QueryResult

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

the class CustomerPersistenceIntegrationTest method testSearchWithEthnicityExists.

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

Example 15 with QueryResult

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

the class CustomerPersistenceIntegrationTest method testSearchWithEthnicityNotExists.

@Test
public void testSearchWithEthnicityNotExists() throws Exception {
    createCustomers(CustomerStatus.GROUP_ACTIVE, CustomerStatus.CLIENT_ACTIVE);
    StaticHibernateUtil.flushSession();
    filters.setEthnicity("wrongEthnicity");
    QueryResult queryResult = new CustomerPersistence().search("%", 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)

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