]> source.dussan.org Git - sonarqube.git/commitdiff
Remove legacy sonar-ws code for components
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>
Thu, 30 Nov 2017 17:39:25 +0000 (18:39 +0100)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 6 Dec 2017 13:40:17 +0000 (14:40 +0100)
27 files changed:
sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java
sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchProjectsRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/component/ShowRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/component/SuggestionsRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/component/package-info.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java
sonar-ws/src/main/protobuf/ws-issues.proto
sonar-ws/src/test/java/org/sonarqube/ws/client/component/ComponentsServiceTest.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/component/SearchProjectsRequestTest.java [deleted file]
tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java
tests/src/test/java/org/sonarqube/tests/analysis/FileExclusionsTest.java
tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java
tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java
tests/src/test/java/org/sonarqube/tests/component/ComponentsWsTest.java
tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java
tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java
tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionPageTest.java
tests/src/test/java/org/sonarqube/tests/project/ProjectDeletionTest.java
tests/src/test/java/org/sonarqube/tests/project/ProjectFilterTest.java
tests/src/test/java/org/sonarqube/tests/project/ProjectKeyUpdateTest.java
tests/src/test/java/org/sonarqube/tests/project/ProjectProvisioningTest.java
tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java
tests/src/test/java/util/ItUtils.java

