]> source.dussan.org Git - sonarqube.git/commitdiff
Remove legacy sonar-ws code for projects
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>
Mon, 4 Dec 2017 17:34:50 +0000 (18:34 +0100)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 6 Dec 2017 13:40:17 +0000 (14:40 +0100)
30 files changed:
server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/ProjectTester.java
sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/project/CreateRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/project/DeleteRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchMyProjectsRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateVisibilityRequest.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/project/SearchRequestTest.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyRequestTest.java [deleted file]
tests/src/test/java/org/sonarqube/tests/analysis/IssueExclusionsTest.java
tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java
tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java
tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java
tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java
tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java
tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java
tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java
tests/src/test/java/org/sonarqube/tests/project/ProjectBulkDeletionTest.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/ProjectSearchTest.java
tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java
tests/src/test/java/org/sonarqube/tests/ui/UiExtensionsTest.java
tests/src/test/java/org/sonarqube/tests/webhook/WebhooksTest.java

index 00eaf34ca73a0d2e6a19aa07c08cec82601803ba..0e1043480d8337ad9ae10bcc8cbcfe1830aed4f0 100644 (file)
@@ -24,10 +24,10 @@ import java.util.function.Consumer;
 import javax.annotation.Nullable;
 import org.sonarqube.ws.Organizations;
 import org.sonarqube.ws.Projects;
-import org.sonarqube.ws.client.project.CreateRequest;
-import org.sonarqube.ws.client.project.DeleteRequest;
-import org.sonarqube.ws.client.project.ProjectsService;
-import org.sonarqube.ws.client.project.SearchRequest;
+import org.sonarqube.ws.client.projects.CreateRequest;
+import org.sonarqube.ws.client.projects.DeleteRequest;
+import org.sonarqube.ws.client.projects.ProjectsService;
+import org.sonarqube.ws.client.projects.SearchRequest;
 
 import static java.util.Arrays.stream;
 import static java.util.Collections.singletonList;
