Search in sources :

Example 11 with PagedResources

use of org.springframework.hateoas.PagedResources in project taskana by Taskana.

the class TaskControllerIntTest method testGetAllTasksKeepingFilters.

@Test
public void testGetAllTasksKeepingFilters() {
    RestTemplate template = getRestTemplate();
    HttpHeaders headers = new HttpHeaders();
    headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
    HttpEntity<String> request = new HttpEntity<String>(headers);
    ResponseEntity<PagedResources<TaskSummaryResource>> response = template.exchange("http://127.0.0.1:" + port + "/v1/tasks?por.type=VNR&por.value=22334455&sortBy=por.value&order=desc", HttpMethod.GET, request, new ParameterizedTypeReference<PagedResources<TaskSummaryResource>>() {
    });
    assertNotNull(response.getBody().getLink(Link.REL_SELF));
    assertTrue(response.getBody().getLink(Link.REL_SELF).getHref().endsWith("/v1/tasks?por.type=VNR&por.value=22334455&sortBy=por.value&order=desc"));
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) HttpEntity(org.springframework.http.HttpEntity) PagedResources(org.springframework.hateoas.PagedResources) RestTemplate(org.springframework.web.client.RestTemplate) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

PagedResources (org.springframework.hateoas.PagedResources)11 Test (org.junit.Test)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)9 HttpEntity (org.springframework.http.HttpEntity)9 HttpHeaders (org.springframework.http.HttpHeaders)9 RestTemplate (org.springframework.web.client.RestTemplate)9 Ignore (org.junit.Ignore)3 Link (org.springframework.hateoas.Link)2 ServletUriComponentsBuilder (org.springframework.web.servlet.support.ServletUriComponentsBuilder)2 UriComponentsBuilder (org.springframework.web.util.UriComponentsBuilder)2 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Optional (java.util.Optional)1 MethodParameter (org.springframework.core.MethodParameter)1 Page (org.springframework.data.domain.Page)1 PageRequest (org.springframework.data.domain.PageRequest)1 Pageable (org.springframework.data.domain.Pageable)1 PageMetadata (org.springframework.hateoas.PagedResources.PageMetadata)1 Resource (org.springframework.hateoas.Resource)1