@Test public void testGetTask() throws Throwable { Task responseTask = new Task(); responseTask.setId("12345"); responseTask.setState("QUEUED"); responseTask.setQueuedTime(Date.from(Instant.now())); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(responseTask); setupMocks(serializedTask, HttpStatus.SC_OK); TasksApi tasksApi = new TasksRestApi(this.restClient); Task task = tasksApi.getTask("foo"); assertEquals(task, responseTask); }
@Override public Task getTask(final String taskId) throws IOException { String path = getBasePath() + "/" + taskId; Future<HttpResponse> response = this.restClient.performAsync( Method.GET, path, null , null ); try { return parseGetTaskHttpResponse(response.get()); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } }
TasksRestApi extends ApiBase implements TasksApi { @Override public Task getTask(final String taskId) throws IOException { String path = getBasePath() + "/" + taskId; Future<HttpResponse> response = this.restClient.performAsync( Method.GET, path, null , null ); try { return parseGetTaskHttpResponse(response.get()); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } } }
TasksRestApi extends ApiBase implements TasksApi { @Override public Task getTask(final String taskId) throws IOException { String path = getBasePath() + "/" + taskId; Future<HttpResponse> response = this.restClient.performAsync( Method.GET, path, null , null ); try { return parseGetTaskHttpResponse(response.get()); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } } TasksRestApi(RestClient restClient); }
TasksRestApi extends ApiBase implements TasksApi { @Override public Task getTask(final String taskId) throws IOException { String path = getBasePath() + "/" + taskId; Future<HttpResponse> response = this.restClient.performAsync( Method.GET, path, null , null ); try { return parseGetTaskHttpResponse(response.get()); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } } TasksRestApi(RestClient restClient); @Override String getBasePath(); @Override Task getTask(final String taskId); @Override void getTaskAsync(final String taskId, final FutureCallback<Task> responseCallback); }
TasksRestApi extends ApiBase implements TasksApi { @Override public Task getTask(final String taskId) throws IOException { String path = getBasePath() + "/" + taskId; Future<HttpResponse> response = this.restClient.performAsync( Method.GET, path, null , null ); try { return parseGetTaskHttpResponse(response.get()); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } } TasksRestApi(RestClient restClient); @Override String getBasePath(); @Override Task getTask(final String taskId); @Override void getTaskAsync(final String taskId, final FutureCallback<Task> responseCallback);  }