use of org.springframework.hateoas.PagedResources in project taskana by Taskana.
the class WorkbasketControllerIntTest method testGetAllWorkbaskets.
@Test
public void testGetAllWorkbaskets() {
RestTemplate template = getRestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
HttpEntity<String> request = new HttpEntity<String>(headers);
ResponseEntity<PagedResources<WorkbasketSummaryResource>> response = template.exchange("http://127.0.0.1:" + port + "/v1/workbaskets", HttpMethod.GET, request, new ParameterizedTypeReference<PagedResources<WorkbasketSummaryResource>>() {
});
assertNotNull(response.getBody().getLink(Link.REL_SELF));
}
use of org.springframework.hateoas.PagedResources in project taskana by Taskana.
the class WorkbasketControllerIntTest method testGetAllWorkbasketsKeepingFilters.
@Test
public void testGetAllWorkbasketsKeepingFilters() {
RestTemplate template = getRestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
HttpEntity<String> request = new HttpEntity<String>(headers);
ResponseEntity<PagedResources<WorkbasketSummaryResource>> response = template.exchange("http://127.0.0.1:" + port + "/v1/workbaskets?type=PERSONAL&sortBy=key&order=desc", HttpMethod.GET, request, new ParameterizedTypeReference<PagedResources<WorkbasketSummaryResource>>() {
});
assertNotNull(response.getBody().getLink(Link.REL_SELF));
assertTrue(response.getBody().getLink(Link.REL_SELF).getHref().endsWith("/v1/workbaskets?type=PERSONAL&sortBy=key&order=desc"));
}
use of org.springframework.hateoas.PagedResources in project taskana by Taskana.
the class TaskControllerIntTest method testGetQueryByPorSecondPageSortedByType.
@Test
@Ignore
public void testGetQueryByPorSecondPageSortedByType() {
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?porCompany=00&porSystem=PASystem&porInstance=00&porType=VNR&porValue=22334455&sortBy=porType&order=asc&page=2&pageSize=5", HttpMethod.GET, request, new ParameterizedTypeReference<PagedResources<TaskSummaryResource>>() {
});
assertEquals(5, response.getBody().getContent().size());
assertEquals("USER_1_1", response.getBody().getContent().iterator().next().getTaskId());
assertNotNull(response.getBody().getLink(Link.REL_SELF));
assertTrue(response.getBody().getLink(Link.REL_SELF).getHref().endsWith("/v1/tasks?sortBy=due&order=desc&page=2&pageSize=5"));
assertNotNull(response.getBody().getLink("allTasks"));
assertTrue(response.getBody().getLink("allTasks").getHref().endsWith("/v1/tasks"));
assertNotNull(response.getBody().getLink(Link.REL_FIRST));
assertNotNull(response.getBody().getLink(Link.REL_LAST));
assertNotNull(response.getBody().getLink(Link.REL_NEXT));
assertNotNull(response.getBody().getLink(Link.REL_PREVIOUS));
}
use of org.springframework.hateoas.PagedResources in project taskana by Taskana.
the class TaskControllerIntTest method testGetLastPageSortedByDueWithHiddenTasksRemovedFromResult.
@Test
@Ignore
public void testGetLastPageSortedByDueWithHiddenTasksRemovedFromResult() {
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?sortBy=due&order=desc&page=14&pageSize=5", HttpMethod.GET, request, new ParameterizedTypeReference<PagedResources<TaskSummaryResource>>() {
});
assertEquals(2, response.getBody().getContent().size());
assertTrue(response.getBody().getLink(Link.REL_LAST).getHref().contains("page=14"));
assertEquals("TKI:000000000000000000000000000000000005", response.getBody().getContent().iterator().next().getTaskId());
assertNotNull(response.getBody().getLink(Link.REL_SELF));
assertTrue(response.getBody().getLink(Link.REL_SELF).getHref().endsWith("/v1/tasks?sortBy=due&order=desc&page=2&pageSize=5"));
assertNotNull(response.getBody().getLink("allTasks"));
assertTrue(response.getBody().getLink("allTasks").getHref().endsWith("/v1/tasks"));
assertNotNull(response.getBody().getLink(Link.REL_FIRST));
assertNotNull(response.getBody().getLink(Link.REL_LAST));
assertNotNull(response.getBody().getLink(Link.REL_NEXT));
assertNotNull(response.getBody().getLink(Link.REL_PREVIOUS));
}
use of org.springframework.hateoas.PagedResources in project taskana by Taskana.
the class TaskControllerIntTest method testGetAllTasks.
@Test
public void testGetAllTasks() {
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", HttpMethod.GET, request, new ParameterizedTypeReference<PagedResources<TaskSummaryResource>>() {
});
assertNotNull(response.getBody().getLink(Link.REL_SELF));
assertEquals(22, response.getBody().getContent().size());
}
Aggregations