@Override public boolean apply(AtomicReference<Operation> input) { checkNotNull(input.get(), "operation"); Operation current = resources.operation(input.get().selfLink()); input.set(current); checkState(current.error().errors().isEmpty(), "Task ended in error %s", current); // ISE will break the loop. switch (current.status()) { case DONE: return true; case PENDING: case RUNNING: default: return false; } } }
@Override public boolean apply(AtomicReference<Operation> input) { checkNotNull(input.get(), "operation"); Operation current = resources.operation(input.get().selfLink()); input.set(current); checkState(current.error().errors().isEmpty(), "Task ended in error %s", current); // ISE will break the loop. switch (current.status()) { case DONE: return true; case PENDING: case RUNNING: default: return false; } } }
@Override public boolean apply(AtomicReference<Operation> input) { checkNotNull(input.get(), "operation"); Operation current = resources.operation(input.get().selfLink()); input.set(current); checkState(current.error().errors().isEmpty(), "Task ended in error %s", current); // ISE will break the loop. switch (current.status()) { case DONE: return true; case PENDING: case RUNNING: default: return false; } } }
@Override public boolean apply(AtomicReference<Operation> input) { checkNotNull(input.get(), "operation"); Operation current = resources.operation(input.get().selfLink()); input.set(current); checkState(current.error().errors().isEmpty(), "Task ended in error %s", current); // ISE will break the loop. switch (current.status()) { case DONE: return true; case PENDING: case RUNNING: default: return false; } } }
@Override public boolean apply(AtomicReference<Operation> input) { input.set(api.operations().get(input.get().selfLink())); return Status.DONE == input.get().status(); } }, operationDoneTimeout, operationDoneInterval, MILLISECONDS).apply(o);
@Test(groups = "live", dependsOnMethods = "listWithOptions") public void testGetOperation() { Operation result = api().get(operation.selfLink()); assertNotNull(result); assertEquals(result.name(), operation.name()); // Checking state besides name can lead to flaky test. }