]> source.dussan.org Git - sonarqube.git/commitdiff
Add TreeWsRequest#component to replace baseComponentKey
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 17 Aug 2017 13:13:29 +0000 (15:13 +0200)
committerJanos Gyerik <janos.gyerik@sonarsource.com>
Tue, 12 Sep 2017 09:01:38 +0000 (11:01 +0200)
sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeWsRequest.java
sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java

index e9a49cfe0b88f27a984408020a1edc2942c15a7c..95279bba0c676f1da94e08478ea5ff76edb64cd7 100644 (file)
@@ -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())
index 7b03a70262e729a699cc54a7b934baad9816003e..d941300974ccaabd81c719f78fa1e1db2f0bdee0 100644 (file)
@@ -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<String> 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;
index 8b73590c1ee5a52892152a91360995f4bd314df5..61805bbdd1abbeeca2303bc70ca5dec24486e659 100644 (file)
@@ -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")