diff options
author | Daniel Schwarz <daniel.schwarz@sonarsource.com> | 2017-05-18 16:04:38 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-06-09 08:26:48 +0200 |
commit | 67045c090faf055cea3946b888929f84df52b03d (patch) | |
tree | 451716e5feffa7308465e116829f9c059db3adc0 /sonar-ws | |
parent | 6dae946633458b9e69e841b57c16570eb1311943 (diff) | |
download | sonarqube-67045c090faf055cea3946b888929f84df52b03d.tar.gz sonarqube-67045c090faf055cea3946b888929f84df52b03d.zip |
SONAR-9245 facet new_reliability_rating in search_projects WS
Diffstat (limited to 'sonar-ws')
-rw-r--r-- | sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java | 3 | ||||
-rw-r--r-- | sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java index 202e7eb33ea..005e47d92ed 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java @@ -80,10 +80,11 @@ public class ComponentsService extends BaseService { public SearchProjectsWsResponse searchProjects(SearchProjectsRequest request) { List<String> additionalFields = request.getAdditionalFields(); + List<String> facets = request.getFacets(); GetRequest get = new GetRequest(path(ACTION_SEARCH_PROJECTS)) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_FILTER, request.getFilter()) - .setParam(Param.FACETS, request.getFacets()) + .setParam(Param.FACETS, !facets.isEmpty() ? inlineMultipleParamValue(facets) : null) .setParam(Param.SORT, request.getSort()) .setParam(Param.ASCENDING, request.getAsc()) .setParam(Param.PAGE, request.getPage()) diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java index 1096ae43486..36d6b5d565e 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java @@ -24,6 +24,7 @@ import org.junit.Test; import org.sonarqube.ws.client.ServiceTester; import org.sonarqube.ws.client.WsConnector; +import static java.util.Arrays.asList; import static java.util.Collections.singletonList; import static org.mockito.Mockito.mock; import static org.sonar.api.server.ws.WebService.Param.ASCENDING; @@ -45,7 +46,7 @@ public class ComponentsServiceTest { public void search_projects() { underTest.searchProjects(SearchProjectsRequest.builder() .setFilter("ncloc > 10") - .setFacets(singletonList("ncloc")) + .setFacets(asList("ncloc", "duplicated_lines_density")) .setSort("coverage") .setAsc(true) .setPage(3) @@ -56,7 +57,7 @@ public class ComponentsServiceTest { serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("search_projects") .hasParam(PARAM_FILTER, "ncloc > 10") - .hasParam(FACETS, singletonList("ncloc")) + .hasParam(FACETS, "ncloc,duplicated_lines_density") .hasParam(SORT, "coverage") .hasParam(ASCENDING, true) .hasParam(PAGE, 3) |