Search in sources :

Example 1 with SelectData

use of org.motechproject.mds.web.SelectData in project motech by motech.

the class EntityControllerTest method shouldReturnRecordsSortedByName.

@Test
public void shouldReturnRecordsSortedByName() throws Exception {
    List<EntityDto> expected = new ArrayList<>();
    expected.add(new EntityDto(9005L, "org.motechproject.appointments.api.model.Appointment", "MOTECH Appointments API", SecurityMode.EVERYONE, null));
    expected.add(new EntityDto(9006L, "org.motechproject.ivr.domain.CallDetailRecord", "MOTECH IVR API", SecurityMode.EVERYONE, null));
    expected.add(new EntityDto(9008L, "org.motechproject.messagecampaign.domain.campaign.Campaign", "MOTECH Message Campaign", SecurityMode.EVERYONE, null));
    expected.add(new EntityDto(9001L, "org.motechproject.openmrs.ws.resource.model.Patient", "MOTECH OpenMRS Web Services", "navio", SecurityMode.EVERYONE, null));
    expected.add(new EntityDto(9003L, "org.motechproject.openmrs.ws.resource.model.Patient", "MOTECH OpenMRS Web Services", "accra", SecurityMode.EVERYONE, null));
    expected.add(new EntityDto(9002L, "org.motechproject.openmrs.ws.resource.model.Person", "MOTECH OpenMRS Web Services", "navio", SecurityMode.EVERYONE, null));
    expected.add(new EntityDto(9004L, "org.motechproject.openmrs.ws.resource.model.Person", "MOTECH OpenMRS Web Services", "accra", SecurityMode.EVERYONE, null));
    expected.add(new EntityDto(9007L, "org.motechproject.mds.entity.Voucher", SecurityMode.EVERYONE, null));
    SelectResult expectedResult = new SelectResult(new SelectData(null, 1, 10), expected);
    controller.perform(get("/selectEntities").param("term", "").param("page", String.valueOf(1)).param("pageLimit", String.valueOf(10))).andExpect(status().isOk()).andExpect(content().string(new ObjectMapper().writeValueAsString(expectedResult)));
}
Also used : SelectData(org.motechproject.mds.web.SelectData) EntityDto(org.motechproject.mds.dto.EntityDto) SelectResult(org.motechproject.mds.web.SelectResult) ArrayList(java.util.ArrayList) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 Test (org.junit.Test)1 EntityDto (org.motechproject.mds.dto.EntityDto)1 SelectData (org.motechproject.mds.web.SelectData)1 SelectResult (org.motechproject.mds.web.SelectResult)1