package org.sonarqube.ws.client.ce;
+import org.sonarqube.ws.WsCe;
import org.sonarqube.ws.WsCe.ActivityResponse;
import org.sonarqube.ws.WsCe.TaskTypesWsResponse;
import org.sonarqube.ws.client.BaseService;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_STATUS;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_TYPE;
+/**
+ * Maps web service {@code api/ce} (Compute Engine).
+ */
public class CeService extends BaseService {
public CeService(WsConnector wsConnector) {
return call(new GetRequest(path("task_types")), TaskTypesWsResponse.parser());
}
+ /**
+ * Gets details of a Compute Engine task.
+ *
+ * @throws org.sonarqube.ws.client.HttpException if HTTP status code is not 2xx.
+ * @since 5.5
+ */
+ public WsCe.TaskResponse task(String id) {
+ return call(new GetRequest(path("task")).setParam("id", id), WsCe.TaskResponse.parser());
+ }
}
import org.sonarqube.ws.client.WsConnector;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.data.MapEntry.entry;
import static org.mockito.Mockito.mock;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT;
assertThat(serviceTester.getGetParser()).isSameAs(WsCe.TaskTypesWsResponse.parser());
}
+
+ @Test
+ public void task() {
+ underTest.task("task_id");
+
+ assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task");
+ assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"));
+ }
}