diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-07-05 17:42:43 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-07-17 10:52:47 +0200 |
commit | 0839c4ba9cf741764c885ce6ba544bc6b1a82410 (patch) | |
tree | 8457fc50f7b0dce1b1ac80389fd51b3700cb6739 /sonar-ws | |
parent | 20873ba1d51089dce84bf6f3e115564adde4e721 (diff) | |
download | sonarqube-0839c4ba9cf741764c885ce6ba544bc6b1a82410.tar.gz sonarqube-0839c4ba9cf741764c885ce6ba544bc6b1a82410.zip |
SONAR-9508 Create api/ce/worker_count WS
Diffstat (limited to 'sonar-ws')
4 files changed, 23 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java index bebc2f1f028..ad610ee4a04 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java @@ -22,10 +22,12 @@ 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.WsCe.WorkerCountResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsConnector; +import static org.sonarqube.ws.client.ce.CeWsParameters.ACTION_WORKER_COUNT; import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID; import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_KEY; import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT; @@ -89,4 +91,8 @@ public class CeService extends BaseService { WsCe.ActivityStatusWsResponse.parser()); } + public WorkerCountResponse workerCount() { + return call(new GetRequest(path(ACTION_WORKER_COUNT)), WorkerCountResponse.parser()); + } + } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java index a56247b77bd..77cbbd673e0 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java @@ -20,6 +20,9 @@ package org.sonarqube.ws.client.ce; public class CeWsParameters { + + public static final String ACTION_WORKER_COUNT = "worker_count"; + public static final String PARAM_COMPONENT_ID = "componentId"; public static final String PARAM_COMPONENT_KEY = "componentKey"; public static final String PARAM_COMPONENT_QUERY = "componentQuery"; diff --git a/sonar-ws/src/main/protobuf/ws-ce.proto b/sonar-ws/src/main/protobuf/ws-ce.proto index 6c80616fd69..cc38df268c7 100644 --- a/sonar-ws/src/main/protobuf/ws-ce.proto +++ b/sonar-ws/src/main/protobuf/ws-ce.proto @@ -61,6 +61,12 @@ message TaskTypesWsResponse { repeated string taskTypes = 1; } +// GET api/ce/worker_count +message WorkerCountResponse { + optional int32 value = 1; + optional bool canSetWorkerCount = 2; +} + message Task { optional string organization = 20; optional string id = 1; diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java index e8e33e1eb90..16d443a7276 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java @@ -133,4 +133,12 @@ public class CeServiceTest { assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/task"); assertThat(serviceTester.getGetRequest().getParams()).containsOnly(entry("id", "task_id"), entry("additionalFields", "stacktrace")); } + + @Test + public void worker_count() { + underTest.workerCount(); + + assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/worker_count"); + assertThat(serviceTester.getGetParser()).isSameAs(WsCe.WorkerCountResponse.parser()); + } } |