index 81b23171f15ca6a69384d62b97f9874149286cc8..272371378ccbc4e3100f2cf06894bfb6cb8460e6 100644 (file)
@@ -56,7 +56,6 @@ class DefaultWsClient implements WsClient {
   private final OrganizationsService organizations;
   private final org.sonarqube.ws.client.permission.PermissionsService permissionsOld;
   private final PermissionsService permissions;
-  private final org.sonarqube.ws.client.component.ComponentsService componentsOld;
   private final ComponentsService components;
   private final FavoritesService favoritesService;
   private final QualityProfilesService qualityProfilesOld;
@@ -87,7 +86,6 @@ class DefaultWsClient implements WsClient {
     this.organizations = new OrganizationsService(wsConnector);
     this.permissionsOld = new org.sonarqube.ws.client.permission.PermissionsService(wsConnector);
     this.permissions = new PermissionsService(wsConnector);
-    this.componentsOld = new org.sonarqube.ws.client.component.ComponentsService(wsConnector);
     this.components = new ComponentsService(wsConnector);
     this.favoritesService = new FavoritesService(wsConnector);
     this.qualityProfilesOld = new QualityProfilesService(wsConnector);
@@ -134,11 +132,6 @@ class DefaultWsClient implements WsClient {
     return permissions;
   }
 
-  @Override
-  public org.sonarqube.ws.client.component.ComponentsService componentsOld() {
-    return componentsOld;
-  }
-
   @Override
   public ComponentsService components() {
     return components;
index 33eb13f191c84e4521ac464ace842f39706d4320..ad4ad79e3a1fe3e4df239ed03b4696f93b46a76c 100644 (file)
@@ -66,12 +66,6 @@ public interface WsClient {
 
   OrganizationsService organizations();
 
-  /**
-   * @deprecated since 7.0 use {@link #components()} instead
-   */
-  @Deprecated
-  org.sonarqube.ws.client.component.ComponentsService componentsOld();
-
   ComponentsService components();
 
   FavoritesService favorites();
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
deleted file mode 100644 (file)
index acb55db..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonarqube.ws.client.component;
-
-import com.google.common.base.Joiner;
-import java.util.List;
-import java.util.stream.Collectors;
-import org.sonarqube.ws.Components.SearchProjectsWsResponse;
-import org.sonarqube.ws.Components.SearchWsResponse;
-import org.sonarqube.ws.Components.ShowWsResponse;
-import org.sonarqube.ws.Components.TreeWsResponse;
-import org.sonarqube.ws.client.BaseService;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.WsConnector;
-import org.sonarqube.ws.client.WsResponse;
-
-import static org.sonar.api.server.ws.WebService.Param;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SEARCH;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SEARCH_PROJECTS;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SHOW;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SUGGESTIONS;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_TREE;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.CONTROLLER_COMPONENTS;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_FILTER;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_ORGANIZATION;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_QUALIFIERS;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_STRATEGY;
-
-/**
- * @deprecated since 7.0, use {@link org.sonarqube.ws.client.components.ComponentsService} instead
- */
-@Deprecated
-public class ComponentsService extends BaseService {
-
-  public ComponentsService(WsConnector wsConnector) {
-    super(wsConnector, CONTROLLER_COMPONENTS);
-  }
-
-  public SearchWsResponse search(SearchRequest request) {
-    GetRequest get = new GetRequest(path(ACTION_SEARCH))
-      .setParam(PARAM_ORGANIZATION, request.getOrganization())
-      .setParam(PARAM_QUALIFIERS, Joiner.on(",").join(request.getQualifiers()))
-      .setParam(Param.PAGE, request.getPage())
-      .setParam(Param.PAGE_SIZE, request.getPageSize())
-      .setParam(Param.TEXT_QUERY, request.getQuery());
-    return call(get, SearchWsResponse.parser());
-  }
-
-  public TreeWsResponse tree(TreeRequest request) {
-    GetRequest get = new GetRequest(path(ACTION_TREE))
-      .setParam(PARAM_COMPONENT_ID, request.getBaseComponentId())
-      .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())
-      .setParam(Param.PAGE, request.getPage())
-      .setParam(Param.PAGE_SIZE, request.getPageSize())
-      .setParam(Param.TEXT_QUERY, request.getQuery())
-      .setParam(Param.SORT, inlineMultipleParamValue(request.getSort()));
-    return call(get, TreeWsResponse.parser());
-  }
-
-  public ShowWsResponse show(ShowRequest request) {
-    GetRequest get = new GetRequest(path(ACTION_SHOW))
-      .setParam(PARAM_COMPONENT_ID, request.getId())
-      .setParam(PARAM_COMPONENT, request.getKey())
-      .setParam(PARAM_BRANCH, request.getBranch());
-    return call(get, ShowWsResponse.parser());
-  }
-
-  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, !facets.isEmpty() ? inlineMultipleParamValue(facets) : null)
-      .setParam(Param.SORT, request.getSort())
-      .setParam(Param.ASCENDING, request.getAsc())
-      .setParam(Param.PAGE, request.getPage())
-      .setParam(Param.PAGE_SIZE, request.getPageSize())
-      .setParam(Param.FIELDS, !additionalFields.isEmpty() ? inlineMultipleParamValue(additionalFields) : null);
-    return call(get, SearchProjectsWsResponse.parser());
-  }
-
-  public WsResponse suggestions(SuggestionsRequest request) {
-    GetRequest get = new GetRequest(path(ACTION_SUGGESTIONS))
-      .setParam("more", request.getMore() == null ? null : request.getMore().toString())
-      .setParam("recentlyBrowsed", request.getRecentlyBrowsed().stream().collect(Collectors.joining(",")))
-      .setParam("s", request.getS());
-    return call(get);
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchProjectsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchProjectsRequest.java
deleted file mode 100644 (file)
index a2e249a..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonarqube.ws.client.component;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Objects.requireNonNull;
-
-public class SearchProjectsRequest {
-
-  public static final int MAX_PAGE_SIZE = 500;
-  public static final int DEFAULT_PAGE_SIZE = 100;
-
-  private final int page;
-  private final int pageSize;
-  private final String organization;
-  private final String filter;
-  private final List<String> facets;
-  private final String sort;
-  private final Boolean asc;
-  private final List<String> additionalFields;
-
-  private SearchProjectsRequest(Builder builder) {
-    this.page = builder.page;
-    this.pageSize = builder.pageSize;
-    this.organization = builder.organization;
-    this.filter = builder.filter;
-    this.facets = builder.facets;
-    this.sort = builder.sort;
-    this.asc = builder.asc;
-    this.additionalFields = builder.additionalFields;
-  }
-
-  @CheckForNull
-  public String getOrganization() {
-    return organization;
-  }
-
-  @CheckForNull
-  public String getFilter() {
-    return filter;
-  }
-
-  public List<String> getFacets() {
-    return facets;
-  }
-
-  @CheckForNull
-  public String getSort() {
-    return sort;
-  }
-
-  public int getPageSize() {
-    return pageSize;
-  }
-
-  public int getPage() {
-    return page;
-  }
-
-  @CheckForNull
-  public Boolean getAsc() {
-    return asc;
-  }
-
-  public List<String> getAdditionalFields() {
-    return additionalFields;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String organization;
-    private Integer page;
-    private Integer pageSize;
-    private String filter;
-    private List<String> facets = new ArrayList<>();
-    private String sort;
-    private Boolean asc;
-    private List<String> additionalFields = new ArrayList<>();
-
-    private Builder() {
-      // enforce static factory method
-    }
-
-    public Builder setOrganization(@Nullable String organization) {
-      this.organization = organization;
-      return this;
-    }
-
-    public Builder setFilter(@Nullable String filter) {
-      this.filter = filter;
-      return this;
-    }
-
-    public Builder setFacets(List<String> facets) {
-      this.facets = requireNonNull(facets);
-      return this;
-    }
-
-    public Builder setPage(int page) {
-      this.page = page;
-      return this;
-    }
-
-    public Builder setPageSize(int pageSize) {
-      this.pageSize = pageSize;
-      return this;
-    }
-
-    public Builder setSort(@Nullable String sort) {
-      this.sort = sort;
-      return this;
-    }
-
-    public Builder setAsc(boolean asc) {
-      this.asc = asc;
-      return this;
-    }
-
-    public Builder setAdditionalFields(List<String> additionalFields) {
-      this.additionalFields = requireNonNull(additionalFields, "additional fields cannot be null");
-      return this;
-    }
-
-    public SearchProjectsRequest build() {
-      if (page == null) {
-        page = 1;
-      }
-      if (pageSize == null) {
-        pageSize = DEFAULT_PAGE_SIZE;
-      }
-      checkArgument(pageSize <= MAX_PAGE_SIZE, "Page size must not be greater than %s", MAX_PAGE_SIZE);
-      return new SearchProjectsRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SearchRequest.java
deleted file mode 100644 (file)
index efe91f2..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonarqube.ws.client.component;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static java.util.Objects.requireNonNull;
-
-public class SearchRequest {
-  private String organization;
-  private List<String> qualifiers;
-  private Integer page;
-  private Integer pageSize;
-  private String query;
-  private String language;
-
-  @CheckForNull
-  public String getOrganization() {
-    return organization;
-  }
-
-  public SearchRequest setOrganization(@Nullable String organization) {
-    this.organization = organization;
-    return this;
-  }
-
-  public List<String> getQualifiers() {
-    return qualifiers;
-  }
-
-  public SearchRequest setQualifiers(List<String> qualifiers) {
-    this.qualifiers = requireNonNull(qualifiers);
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getPage() {
-    return page;
-  }
-
-  public SearchRequest setPage(int page) {
-    this.page = page;
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getPageSize() {
-    return pageSize;
-  }
-
-  public SearchRequest setPageSize(int pageSize) {
-    this.pageSize = pageSize;
-    return this;
-  }
-
-  @CheckForNull
-  public String getQuery() {
-    return query;
-  }
-
-  public SearchRequest setQuery(@Nullable String query) {
-    this.query = query;
-    return this;
-  }
-
-  @CheckForNull
-  public String getLanguage() {
-    return language;
-  }
-
-  public SearchRequest setLanguage(@Nullable String language) {
-    this.language = language;
-    return this;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ShowRequest.java
deleted file mode 100644 (file)
index 2377e7d..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonarqube.ws.client.component;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class ShowRequest {
-  private String id;
-  private String key;
-  private String branch;
-
-  @CheckForNull
-  public String getId() {
-    return id;
-  }
-
-  public ShowRequest setId(@Nullable String id) {
-    this.id = id;
-    return this;
-  }
-
-  @CheckForNull
-  public String getKey() {
-    return key;
-  }
-
-  public ShowRequest setKey(@Nullable String key) {
-    this.key = key;
-    return this;
-  }
-
-  @CheckForNull
-  public String getBranch() {
-    return branch;
-  }
-
-  public ShowRequest setBranch(@Nullable String branch) {
-    this.branch = branch;
-    return this;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SuggestionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/SuggestionsRequest.java
deleted file mode 100644 (file)
index 1f28b21..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonarqube.ws.client.component;
-
-import java.util.Collections;
-import java.util.List;
-
-public class SuggestionsRequest {
-
-  public static final int MAX_PAGE_SIZE = 500;
-  public static final int DEFAULT_PAGE_SIZE = 100;
-
-  public enum More {
-    VW,
-    SVW,
-    APP,
-    TRK,
-    BRC,
-    FIL,
-    UTS
-  }
-
-  private final More more;
-  private final List<String> recentlyBrowsed;
-  private final String s;
-
-  private SuggestionsRequest(Builder builder) {
-    this.more = builder.more;
-    this.recentlyBrowsed = builder.recentlyBrowsed;
-    this.s = builder.s;
-  }
-
-  public More getMore() {
-    return more;
-  }
-
-  public List<String> getRecentlyBrowsed() {
-    return recentlyBrowsed;
-  }
-
-  public String getS() {
-    return s;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-
-    private More more;
-    private List<String> recentlyBrowsed = Collections.emptyList();
-    private String s;
-
-    private Builder() {
-      // enforce static factory method
-    }
-
-    public Builder setMore(More more) {
-      this.more = more;
-      return this;
-    }
-
-    public Builder setRecentlyBrowsed(List<String> recentlyBrowsed) {
-      this.recentlyBrowsed = recentlyBrowsed;
-      return this;
-    }
-
-    public Builder setS(String s) {
-      this.s = s;
-      return this;
-    }
-
-    public SuggestionsRequest build() {
-      return new SuggestionsRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/TreeRequest.java
deleted file mode 100644 (file)
index 569e44a..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonarqube.ws.client.component;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class TreeRequest {
-  private String baseComponentId;
-  private String baseComponentKey;
-  private String component;
-  private String branch;
-  private String strategy;
-  private List<String> qualifiers;
-  private String query;
-  private List<String> sort;
-  private Boolean asc;
-  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 TreeRequest 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 TreeRequest setBaseComponentKey(@Nullable String baseComponentKey) {
-    this.baseComponentKey = baseComponentKey;
-    return this;
-  }
-
-  public TreeRequest setComponent(@Nullable String component) {
-    this.component = component;
-    return this;
-  }
-
-  @CheckForNull
-  public String getComponent() {
-    return component;
-  }
-
-  @CheckForNull
-  public String getBranch() {
-    return branch;
-  }
-
-  public TreeRequest setBranch(@Nullable String branch) {
-    this.branch = branch;
-    return this;
-  }
-
-  @CheckForNull
-  public String getStrategy() {
-    return strategy;
-  }
-
-  public TreeRequest setStrategy(@Nullable String strategy) {
-    this.strategy = strategy;
-    return this;
-  }
-
-  @CheckForNull
-  public List<String> getQualifiers() {
-    return qualifiers;
-  }
-
-  public TreeRequest setQualifiers(@Nullable List<String> qualifiers) {
-    this.qualifiers = qualifiers;
-    return this;
-  }
-
-  @CheckForNull
-  public String getQuery() {
-    return query;
-  }
-
-  public TreeRequest setQuery(@Nullable String query) {
-    this.query = query;
-    return this;
-  }
-
-  @CheckForNull
-  public List<String> getSort() {
-    return sort;
-  }
-
-  public TreeRequest setSort(@Nullable List<String> sort) {
-    this.sort = sort;
-    return this;
-  }
-
-  public Boolean getAsc() {
-    return asc;
-  }
-
-  public TreeRequest setAsc(@Nullable Boolean asc) {
-    this.asc = asc;
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getPage() {
-    return page;
-  }
-
-  public TreeRequest setPage(@Nullable Integer page) {
-    this.page = page;
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getPageSize() {
-    return pageSize;
-  }
-
-  public TreeRequest setPageSize(@Nullable Integer pageSize) {
-    this.pageSize = pageSize;
-    return this;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/package-info.java
deleted file mode 100644 (file)
index 913f8c7..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.component;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
index 2ca4e8be540bd20c312c81dc9b43e311b15be514..6ead62cc9cc2ef6e6affe970f9ea18d0313ad93e 100644 (file)
@@ -21,14 +21,23 @@ package org.sonarqube.ws.client.issues;
 
 import java.util.stream.Collectors;
 import javax.annotation.Generated;
+import org.sonarqube.ws.Issues.AddCommentResponse;
+import org.sonarqube.ws.Issues.AssignResponse;
+import org.sonarqube.ws.Issues.AuthorsResponse;
+import org.sonarqube.ws.Issues.BulkChangeWsResponse;
+import org.sonarqube.ws.Issues.ChangelogWsResponse;
+import org.sonarqube.ws.Issues.DeleteCommentResponse;
+import org.sonarqube.ws.Issues.DoTransitionResponse;
+import org.sonarqube.ws.Issues.SearchWsResponse;
+import org.sonarqube.ws.Issues.SetSeverityResponse;
+import org.sonarqube.ws.Issues.SetTagsResponse;
+import org.sonarqube.ws.Issues.SetTypeResponse;
+import org.sonarqube.ws.Issues.TagsResponse;
 import org.sonarqube.ws.MediaTypes;
 import org.sonarqube.ws.client.BaseService;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.PostRequest;
 import org.sonarqube.ws.client.WsConnector;
-import org.sonarqube.ws.Issues.BulkChangeWsResponse;
-import org.sonarqube.ws.Issues.ChangelogWsResponse;
-import org.sonarqube.ws.Issues.SearchWsResponse;
 
 /**
  * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues">Further information about this web service online</a>
@@ -47,13 +56,12 @@ public class IssuesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/add_comment">Further information about this action online (including a response example)</a>
    * @since 3.6
    */
-  public String addComment(AddCommentRequest request) {
+  public AddCommentResponse addComment(AddCommentRequest request) {
     return call(
       new PostRequest(path("add_comment"))
         .setParam("issue", request.getIssue())
-        .setParam("text", request.getText())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setParam("text", request.getText()),
+      AddCommentResponse.parser());
   }
 
   /**
@@ -63,14 +71,13 @@ public class IssuesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/assign">Further information about this action online (including a response example)</a>
    * @since 3.6
    */
-  public String assign(AssignRequest request) {
+  public AssignResponse assign(AssignRequest request) {
     return call(
       new PostRequest(path("assign"))
         .setParam("assignee", request.getAssignee())
         .setParam("issue", request.getIssue())
-        .setParam("me", request.getMe())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setParam("me", request.getMe()),
+      AssignResponse.parser());
   }
 
   /**
@@ -80,13 +87,12 @@ public class IssuesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/authors">Further information about this action online (including a response example)</a>
    * @since 5.1
    */
-  public String authors(AuthorsRequest request) {
+  public AuthorsResponse authors(AuthorsRequest request) {
     return call(
       new GetRequest(path("authors"))
         .setParam("ps", request.getPs())
-        .setParam("q", request.getQ())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setParam("q", request.getQ()),
+      AuthorsResponse.parser());
   }
 
   /**
@@ -150,12 +156,11 @@ public class IssuesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/delete_comment">Further information about this action online (including a response example)</a>
    * @since 3.6
    */
-  public String deleteComment(DeleteCommentRequest request) {
+  public DeleteCommentResponse deleteComment(DeleteCommentRequest request) {
     return call(
       new PostRequest(path("delete_comment"))
-        .setParam("comment", request.getComment())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setParam("comment", request.getComment()),
+      DeleteCommentResponse.parser());
   }
 
   /**
@@ -165,13 +170,12 @@ public class IssuesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/do_transition">Further information about this action online (including a response example)</a>
    * @since 3.6
    */
-  public String doTransition(DoTransitionRequest request) {
+  public DoTransitionResponse doTransition(DoTransitionRequest request) {
     return call(
       new PostRequest(path("do_transition"))
         .setParam("issue", request.getIssue())
-        .setParam("transition", request.getTransition())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setParam("transition", request.getTransition()),
+      DoTransitionResponse.parser());
   }
 
   /**
@@ -247,13 +251,12 @@ public class IssuesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/set_severity">Further information about this action online (including a response example)</a>
    * @since 3.6
    */
-  public String setSeverity(SetSeverityRequest request) {
+  public SetSeverityResponse setSeverity(SetSeverityRequest request) {
     return call(
       new PostRequest(path("set_severity"))
         .setParam("issue", request.getIssue())
-        .setParam("severity", request.getSeverity())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setParam("severity", request.getSeverity()),
+      SetSeverityResponse.parser());
   }
 
   /**
@@ -263,13 +266,12 @@ public class IssuesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/set_tags">Further information about this action online (including a response example)</a>
    * @since 5.1
    */
-  public String setTags(SetTagsRequest request) {
+  public SetTagsResponse setTags(SetTagsRequest request) {
     return call(
       new PostRequest(path("set_tags"))
         .setParam("issue", request.getIssue())
-        .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(",")))
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setParam("tags", request.getTags() == null ? null : request.getTags().stream().collect(Collectors.joining(","))),
+      SetTagsResponse.parser());
   }
 
   /**
@@ -279,13 +281,12 @@ public class IssuesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/set_type">Further information about this action online (including a response example)</a>
    * @since 5.5
    */
-  public String setType(SetTypeRequest request) {
+  public SetTypeResponse setType(SetTypeRequest request) {
     return call(
       new PostRequest(path("set_type"))
         .setParam("issue", request.getIssue())
-        .setParam("type", request.getType())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setParam("type", request.getType()),
+      SetTypeResponse.parser());
   }
 
   /**
@@ -295,13 +296,12 @@ public class IssuesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues/tags">Further information about this action online (including a response example)</a>
    * @since 5.1
    */
-  public String tags(TagsRequest request) {
+  public TagsResponse tags(TagsRequest request) {
     return call(
       new GetRequest(path("tags"))
         .setParam("organization", request.getOrganization())
         .setParam("ps", request.getPs())
-        .setParam("q", request.getQ())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setParam("q", request.getQ()),
+      TagsResponse.parser());
   }
 }
index a1309679f584d5c2d3530dc9505cc4f39c4dc3db..8d58b8b935bfbfa8eef34e64afd42923161d747e 100644 (file)
@@ -49,14 +49,65 @@ message SearchWsResponse {
   optional sonarqube.ws.commons.Facets facets = 12;
 }
 
-// Response of most of POST/issues/{operation}, for instance assign, add_comment and set_severity
 message Operation {
   optional Issue issue = 1;
   repeated Component components = 2;
   repeated sonarqube.ws.commons.Rule rules = 3;
   repeated Users.User users = 4;
-  // Deprecated since 5.5, action plan has been removed
-  repeated ActionPlan unusedActionPlans = 5;
+}
+message AddCommentResponse {
+  optional Issue issue = 1;
+  repeated Component components = 2;
+  repeated sonarqube.ws.commons.Rule rules = 3;
+  repeated Users.User users = 4;
+}
+message AssignResponse {
+  optional Issue issue = 1;
+  repeated Component components = 2;
+  repeated sonarqube.ws.commons.Rule rules = 3;
+  repeated Users.User users = 4;
+}
+message AuthorsResponse {
+  optional Issue issue = 1;
+  repeated Component components = 2;
+  repeated sonarqube.ws.commons.Rule rules = 3;
+  repeated Users.User users = 4;
+}
+message DeleteCommentResponse {
+  optional Issue issue = 1;
+  repeated Component components = 2;
+  repeated sonarqube.ws.commons.Rule rules = 3;
+  repeated Users.User users = 4;
+}
+message DoTransitionResponse {
+  optional Issue issue = 1;
+  repeated Component components = 2;
+  repeated sonarqube.ws.commons.Rule rules = 3;
+  repeated Users.User users = 4;
+}
+message SetSeverityResponse {
+  optional Issue issue = 1;
+  repeated Component components = 2;
+  repeated sonarqube.ws.commons.Rule rules = 3;
+  repeated Users.User users = 4;
+}
+message SetTagsResponse {
+  optional Issue issue = 1;
+  repeated Component components = 2;
+  repeated sonarqube.ws.commons.Rule rules = 3;
+  repeated Users.User users = 4;
+}
+message SetTypeResponse {
+  optional Issue issue = 1;
+  repeated Component components = 2;
+  repeated sonarqube.ws.commons.Rule rules = 3;
+  repeated Users.User users = 4;
+}
+message TagsResponse {
+  optional Issue issue = 1;
+  repeated Component components = 2;
+  repeated sonarqube.ws.commons.Rule rules = 3;
+  repeated Users.User users = 4;
 }
 
 message Issue {
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
deleted file mode 100644 (file)
index 86f01cb..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonarqube.ws.client.component;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.Components;
-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.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.sonar.api.server.ws.WebService.Param.ASCENDING;
-import static org.sonar.api.server.ws.WebService.Param.FACETS;
-import static org.sonar.api.server.ws.WebService.Param.FIELDS;
-import static org.sonar.api.server.ws.WebService.Param.PAGE;
-import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
-import static org.sonar.api.server.ws.WebService.Param.SORT;
-import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_FILTER;
-
-public class ComponentsServiceTest {
-
-  @Rule
-  public ServiceTester<ComponentsService> serviceTester = new ServiceTester<>(new ComponentsService(mock(WsConnector.class)));
-
-  private ComponentsService underTest = serviceTester.getInstanceUnderTest();
-
-  @Test
-  public void search_projects() {
-    underTest.searchProjects(SearchProjectsRequest.builder()
-      .setFilter("ncloc > 10")
-      .setFacets(asList("ncloc", "duplicated_lines_density"))
-      .setSort("coverage")
-      .setAsc(true)
-      .setPage(3)
-      .setPageSize(10)
-      .setAdditionalFields(singletonList("analysisDate"))
-      .build());
-
-    assertThat(serviceTester.getGetParser()).isSameAs(Components.SearchProjectsWsResponse.parser());
-    serviceTester.assertThat(serviceTester.getGetRequest())
-      .hasPath("search_projects")
-      .hasParam(PARAM_FILTER, "ncloc > 10")
-      .hasParam(FACETS, "ncloc,duplicated_lines_density")
-      .hasParam(SORT, "coverage")
-      .hasParam(ASCENDING, true)
-      .hasParam(PAGE, 3)
-      .hasParam(PAGE_SIZE, 10)
-      .hasParam(FIELDS, "analysisDate")
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void search_projects_without_sort() {
-    underTest.searchProjects(SearchProjectsRequest.builder()
-      .setFilter("ncloc > 10")
-      .setFacets(singletonList("ncloc"))
-      .setPage(3)
-      .setPageSize(10)
-      .build());
-
-    assertThat(serviceTester.getGetParser()).isSameAs(Components.SearchProjectsWsResponse.parser());
-    serviceTester.assertThat(serviceTester.getGetRequest())
-      .hasPath("search_projects")
-      .hasParam(PARAM_FILTER, "ncloc > 10")
-      .hasParam(FACETS, singletonList("ncloc"))
-      .hasParam(PAGE, 3)
-      .hasParam(PAGE_SIZE, 10)
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void show() {
-    String key = randomAlphanumeric(20);
-    String id = randomAlphanumeric(20);
-    underTest.show(new ShowRequest()
-      .setKey(key)
-      .setId(id)
-      .setBranch("my_branch"));
-
-    assertThat(serviceTester.getGetParser()).isSameAs(Components.ShowWsResponse.parser());
-    serviceTester.assertThat(serviceTester.getGetRequest())
-      .hasPath("show")
-      .hasParam("component", key)
-      .hasParam("componentId", id)
-      .hasParam("branch", "my_branch")
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void suggestions() {
-    SuggestionsRequest.More more = SuggestionsRequest.More.BRC;
-    String s = randomAlphanumeric(20);
-    underTest.suggestions(SuggestionsRequest.builder()
-      .setMore(more)
-      .setS(s)
-      .setRecentlyBrowsed(asList("key-1", "key-2"))
-      .build());
-
-    // in this case no protobuf parser is used
-    assertThat(serviceTester.getGetParser()).isNull();
-
-    serviceTester.assertThat(serviceTester.getGetRequest())
-      .hasPath("suggestions")
-      .hasParam("more", more.toString())
-      .hasParam("s", s)
-      .hasParam("recentlyBrowsed", "key-1,key-2")
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void search() {
-    String organization = randomAlphanumeric(20);
-    int page = 17;
-    int pageSize = 39;
-    String textQuery = randomAlphanumeric(20);
-    underTest.search(new SearchRequest()
-      .setOrganization(organization)
-      .setQualifiers(asList("q1", "q2"))
-      .setPage(page)
-      .setPageSize(pageSize)
-      .setQuery(textQuery));
-
-    assertThat(serviceTester.getGetParser()).isSameAs(Components.SearchWsResponse.parser());
-    serviceTester.assertThat(serviceTester.getGetRequest())
-      .hasPath("search")
-      .hasParam("organization", organization)
-      .hasParam("qualifiers", "q1,q2")
-      .hasParam("p", page)
-      .hasParam("ps", pageSize)
-      .hasParam("q", textQuery)
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void tree() {
-    String componentId = randomAlphanumeric(20);
-    String componentKey = randomAlphanumeric(20);
-    String strategy = randomAlphanumeric(20);
-    int page = 17;
-    int pageSize = 39;
-    String query = randomAlphanumeric(20);
-    underTest.tree(new TreeRequest()
-      .setBaseComponentId(componentId)
-      .setBaseComponentKey(componentKey)
-      .setComponent(componentKey)
-      .setBranch("my_branch")
-      .setQualifiers(asList("q1", "q2"))
-      .setStrategy(strategy)
-      .setPage(page)
-      .setPageSize(pageSize)
-      .setQuery(query)
-      .setSort(asList("sort1", "sort2")));
-
-    assertThat(serviceTester.getGetParser()).isSameAs(Components.TreeWsResponse.parser());
-    serviceTester.assertThat(serviceTester.getGetRequest())
-      .hasPath("tree")
-      .hasParam("componentId", componentId)
-      .hasParam("baseComponentKey", componentKey)
-      .hasParam("component", componentKey)
-      .hasParam("branch", "my_branch")
-      .hasParam("qualifiers", "q1,q2")
-      .hasParam("strategy", strategy)
-      .hasParam("p", page)
-      .hasParam("ps", pageSize)
-      .hasParam("q", query)
-      .hasParam("s", "sort1,sort2")
-      .andNoOtherParam();
-  }
-}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/component/SearchProjectsRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/component/SearchProjectsRequestTest.java
deleted file mode 100644 (file)
index 9b4fcad..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonarqube.ws.client.component;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static java.util.Collections.singletonList;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SearchProjectsRequestTest {
-
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  SearchProjectsRequest.Builder underTest = SearchProjectsRequest.builder();
-
-  @Test
-  public void filter_parameter() throws Exception {
-    SearchProjectsRequest result = underTest
-      .setFilter("ncloc > 10")
-      .build();
-
-    assertThat(result.getFilter()).isEqualTo("ncloc > 10");
-  }
-
-  @Test
-  public void set_facets() throws Exception {
-    SearchProjectsRequest result = underTest
-      .setFacets(singletonList("ncloc"))
-      .build();
-
-    assertThat(result.getFacets()).containsOnly("ncloc");
-  }
-
-  @Test
-  public void facets_are_empty_by_default() throws Exception {
-    SearchProjectsRequest result = underTest.build();
-
-    assertThat(result.getFacets()).isEmpty();
-  }
-
-  @Test
-  public void fail_if_facets_is_null() {
-    expectedException.expect(NullPointerException.class);
-
-    underTest.setFacets(null);
-  }
-
-  @Test
-  public void default_page_values() {
-    SearchProjectsRequest result = underTest.build();
-
-    assertThat(result.getPage()).isEqualTo(1);
-    assertThat(result.getPageSize()).isEqualTo(100);
-  }
-
-  @Test
-  public void handle_paging_limit_values() {
-    SearchProjectsRequest result = underTest.setPageSize(500).build();
-
-    assertThat(result.getPage()).isEqualTo(1);
-    assertThat(result.getPageSize()).isEqualTo(500);
-  }
-
-  @Test
-  public void fail_if_page_size_greater_than_500() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Page size must not be greater than 500");
-
-    underTest.setPageSize(501).build();
-  }
-}
index 46b49e6eb672369357a376c0ff14ebf0a905f74e..e207bc33ba688343806c017ebe5d572ee3df03bf 100644 (file)
@@ -27,9 +27,7 @@ import java.net.InetAddress;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 import javax.annotation.Nullable;
 import org.junit.After;
 import org.junit.ClassRule;
@@ -39,13 +37,15 @@ import org.sonarqube.qa.util.Tester;
 import org.sonarqube.tests.Byteman;
 import org.sonarqube.ws.Ce;
 import org.sonarqube.ws.Common;
+import org.sonarqube.ws.Components;
+import org.sonarqube.ws.Components.SuggestionsWsResponse.Suggestion;
 import org.sonarqube.ws.Issues;
 import org.sonarqube.ws.Organizations.Organization;
-import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile;
 import org.sonarqube.ws.Projects;
+import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile;
 import org.sonarqube.ws.Users.CreateWsResponse.User;
 import org.sonarqube.ws.client.ce.TaskRequest;
-import org.sonarqube.ws.client.component.SuggestionsRequest;
+import org.sonarqube.ws.client.components.SuggestionsRequest;
 import org.sonarqube.ws.client.issue.SearchRequest;
 import util.ItUtils;
 
@@ -98,9 +98,9 @@ public class AnalysisEsResilienceTest {
       .assignQProfileToProject(profile, project);
 
     executeAnalysis(projectKey, organization, orgAdministrator, "analysis/resilience/resilience-sample-v1", null);
-    assertThat(searchFile(fileKey, organization)).isNotEmpty();
-    assertThat(searchFile(file2Key, organization)).isEmpty();
-    assertThat(searchFile(file3Key, organization)).isEmpty();
+    assertThat(searchFile(fileKey)).isNotEmpty();
+    assertThat(searchFile(file2Key)).isEmpty();
+    assertThat(searchFile(file3Key)).isEmpty();
     Issues.SearchWsResponse issues = searchIssues(projectKey);
     assertThat(issues.getIssuesList())
       .extracting(Issues.Issue::getComponent)
@@ -108,9 +108,9 @@ public class AnalysisEsResilienceTest {
 
     byteman.activateScript("resilience/making_ce_indexation_failing.btm");
     executeAnalysis(projectKey, organization, orgAdministrator, "analysis/resilience/resilience-sample-v2", null);
-    assertThat(searchFile(fileKey, organization)).isNotEmpty();
-    assertThat(searchFile(file2Key, organization)).isEmpty();// inconsistency: in DB there is also file2Key
-    assertThat(searchFile(file3Key, organization)).isEmpty();// inconsistency: in DB there is also file3Key
+    assertThat(searchFile(fileKey)).isNotEmpty();
+    assertThat(searchFile(file2Key)).isEmpty();// inconsistency: in DB there is also file2Key
+    assertThat(searchFile(file3Key)).isEmpty();// inconsistency: in DB there is also file3Key
     issues = searchIssues(projectKey);
     assertThat(issues.getIssuesList())
       .extracting(Issues.Issue::getComponent)
@@ -118,9 +118,9 @@ public class AnalysisEsResilienceTest {
     byteman.deactivateAllRules();
 
     executeAnalysis(projectKey, organization, orgAdministrator, "analysis/resilience/resilience-sample-v3", null);
-    assertThat(searchFile(fileKey, organization)).isNotEmpty();
-    assertThat(searchFile(file2Key, organization)).isEmpty();
-    assertThat(searchFile(file3Key, organization)).isNotEmpty();
+    assertThat(searchFile(fileKey)).isNotEmpty();
+    assertThat(searchFile(file2Key)).isEmpty();
+    assertThat(searchFile(file3Key)).isNotEmpty();
     issues = searchIssues(projectKey);
     assertThat(issues.getIssuesList())
       .extracting(Issues.Issue::getComponent, Issues.Issue::getStatus)
@@ -144,7 +144,7 @@ public class AnalysisEsResilienceTest {
       .assignQProfileToProject(profile, project);
 
     executeAnalysis(projectKey, organization, orgAdministrator, "analysis/resilience/resilience-purge", "2000-01-01");
-    assertThat(searchFile(fileKey, organization)).isNotEmpty();
+    assertThat(searchFile(fileKey)).isNotEmpty();
     Issues.SearchWsResponse issues = searchIssues(projectKey);
     assertThat(issues.getIssuesList())
       .extracting(Issues.Issue::getComponent)
@@ -166,7 +166,7 @@ public class AnalysisEsResilienceTest {
       .contains("Caused by: java.lang.IllegalStateException: Unrecoverable indexation failures");
 
     // The issue must be present with status CLOSED in database
-    assertThat(searchFile(fileKey, organization)).isNotEmpty();
+    assertThat(searchFile(fileKey)).isNotEmpty();
     issues = searchIssues(projectKey);
     assertThat(issues.getIssuesList())
       .extracting(Issues.Issue::getComponent, Issues.Issue::getStatus)
@@ -189,7 +189,7 @@ public class AnalysisEsResilienceTest {
     // Second analysis must fix the issue,
     // The purge will delete the "old" issue
     executeAnalysis(projectKey, organization, orgAdministrator, "analysis/resilience/resilience-purge", null);
-    assertThat(searchFile(fileKey, organization)).isNotEmpty();
+    assertThat(searchFile(fileKey)).isNotEmpty();
     issues = searchIssues(projectKey);
     assertThat(issues.getIssuesList())
       .isEmpty();
@@ -232,18 +232,16 @@ public class AnalysisEsResilienceTest {
     return tester.wsClient().issuesOld().search(request);
   }
 
-  private List<String> searchFile(String key, Organization organization) {
-    SuggestionsRequest query = SuggestionsRequest.builder()
-      .setS(key)
-      .build();
-    Map<String, Object> response = ItUtils.jsonToMap(
-      tester.wsClient().componentsOld().suggestions(query).content()
-    );
-    List results = (List) response.get("results");
-    Map trkResult = (Map) results.stream().filter(result -> "FIL".equals(((Map) result).get("q"))).findAny().get();
-    List items = (List) trkResult.get("items");
-    Stream<String> x = items.stream().map(item -> (String) ((Map) item).get("key"));
-    return x.collect(Collectors.toList());
+  private List<String> searchFile(String key) {
+    SuggestionsRequest query = new SuggestionsRequest().setS(key);
+
+    Components.SuggestionsWsResponse response = tester.wsClient().components().suggestions(query);
+
+    return response
+      .getResultsList().stream().filter(result -> "FIL".equals(result.getQ())).findAny().get()
+      .getItemsList().stream()
+      .map(Suggestion::getKey)
+      .collect(Collectors.toList());
   }
 
   private String executeAnalysis(String projectKey, Organization organization, User orgAdministrator, String projectPath, @Nullable String date) {
index 75cffdb3e1193dde923ab23e6c759064ca03fe59..a1716492c525698d48bebc6be7004def9ed4203a 100644 (file)
@@ -28,7 +28,7 @@ import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Test;
 import org.sonarqube.ws.Components.Component;
-import org.sonarqube.ws.client.component.TreeRequest;
+import org.sonarqube.ws.client.components.TreeRequest;
 import util.ItUtils;
 
 import static java.util.Collections.singletonList;
@@ -134,6 +134,6 @@ public class FileExclusionsTest {
   }
 
   public static List<Component> getComponents(String qualifier) {
-    return newWsClient(orchestrator).componentsOld().tree(new TreeRequest().setBaseComponentKey(PROJECT).setQualifiers(singletonList(qualifier))).getComponentsList();
+    return newWsClient(orchestrator).components().tree(new TreeRequest().setComponent(PROJECT).setQualifiers(singletonList(qualifier))).getComponentsList();
   }
 }
index fa7261ced8b2e1c4e6d734e77b8e8d53e59cf412..15b2055574119524421077f23aee39aaa1724688 100644 (file)
@@ -33,7 +33,7 @@ import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 import org.sonarqube.qa.util.Tester;
 import org.sonarqube.tests.Category3Suite;
-import org.sonarqube.ws.client.component.SearchRequest;
+import org.sonarqube.ws.client.components.SearchRequest;
 import util.ItUtils;
 
 import static java.util.Collections.singletonList;
@@ -68,7 +68,7 @@ public class ScannerTest {
     scan("shared/xoo-multi-modules-sample");
     scan("shared/xoo-multi-modules-sample", "sonar.branch", "branch/0.x");
 
-    assertThat(tester.wsClient().componentsOld().search(new SearchRequest().setQualifiers(singletonList("TRK"))).getComponentsList()).hasSize(2);
+    assertThat(tester.wsClient().components().search(new SearchRequest().setQualifiers(singletonList("TRK"))).getComponentsList()).hasSize(2);
     assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:multi-modules-sample").getName()).isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample");
     assertThat(getComponent(orchestrator, "com.sonarsource.it.samples:multi-modules-sample:branch/0.x").getName())
       .isEqualTo("Sonar :: Integration Tests :: Multi-modules Sample branch/0.x");
index ad7898a3ab754ff2a5e92d07182d7988d6f1c56f..6379e36a30a6d9b7a3b374e73b02dbb169cc8519 100644 (file)
@@ -29,15 +29,15 @@ import org.junit.Test;
 import org.junit.rules.DisableOnDebug;
 import org.junit.rules.TestRule;
 import org.junit.rules.Timeout;
-import org.sonarqube.tests.Category6Suite;
 import org.sonarqube.qa.util.Tester;
+import org.sonarqube.tests.Category6Suite;
 import org.sonarqube.ws.Organizations.Organization;
 import org.sonarqube.ws.Permissions;
 import org.sonarqube.ws.Permissions.CreateTemplateWsResponse;
 import org.sonarqube.ws.Projects.CreateWsResponse.Project;
 import org.sonarqube.ws.Users.CreateWsResponse;
 import org.sonarqube.ws.client.WsClient;
-import org.sonarqube.ws.client.component.SearchProjectsRequest;
+import org.sonarqube.ws.client.components.SearchProjectsRequest;
 import org.sonarqube.ws.client.permission.AddUserToTemplateRequest;
 import org.sonarqube.ws.client.permission.ApplyTemplateRequest;
 import org.sonarqube.ws.client.permission.BulkApplyTemplateRequest;
@@ -191,9 +191,9 @@ public class PermissionTemplateTest {
   }
 
   private boolean userHasAccessToIndexedProject(CreateWsResponse.User user, Organization organization, Project project) {
-    SearchProjectsRequest request = SearchProjectsRequest.builder().setOrganization(organization.getKey()).build();
+    SearchProjectsRequest request = new SearchProjectsRequest().setOrganization(organization.getKey());
     WsClient userSession = tester.as(user.getLogin()).wsClient();
-    return userSession.componentsOld().searchProjects(request)
+    return userSession.components().searchProjects(request)
       .getComponentsList().stream()
       .anyMatch(c -> c.getKey().equals(project.getKey()));
   }
index dbd32671196e6a1fe31d53d03716d0d6bf9f777d..d978ad8c32f1eef1783b4ea17ed2db570a53504e 100644 (file)
@@ -27,10 +27,8 @@ import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.Components;
-import org.sonarqube.ws.client.component.SearchRequest;
-import org.sonarqube.ws.client.component.ShowRequest;
+import org.sonarqube.ws.client.components.ShowRequest;
 
-import static java.util.Collections.singletonList;
 import static org.assertj.core.api.Assertions.assertThat;
 import static util.ItUtils.projectDir;
 
@@ -53,19 +51,10 @@ public class ComponentsWsTest {
 
   @Test
   public void show() {
-    Components.ShowWsResponse response = tester.wsClient().componentsOld().show(new ShowRequest().setKey(FILE_KEY));
+    Components.ShowWsResponse response = tester.wsClient().components().show(new ShowRequest().setComponent(FILE_KEY));
 
     assertThat(response).isNotNull();
     assertThat(response.getComponent().getKey()).isEqualTo(FILE_KEY);
     assertThat(response.getAncestorsList()).isNotEmpty();
   }
-
-  @Test
-  public void search() {
-    Components.SearchWsResponse response = tester.wsClient().componentsOld().search(new SearchRequest()
-      .setQualifiers(singletonList("FIL")));
-
-    assertThat(response).isNotNull();
-    assertThat(response.getComponents(0).getKey()).isEqualTo(FILE_KEY);
-  }
 }
index 30ace8285e18e24bfad4ae0e32f8bfe718f9ea74..1404a396b78ac60fa5881af483ca7e60ab720756 100644 (file)
@@ -28,7 +28,7 @@ import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.Issues;
 import org.sonarqube.ws.Components;
 import org.sonarqube.ws.Measures;
-import org.sonarqube.ws.client.component.TreeRequest;
+import org.sonarqube.ws.client.components.TreeRequest;
 import org.sonarqube.ws.client.issue.IssuesService;
 import org.sonarqube.ws.client.issue.SearchRequest;
 import org.sonarqube.ws.client.measure.ComponentTreeRequest;
@@ -75,8 +75,8 @@ public class LiteTest {
   @Test
   public void call_components_ws() {
     // files in project
-    Components.TreeWsResponse tree = tester.wsClient().componentsOld().tree(new TreeRequest()
-      .setBaseComponentKey(PROJECT_KEY)
+    Components.TreeWsResponse tree = tester.wsClient().components().tree(new TreeRequest()
+      .setComponent(PROJECT_KEY)
       .setQualifiers(singletonList("FIL")));
     assertThat(tree.getComponentsCount()).isEqualTo(4);
     tree.getComponentsList().forEach(c -> {
index 5b72379ff634568614d49881ea58347e7be802c1..dd40c775f24312695718555dfd6822ad46a0f903 100644 (file)
@@ -36,7 +36,6 @@ import org.sonarqube.ws.Rules;
 import org.sonarqube.ws.UserGroups.Group;
 import org.sonarqube.ws.Users;
 import org.sonarqube.ws.Users.CreateWsResponse.User;
-import org.sonarqube.ws.client.component.ComponentsService;
 import org.sonarqube.ws.client.organizations.AddMemberRequest;
 import org.sonarqube.ws.client.organizations.CreateRequest;
 import org.sonarqube.ws.client.organizations.DeleteRequest;
@@ -203,8 +202,7 @@ public class OrganizationTest {
       "sonar.organization", organization.getKey(),
       "sonar.login", user.getLogin(),
       "sonar.password", user.getLogin());
-    ComponentsService componentsService = tester.as(user.getLogin()).wsClient().componentsOld();
-    assertThat(searchSampleProject(organization.getKey(), componentsService).getComponentsList()).hasSize(1);
+    assertThat(searchSampleProject(organization.getKey()).getComponentsList()).hasSize(1);
   }
 
   @Test
@@ -219,8 +217,7 @@ public class OrganizationTest {
       assertThat(e.getResult().getLogs()).contains("Insufficient privileges");
     }
 
-    ComponentsService componentsService = tester.wsClient().componentsOld();
-    assertThat(searchSampleProject(organization.getKey(), componentsService).getComponentsCount()).isEqualTo(0);
+    assertThat(searchSampleProject(organization.getKey()).getComponentsCount()).isEqualTo(0);
   }
 
   @Test
@@ -229,8 +226,7 @@ public class OrganizationTest {
 
     runProjectAnalysis(orchestrator, "shared/xoo-sample", "sonar.organization", organization.getKey(), "sonar.login", "admin", "sonar.password", "admin");
 
-    ComponentsService componentsService = tester.asAnonymous().wsClient().componentsOld();
-    assertThat(searchSampleProject(organization.getKey(), componentsService).getComponentsList()).hasSize(1);
+    assertThat(searchSampleProject(organization.getKey()).getComponentsList()).hasSize(1);
   }
 
   private void addPermissionsToUser(String orgKeyAndName, String login, String permission, String... otherPermissions) {
@@ -249,12 +245,11 @@ public class OrganizationTest {
       "sonar.organization", organization.getKey(),
       "sonar.login", "admin",
       "sonar.password", "admin");
-    ComponentsService componentsService = tester.wsClient().componentsOld();
-    assertThat(searchSampleProject(organization.getKey(), componentsService).getComponentsList()).hasSize(1);
+    assertThat(searchSampleProject(organization.getKey()).getComponentsList()).hasSize(1);
 
     tester.organizations().service().delete(new DeleteRequest().setOrganization(organization.getKey()));
 
-    expectNotFoundError(() -> searchSampleProject(organization.getKey(), componentsService));
+    expectNotFoundError(() -> searchSampleProject(organization.getKey()));
     assertThatOrganizationDoesNotExit(organization);
   }
 
@@ -297,12 +292,12 @@ public class OrganizationTest {
       .hasSize(1);
   }
 
-  private Components.SearchWsResponse searchSampleProject(String organizationKey, ComponentsService componentsService) {
-    return componentsService
-      .search(new org.sonarqube.ws.client.component.SearchRequest()
+  private Components.SearchWsResponse searchSampleProject(String organizationKey) {
+    return tester.wsClient().components()
+      .search(new org.sonarqube.ws.client.components.SearchRequest()
         .setOrganization(organizationKey)
         .setQualifiers(singletonList("TRK"))
-        .setQuery("sample"));
+        .setQ("sample"));
   }
 
   private void assertThatOrganizationDoesNotExit(Organization org) {
index 6b5a48383a4d431a4eeb0f4e9b6aef05f164a5b2..8fecbb8eb6f4d94385f849c53aa82331b38c5f43 100644 (file)
@@ -26,7 +26,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.Projects.CreateWsResponse.Project;
-import org.sonarqube.ws.client.component.SearchProjectsRequest;
+import org.sonarqube.ws.client.components.SearchProjectsRequest;
 
 import static com.codeborne.selenide.Condition.text;
 import static com.codeborne.selenide.Condition.visible;
@@ -68,7 +68,7 @@ public class ProjectBulkDeletionPageTest {
     $(".modal button").click();
     $("#projects-management-page").shouldNotHave(text(project1.getName())).shouldNotHave(text(project3.getName()));
 
-    assertThat(tester.wsClient().componentsOld().searchProjects(SearchProjectsRequest.builder().build())
+    assertThat(tester.wsClient().components().searchProjects(new SearchProjectsRequest())
       .getComponentsCount()).isEqualTo(1);
   }
 }
index 8216d8897da251fca5bad699b330e7bf212d80fd..9f679c9b20a265e600b2763c4549bb9b7fa3de21 100644 (file)
@@ -40,7 +40,7 @@ import org.sonarqube.ws.Users;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.WsClient;
 import org.sonarqube.ws.client.WsResponse;
-import org.sonarqube.ws.client.component.SearchProjectsRequest;
+import org.sonarqube.ws.client.components.SearchProjectsRequest;
 import org.sonarqube.ws.client.project.CreateRequest;
 import org.sonarqube.ws.client.project.DeleteRequest;
 import org.sonarqube.ws.client.project.SearchRequest;
@@ -202,8 +202,8 @@ public class ProjectDeletionTest {
    * Projects page - api/components/search_projects - uses ES + DB
    */
   private boolean isInComponentSearchProjects(String name) {
-    Components.SearchProjectsWsResponse response = tester.wsClient().componentsOld().searchProjects(
-      SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build());
+    Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects(
+      new SearchProjectsRequest().setFilter("query=\"" + name + "\""));
     return response.getComponentsCount() > 0;
   }
 
index 3972f771c7807ac9a2e9dbe74580afb3a3fb641b..02af1ddf6a07588e20f72ae74597e48362ccbc26 100644 (file)
@@ -34,7 +34,7 @@ import org.sonarqube.ws.Common;
 import org.sonarqube.ws.Organizations.Organization;
 import org.sonarqube.ws.Components.Component;
 import org.sonarqube.ws.Components.SearchProjectsWsResponse;
-import org.sonarqube.ws.client.component.SearchProjectsRequest;
+import org.sonarqube.ws.client.components.SearchProjectsRequest;
 import org.sonarqube.ws.client.project.CreateRequest;
 
 import static java.util.Arrays.asList;
@@ -90,7 +90,7 @@ public class ProjectFilterTest {
     String projectKey = newProjectKey();
     tester.wsClient().projects().create(CreateRequest.builder().setKey(projectKey).setName(projectKey).setOrganization(organization.getKey()).build());
 
-    SearchProjectsWsResponse response = searchProjects(SearchProjectsRequest.builder().setOrganization(organization.getKey()).build());
+    SearchProjectsWsResponse response = searchProjects(new SearchProjectsRequest().setOrganization(organization.getKey()));
 
     assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(projectKey);
   }
@@ -110,7 +110,7 @@ public class ProjectFilterTest {
     tester.wsClient().projects().create(CreateRequest.builder().setKey(projectKey3).setName(projectKey3).setOrganization(organization.getKey()).build());
 
     SearchProjectsWsResponse response = searchProjects(
-      SearchProjectsRequest.builder().setAdditionalFields(singletonList("leakPeriodDate")).setOrganization(organization.getKey()).build());
+      new SearchProjectsRequest().setF(singletonList("leakPeriodDate")).setOrganization(organization.getKey()));
 
     assertThat(response.getComponentsList()).extracting(Component::getKey, Component::hasLeakPeriodDate)
       .containsOnly(
@@ -137,18 +137,18 @@ public class ProjectFilterTest {
     assertThat(searchProjects("query = \"unknown\"").getComponentsList()).isEmpty();
 
     // Search by metric criteria and text query
-    assertThat(searchProjects(SearchProjectsRequest.builder().setFilter("query = \"pAch\" AND ncloc > 50").build()).getComponentsList())
+    assertThat(searchProjects(new SearchProjectsRequest().setFilter("query = \"pAch\" AND ncloc > 50")).getComponentsList())
       .extracting(Component::getKey).containsExactly("project3");
-    assertThat(searchProjects(SearchProjectsRequest.builder().setFilter("query = \"nd\" AND ncloc > 50").build()).getComponentsList())
+    assertThat(searchProjects(new SearchProjectsRequest().setFilter("query = \"nd\" AND ncloc > 50")).getComponentsList())
       .extracting(Component::getKey).containsExactly("project3", "project4");
-    assertThat(searchProjects(SearchProjectsRequest.builder().setFilter("query = \"unknown\" AND ncloc > 50").build()).getComponentsList()).isEmpty();
+    assertThat(searchProjects(new SearchProjectsRequest().setFilter("query = \"unknown\" AND ncloc > 50")).getComponentsList()).isEmpty();
     ;
 
     // Check facets
-    assertThat(searchProjects(SearchProjectsRequest.builder().setFilter("query = \"apache\"").setFacets(singletonList("ncloc")).build()).getFacets().getFacets(0).getValuesList())
+    assertThat(searchProjects(new SearchProjectsRequest().setFilter("query = \"apache\"").setFacets(singletonList("ncloc"))).getFacets().getFacets(0).getValuesList())
       .extracting(Common.FacetValue::getVal, Common.FacetValue::getCount)
       .containsOnly(tuple("*-1000.0", 3L), tuple("1000.0-10000.0", 0L), tuple("10000.0-100000.0", 0L), tuple("100000.0-500000.0", 0L), tuple("500000.0-*", 0L));
-    assertThat(searchProjects(SearchProjectsRequest.builder().setFilter("query = \"unknown\"").setFacets(singletonList("ncloc")).build()).getFacets().getFacets(0)
+    assertThat(searchProjects(new SearchProjectsRequest().setFilter("query = \"unknown\"").setFacets(singletonList("ncloc"))).getFacets().getFacets(0)
       .getValuesList()).extracting(Common.FacetValue::getVal, Common.FacetValue::getCount)
         .containsOnly(tuple("*-1000.0", 0L), tuple("1000.0-10000.0", 0L), tuple("10000.0-100000.0", 0L), tuple("100000.0-500000.0", 0L), tuple("500000.0-*", 0L));
   }
@@ -158,7 +158,7 @@ public class ProjectFilterTest {
     analyzeProject(newProjectKey(), "shared/xoo-sample");
     analyzeProject(newProjectKey(), "shared/xoo-multi-modules-sample");
 
-    SearchProjectsWsResponse response = searchProjects(SearchProjectsRequest.builder().setOrganization(organization.getKey()).setFacets(asList(
+    SearchProjectsWsResponse response = searchProjects(new SearchProjectsRequest().setOrganization(organization.getKey()).setFacets(asList(
       "alert_status",
       "coverage",
       "duplicated_lines_density",
@@ -167,7 +167,7 @@ public class ProjectFilterTest {
       "reliability_rating",
       "security_rating",
       "sqale_rating",
-      "tags")).build());
+      "tags")));
 
     checkFacet(response, "alert_status",
       tuple("OK", 2L),
@@ -228,8 +228,8 @@ public class ProjectFilterTest {
     analyzeProject(projectKey2, "projectSearch/xoo-history-v1", "sonar.projectDate", "2016-12-31");
     analyzeProject(projectKey2, "projectSearch/xoo-history-v2");
 
-    SearchProjectsWsResponse response = searchProjects(SearchProjectsRequest.builder().setOrganization(organization.getKey()).setFacets(asList(
-      "new_reliability_rating", "new_security_rating", "new_maintainability_rating", "new_coverage", "new_duplicated_lines_density", "new_lines")).build());
+    SearchProjectsWsResponse response = searchProjects(new SearchProjectsRequest().setOrganization(organization.getKey()).setFacets(asList(
+      "new_reliability_rating", "new_security_rating", "new_maintainability_rating", "new_coverage", "new_duplicated_lines_density", "new_lines")));
 
     checkFacet(response, "new_reliability_rating",
       tuple("1", 2L),
@@ -287,11 +287,11 @@ public class ProjectFilterTest {
   }
 
   private SearchProjectsWsResponse searchProjects(String filter) throws IOException {
-    return searchProjects(SearchProjectsRequest.builder().setOrganization(organization.getKey()).setFilter(filter).build());
+    return searchProjects(new SearchProjectsRequest().setOrganization(organization.getKey()).setFilter(filter));
   }
 
   private SearchProjectsWsResponse searchProjects(SearchProjectsRequest request) throws IOException {
-    return tester.wsClient().componentsOld().searchProjects(request);
+    return tester.wsClient().components().searchProjects(request);
   }
 
   private void verifyFilterMatches(String projectKey, String filter) throws IOException {
index 2ab5e74158d88ad3d206e7df77afcac37e1549a7..d42e850af281638bb95c8708a82679017f4d9e23 100644 (file)
@@ -39,8 +39,8 @@ import org.sonarqube.ws.Organizations;
 import org.sonarqube.ws.Projects;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.WsResponse;
-import org.sonarqube.ws.client.component.SearchProjectsRequest;
-import org.sonarqube.ws.client.component.ShowRequest;
+import org.sonarqube.ws.client.components.SearchProjectsRequest;
+import org.sonarqube.ws.client.components.ShowRequest;
 import org.sonarqube.ws.client.project.BulkUpdateKeyRequest;
 import org.sonarqube.ws.client.project.CreateRequest;
 import org.sonarqube.ws.client.project.UpdateKeyRequest;
@@ -71,7 +71,7 @@ public class ProjectKeyUpdateTest {
   public void update_key() {
     analyzeXooSample();
     String newProjectKey = "another_project_key";
-    Components.Component project = tester.wsClient().componentsOld().show(new ShowRequest().setKey(PROJECT_KEY)).getComponent();
+    Components.Component project = tester.wsClient().components().show(new ShowRequest().setComponent(PROJECT_KEY)).getComponent();
     assertThat(project.getKey()).isEqualTo(PROJECT_KEY);
 
     tester.wsClient().projects().updateKey(UpdateKeyRequest.builder()
@@ -79,14 +79,14 @@ public class ProjectKeyUpdateTest {
       .setNewKey(newProjectKey)
       .build());
 
-    assertThat(tester.wsClient().componentsOld().show(new ShowRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey);
+    assertThat(tester.wsClient().components().show(new ShowRequest().setComponentId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey);
   }
 
   @Test
   public void bulk_update_key() {
     analyzeXooSample();
     String newProjectKey = "another_project_key";
-    Components.Component project = tester.wsClient().componentsOld().show(new ShowRequest().setKey(PROJECT_KEY)).getComponent();
+    Components.Component project = tester.wsClient().components().show(new ShowRequest().setComponent(PROJECT_KEY)).getComponent();
     assertThat(project.getKey()).isEqualTo(PROJECT_KEY);
 
     Projects.BulkUpdateKeyWsResponse result = tester.wsClient().projects().bulkUpdateKey(BulkUpdateKeyRequest.builder()
@@ -95,7 +95,7 @@ public class ProjectKeyUpdateTest {
       .setTo(newProjectKey)
       .build());
 
-    assertThat(tester.wsClient().componentsOld().show(new ShowRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey);
+    assertThat(tester.wsClient().components().show(new ShowRequest().setComponentId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey);
     assertThat(result.getKeysCount()).isEqualTo(1);
     assertThat(result.getKeys(0))
       .extracting(Projects.BulkUpdateKeyWsResponse.Key::getKey, Projects.BulkUpdateKeyWsResponse.Key::getNewKey, Projects.BulkUpdateKeyWsResponse.Key::getDuplicate)
@@ -254,8 +254,8 @@ public class ProjectKeyUpdateTest {
    */
   @CheckForNull
   private String keyInComponentSearchProjects(String name) {
-    Components.SearchProjectsWsResponse response = tester.wsClient().componentsOld().searchProjects(
-      SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build());
+    Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects(
+      new SearchProjectsRequest().setFilter("query=\"" + name + "\""));
     if (response.getComponentsCount() > 0) {
       return response.getComponents(0).getKey();
     }
index 1faa8d031e35f2722a69f130a90d89a15bb8cdfb..ddb5803da22d73d341e57d6bd3b9b8775323c522 100644 (file)
@@ -35,7 +35,7 @@ import org.sonarqube.ws.Projects;
 import org.sonarqube.ws.Projects.CreateWsResponse.Project;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.WsResponse;
-import org.sonarqube.ws.client.component.SearchProjectsRequest;
+import org.sonarqube.ws.client.components.SearchProjectsRequest;
 import org.sonarqube.ws.client.project.CreateRequest;
 import org.sonarqube.ws.client.project.SearchRequest;
 import util.ItUtils;
@@ -109,8 +109,8 @@ public class ProjectProvisioningTest {
    * Projects page - api/components/search_projects - uses ES + DB
    */
   private boolean isInComponentSearchProjects(String name) {
-    Components.SearchProjectsWsResponse response = tester.wsClient().componentsOld().searchProjects(
-      SearchProjectsRequest.builder().setFilter("query=\"" + name + "\"").build());
+    Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects(
+      new SearchProjectsRequest().setFilter("query=\"" + name + "\""));
     return response.getComponentsCount() > 0;
   }
 
index 0f9c90fb04e3533c85f667306f62a2aa6bd21b6f..926212d90fc56f72f950693f2d4afeb45d7d54c4 100644 (file)
@@ -28,12 +28,11 @@ import org.junit.Test;
 import org.sonarqube.qa.util.Tester;
 import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage;
 import org.sonarqube.ws.Components;
-import org.sonarqube.ws.client.component.SearchProjectsRequest;
+import org.sonarqube.ws.client.components.SearchProjectsRequest;
 import org.sonarqube.ws.client.permission.RemoveGroupRequest;
 import org.sonarqube.ws.client.project.UpdateVisibilityRequest;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.newAdminWsClient;
 import static util.ItUtils.projectDir;
 
 public class ProjectVisibilityPageTest {
@@ -84,8 +83,8 @@ public class ProjectVisibilityPageTest {
       .createProject("foo", "foo", visibility)
       .shouldHaveProjectsCount(1);
 
-    Components.SearchProjectsWsResponse response = newAdminWsClient(orchestrator).componentsOld().searchProjects(
-      SearchProjectsRequest.builder().build());
+    Components.SearchProjectsWsResponse response = tester.wsClient().components().searchProjects(
+      new SearchProjectsRequest());
     assertThat(response.getComponentsCount()).isEqualTo(1);
     assertThat(response.getComponents(0).getKey()).isEqualTo("foo");
     assertThat(response.getComponents(0).getName()).isEqualTo("foo");
index 6ac8775f63587e67bd2ff46df5875fb4fbf52a55..c1dfd54f86ec55940a8fccf21713bbf4366b54a1 100644 (file)
@@ -70,7 +70,7 @@ import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.HttpConnector;
 import org.sonarqube.ws.client.WsClient;
 import org.sonarqube.ws.client.WsClientFactories;
-import org.sonarqube.ws.client.component.ShowRequest;
+import org.sonarqube.ws.client.components.ShowRequest;
 import org.sonarqube.ws.client.measure.ComponentRequest;
 import org.sonarqube.ws.client.qualityprofile.RestoreRequest;
 import org.sonarqube.ws.client.settings.ResetRequest;
@@ -373,7 +373,7 @@ public class ItUtils {
   @CheckForNull
   public static Component getComponent(Orchestrator orchestrator, String componentKey) {
     try {
-      return newWsClient(orchestrator).componentsOld().show(new ShowRequest().setKey((componentKey))).getComponent();
+      return newWsClient(orchestrator).components().show(new ShowRequest().setComponent((componentKey))).getComponent();
     } catch (org.sonarqube.ws.client.HttpException e) {
       if (e.code() == 404) {
         return null;