@Test public void testGetVmAsync() throws IOException, InterruptedException { final SystemStatus systemStatus = new SystemStatus(); systemStatus.setStatus(StatusType.READY); ObjectMapper mapper = new ObjectMapper(); String serialized = mapper.writeValueAsString(systemStatus); setupMocks(serialized, HttpStatus.SC_OK); SystemStatusApi systemStatusApi = new SystemStatusRestApi(restClient); final CountDownLatch latch = new CountDownLatch(1); systemStatusApi.getSystemStatusAsync(new FutureCallback<SystemStatus>() { @Override public void onSuccess(@Nullable SystemStatus result) { assertEquals(result, systemStatus); latch.countDown(); } @Override public void onFailure(Throwable t) { fail(t.toString()); latch.countDown(); } }); assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true)); }
@Override public void getSystemStatusAsync(final FutureCallback<SystemStatus> responseCallback) throws IOException { String path = getBasePath(); getObjectByPathAsync(path, responseCallback, new TypeReference<SystemStatus>() { }); }
SystemStatusRestApi extends ApiBase implements SystemStatusApi { @Override public void getSystemStatusAsync(final FutureCallback<SystemStatus> responseCallback) throws IOException { String path = getBasePath(); getObjectByPathAsync(path, responseCallback, new TypeReference<SystemStatus>() { }); } }
SystemStatusRestApi extends ApiBase implements SystemStatusApi { @Override public void getSystemStatusAsync(final FutureCallback<SystemStatus> responseCallback) throws IOException { String path = getBasePath(); getObjectByPathAsync(path, responseCallback, new TypeReference<SystemStatus>() { }); } SystemStatusRestApi(RestClient restClient); }
SystemStatusRestApi extends ApiBase implements SystemStatusApi { @Override public void getSystemStatusAsync(final FutureCallback<SystemStatus> responseCallback) throws IOException { String path = getBasePath(); getObjectByPathAsync(path, responseCallback, new TypeReference<SystemStatus>() { }); } SystemStatusRestApi(RestClient restClient); @Override String getBasePath(); @Override SystemStatus getSystemStatus(); @Override void getSystemStatusAsync(final FutureCallback<SystemStatus> responseCallback); }
SystemStatusRestApi extends ApiBase implements SystemStatusApi { @Override public void getSystemStatusAsync(final FutureCallback<SystemStatus> responseCallback) throws IOException { String path = getBasePath(); getObjectByPathAsync(path, responseCallback, new TypeReference<SystemStatus>() { }); } SystemStatusRestApi(RestClient restClient); @Override String getBasePath(); @Override SystemStatus getSystemStatus(); @Override void getSystemStatusAsync(final FutureCallback<SystemStatus> responseCallback);  }