@Override protected IterableWithMarker<Action> fetchPageUsingOptions(ListOptions options, Optional<Object> arg0) { return api.actionApi().list(options); } }
@Override protected IterableWithMarker<Action> fetchPageUsingOptions(ListOptions options, Optional<Object> arg0) { return api.actionApi().list(options); } }
@Override protected IterableWithMarker<Action> fetchPageUsingOptions(ListOptions options, Optional<Object> arg0) { return api.actionApi().list(options); } }
public void testListActions() { final AtomicInteger found = new AtomicInteger(0); // DigitalOcean return 25 records per page by default. Inspect at most 2 pages assertTrue(api().list().concat().limit(50).allMatch(new Predicate<Action>() { @Override public boolean apply(Action input) { found.incrementAndGet(); return !isNullOrEmpty(input.type()); } }), "All actions must have the 'type' field populated"); assertTrue(found.get() > 0, "Expected some actions to be returned"); }
public void testListActionsOnePage() { final AtomicInteger found = new AtomicInteger(0); assertTrue(api().list(page(1).perPage(5)).allMatch(new Predicate<Action>() { @Override public boolean apply(Action input) { found.incrementAndGet(); return !isNullOrEmpty(input.type()); } }), "All actions must have the 'type' field populated"); assertTrue(found.get() > 0, "Expected some actions to be returned"); }
public void testGetAction() { Optional<Action> first = api().list().concat().first(); assertTrue(first.isPresent(), "At least one action was expected to exist"); assertNotNull(api().get(first.get().id())); }
public void testListActionsReturns404() throws InterruptedException { server.enqueue(response404()); Iterable<Action> actions = api.actionApi().list().concat(); assertTrue(isEmpty(actions)); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/actions"); }
public void testListActionsWithOptions() throws InterruptedException { server.enqueue(jsonResponse("/actions-first.json")); Iterable<Action> actions = api.actionApi().list(page(1).perPage(5)); assertEquals(size(actions), 5); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/actions?page=1&per_page=5"); }
public void testListActionsWithOptionsReturns404() throws InterruptedException { server.enqueue(response404()); Iterable<Action> actions = api.actionApi().list(page(1).perPage(5)); assertTrue(isEmpty(actions)); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/actions?page=1&per_page=5"); }
public void testListActions() throws InterruptedException { server.enqueue(jsonResponse("/actions-first.json")); server.enqueue(jsonResponse("/actions-last.json")); Iterable<Action> actions = api.actionApi().list().concat(); assertEquals(size(actions), 8); // Force the PagedIterable to advance assertEquals(server.getRequestCount(), 2); assertSent(server, "GET", "/actions"); assertSent(server, "GET", "/actions?page=2&per_page=5"); }