diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-11-02 12:00:05 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-11-03 15:35:15 +0100 |
commit | 0b3cf3fe412da603e81a9d01ff3ad55a2b4922e3 (patch) | |
tree | e9042b1179a1485f864760f6983dd39032ab3dd7 /sonar-ws/src | |
parent | 5e53506d7357b7b7eb0d22d6b50bf4eb6a652325 (diff) | |
download | sonarqube-0b3cf3fe412da603e81a9d01ff3ad55a2b4922e3.tar.gz sonarqube-0b3cf3fe412da603e81a9d01ff3ad55a2b4922e3.zip |
SONAR-8120 api/measures/search now accepts only project keys
Diffstat (limited to 'sonar-ws/src')
3 files changed, 17 insertions, 17 deletions
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 49ce3efb27e..f83b5427f65 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 @@ -43,7 +43,7 @@ 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_COMPONENT_KEYS = "componentKeys"; + public static final String PARAM_PROJECT_KEYS = "projectKeys"; public static final String PARAM_DEVELOPER_ID = "developerId"; public static final String PARAM_DEVELOPER_KEY = "developerKey"; public static final String ADDITIONAL_METRICS = "metrics"; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/SearchRequest.java index a9e76772970..41821338e31 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/SearchRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/SearchRequest.java @@ -25,22 +25,22 @@ import java.util.List; import static com.google.common.base.Preconditions.checkArgument; public class SearchRequest { - public static final int MAX_NB_COMPONENTS = 100; + public static final int MAX_NB_PROJECTS = 100; private final List<String> metricKeys; - private final List<String> componentKeys; + private final List<String> projectKeys; public SearchRequest(Builder builder) { metricKeys = builder.metricKeys; - componentKeys = builder.componentKeys; + projectKeys = builder.projectKeys; } public List<String> getMetricKeys() { return metricKeys; } - public List<String> getComponentKeys() { - return componentKeys; + public List<String> getProjectKeys() { + return projectKeys; } public static Builder builder() { @@ -49,7 +49,7 @@ public class SearchRequest { public static class Builder { private List<String> metricKeys; - private List<String> componentKeys; + private List<String> projectKeys; private Builder() { // enforce method constructor @@ -60,17 +60,17 @@ public class SearchRequest { return this; } - public Builder setComponentKeys(List<String> componentKeys) { - this.componentKeys = componentKeys; + public Builder setProjectKeys(List<String> projectKeys) { + this.projectKeys = projectKeys; return this; } public SearchRequest build() { checkArgument(metricKeys != null && !metricKeys.isEmpty(), "Metric keys must be provided"); - checkArgument(componentKeys != null && !componentKeys.isEmpty(), "Component keys must be provided"); - int nbComponents = componentKeys.size(); - checkArgument(nbComponents < MAX_NB_COMPONENTS, - "%s components provided, more than maximum authorized (%s)", nbComponents, MAX_NB_COMPONENTS); + checkArgument(projectKeys != null && !projectKeys.isEmpty(), "Project keys must be provided"); + int nbComponents = projectKeys.size(); + checkArgument(nbComponents < MAX_NB_PROJECTS, + "%s projects provided, more than maximum authorized (%s)", nbComponents, MAX_NB_PROJECTS); return new SearchRequest(this); } } diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/SearchRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/SearchRequestTest.java index 6e174d78ed5..878f314a587 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/SearchRequestTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/measure/SearchRequestTest.java @@ -39,11 +39,11 @@ public class SearchRequestTest { public void with_component_keys() { SearchRequest result = underTest .setMetricKeys(singletonList("metric")) - .setComponentKeys(singletonList("key")) + .setProjectKeys(singletonList("key")) .build(); assertThat(result.getMetricKeys()).containsExactly("metric"); - assertThat(result.getComponentKeys()).containsExactly("key"); + assertThat(result.getProjectKeys()).containsExactly("key"); } @Test @@ -73,7 +73,7 @@ public class SearchRequestTest { underTest .setMetricKeys(singletonList("metric")) - .setComponentKeys(emptyList()) + .setProjectKeys(emptyList()) .build(); } @@ -84,6 +84,6 @@ public class SearchRequestTest { private void expectExceptionOnComponents() { expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Component keys must be provided"); + expectedException.expectMessage("Project keys must be provided"); } } |