summaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-08-16 12:27:40 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-08-16 15:08:17 +0200
commit4085269c08104482e8c88b268642ecc39ff90770 (patch)
tree653fdebc22dfe3f1e808d82c7da63c615814e906 /sonar-ws
parent7ea165042aa3af5f656249bd0cf5acadeef29dba (diff)
downloadsonarqube-4085269c08104482e8c88b268642ecc39ff90770.tar.gz
sonarqube-4085269c08104482e8c88b268642ecc39ff90770.zip
SONAR-9708 Return 'incremental' field on tasks in queue
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java8
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/ce/CeServiceTest.java13
2 files changed, 21 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 ad610ee4a04..c223da8dd3a 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
@@ -21,6 +21,7 @@ package org.sonarqube.ws.client.ce;
import org.sonarqube.ws.WsCe;
import org.sonarqube.ws.WsCe.ActivityResponse;
+import org.sonarqube.ws.WsCe.ProjectResponse;
import org.sonarqube.ws.WsCe.TaskTypesWsResponse;
import org.sonarqube.ws.WsCe.WorkerCountResponse;
import org.sonarqube.ws.client.BaseService;
@@ -95,4 +96,11 @@ public class CeService extends BaseService {
return call(new GetRequest(path(ACTION_WORKER_COUNT)), WorkerCountResponse.parser());
}
+ public ProjectResponse component(String componentKey) {
+ return call(
+ new GetRequest(path("component"))
+ .setParam(PARAM_COMPONENT_KEY, componentKey),
+ ProjectResponse.parser());
+ }
+
}
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 16d443a7276..5e65034cd41 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
@@ -32,6 +32,7 @@ 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_COMPONENT_KEY;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_ONLY_CURRENTS;
@@ -141,4 +142,16 @@ public class CeServiceTest {
assertThat(serviceTester.getGetRequest().getPath()).isEqualTo("api/ce/worker_count");
assertThat(serviceTester.getGetParser()).isSameAs(WsCe.WorkerCountResponse.parser());
}
+
+ @Test
+ public void component() {
+ underTest.component("my_component");
+ GetRequest result = serviceTester.getGetRequest();
+
+ assertThat(serviceTester.getGetParser()).isSameAs(WsCe.ProjectResponse.parser());
+ serviceTester.assertThat(result)
+ .hasPath("component")
+ .hasParam(PARAM_COMPONENT_KEY, "my_component")
+ .andNoOtherParam();
+ }
}