aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-04-06 18:36:39 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-04-07 13:54:46 +0200
commit616389be7c3eecd9a979aafec6d42c4445a1558a (patch)
tree837260d69fa50bda415c5f06bee1c46095747ab6 /sonar-ws
parent3049d9176376e1907980a692c318c9d0299b8bd8 (diff)
downloadsonarqube-616389be7c3eecd9a979aafec6d42c4445a1558a.tar.gz
sonarqube-616389be7c3eecd9a979aafec6d42c4445a1558a.zip
SONAR-7528 WS api/measures/component_tree handles developer measures
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java22
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java4
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresWsParameters.java2
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java10
4 files changed, 37 insertions, 1 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java
index 9194be603f6..86727a6c5c3 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java
@@ -38,6 +38,8 @@ public class ComponentTreeWsRequest {
private List<String> metricKeys;
private Integer page;
private Integer pageSize;
+ private String developerId;
+ private String developerKey;
@CheckForNull
public String getBaseComponentId() {
@@ -168,4 +170,24 @@ public class ComponentTreeWsRequest {
this.metricPeriodSort = metricPeriodSort;
return this;
}
+
+ @CheckForNull
+ public String getDeveloperId() {
+ return developerId;
+ }
+
+ public ComponentTreeWsRequest setDeveloperId(@Nullable String developerId) {
+ this.developerId = developerId;
+ return this;
+ }
+
+ @CheckForNull
+ public String getDeveloperKey() {
+ return developerKey;
+ }
+
+ public ComponentTreeWsRequest setDeveloperKey(@Nullable String developerKey) {
+ this.developerKey = developerKey;
+ return this;
+ }
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java
index 7fb0019e03f..829b170b9a9 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresService.java
@@ -33,6 +33,8 @@ import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BASE_CO
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BASE_COMPONENT_KEY;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT_ID;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_COMPONENT_KEY;
+import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_ID;
+import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_QUALIFIERS;
@@ -51,6 +53,8 @@ public class MeasuresService extends BaseService {
.setParam(PARAM_QUALIFIERS, inlineMultipleParamValue(request.getQualifiers()))
.setParam(PARAM_METRIC_KEYS, inlineMultipleParamValue(request.getMetricKeys()))
.setParam(PARAM_ADDITIONAL_FIELDS, inlineMultipleParamValue(request.getAdditionalFields()))
+ .setParam(PARAM_DEVELOPER_ID, request.getDeveloperId())
+ .setParam(PARAM_DEVELOPER_KEY, request.getDeveloperKey())
.setParam("q", request.getQuery())
.setParam("p", request.getPage())
.setParam("ps", request.getPageSize())
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresWsParameters.java
index 4aca69b797e..b06b762c8e8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresWsParameters.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/MeasuresWsParameters.java
@@ -42,6 +42,8 @@ public class MeasuresWsParameters {
public static final String PARAM_ADDITIONAL_FIELDS = "additionalFields";
public static final String PARAM_COMPONENT_ID = "componentId";
public static final String PARAM_COMPONENT_KEY = "componentKey";
+ public static final String PARAM_DEVELOPER_ID = "developerId";
+ public static final String PARAM_DEVELOPER_KEY = "developerKey";
public static final String ADDITIONAL_METRICS = "metrics";
public static final String ADDITIONAL_PERIODS = "periods";
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java
index 9e3bd05e6b9..869dd6fcd21 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/MeasuresServiceTest.java
@@ -34,6 +34,8 @@ import static org.mockito.Mockito.mock;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_ADDITIONAL_FIELDS;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BASE_COMPONENT_ID;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_BASE_COMPONENT_KEY;
+import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_ID;
+import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_DEVELOPER_KEY;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_KEYS;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_METRIC_SORT;
import static org.sonarqube.ws.client.measure.MeasuresWsParameters.PARAM_QUALIFIERS;
@@ -52,6 +54,8 @@ public class MeasuresServiceTest {
private static final int VALUE_PAGE = 42;
private static final int VALUE_PAGE_SIZE = 1984;
private static final String VALUE_QUERY = "query-sq";
+ private static final String VALUE_DEVELOPER_ID = "developer-id";
+ private static final String VALUE_DEVELOPER_KEY = "developer-key";
@Rule
public ServiceTester<MeasuresService> serviceTester = new ServiceTester<>(new MeasuresService(mock(WsConnector.class)));
@@ -72,7 +76,9 @@ public class MeasuresServiceTest {
.setMetricSort(VALUE_METRIC_SORT)
.setPage(VALUE_PAGE)
.setPageSize(VALUE_PAGE_SIZE)
- .setQuery(VALUE_QUERY);
+ .setQuery(VALUE_QUERY)
+ .setDeveloperId(VALUE_DEVELOPER_ID)
+ .setDeveloperKey(VALUE_DEVELOPER_KEY);
underTest.componentTree(componentTreeRequest);
GetRequest getRequest = serviceTester.getGetRequest();
@@ -91,6 +97,8 @@ public class MeasuresServiceTest {
.hasParam("p", VALUE_PAGE)
.hasParam("ps", VALUE_PAGE_SIZE)
.hasParam("q", VALUE_QUERY)
+ .hasParam(PARAM_DEVELOPER_ID, VALUE_DEVELOPER_ID)
+ .hasParam(PARAM_DEVELOPER_KEY, VALUE_DEVELOPER_KEY)
.andNoOtherParam();
}
}