@Test public void testResize() throws IOException { 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_CREATED); ClusterApi clusterApi = new ClusterRestApi(restClient); Task task = clusterApi.resize("dummy-cluster-id", 100); assertEquals(task, responseTask); }
@Override public Task resize(String clusterId, int size) throws IOException { String path = String.format("%s/%s/resize", getBasePath(), clusterId); ClusterResizeOperation op = new ClusterResizeOperation(); op.setNewWorkerCount(size); HttpResponse response = this.restClient.perform(RestClient.Method.POST, path, serializeObjectAsJson(op)); this.restClient.checkResponse(response, HttpStatus.SC_CREATED); return parseTaskFromHttpResponse(response); }
ClusterRestApi extends ApiBase implements ClusterApi { @Override public Task resize(String clusterId, int size) throws IOException { String path = String.format("%s/%s/resize", getBasePath(), clusterId); ClusterResizeOperation op = new ClusterResizeOperation(); op.setNewWorkerCount(size); HttpResponse response = this.restClient.perform(RestClient.Method.POST, path, serializeObjectAsJson(op)); this.restClient.checkResponse(response, HttpStatus.SC_CREATED); return parseTaskFromHttpResponse(response); } }
ClusterRestApi extends ApiBase implements ClusterApi { @Override public Task resize(String clusterId, int size) throws IOException { String path = String.format("%s/%s/resize", getBasePath(), clusterId); ClusterResizeOperation op = new ClusterResizeOperation(); op.setNewWorkerCount(size); HttpResponse response = this.restClient.perform(RestClient.Method.POST, path, serializeObjectAsJson(op)); this.restClient.checkResponse(response, HttpStatus.SC_CREATED); return parseTaskFromHttpResponse(response); } ClusterRestApi(RestClient restClient); }
ClusterRestApi extends ApiBase implements ClusterApi { @Override public Task resize(String clusterId, int size) throws IOException { String path = String.format("%s/%s/resize", getBasePath(), clusterId); ClusterResizeOperation op = new ClusterResizeOperation(); op.setNewWorkerCount(size); HttpResponse response = this.restClient.perform(RestClient.Method.POST, path, serializeObjectAsJson(op)); this.restClient.checkResponse(response, HttpStatus.SC_CREATED); return parseTaskFromHttpResponse(response); } ClusterRestApi(RestClient restClient); @Override String getBasePath(); @Override Cluster getCluster(String clusterId); @Override void getClusterAsync(final String clusterId, final FutureCallback<Cluster> responseCallback); @Override Task delete(String clusterId); @Override void deleteAsync(final String clusterId, final FutureCallback<Task> responseCallback); @Override Task resize(String clusterId, int size); @Override void resizeAsync(
      final String clusterId, final int size, final FutureCallback<Task> responseCallback); @Override ResourceList<Vm> getVmsInCluster(String clusterId); @Override void getVmsInClusterAsync(final String clusterId, final FutureCallback<ResourceList<Vm>> responseCallback); }
ClusterRestApi extends ApiBase implements ClusterApi { @Override public Task resize(String clusterId, int size) throws IOException { String path = String.format("%s/%s/resize", getBasePath(), clusterId); ClusterResizeOperation op = new ClusterResizeOperation(); op.setNewWorkerCount(size); HttpResponse response = this.restClient.perform(RestClient.Method.POST, path, serializeObjectAsJson(op)); this.restClient.checkResponse(response, HttpStatus.SC_CREATED); return parseTaskFromHttpResponse(response); } ClusterRestApi(RestClient restClient); @Override String getBasePath(); @Override Cluster getCluster(String clusterId); @Override void getClusterAsync(final String clusterId, final FutureCallback<Cluster> responseCallback); @Override Task delete(String clusterId); @Override void deleteAsync(final String clusterId, final FutureCallback<Task> responseCallback); @Override Task resize(String clusterId, int size); @Override void resizeAsync(
      final String clusterId, final int size, final FutureCallback<Task> responseCallback); @Override ResourceList<Vm> getVmsInCluster(String clusterId); @Override void getVmsInClusterAsync(final String clusterId, final FutureCallback<ResourceList<Vm>> responseCallback);  }