From 139467cf51932ba232190f363ad864e60eb3fd4d Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 17 Aug 2017 15:13:29 +0200 Subject: [PATCH] Add TreeWsRequest#component to replace baseComponentKey --- .../client/component/ComponentsService.java | 3 ++- .../ws/client/component/TreeWsRequest.java | 27 +++++++++++++++++++ .../component/ComponentsServiceTest.java | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) 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 e9a49cfe0b8..95279bba0c6 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 @@ -65,7 +65,8 @@ public class ComponentsService extends BaseService { public TreeWsResponse tree(TreeWsRequest request) { GetRequest get = new GetRequest(path(ACTION_TREE)) .setParam(PARAM_COMPONENT_ID, request.getBaseComponentId()) - .setParam(PARAM_COMPONENT, request.getBaseComponentKey()) + .setParam("baseComponentKey", request.getBaseComponentKey()) + .setParam(PARAM_COMPONENT, request.getComponent()) .setParam(PARAM_BRANCH, request.getBranch()) .setParam(PARAM_QUALIFIERS, inlineMultipleParamValue(request.getQualifiers())) .setParam(PARAM_STRATEGY, request.getStrategy()) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeWsRequest.java index 7b03a70262e..d941300974c 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeWsRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeWsRequest.java @@ -26,6 +26,7 @@ import javax.annotation.Nullable; public class TreeWsRequest { private String baseComponentId; private String baseComponentKey; + private String component; private String branch; private String strategy; private List qualifiers; @@ -35,26 +36,52 @@ public class TreeWsRequest { private Integer page; private Integer pageSize; + /** + * @deprecated since 6.4, please use {@link #getComponent()} instead + */ + @Deprecated @CheckForNull public String getBaseComponentId() { return baseComponentId; } + /** + * @deprecated since 6.4, please use {@link #setComponent(String)} instead + */ + @Deprecated public TreeWsRequest setBaseComponentId(@Nullable String baseComponentId) { this.baseComponentId = baseComponentId; return this; } + /** + * @deprecated since 6.4, please use {@link #getComponent()} instead + */ + @Deprecated @CheckForNull public String getBaseComponentKey() { return baseComponentKey; } + /** + * @deprecated since 6.4, please use {@link #setComponent(String)} instead + */ + @Deprecated public TreeWsRequest setBaseComponentKey(@Nullable String baseComponentKey) { this.baseComponentKey = baseComponentKey; return this; } + public TreeWsRequest setComponent(@Nullable String component) { + this.component = component; + return this; + } + + @CheckForNull + public String getComponent() { + return component; + } + @CheckForNull public String getBranch() { return branch; 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 8b73590c1ee..61805bbdd1a 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 @@ -163,6 +163,7 @@ public class ComponentsServiceTest { underTest.tree(new TreeWsRequest() .setBaseComponentId(componentId) .setBaseComponentKey(componentKey) + .setComponent(componentKey) .setBranch("my_branch") .setQualifiers(asList("q1", "q2")) .setStrategy(strategy) @@ -175,6 +176,7 @@ public class ComponentsServiceTest { serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("tree") .hasParam("componentId", componentId) + .hasParam("baseComponentKey", componentKey) .hasParam("component", componentKey) .hasParam("branch", "my_branch") .hasParam("qualifiers", "q1,q2") -- 2.39.5