Search in sources :

Example 41 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 42 with QueryResult

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

the class GroupActionStrutsTest method testSearch.

@Test
public void testSearch() throws Exception {
    createGroupWithCenter();
    addRequestParameter("searchString", "gr");
    addActionAndMethod(Methods.search.toString());
    addCurrentFlowKey();
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.search_success.toString());
    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) Test(org.junit.Test)

Example 43 with QueryResult

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

the class GroupPersistenceIntegrationTest method testSearchForAddingClientToGroup.

@Test
public void testSearchForAddingClientToGroup() throws Exception {
    createGroup_ON_HOLD_STATUS();
    QueryResult queryResult = groupPersistence.searchForAddingClientToGroup(group.getDisplayName(), Short.valueOf("1"));
    Assert.assertNotNull(queryResult);
    Assert.assertEquals(0, queryResult.getSize());
    Assert.assertEquals(0, queryResult.get(0, 10).size());
}
Also used : QueryResult(org.mifos.framework.hibernate.helper.QueryResult) Test(org.junit.Test)

Example 44 with QueryResult

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

the class CustomerPersistenceIntegrationTest method testSearchWithGovernmentId.

@Test
public void testSearchWithGovernmentId() throws Exception {
    OfficeBO office = IntegrationTestObjectMother.sampleBranchOffice();
    PersonnelBO testUser = IntegrationTestObjectMother.testUser();
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().monthly().every(1).onDayOfMonth(1).build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    center = new CenterBuilder().with(weeklyMeeting).withName(this.getClass().getSimpleName() + " Center").with(office).withLoanOfficer(testUser).build();
    IntegrationTestObjectMother.createCenter((CenterBO) center, weeklyMeeting);
    group = new GroupBuilder().withMeeting(weeklyMeeting).withName("Group").withOffice(office).withLoanOfficer(testUser).withParentCustomer(center).withStatus(CustomerStatus.GROUP_ACTIVE).build();
    IntegrationTestObjectMother.createGroup((GroupBO) group, weeklyMeeting);
    String clientGovernmentId = "76346793216";
    client = new ClientBuilder().withMeeting(weeklyMeeting).withName("Client 1").withOffice(office).withLoanOfficer(testUser).withParentCustomer(group).withStatus(CustomerStatus.CLIENT_ACTIVE).withGovernmentId(clientGovernmentId).buildForIntegrationTests();
    IntegrationTestObjectMother.createClient(client, weeklyMeeting);
    QueryResult queryResult = new CustomerPersistence().search(clientGovernmentId, office.getOfficeId(), testUser.getPersonnelId(), testUser.getOffice().getOfficeId(), filters);
    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) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) MeetingBO(org.mifos.application.meeting.business.MeetingBO) GroupBuilder(org.mifos.domain.builders.GroupBuilder) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Test(org.junit.Test)

Example 45 with QueryResult

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

the class CustomerPersistenceIntegrationTest method testSearchActiveClients.

@Test
public void testSearchActiveClients() throws Exception {
    createCustomers(CustomerStatus.GROUP_ACTIVE, CustomerStatus.CLIENT_ACTIVE);
    StaticHibernateUtil.flushSession();
    Integer activeStatus = CustomerStatus.CLIENT_ACTIVE.getValue().intValue();
    filters.getCustomerStates().put(CustomerLevel.CLIENT.toString(), activeStatus);
    QueryResult queryResult = new CustomerPersistence().search("Client", Short.valueOf("0"), Short.valueOf("1"), Short.valueOf("1"), filters);
    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