Search in sources :

Example 6 with LinksResponse

use of org.molgenis.api.model.response.LinksResponse in project molgenis by molgenis.

the class PermissionResponseUtils method getPermissionResponse.

static PagedApiResponse getPermissionResponse(String query, int page, int pageSize, int totalItems, Object data) {
    PageResponse pageResponse = PageResponse.create(pageSize, totalItems, page);
    LinksResponse linksResponse = getLinks(query, page, pageSize, totalItems);
    return PagedApiResponse.create(pageResponse, linksResponse, data);
}
Also used : LinksResponse(org.molgenis.api.model.response.LinksResponse) PageResponse(org.molgenis.api.model.response.PageResponse)

Example 7 with LinksResponse

use of org.molgenis.api.model.response.LinksResponse in project molgenis by molgenis.

the class LinksUtilsTest method createLinksResponse.

@Test
void createLinksResponse() throws URISyntaxException {
    request.setQueryString("page=1");
    LinksResponse linksResponse = LinksResponse.builder().setPrevious(new URI("http://localhost?page=0")).setSelf(new URI("http://localhost?page=1")).setNext(new URI("http://localhost?page=2")).build();
    assertEquals(linksResponse, LinksUtils.createLinksResponse(1, 10, 30));
}
Also used : LinksResponse(org.molgenis.api.model.response.LinksResponse) URI(java.net.URI) Test(org.junit.jupiter.api.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Example 8 with LinksResponse

use of org.molgenis.api.model.response.LinksResponse in project molgenis by molgenis.

the class LinksUtilsTest method createLinksResponseFirstPage.

@Test
void createLinksResponseFirstPage() throws URISyntaxException {
    request.setQueryString("page=0");
    LinksResponse linksResponse = LinksResponse.builder().setSelf(new URI("http://localhost?page=0")).setNext(new URI("http://localhost?page=1")).build();
    assertEquals(linksResponse, LinksUtils.createLinksResponse(0, 10, 30));
}
Also used : LinksResponse(org.molgenis.api.model.response.LinksResponse) URI(java.net.URI) Test(org.junit.jupiter.api.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Aggregations

LinksResponse (org.molgenis.api.model.response.LinksResponse)8 URI (java.net.URI)6 Test (org.junit.jupiter.api.Test)6 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)6 EntitiesResponse (org.molgenis.api.data.v3.model.EntitiesResponse)1 Builder (org.molgenis.api.data.v3.model.EntitiesResponse.Builder)1 PageResponse (org.molgenis.api.model.response.PageResponse)1