Skip to content

Commit

Permalink
Fix the output of the GET /activity to just contain the array of ws i…
Browse files Browse the repository at this point in the history
…ds (#12271)

not the full page object.

Signed-off-by: Lukas Krejci <lkrejci@redhat.com>
  • Loading branch information
metlos authored and skabashnyuk committed Dec 24, 2018
1 parent bac76ac commit 80596fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@ public Response getWorkspacesByActivity(
Page<String> data =
workspaceActivityManager.findWorkspacesInStatus(status, limit, maxItems, skipCount);

return Response.ok(data).header("Link", createLinkHeader(data)).build();
return Response.ok(data.getItems()).header("Link", createLinkHeader(data)).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import static com.jayway.restassured.RestAssured.given;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
Expand Down Expand Up @@ -134,14 +135,15 @@ public void shouldBeAbleToQueryWithoutTimeConstraints() throws ServerException {
public void shouldIgnoredMinDurationWhenThresholdSpecified() throws Exception {
when(workspaceActivityManager.findWorkspacesInStatus(
eq(WorkspaceStatus.STOPPED), anyLong(), anyInt(), anyLong()))
.thenReturn(new Page<>(emptyList(), 0, 1, 0));
.thenReturn(new Page<>(singletonList("ws-1"), 0, 1, 1));

Response response =
given()
.when()
.get(URI.create(SERVICE_PATH + "?status=STOPPED&threshold=15&minDuration=55"));

assertEquals(response.getStatusCode(), 200);
assertEquals(response.getBody().print(), "[\"ws-1\"]");
verify(workspaceActivityManager, times(1))
.findWorkspacesInStatus(
eq(WorkspaceStatus.STOPPED), eq(15L), eq(Pages.DEFAULT_PAGE_SIZE), eq(0L));
Expand Down

0 comments on commit 80596fb

Please sign in to comment.