@@ -44,24 +44,24 @@ public class ProjectTester {
 
   void deleteAll() {
     ProjectsService service = session.wsClient().projects();
-    service.search(SearchRequest.builder().setQualifiers(singletonList("TRK")).build()).getComponentsList().forEach(p ->
-      service.delete(DeleteRequest.builder().setKey(p.getKey()).build()));
+    service.search(new SearchRequest().setQualifiers(singletonList("TRK"))).getComponentsList().forEach(p ->
+      service.delete(new DeleteRequest().setProject(p.getKey())));
   }
 
   @SafeVarargs
-  public final Projects.CreateWsResponse.Project provision(Consumer<CreateRequest.Builder>... populators) {
+  public final Projects.CreateWsResponse.Project provision(Consumer<CreateRequest>... populators) {
     return provision(null, populators);
   }
 
   @SafeVarargs
-  public final Projects.CreateWsResponse.Project provision(@Nullable Organizations.Organization organization, Consumer<CreateRequest.Builder>... populators) {
+  public final Projects.CreateWsResponse.Project provision(@Nullable Organizations.Organization organization, Consumer<CreateRequest>... populators) {
     int id = ID_GENERATOR.getAndIncrement();
-    CreateRequest.Builder request = CreateRequest.builder()
-      .setKey("key" + id)
+    CreateRequest request = new CreateRequest()
+      .setProject("key" + id)
       .setName("Name " + id)
       .setOrganization(organization != null ? organization.getKey() : null);
     stream(populators).forEach(p -> p.accept(request));
 
-    return session.wsClient().projects().create(request.build()).getProject();
+    return session.wsClient().projects().create(request).getProject();
   }
 }
index ecef12eecfd91704c076632a6021cf0ab8108464..daa1a503ce046e5928973401a90a26402b90cf7b 100644 (file)
@@ -45,8 +45,8 @@ import org.sonarqube.ws.client.profiles.ProfilesService;
 import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService;
 import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
 import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
-import org.sonarqube.ws.client.projects.ProjectsService;
 import org.sonarqube.ws.client.projecttags.ProjectTagsService;
+import org.sonarqube.ws.client.projects.ProjectsService;
 import org.sonarqube.ws.client.properties.PropertiesService;
 import org.sonarqube.ws.client.qualitygates.QualitygatesService;
 import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyRequest.java
deleted file mode 100644 (file)
index 980f636..0000000
+++ /dev/null
@@ -1,113 +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.project;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-@Immutable
-public class BulkUpdateKeyRequest {
-  private final String id;
-  private final String key;
-  private final String from;
-  private final String to;
-  private final boolean dryRun;
-
-  public BulkUpdateKeyRequest(Builder builder) {
-    this.id = builder.id;
-    this.key = builder.key;
-    this.from = builder.from;
-    this.to = builder.to;
-    this.dryRun = builder.dryRun;
-  }
-
-  @CheckForNull
-  public String getId() {
-    return id;
-  }
-
-  @CheckForNull
-  public String getKey() {
-    return key;
-  }
-
-  public String getFrom() {
-    return from;
-  }
-
-  public String getTo() {
-    return to;
-  }
-
-  public boolean isDryRun() {
-    return dryRun;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String id;
-    private String key;
-    private String from;
-    private String to;
-    private boolean dryRun;
-
-    private Builder() {
-      // enforce method constructor
-    }
-
-    public Builder setId(@Nullable String id) {
-      this.id = id;
-      return this;
-    }
-
-    public Builder setKey(@Nullable String key) {
-      this.key = key;
-      return this;
-    }
-
-    public Builder setFrom(String from) {
-      this.from = from;
-      return this;
-    }
-
-    public Builder setTo(String to) {
-      this.to = to;
-      return this;
-    }
-
-    public Builder setDryRun(boolean dryRun) {
-      this.dryRun = dryRun;
-      return this;
-    }
-
-    public BulkUpdateKeyRequest build() {
-      checkArgument(from != null && !from.isEmpty(), "The string to match must not be empty");
-      checkArgument(to != null && !to.isEmpty(), "The string replacement must not be empty");
-      return new BulkUpdateKeyRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/CreateRequest.java
deleted file mode 100644 (file)
index 61c89ee..0000000
+++ /dev/null
@@ -1,113 +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.project;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-@Immutable
-public class CreateRequest {
-
-  private final String organization;
-  private final String key;
-  private final String name;
-  private final String branch;
-  @CheckForNull
-  private final String visibility;
-
-  private CreateRequest(Builder builder) {
-    this.organization = builder.organization;
-    this.key = builder.key;
-    this.name = builder.name;
-    this.branch = builder.branch;
-    this.visibility = builder.visibility;
-  }
-
-  @CheckForNull
-  public String getOrganization() {
-    return organization;
-  }
-
-  @CheckForNull
-  public String getKey() {
-    return key;
-  }
-
-  @CheckForNull
-  public String getName() {
-    return name;
-  }
-
-  @CheckForNull
-  public String getBranch() {
-    return branch;
-  }
-
-  @CheckForNull
-  public String getVisibility() {
-    return visibility;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String organization;
-    private String key;
-    private String name;
-    private String branch;
-    @CheckForNull
-    private String visibility;
-
-    private Builder() {
-    }
-
-    public Builder setOrganization(@Nullable String organization) {
-      this.organization = organization;
-      return this;
-    }
-
-    public Builder setKey(@Nullable String key) {
-      this.key = key;
-      return this;
-    }
-
-    public Builder setName(@Nullable String name) {
-      this.name = name;
-      return this;
-    }
-
-    public Builder setBranch(@Nullable String branch) {
-      this.branch = branch;
-      return this;
-    }
-
-    public Builder setVisibility(@Nullable String visibility) {
-      this.visibility = visibility;
-      return this;
-    }
-
-    public CreateRequest build() {
-      return new CreateRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/DeleteRequest.java
deleted file mode 100644 (file)
index 0d798bd..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.project;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-@Immutable
-public class DeleteRequest {
-
-  private final String key;
-
-  private DeleteRequest(Builder builder) {
-    this.key = builder.key;
-  }
-
-  @CheckForNull
-  public String getKey() {
-    return key;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String key;
-
-    private Builder() {
-    }
-
-    public Builder setKey(@Nullable String key) {
-      this.key = key;
-      return this;
-    }
-
-    public DeleteRequest build() {
-      return new DeleteRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java
deleted file mode 100644 (file)
index e169f4f..0000000
+++ /dev/null
@@ -1,140 +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.project;
-
-import com.google.common.base.Joiner;
-import org.sonarqube.ws.Projects.BulkUpdateKeyWsResponse;
-import org.sonarqube.ws.Projects.CreateWsResponse;
-import org.sonarqube.ws.Projects.SearchWsResponse;
-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 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.TEXT_QUERY;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_BULK_UPDATE_KEY;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_CREATE;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_SEARCH;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_UPDATE_KEY;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_UPDATE_VISIBILITY;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.CONTROLLER;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ANALYZED_BEFORE;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_FROM;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ON_PROVISIONED_ONLY;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ORGANIZATION;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECTS;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT_IDS;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_QUALIFIERS;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_TO;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_VISIBILITY;
-
-/**
- * Maps web service {@code api/projects}.
- *
- * @since 5.5
- */
-public class ProjectsService extends BaseService {
-
-  public ProjectsService(WsConnector wsConnector) {
-    super(wsConnector, CONTROLLER);
-  }
-
-  /**
-   * Provisions a new project.
-   *
-   * @throws org.sonarqube.ws.client.HttpException if HTTP status code is not 2xx.
-   */
-  public CreateWsResponse create(CreateRequest project) {
-    PostRequest request = new PostRequest(path(ACTION_CREATE))
-      .setParam(PARAM_ORGANIZATION, project.getOrganization())
-      .setParam(PARAM_PROJECT, project.getKey())
-      .setParam(PARAM_NAME, project.getName())
-      .setParam(PARAM_BRANCH, project.getBranch())
-      .setParam(PARAM_VISIBILITY, project.getVisibility());
-    return call(request, CreateWsResponse.parser());
-  }
-
-  /**
-   * @throws org.sonarqube.ws.client.HttpException if HTTP status code is not 2xx.
-   */
-  public void delete(DeleteRequest request) {
-    call(new PostRequest(path("delete"))
-      .setParam("project", request.getKey()));
-  }
-
-  public void bulkDelete(SearchRequest request) {
-    PostRequest post = new PostRequest(path("bulk_delete"))
-      .setParam(PARAM_ORGANIZATION, request.getOrganization())
-      .setParam(PARAM_QUALIFIERS, inlineMultipleParamValue(request.getQualifiers()))
-      .setParam(PARAM_ANALYZED_BEFORE, request.getAnalyzedBefore())
-      .setParam(TEXT_QUERY, request.getQuery())
-      .setParam(PARAM_ON_PROVISIONED_ONLY, request.isOnProvisionedOnly())
-      .setParam(PARAM_PROJECTS, inlineMultipleParamValue(request.getProjects()))
-      .setParam(PARAM_PROJECT_IDS, inlineMultipleParamValue(request.getProjectIds()));
-
-    call(post);
-  }
-
-  public void updateKey(UpdateKeyRequest request) {
-    PostRequest post = new PostRequest(path(ACTION_UPDATE_KEY))
-      .setParam(PARAM_PROJECT_ID, request.getId())
-      .setParam(PARAM_FROM, request.getKey())
-      .setParam(PARAM_TO, request.getNewKey());
-
-    call(post);
-  }
-
-  public BulkUpdateKeyWsResponse bulkUpdateKey(BulkUpdateKeyRequest request) {
-    PostRequest post = new PostRequest(path(ACTION_BULK_UPDATE_KEY))
-      .setParam(PARAM_PROJECT_ID, request.getId())
-      .setParam(PARAM_PROJECT, request.getKey())
-      .setParam(ProjectsWsParameters.PARAM_FROM, request.getFrom())
-      .setParam(ProjectsWsParameters.PARAM_TO, request.getTo());
-
-    return call(post, BulkUpdateKeyWsResponse.parser());
-  }
-
-  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_ANALYZED_BEFORE, request.getAnalyzedBefore())
-      .setParam(TEXT_QUERY, request.getQuery())
-      .setParam(PAGE, request.getPage())
-      .setParam(PAGE_SIZE, request.getPageSize())
-      .setParam(PARAM_ON_PROVISIONED_ONLY, request.isOnProvisionedOnly())
-      .setParam(PARAM_PROJECTS, inlineMultipleParamValue(request.getProjects()))
-      .setParam(PARAM_PROJECT_IDS, inlineMultipleParamValue(request.getProjectIds()));
-    return call(get, SearchWsResponse.parser());
-  }
-
-  public void updateVisibility(UpdateVisibilityRequest request) {
-    PostRequest post = new PostRequest(path(ACTION_UPDATE_VISIBILITY))
-      .setParam(PARAM_PROJECT, request.getProject())
-      .setParam(PARAM_VISIBILITY, request.getVisibility());
-    call(post);
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchMyProjectsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchMyProjectsRequest.java
deleted file mode 100644 (file)
index a0b6b3d..0000000
+++ /dev/null
@@ -1,72 +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.project;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-@Immutable
-public class SearchMyProjectsRequest {
-  private final Integer page;
-  private final Integer pageSize;
-
-  private SearchMyProjectsRequest(Builder builder) {
-    this.page = builder.page;
-    this.pageSize = builder.pageSize;
-  }
-
-  @CheckForNull
-  public Integer getPage() {
-    return page;
-  }
-
-  @CheckForNull
-  public Integer getPageSize() {
-    return pageSize;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private Integer page;
-    private Integer pageSize;
-
-    private Builder() {
-      // enforce method constructor
-    }
-
-    public Builder setPage(@Nullable Integer page) {
-      this.page = page;
-      return this;
-    }
-
-    public Builder setPageSize(@Nullable Integer pageSize) {
-      this.pageSize = pageSize;
-      return this;
-    }
-
-    public SearchMyProjectsRequest build() {
-      return new SearchMyProjectsRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/SearchRequest.java
deleted file mode 100644 (file)
index 5cf2b55..0000000
+++ /dev/null
@@ -1,179 +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.project;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.sonar.api.resources.Qualifiers;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Collections.singletonList;
-import static java.util.Objects.requireNonNull;
-import static org.sonarqube.ws.client.project.ProjectsWsParameters.MAX_PAGE_SIZE;
-
-public class SearchRequest {
-
-  private final String organization;
-  private final String query;
-  private final List<String> qualifiers;
-  private final String visibility;
-  private final Integer page;
-  private final Integer pageSize;
-  private final String analyzedBefore;
-  private final boolean onProvisionedOnly;
-  private final List<String> projects;
-  private final List<String> projectIds;
-
-  public SearchRequest(Builder builder) {
-    this.organization = builder.organization;
-    this.query = builder.query;
-    this.qualifiers = builder.qualifiers;
-    this.visibility = builder.visibility;
-    this.page = builder.page;
-    this.pageSize = builder.pageSize;
-    this.analyzedBefore = builder.analyzedBefore;
-    this.onProvisionedOnly = builder.onProvisionedOnly;
-    this.projects = builder.projects;
-    this.projectIds = builder.projectIds;
-  }
-
-  @CheckForNull
-  public String getOrganization() {
-    return organization;
-  }
-
-  public List<String> getQualifiers() {
-    return qualifiers;
-  }
-
-  @CheckForNull
-  public Integer getPage() {
-    return page;
-  }
-
-  @CheckForNull
-  public Integer getPageSize() {
-    return pageSize;
-  }
-
-  @CheckForNull
-  public String getQuery() {
-    return query;
-  }
-
-  @CheckForNull
-  public String getVisibility() {
-    return visibility;
-  }
-
-  @CheckForNull
-  public String getAnalyzedBefore() {
-    return analyzedBefore;
-  }
-
-  public boolean isOnProvisionedOnly() {
-    return onProvisionedOnly;
-  }
-
-  @CheckForNull
-  public List<String> getProjects() {
-    return projects;
-  }
-
-  @CheckForNull
-  public List<String> getProjectIds() {
-    return projectIds;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String organization;
-    private List<String> qualifiers = singletonList(Qualifiers.PROJECT);
-    private Integer page;
-    private Integer pageSize;
-    private String query;
-    private String visibility;
-    private String analyzedBefore;
-    private boolean onProvisionedOnly = false;
-    private List<String> projects;
-    private List<String> projectIds;
-
-    public Builder setOrganization(@Nullable String organization) {
-      this.organization = organization;
-      return this;
-    }
-
-    public Builder setQualifiers(List<String> qualifiers) {
-      this.qualifiers = requireNonNull(qualifiers, "Qualifiers cannot be null");
-      return this;
-    }
-
-    public Builder setPage(@Nullable Integer page) {
-      this.page = page;
-      return this;
-    }
-
-    public Builder setPageSize(@Nullable Integer pageSize) {
-      this.pageSize = pageSize;
-      return this;
-    }
-
-    public Builder setQuery(@Nullable String query) {
-      this.query = query;
-      return this;
-    }
-
-    public Builder setVisibility(@Nullable String visibility) {
-      this.visibility = visibility;
-      return this;
-    }
-
-    public Builder setAnalyzedBefore(@Nullable String lastAnalysisBefore) {
-      this.analyzedBefore = lastAnalysisBefore;
-      return this;
-    }
-
-    public Builder setOnProvisionedOnly(boolean onProvisionedOnly) {
-      this.onProvisionedOnly = onProvisionedOnly;
-      return this;
-    }
-
-    public Builder setProjects(@Nullable List<String> projects) {
-      this.projects = projects;
-      return this;
-    }
-
-    public Builder setProjectIds(@Nullable List<String> projectIds) {
-      this.projectIds = projectIds;
-      return this;
-    }
-
-    public SearchRequest build() {
-      checkArgument(projects==null || !projects.isEmpty(), "Project key list must not be empty");
-      checkArgument(projectIds==null || !projectIds.isEmpty(), "Project id list must not be empty");
-      checkArgument(pageSize == null || pageSize <= MAX_PAGE_SIZE, "Page size must not be greater than %s", MAX_PAGE_SIZE);
-      return new SearchRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyRequest.java
deleted file mode 100644 (file)
index 0995a38..0000000
+++ /dev/null
@@ -1,88 +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.project;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-@Immutable
-public class UpdateKeyRequest {
-  private final String id;
-  private final String key;
-  private final String newKey;
-
-  public UpdateKeyRequest(Builder builder) {
-    this.id = builder.id;
-    this.key = builder.key;
-    this.newKey = builder.newKey;
-  }
-
-  @CheckForNull
-  public String getId() {
-    return id;
-  }
-
-  @CheckForNull
-  public String getKey() {
-    return key;
-  }
-
-  public String getNewKey() {
-    return newKey;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String id;
-    private String key;
-    private String newKey;
-
-    private Builder() {
-      // enforce method constructor
-    }
-
-    public Builder setId(@Nullable String id) {
-      this.id = id;
-      return this;
-    }
-
-    public Builder setKey(@Nullable String key) {
-      this.key = key;
-      return this;
-    }
-
-    public Builder setNewKey(String newKey) {
-      this.newKey = newKey;
-      return this;
-    }
-
-    public UpdateKeyRequest build() {
-      checkArgument(newKey != null && !newKey.isEmpty(), "The new key must not be empty");
-      return new UpdateKeyRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateVisibilityRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateVisibilityRequest.java
deleted file mode 100644 (file)
index 342b7a5..0000000
+++ /dev/null
@@ -1,66 +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.project;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class UpdateVisibilityRequest {
-  private final String project;
-  private final String visibility;
-
-  public UpdateVisibilityRequest(Builder builder) {
-    this.project = builder.project;
-    this.visibility = builder.visibility;
-  }
-
-  @CheckForNull
-  public String getProject() {
-    return project;
-  }
-
-  @CheckForNull
-  public String getVisibility() {
-    return visibility;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String project;
-    private String visibility;
-
-    public Builder setProject(@Nullable String project) {
-      this.project = project;
-      return this;
-    }
-
-    public Builder setVisibility(@Nullable String visibility) {
-      this.visibility = visibility;
-      return this;
-    }
-
-    public UpdateVisibilityRequest build() {
-      return new UpdateVisibilityRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/ProjectsServiceTest.java
deleted file mode 100644 (file)
index 9b8fbb0..0000000
+++ /dev/null
@@ -1,184 +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.project;
-
-import java.util.Arrays;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.Projects;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static java.util.Arrays.asList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.data.MapEntry.entry;
-import static org.mockito.Mockito.mock;
-import static org.sonar.api.server.ws.WebService.Param.PAGE;
-import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE;
-
-public class ProjectsServiceTest {
-
-  @Rule
-  public ServiceTester<ProjectsService> serviceTester = new ServiceTester<>(new ProjectsService(mock(WsConnector.class)));
-
-  private ProjectsService underTest = serviceTester.getInstanceUnderTest();
-
-  @Test
-  public void creates_project() {
-    underTest.create(CreateRequest.builder()
-      .setKey("project_key")
-      .setName("Project Name")
-      .build());
-
-    assertThat(serviceTester.getPostParser()).isSameAs(Projects.CreateWsResponse.parser());
-    assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/create");
-    assertThat(serviceTester.getPostRequest().getParams()).containsOnly(
-      entry("project", "project_key"),
-      entry("name", "Project Name"));
-  }
-
-  @Test
-  public void creates_project_on_organization() {
-    underTest.create(CreateRequest.builder()
-      .setOrganization("org_key")
-      .setKey("project_key")
-      .setName("Project Name")
-      .build());
-
-    assertThat(serviceTester.getPostParser()).isSameAs(Projects.CreateWsResponse.parser());
-    assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/create");
-    assertThat(serviceTester.getPostRequest().getParams()).containsOnly(
-      entry("organization", "org_key"),
-      entry("project", "project_key"),
-      entry("name", "Project Name"));
-  }
-
-  @Test
-  public void creates_project_on_branch() {
-    underTest.create(CreateRequest.builder()
-      .setKey("project_key")
-      .setName("Project Name")
-      .setBranch("the_branch")
-      .build());
-
-    assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/create");
-    assertThat(serviceTester.getPostRequest().getParams()).containsOnly(
-      entry("project", "project_key"),
-      entry("name", "Project Name"),
-      entry("branch", "the_branch"));
-  }
-
-  @Test
-  public void creates_public_project() {
-    underTest.create(CreateRequest.builder()
-      .setKey("project_key")
-      .setName("Project Name")
-      .setVisibility("public")
-      .build());
-
-    assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/create");
-    assertThat(serviceTester.getPostRequest().getParams()).containsOnly(
-      entry("project", "project_key"),
-      entry("name", "Project Name"),
-      entry("visibility", "public"));
-  }
-
-  @Test
-  public void creates_private_project() {
-    underTest.create(CreateRequest.builder()
-      .setKey("project_key")
-      .setName("Project Name")
-      .setVisibility("private")
-      .build());
-
-    assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/create");
-    assertThat(serviceTester.getPostRequest().getParams()).containsOnly(
-      entry("project", "project_key"),
-      entry("name", "Project Name"),
-      entry("visibility", "private"));
-  }
-
-  @Test
-  public void delete() {
-    underTest.delete(DeleteRequest.builder().setKey("P1").build());
-
-    assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/delete");
-    assertThat(serviceTester.getPostRequest().getParams()).containsOnly(entry("project", "P1"));
-  }
-
-  @Test
-  public void bulk_delete() {
-    underTest.bulkDelete(SearchRequest.builder()
-      .setOrganization("default")
-      .setQuery("project")
-      .setQualifiers(asList("TRK", "VW"))
-      .setAnalyzedBefore("2017-09-01")
-      .setProjects(Arrays.asList("P1", "P2"))
-      .setOnProvisionedOnly(true)
-      .build());
-
-    serviceTester.assertThat(serviceTester.getPostRequest())
-      .hasPath("bulk_delete")
-      .hasParam("organization", "default")
-      .hasParam("q", "project")
-      .hasParam("analyzedBefore", "2017-09-01")
-      .hasParam("qualifiers", "TRK,VW")
-      .hasParam("onProvisionedOnly", "true")
-      .hasParam("projects", "P1,P2")
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void search() {
-    underTest.search(SearchRequest.builder()
-      .setOrganization("default")
-      .setQuery("project")
-      .setQualifiers(asList("TRK", "VW"))
-      .setAnalyzedBefore("2017-09-01")
-      .setOnProvisionedOnly(true)
-      .setPage(3)
-      .setPageSize(10)
-      .build());
-
-    serviceTester.assertThat(serviceTester.getGetRequest())
-      .hasPath("search")
-      .hasParam("organization", "default")
-      .hasParam("q", "project")
-      .hasParam("analyzedBefore", "2017-09-01")
-      .hasParam("qualifiers", "TRK,VW")
-      .hasParam("onProvisionedOnly", "true")
-      .hasParam(PAGE, 3)
-      .hasParam(PAGE_SIZE, 10)
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void update_visibility() {
-    underTest.updateVisibility(UpdateVisibilityRequest.builder()
-      .setProject("project_key")
-      .setVisibility("public")
-      .build());
-
-    assertThat(serviceTester.getPostRequest().getPath()).isEqualTo("api/projects/update_visibility");
-    assertThat(serviceTester.getPostRequest().getParams()).containsOnly(
-      entry("project", "project_key"),
-      entry("visibility", "public"));
-  }
-}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/SearchRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/SearchRequestTest.java
deleted file mode 100644 (file)
index ee64ad7..0000000
+++ /dev/null
@@ -1,81 +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.project;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.emptyList;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SearchRequestTest {
-
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  @Test
-  public void create_request() throws Exception {
-    SearchRequest underTest = SearchRequest.builder()
-      .setOrganization("orga")
-      .setQuery("project")
-      .setQualifiers(asList("TRK", "VW"))
-      .setPage(5)
-      .setPageSize(10)
-      .build();
-
-    assertThat(underTest.getOrganization()).isEqualTo("orga");
-    assertThat(underTest.getQuery()).isEqualTo("project");
-    assertThat(underTest.getQualifiers()).containsOnly("TRK", "VW");
-    assertThat(underTest.getPage()).isEqualTo(5);
-    assertThat(underTest.getPageSize()).isEqualTo(10);
-  }
-
-  @Test
-  public void fail_when_page_size_is_greater_then_500() throws Exception {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Page size must not be greater than 500");
-
-    SearchRequest.builder()
-      .setPageSize(10000)
-      .build();
-  }
-
-  @Test
-  public void fail_if_project_key_list_is_empty() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Project key list must not be empty");
-
-    SearchRequest.builder()
-      .setProjects(emptyList())
-      .build();
-  }
-
-  @Test
-  public void fail_if_project_id_list_is_empty() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Project id list must not be empty");
-
-    SearchRequest.builder()
-      .setProjectIds(emptyList())
-      .build();
-  }
-}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyRequestTest.java
deleted file mode 100644 (file)
index 7b99e95..0000000
+++ /dev/null
@@ -1,49 +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.project;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-public class UpdateKeyRequestTest {
-
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  UpdateKeyRequest.Builder underTest = UpdateKeyRequest.builder();
-
-  @Test
-  public void fail_if_new_key_is_null() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("The new key must not be empty");
-
-    underTest.setNewKey(null).build();
-  }
-
-  @Test
-  public void fail_if_new_key_is_empty() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("The new key must not be empty");
-
-    underTest.setNewKey("").build();
-  }
-}
index 45b4a28a05d71d0879a1245c86df2136e9ac8d2f..a9f243a878fec05036dd9300a7266dc208a50e88 100644 (file)
@@ -237,7 +237,7 @@ public class IssueExclusionsTest {
     ItUtils.restoreProfile(orchestrator, getClass().getResource("/exclusions/IssueExclusionsTest/with-many-rules.xml"));
 
     tester.projects().provision(p -> p
-      .setKey("com.sonarsource.it.samples:multi-modules-exclusions")
+      .setProject("com.sonarsource.it.samples:multi-modules-exclusions")
       .setName("Sonar :: Integration Tests :: Multi-modules With Exclusions"));
     tester.wsClient().qualityprofiles().addProject(new AddProjectRequest().setProject("com.sonarsource.it.samples:multi-modules-exclusions")
       .setLanguage("xoo").setQualityProfile("with-many-rules"));
index 6f6a4df3f49ecf69e25a0da337e8b374b14e3b24..f2b2116d14e71b876d175b9c08bfb8b1efbc2000 100644 (file)
@@ -30,7 +30,7 @@ import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.client.permissions.AddGroupRequest;
 import org.sonarqube.ws.client.permissions.AddProjectCreatorToTemplateRequest;
 import org.sonarqube.ws.client.permissions.RemoveGroupRequest;
-import org.sonarqube.ws.client.project.UpdateVisibilityRequest;
+import org.sonarqube.ws.client.projects.UpdateVisibilityRequest;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.fail;
@@ -78,7 +78,7 @@ public class ExecuteAnalysisPermissionTest {
         "You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. Please contact your SonarQube administrator.");
     }
 
-    tester.wsClient().projects().updateVisibility(UpdateVisibilityRequest.builder().setProject(PROJECT_KEY).setVisibility("private").build());
+    tester.wsClient().projects().updateVisibility(new UpdateVisibilityRequest().setProject(PROJECT_KEY).setVisibility("private"));
     try {
       // Execute anonymous analysis
       executeAnonymousAnalysis();
@@ -95,7 +95,7 @@ public class ExecuteAnalysisPermissionTest {
     executeAnonymousAnalysis();
 
     // make project private
-    tester.wsClient().projects().updateVisibility(UpdateVisibilityRequest.builder().setProject("sample").setVisibility("private").build());
+    tester.wsClient().projects().updateVisibility(new UpdateVisibilityRequest().setProject("sample").setVisibility("private"));
 
     // still no error
     executeAnonymousAnalysis();
index 72e9c16b2359ea87fa746e5dfdad8ba163a3f207..1f31815f899e726892bc29d324bb9f49d6ab9cf5 100644 (file)
@@ -35,7 +35,7 @@ import org.sonarqube.ws.Issues;
 import org.sonarqube.ws.client.issues.BulkChangeRequest;
 import org.sonarqube.ws.client.issues.ChangelogRequest;
 import org.sonarqube.ws.client.permissions.AddUserRequest;
-import org.sonarqube.ws.client.project.UpdateVisibilityRequest;
+import org.sonarqube.ws.client.projects.UpdateVisibilityRequest;
 import util.ItUtils;
 
 import static java.util.Arrays.asList;
@@ -60,7 +60,7 @@ public class IssuePermissionTest {
     ItUtils.restoreProfile(orchestrator, getClass().getResource("/authorisation/one-issue-per-line-profile.xml"));
 
     orchestrator.getServer().provisionProject("privateProject", "PrivateProject");
-    tester.wsClient().projects().updateVisibility(UpdateVisibilityRequest.builder().setProject("privateProject").setVisibility("private").build());
+    tester.wsClient().projects().updateVisibility(new UpdateVisibilityRequest().setProject("privateProject").setVisibility("private"));
     orchestrator.getServer().associateProjectToQualityProfile("privateProject", "xoo", "one-issue-per-line");
     SonarScanner privateProject = SonarScanner.create(projectDir("shared/xoo-sample"))
       .setProperty("sonar.projectKey", "privateProject")
index 1fc4588d6cc6b3dc114a6c03470cc7b7655d53e1..23d330be20d43472500e5ceb1b9e762dcb9856ce 100644 (file)
@@ -31,7 +31,7 @@ import org.sonarqube.ws.client.permissions.AddGroupRequest;
 import org.sonarqube.ws.client.permissions.AddUserRequest;
 import org.sonarqube.ws.client.permissions.RemoveGroupRequest;
 import org.sonarqube.ws.client.permissions.RemoveUserRequest;
-import org.sonarqube.ws.client.project.CreateRequest;
+import org.sonarqube.ws.client.projects.CreateRequest;
 import util.ItUtils;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -108,7 +108,7 @@ public class ProvisioningPermissionTest {
     final String newName = "New Project";
 
     Project created = tester.as(USER_WITH_PROVISIONING, PASSWORD).wsClient().projects()
-      .create(CreateRequest.builder().setKey(newKey).setName(newName).build())
+      .create(new CreateRequest().setProject(newKey).setName(newName))
       .getProject();
 
     assertThat(created).isNotNull();
@@ -124,7 +124,7 @@ public class ProvisioningPermissionTest {
   public void user_cannot_provision_project_through_ws_if_he_does_not_have_provisioning_permission() {
     ItUtils.expectForbiddenError(() -> {
       tester.as(USER_WITHOUT_PROVISIONING, PASSWORD).wsClient().projects()
-        .create(CreateRequest.builder().setKey("new-project").setName("New Project").build())
+        .create(new CreateRequest().setProject("new-project").setName("New Project"))
         .getProject();
     });
   }
index 9eed0add1627661dad4596a55890aa4e3058b5a3..e1c15d12d24fab1eff5680c8c23b23fab7a619fc 100644 (file)
@@ -288,7 +288,7 @@ public class IssueNotificationsTest {
   private void createSampleProject(String visibility) {
     // Create project
     Qualityprofiles.CreateWsResponse.QualityProfile profile = tester.qProfiles().createXooProfile(organization);
-    Project project = tester.projects().provision(organization, p -> p.setKey(PROJECT_KEY)
+    Project project = tester.projects().provision(organization, p -> p.setProject(PROJECT_KEY)
       .setName("Sample")
       .setVisibility(visibility));
     tester.qProfiles()
index 6354d6f0b5bacfa31c6f6356f1423762e5cea3f8..94803195923ece0b7420deb63e46578f8d98a8d2 100644 (file)
@@ -38,7 +38,7 @@ import org.sonarqube.ws.client.issues.SetTagsRequest;
 import org.sonarqube.ws.client.issues.TagsRequest;
 import org.sonarqube.ws.client.organizations.AddMemberRequest;
 import org.sonarqube.ws.client.permissions.AddUserRequest;
-import org.sonarqube.ws.client.project.CreateRequest;
+import org.sonarqube.ws.client.projects.CreateRequest;
 
 import static java.util.Arrays.asList;
 import static java.util.Collections.singletonList;
@@ -71,12 +71,11 @@ public class IssueTagsTest {
     restoreProfile(orchestrator, IssueTagsTest.class.getResource("/issue/one-issue-per-line-profile.xml"), organization.getKey());
     String projectKey = newProjectKey();
     tester.wsClient().projects().create(
-      CreateRequest.builder()
-        .setKey(projectKey)
+      new CreateRequest()
+        .setProject(projectKey)
         .setOrganization(organization.getKey())
         .setName(randomAlphabetic(10))
-        .setVisibility("private")
-        .build());
+        .setVisibility("private"));
     analyzeProject(organization.getKey(), projectKey);
 
     String issue = tester.wsClient().issues().search(new SearchRequest()).getIssues(0).getKey();
index 79b0b20cd0f03c7feac794f4cd77a54d587b3b98..6cce01986250b35f620c1bc94d229a05b011d3f7 100644 (file)
@@ -37,8 +37,8 @@ import org.sonarqube.ws.Users.CreateWsResponse.User;
 import org.sonarqube.ws.client.issues.AssignRequest;
 import org.sonarqube.ws.client.issues.BulkChangeRequest;
 import org.sonarqube.ws.client.issues.SearchRequest;
-import org.sonarqube.ws.client.project.CreateRequest;
 import org.sonarqube.ws.client.qualityprofiles.AddProjectRequest;
+import org.sonarqube.ws.client.projects.CreateRequest;
 import util.issue.IssueRule;
 
 import static java.lang.String.format;
@@ -185,11 +185,10 @@ public class OrganizationIssueAssignTest {
 
   private void provisionProject(String projectKey, String organization) {
     tester.wsClient().projects().create(
-      CreateRequest.builder()
-        .setKey(projectKey)
+      new CreateRequest()
+        .setProject(projectKey)
         .setName(projectKey)
-        .setOrganization(organization)
-        .build());
+        .setOrganization(organization));
   }
 
   private void analyseProject(String projectKey, String organization) {
index 0304a639f53e8dc72c6245fd89f6e053d2465900..43a8f15e20dbdcc268cd77abd59c26698faff478 100644 (file)
@@ -35,8 +35,8 @@ import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.WsResponse;
 import org.sonarqube.ws.client.ce.TaskRequest;
 import org.sonarqube.ws.client.organizations.UpdateProjectVisibilityRequest;
-import org.sonarqube.ws.client.project.CreateRequest;
-import org.sonarqube.ws.client.project.UpdateVisibilityRequest;
+import org.sonarqube.ws.client.projects.CreateRequest;
+import org.sonarqube.ws.client.projects.UpdateVisibilityRequest;
 import util.ItUtils;
 
 import static java.lang.String.format;
@@ -150,7 +150,7 @@ public class BillingTest {
     String projectKey = createPublicProject();
     tester.settings().setGlobalSettings("sonar.billing.preventUpdatingProjectsVisibilityToPrivate", "false");
 
-    tester.wsClient().projects().updateVisibility(UpdateVisibilityRequest.builder().setProject(projectKey).setVisibility("private").build());
+    tester.wsClient().projects().updateVisibility(new UpdateVisibilityRequest().setProject(projectKey).setVisibility("private"));
 
     assertWsResponseAsAdmin(new GetRequest("api/navigation/component").setParam("componentKey", projectKey), "\"visibility\":\"private\"");
   }
@@ -162,7 +162,7 @@ public class BillingTest {
 
     expectHttpError(400,
       format("Organization %s cannot use private project", organization.getKey()),
-      () -> tester.wsClient().projects().updateVisibility(UpdateVisibilityRequest.builder().setProject(projectKey).setVisibility("private").build()));
+      () -> tester.wsClient().projects().updateVisibility(new UpdateVisibilityRequest().setProject(projectKey).setVisibility("private")));
   }
 
   @Test
@@ -170,7 +170,7 @@ public class BillingTest {
     String projectKey = newProjectKey();
     tester.settings().setGlobalSettings("sonar.billing.preventUpdatingProjectsVisibilityToPrivate", "false");
 
-    tester.wsClient().projects().create(CreateRequest.builder().setKey(projectKey).setName(projectKey).setOrganization(organization.getKey()).setVisibility("public").build());
+    tester.wsClient().projects().create(new CreateRequest().setProject(projectKey).setName(projectKey).setOrganization(organization.getKey()).setVisibility("public"));
 
     assertWsResponseAsAdmin(new GetRequest("api/navigation/component").setParam("componentKey", projectKey), "\"visibility\":\"public\"");
   }
@@ -183,7 +183,7 @@ public class BillingTest {
     expectHttpError(400,
       format("Organization %s cannot use private project", organization.getKey()),
       () -> tester.wsClient().projects()
-        .create(CreateRequest.builder().setKey(projectKey).setName(projectKey).setOrganization(organization.getKey()).setVisibility("private").build()));
+        .create(new CreateRequest().setProject(projectKey).setName(projectKey).setOrganization(organization.getKey()).setVisibility("private")));
   }
 
   @Test
index ce7fdb4bc33a37a573aa507e6f76d58f9dc4b577..050eaaf079c041a0ac410fb9a84050d3c588f48d 100644 (file)
@@ -30,7 +30,8 @@ import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.Organizations;
 import org.sonarqube.ws.Projects.CreateWsResponse;
 import org.sonarqube.ws.Projects.SearchWsResponse.Component;
-import org.sonarqube.ws.client.project.SearchRequest;
+import org.sonarqube.ws.client.projects.BulkDeleteRequest;
+import org.sonarqube.ws.client.projects.SearchRequest;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static util.ItUtils.runProjectAnalysis;
@@ -46,18 +47,18 @@ public class ProjectBulkDeletionTest {
   @Test
   public void delete_projects() {
     Organizations.Organization organization = tester.organizations().generate();
-    CreateWsResponse.Project firstProvisionedProject = tester.projects().provision(organization, p -> p.setKey("first-provisioned-project"));
-    CreateWsResponse.Project secondProvisionedProject = tester.projects().provision(organization, p -> p.setKey("second-provisioned-project"));
+    CreateWsResponse.Project firstProvisionedProject = tester.projects().provision(organization, p -> p.setProject("first-provisioned-project"));
+    CreateWsResponse.Project secondProvisionedProject = tester.projects().provision(organization, p -> p.setProject("second-provisioned-project"));
     CreateWsResponse.Project analyzedProject = tester.projects().provision(organization);
 
     analyzeProject(analyzedProject.getKey(), organization.getKey());
 
-    tester.wsClient().projects().bulkDelete(SearchRequest.builder()
+    tester.wsClient().projects().bulkDelete(new BulkDeleteRequest()
       .setOrganization(organization.getKey())
-      .setQuery("FIRST-PROVISIONED")
-      .setOnProvisionedOnly(true).build());
+      .setQ("FIRST-PROVISIONED")
+      .setOnProvisionedOnly("true"));
 
-    List<Component> projects = tester.wsClient().projects().search(SearchRequest.builder().setOrganization(organization.getKey()).build()).getComponentsList();
+    List<Component> projects = tester.wsClient().projects().search(new SearchRequest().setOrganization(organization.getKey())).getComponentsList();
     assertThat(projects).extracting(Component::getKey)
       .containsExactlyInAnyOrder(analyzedProject.getKey(), secondProvisionedProject.getKey())
       .doesNotContain(firstProvisionedProject.getKey());
@@ -67,13 +68,14 @@ public class ProjectBulkDeletionTest {
   public void delete_more_than_50_projects_at_the_same_time() {
     Organizations.Organization organization = tester.organizations().generate();
     IntStream.range(0, 60).forEach(i -> tester.projects().provision(organization));
-    SearchRequest request = SearchRequest.builder().setOrganization(organization.getKey()).build();
-    assertThat(tester.wsClient().projects().search(request).getPaging().getTotal()).isEqualTo(60);
+    SearchRequest searchRequest = new SearchRequest().setOrganization(organization.getKey());
+    BulkDeleteRequest deleteRequest = new BulkDeleteRequest().setOrganization(organization.getKey());
+    assertThat(tester.wsClient().projects().search(searchRequest).getPaging().getTotal()).isEqualTo(60);
 
-    tester.wsClient().projects().bulkDelete(request);
+    tester.wsClient().projects().bulkDelete(deleteRequest);
 
-    assertThat(tester.wsClient().projects().search(request).getComponentsList()).isEmpty();
-    assertThat(tester.wsClient().projects().search(request).getPaging().getTotal()).isEqualTo(0);
+    assertThat(tester.wsClient().projects().search(searchRequest).getComponentsList()).isEmpty();
+    assertThat(tester.wsClient().projects().search(searchRequest).getPaging().getTotal()).isEqualTo(0);
   }
 
   private void analyzeProject(String projectKey, String organizationKey) {
index 9f679c9b20a265e600b2763c4549bb9b7fa3de21..22915b31255f66b2f3f90ff69e78ab812f3e9dc0 100644 (file)
@@ -32,8 +32,8 @@ import org.junit.rules.DisableOnDebug;
 import org.junit.rules.TestRule;
 import org.junit.rules.Timeout;
 import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.Organizations;
 import org.sonarqube.ws.Components;
+import org.sonarqube.ws.Organizations;
 import org.sonarqube.ws.Projects;
 import org.sonarqube.ws.Projects.CreateWsResponse.Project;
 import org.sonarqube.ws.Users;
@@ -41,9 +41,10 @@ import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.WsClient;
 import org.sonarqube.ws.client.WsResponse;
 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;
+import org.sonarqube.ws.client.projects.BulkDeleteRequest;
+import org.sonarqube.ws.client.projects.CreateRequest;
+import org.sonarqube.ws.client.projects.DeleteRequest;
+import org.sonarqube.ws.client.projects.SearchRequest;
 import util.ItUtils;
 
 import static java.util.Collections.singletonList;
@@ -161,19 +162,18 @@ public class ProjectDeletionTest {
   }
 
   private void deleteProject(Project project) {
-    tester.wsClient().projects().delete(DeleteRequest.builder().setKey(project.getKey()).build());
+    tester.wsClient().projects().delete(new DeleteRequest().setProject(project.getKey()));
   }
 
   private void bulkDeleteProjects(Organizations.Organization organization, Project... projects) {
-    SearchRequest request = SearchRequest.builder()
+    BulkDeleteRequest request = new BulkDeleteRequest()
       .setOrganization(organization.getKey())
-      .setProjects(Arrays.stream(projects).map(Project::getKey).collect(Collectors.toList()))
-      .build();
+      .setProjects(Arrays.stream(projects).map(Project::getKey).collect(Collectors.toList()));
     tester.wsClient().projects().bulkDelete(request);
   }
 
   private Project createProject(Organizations.Organization organization, String key, String name) {
-    CreateRequest createRequest = CreateRequest.builder().setKey(key).setName(name).setOrganization(organization.getKey()).build();
+    CreateRequest createRequest = new CreateRequest().setProject(key).setName(name).setOrganization(organization.getKey());
     return tester.wsClient().projects().create(createRequest).getProject();
   }
 
@@ -194,7 +194,7 @@ public class ProjectDeletionTest {
    */
   private boolean isInProjectsSearch(Organizations.Organization organization, String name) {
     Projects.SearchWsResponse response = tester.wsClient().projects().search(
-      SearchRequest.builder().setOrganization(organization.getKey()).setQuery(name).setQualifiers(singletonList("TRK")).build());
+      new SearchRequest().setOrganization(organization.getKey()).setQ(name).setQualifiers(singletonList("TRK")));
     return response.getComponentsCount() > 0;
   }
 
@@ -229,6 +229,6 @@ public class ProjectDeletionTest {
   }
 
   private static void executeDeleteRequest(WsClient wsClient, String key) {
-    wsClient.projects().delete(DeleteRequest.builder().setKey(key).build());
+    wsClient.projects().delete(new DeleteRequest().setProject(key));
   }
 }
index 02af1ddf6a07588e20f72ae74597e48362ccbc26..57da2663e343f41e0ba73c3f5d2015bea290b005 100644 (file)
@@ -31,11 +31,11 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.sonarqube.qa.util.Tester;
 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.Organizations.Organization;
 import org.sonarqube.ws.client.components.SearchProjectsRequest;
-import org.sonarqube.ws.client.project.CreateRequest;
+import org.sonarqube.ws.client.projects.CreateRequest;
 
 import static java.util.Arrays.asList;
 import static java.util.Collections.singletonList;
@@ -88,7 +88,7 @@ public class ProjectFilterTest {
   @Test
   public void provisioned_projects_should_be_included_to_results() throws Exception {
     String projectKey = newProjectKey();
-    tester.wsClient().projects().create(CreateRequest.builder().setKey(projectKey).setName(projectKey).setOrganization(organization.getKey()).build());
+    tester.wsClient().projects().create(new CreateRequest().setProject(projectKey).setName(projectKey).setOrganization(organization.getKey()));
 
     SearchProjectsWsResponse response = searchProjects(new SearchProjectsRequest().setOrganization(organization.getKey()));
 
@@ -107,7 +107,7 @@ public class ProjectFilterTest {
     analyzeProject(projectKey2, "shared/xoo-sample");
     // This project is provisioned, so has no leak period
     String projectKey3 = newProjectKey();
-    tester.wsClient().projects().create(CreateRequest.builder().setKey(projectKey3).setName(projectKey3).setOrganization(organization.getKey()).build());
+    tester.wsClient().projects().create(new CreateRequest().setProject(projectKey3).setName(projectKey3).setOrganization(organization.getKey()));
 
     SearchProjectsWsResponse response = searchProjects(
       new SearchProjectsRequest().setF(singletonList("leakPeriodDate")).setOrganization(organization.getKey()));
index d42e850af281638bb95c8708a82679017f4d9e23..c448982532f460d6538f566ac49fa6b7968cc930 100644 (file)
@@ -41,9 +41,8 @@ import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.WsResponse;
 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;
+import org.sonarqube.ws.client.projects.UpdateKeyRequest;
+import org.sonarqube.ws.client.projects.CreateRequest;
 import util.ItUtils;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -74,32 +73,11 @@ public class ProjectKeyUpdateTest {
     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()
-      .setKey(PROJECT_KEY)
-      .setNewKey(newProjectKey)
-      .build());
-
-    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().components().show(new ShowRequest().setComponent(PROJECT_KEY)).getComponent();
-    assertThat(project.getKey()).isEqualTo(PROJECT_KEY);
-
-    Projects.BulkUpdateKeyWsResponse result = tester.wsClient().projects().bulkUpdateKey(BulkUpdateKeyRequest.builder()
-      .setKey(PROJECT_KEY)
+    tester.wsClient().projects().updateKey(new UpdateKeyRequest()
       .setFrom(PROJECT_KEY)
-      .setTo(newProjectKey)
-      .build());
+      .setTo(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)
-      .containsOnlyOnce(PROJECT_KEY, newProjectKey, false);
   }
 
   @Test
@@ -229,15 +207,15 @@ public class ProjectKeyUpdateTest {
   }
 
   private void updateKey(Projects.CreateWsResponse.Project project, String newKey) {
-    tester.wsClient().projects().updateKey(UpdateKeyRequest.builder().setKey(project.getKey()).setNewKey(newKey).build());
+    tester.wsClient().projects().updateKey(new UpdateKeyRequest().setFrom(project.getKey()).setTo(newKey));
   }
 
   private void updateKey(String initialKey, String newKey) {
-    tester.wsClient().projects().updateKey(UpdateKeyRequest.builder().setKey(initialKey).setNewKey(newKey).build());
+    tester.wsClient().projects().updateKey(new UpdateKeyRequest().setFrom(initialKey).setTo(newKey));
   }
 
   private Projects.CreateWsResponse.Project createProject(Organizations.Organization organization, String key, String name) {
-    CreateRequest createRequest = CreateRequest.builder().setKey(key).setName(name).setOrganization(organization.getKey()).build();
+    CreateRequest createRequest = new CreateRequest().setProject(key).setName(name).setOrganization(organization.getKey());
     return tester.wsClient().projects().create(createRequest).getProject();
   }
 
index ddb5803da22d73d341e57d6bd3b9b8775323c522..7e9842c44002d44e1435e78e0d5cb034c88ff46e 100644 (file)
@@ -29,15 +29,15 @@ import org.junit.rules.DisableOnDebug;
 import org.junit.rules.TestRule;
 import org.junit.rules.Timeout;
 import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.Organizations;
 import org.sonarqube.ws.Components;
+import org.sonarqube.ws.Organizations;
 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.components.SearchProjectsRequest;
-import org.sonarqube.ws.client.project.CreateRequest;
-import org.sonarqube.ws.client.project.SearchRequest;
+import org.sonarqube.ws.client.projects.CreateRequest;
+import org.sonarqube.ws.client.projects.SearchRequest;
 import util.ItUtils;
 
 import static java.util.Collections.singletonList;
@@ -92,7 +92,7 @@ public class ProjectProvisioningTest {
   }
 
   private Project createProject(Organizations.Organization organization, String key, String name) {
-    CreateRequest createRequest = CreateRequest.builder().setKey(key).setName(name).setOrganization(organization.getKey()).build();
+    CreateRequest createRequest = new CreateRequest().setProject(key).setName(name).setOrganization(organization.getKey());
     return tester.wsClient().projects().create(createRequest).getProject();
   }
 
@@ -101,7 +101,7 @@ public class ProjectProvisioningTest {
    */
   private boolean isInProjectsSearch(Organizations.Organization organization, String name) {
     Projects.SearchWsResponse response = tester.wsClient().projects().search(
-      SearchRequest.builder().setOrganization(organization.getKey()).setQuery(name).setQualifiers(singletonList("TRK")).build());
+      new SearchRequest().setOrganization(organization.getKey()).setQ(name).setQualifiers(singletonList("TRK")));
     return response.getComponentsCount() > 0;
   }
 
index 12508573f70b63036c20ecfc79821ed08ba6807a..d29f9eb87716c29087718a2234fbc6120f21f528 100644 (file)
@@ -32,7 +32,7 @@ import org.sonarqube.ws.Projects.CreateWsResponse;
 import org.sonarqube.ws.Projects.SearchWsResponse;
 import org.sonarqube.ws.Projects.SearchWsResponse.Component;
 import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.project.SearchRequest;
+import org.sonarqube.ws.client.projects.SearchRequest;
 
 import static java.util.Collections.singletonList;
 import static org.assertj.core.api.Assertions.assertThat;
@@ -59,10 +59,10 @@ public class ProjectSearchTest {
     analyzeProject(oldProject.getKey(), moreThanOneYearAgo, organization.getKey());
     analyzeProject(recentProject.getKey(), now, organization.getKey());
 
-    SearchWsResponse result = tester.wsClient().projects().search(SearchRequest.builder()
+    SearchWsResponse result = tester.wsClient().projects().search(new SearchRequest()
       .setOrganization(organization.getKey())
       .setQualifiers(singletonList("TRK"))
-      .setAnalyzedBefore(formatDate(oneYearAgo)).build());
+      .setAnalyzedBefore(formatDate(oneYearAgo)));
 
     assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(oldProject.getKey());
   }
@@ -70,19 +70,18 @@ public class ProjectSearchTest {
   @Test
   public void search_on_key_query_partial_match_case_insensitive() {
     Organizations.Organization organization = tester.organizations().generate();
-    CreateWsResponse.Project lowerCaseProject = tester.projects().provision(organization, p -> p.setKey("project-key"));
-    CreateWsResponse.Project upperCaseProject = tester.projects().provision(organization, p -> p.setKey("PROJECT-KEY"));
-    CreateWsResponse.Project anotherProject = tester.projects().provision(organization, p -> p.setKey("another-project"));
+    CreateWsResponse.Project lowerCaseProject = tester.projects().provision(organization, p -> p.setProject("project-key"));
+    CreateWsResponse.Project upperCaseProject = tester.projects().provision(organization, p -> p.setProject("PROJECT-KEY"));
+    CreateWsResponse.Project anotherProject = tester.projects().provision(organization, p -> p.setProject("another-project"));
 
     analyzeProject(lowerCaseProject.getKey(), organization.getKey());
     analyzeProject(upperCaseProject.getKey(), organization.getKey());
     analyzeProject(anotherProject.getKey(), organization.getKey());
 
-    SearchWsResponse result = tester.wsClient().projects().search(SearchRequest.builder()
+    SearchWsResponse result = tester.wsClient().projects().search(new SearchRequest()
       .setOrganization(organization.getKey())
       .setQualifiers(singletonList("TRK"))
-      .setQuery("JeCt-K")
-      .build());
+      .setQ("JeCt-K"));
 
     assertThat(result.getComponentsList()).extracting(Component::getKey)
       .containsExactlyInAnyOrder(lowerCaseProject.getKey(), upperCaseProject.getKey())
@@ -101,10 +100,10 @@ public class ProjectSearchTest {
     String result = tester.wsClient().wsConnector().call(new GetRequest("api/projects/provisioned")
       .setParam("organization", organization.getKey()))
       .failIfNotSuccessful().content();
-   SearchWsResponse searchResult = tester.wsClient().projects().search(SearchRequest.builder()
+   SearchWsResponse searchResult = tester.wsClient().projects().search(new SearchRequest()
      .setQualifiers(singletonList("TRK"))
      .setOrganization(organization.getKey())
-     .setOnProvisionedOnly(true).build());
+     .setOnProvisionedOnly("true"));
 
     assertThat(result).contains(firstProvisionedProject.getKey(), secondProvisionedProject.getKey()).doesNotContain(analyzedProject.getKey());
     assertThat(searchResult.getComponentsList()).extracting(Component::getKey)
index 5607dc8fad0cfe86aec772f0980aa46144680eca..55ed2134a6a73957fbc3769fedb0f87c90d8569c 100644 (file)
@@ -30,7 +30,7 @@ import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage;
 import org.sonarqube.ws.Components;
 import org.sonarqube.ws.client.components.SearchProjectsRequest;
 import org.sonarqube.ws.client.permissions.RemoveGroupRequest;
-import org.sonarqube.ws.client.project.UpdateVisibilityRequest;
+import org.sonarqube.ws.client.projects.UpdateVisibilityRequest;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static util.ItUtils.projectDir;
@@ -54,7 +54,7 @@ public class ProjectVisibilityPageTest {
   public void return_all_projects_even_when_no_permission() throws Exception {
     orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")).setProperties("sonar.projectKey", "sample1"));
     orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")).setProperties("sonar.projectKey", "sample2"));
-    tester.wsClient().projects().updateVisibility(UpdateVisibilityRequest.builder().setProject("sample2").setVisibility("private").build());
+    tester.wsClient().projects().updateVisibility(new UpdateVisibilityRequest().setProject("sample2").setVisibility("private"));
     // Remove 'Admin' permission for admin group on project 2 -> No one can access or admin this project, expect System Admin
     tester.wsClient().permissions().removeGroup(new RemoveGroupRequest().setProjectKey("sample2").setGroupName("sonar-administrators").setPermission("admin"));
 
index 8e6f6cba8215d31fed7135e1d0deb162a872d265..48f32a7dac113692191b149c20eb0da952dc6fac 100644 (file)
 package org.sonarqube.tests.ui;
 
 import com.sonar.orchestrator.Orchestrator;
-import org.sonarqube.tests.Category4Suite;
 import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.openqa.selenium.By;
 import org.sonarqube.qa.util.Tester;
+import org.sonarqube.tests.Category4Suite;
 import org.sonarqube.ws.Projects;
 import org.sonarqube.ws.Users.CreateWsResponse.User;
-import org.sonarqube.ws.client.project.CreateRequest;
+import org.sonarqube.ws.client.projects.CreateRequest;
 import util.ItUtils;
 import util.selenium.Selenese;
 
@@ -107,9 +107,8 @@ public class UiExtensionsTest {
 
   private Projects.CreateWsResponse.Project createSampleProject() {
     String projectKey = ItUtils.newProjectKey();
-    return tester.wsClient().projects().create(CreateRequest.builder()
-      .setKey(projectKey)
-      .setName("Name of " + projectKey)
-      .build()).getProject();
+    return tester.wsClient().projects().create(new CreateRequest()
+      .setProject(projectKey)
+      .setName("Name of " + projectKey)).getProject();
   }
 }
index b88d64da7155424c600798047ed2a27cc33fa033..8c5d8b3b0cb562c9c0cd348fe4e636a9e94a4d6f 100644 (file)
@@ -21,7 +21,6 @@ package org.sonarqube.tests.webhook;
 
 import com.sonar.orchestrator.Orchestrator;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -36,7 +35,7 @@ import org.sonarqube.tests.Category3Suite;
 import org.sonarqube.ws.Webhooks;
 import org.sonarqube.ws.client.HttpException;
 import org.sonarqube.ws.client.WsClient;
-import org.sonarqube.ws.client.project.DeleteRequest;
+import org.sonarqube.ws.client.projects.DeleteRequest;
 import org.sonarqube.ws.client.settings.ResetRequest;
 import org.sonarqube.ws.client.settings.SetRequest;
 import org.sonarqube.ws.client.webhooks.DeliveriesRequest;
@@ -75,7 +74,7 @@ public class WebhooksTest {
     disableGlobalWebhooks();
     try {
       // delete project and related properties/webhook deliveries
-      adminWs.projects().delete(DeleteRequest.builder().setKey(PROJECT_KEY).build());
+      adminWs.projects().delete(new DeleteRequest().setProject(PROJECT_KEY));
     } catch (HttpException e) {
       // ignore because project may not exist
     }