Search in sources :

Example 1 with SearchLogResponse

use of io.gravitee.rest.api.model.log.SearchLogResponse in project gravitee-management-rest-api by gravitee-io.

the class ApplicationLogsResourceTest method shouldGetNoLogAndNoLink.

@Test
public void shouldGetNoLogAndNoLink() {
    SearchLogResponse<ApplicationRequestItem> emptySearchResponse = new SearchLogResponse<>(0);
    emptySearchResponse.setLogs(Collections.emptyList());
    doReturn(emptySearchResponse).when(logsService).findByApplication(eq(APPLICATION), any());
    final Response response = target(APPLICATION).path("logs").queryParam("page", 1).queryParam("size", 10).queryParam("query", APPLICATION).queryParam("from", 0).queryParam("to", 100).queryParam("field", APPLICATION).queryParam("order", "ASC").request().get();
    assertEquals(HttpStatusCode.OK_200, response.getStatus());
    LogsResponse logsResponse = response.readEntity(LogsResponse.class);
    assertEquals(0, logsResponse.getData().size());
    Links links = logsResponse.getLinks();
    assertNull(links);
}
Also used : LogsResponse(io.gravitee.rest.api.portal.rest.model.LogsResponse) Response(javax.ws.rs.core.Response) SearchLogResponse(io.gravitee.rest.api.model.log.SearchLogResponse) LogsResponse(io.gravitee.rest.api.portal.rest.model.LogsResponse) ApplicationRequestItem(io.gravitee.rest.api.model.log.ApplicationRequestItem) SearchLogResponse(io.gravitee.rest.api.model.log.SearchLogResponse) Links(io.gravitee.rest.api.portal.rest.model.Links) Test(org.junit.Test)

Aggregations

ApplicationRequestItem (io.gravitee.rest.api.model.log.ApplicationRequestItem)1 SearchLogResponse (io.gravitee.rest.api.model.log.SearchLogResponse)1 Links (io.gravitee.rest.api.portal.rest.model.Links)1 LogsResponse (io.gravitee.rest.api.portal.rest.model.LogsResponse)1 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1