]> source.dussan.org Git - sonarqube.git/commitdiff
Remove legacy sonar-ws code for organizations
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>
Thu, 30 Nov 2017 14:14:04 +0000 (15:14 +0100)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 6 Dec 2017 13:40:17 +0000 (14:40 +0100)
19 files changed:
server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/OrganizationTester.java
server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/UserTester.java
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/organization/CreateRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchMembersRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateProjectVisibilityRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateRequest.java [deleted file]
sonar-ws/src/main/java/org/sonarqube/ws/client/organization/package-info.java [deleted file]
sonar-ws/src/test/java/org/sonarqube/ws/client/organization/OrganizationServiceTest.java [deleted file]
tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java
tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java
tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java
tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java
tests/src/test/java/org/sonarqube/tests/organization/PersonalOrganizationTest.java
tests/src/test/java/org/sonarqube/tests/qualityProfile/CustomQualityProfilesTest.java
tests/src/test/java/org/sonarqube/tests/user/OrganizationIdentityProviderTest.java

index 85a9c8da5aa98be0ffac13b5aaf17234851fb71d..e6bdc24940be47819f81d4e569667a12aa49beb0 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonarqube.qa.util;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Consumer;
@@ -28,10 +29,12 @@ import org.sonarqube.ws.Organizations;
 import org.sonarqube.ws.Users;
 import org.sonarqube.ws.client.HttpException;
 import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.organization.CreateRequest;
-import org.sonarqube.ws.client.organization.OrganizationService;
-import org.sonarqube.ws.client.organization.SearchMembersRequest;
-import org.sonarqube.ws.client.organization.SearchRequest;
+import org.sonarqube.ws.client.organizations.AddMemberRequest;
+import org.sonarqube.ws.client.organizations.CreateRequest;
+import org.sonarqube.ws.client.organizations.DeleteRequest;
+import org.sonarqube.ws.client.organizations.OrganizationsService;
+import org.sonarqube.ws.client.organizations.SearchMembersRequest;
+import org.sonarqube.ws.client.organizations.SearchRequest;
 import org.sonarqube.ws.client.user.GroupsRequest;
 
 import static java.util.Arrays.stream;
@@ -51,38 +54,38 @@ public class OrganizationTester {
   }
 
   void deleteNonGuardedOrganizations() {
-    service().search(SearchRequest.builder().build()).getOrganizationsList()
+    service().search(new SearchRequest()).getOrganizationsList()
       .stream()
       .filter(o -> !o.getKey().equals("default-organization"))
-      .forEach(organization -> service().delete(organization.getKey()));
+      .forEach(organization -> service().delete(new DeleteRequest().setOrganization(organization.getKey())));
   }
 
   @SafeVarargs
-  public final Organizations.Organization generate(Consumer<CreateRequest.Builder>... populators) {
+  public final Organizations.Organization generate(Consumer<CreateRequest>... populators) {
     int id = ID_GENERATOR.getAndIncrement();
-    CreateRequest.Builder request = new CreateRequest.Builder()
+    CreateRequest request = new CreateRequest()
       .setKey("org" + id)
       .setName("Org " + id)
       .setDescription("Description " + id)
       .setUrl("http://test" + id);
     stream(populators).forEach(p -> p.accept(request));
-    return service().create(request.build()).getOrganization();
+    return service().create(request).getOrganization();
   }
 
   public OrganizationTester addMember(Organizations.Organization organization, Users.CreateWsResponse.User user) {
-    service().addMember(organization.getKey(), user.getLogin());
+    service().addMember(new AddMemberRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()));
     return this;
   }
 
   public Organizations.Organization getDefaultOrganization() {
-    return service().search(SearchRequest.builder().build()).getOrganizationsList()
+    return service().search(new SearchRequest()).getOrganizationsList()
       .stream()
       .filter(o -> o.getKey().equals("default-organization"))
       .findFirst().orElseThrow(() -> new IllegalStateException("Can't find default organization"));
   }
 
   public OrganizationTester assertThatOrganizationDoesNotExist(String organizationKey) {
-    SearchRequest request = new SearchRequest.Builder().setOrganizations(organizationKey).build();
+    SearchRequest request = new SearchRequest().setOrganizations(Collections.singletonList(organizationKey));
     Organizations.SearchWsResponse searchWsResponse = service().search(request);
     Assertions.assertThat(searchWsResponse.getOrganizationsList()).isEmpty();
     return this;
@@ -117,7 +120,7 @@ public class OrganizationTester {
 
   private void verifyOrganizationMembership(@Nullable Organizations.Organization organization, String userLogin, boolean isMember) {
     List<Organizations.User> users = service().searchMembers(new SearchMembersRequest()
-      .setQuery(userLogin)
+      .setQ(userLogin)
       .setSelected("selected")
       .setOrganization(organization != null ? organization.getKey() : null))
       .getUsersList();
@@ -135,7 +138,7 @@ public class OrganizationTester {
     Assertions.assertThat(groups).hasSize(isMember ? 1 : 0);
   }
 
-  public OrganizationService service() {
-    return session.wsClient().organizationsOld();
+  public OrganizationsService service() {
+    return session.wsClient().organizations();
   }
 }
index af434c5d2aca145995fa0ff7a2ef89a09d37f67e..fca8bf4f1b895e0941c0da9920b4b6e1bba949a1 100644 (file)
@@ -27,6 +27,7 @@ import org.sonarqube.ws.Organizations;
 import org.sonarqube.ws.Users;
 import org.sonarqube.ws.Users.CreateWsResponse.User;
 import org.sonarqube.ws.client.PostRequest;
+import org.sonarqube.ws.client.organizations.AddMemberRequest;
 import org.sonarqube.ws.client.user.CreateRequest;
 import org.sonarqube.ws.client.user.SearchRequest;
 import org.sonarqube.ws.client.user.UsersService;
@@ -74,7 +75,7 @@ public class UserTester {
   @SafeVarargs
   public final User generateAdministrator(Consumer<CreateRequest.Builder>... populators) {
     User user = generate(populators);
-    session.wsClient().permissionsOld().addUser(new org.sonarqube.ws.client.permission.AddUserRequest().setLogin(user.getLogin()).setPermission("admin"));
+    session.wsClient().permissions().addUser(new org.sonarqube.ws.client.permissions.AddUserRequest().setLogin(user.getLogin()).setPermission("admin"));
     session.wsClient().userGroups().addUser(new AddUserRequest().setLogin(user.getLogin()).setName("sonar-administrators"));
     return user;
   }
@@ -83,7 +84,7 @@ public class UserTester {
   public final User generateAdministrator(Organizations.Organization organization, Consumer<CreateRequest.Builder>... populators) {
     String organizationKey = organization.getKey();
     User user = generate(populators);
-    session.wsClient().organizationsOld().addMember(organizationKey, user.getLogin());
+    session.wsClient().organizations().addMember(new AddMemberRequest().setOrganization(organizationKey).setLogin(user.getLogin()));
     session.wsClient().userGroups().addUser(new AddUserRequest()
       .setOrganization(organizationKey)
       .setLogin(user.getLogin())
@@ -94,7 +95,7 @@ public class UserTester {
   @SafeVarargs
   public final User generateAdministratorOnDefaultOrganization(Consumer<CreateRequest.Builder>... populators) {
     User user = generate(populators);
-    session.wsClient().organizationsOld().addMember(DEFAULT_ORGANIZATION_KEY, user.getLogin());
+    session.wsClient().organizations().addMember(new AddMemberRequest().setOrganization(DEFAULT_ORGANIZATION_KEY).setLogin(user.getLogin()));
     session.wsClient().userGroups().addUser(new AddUserRequest()
       .setOrganization(DEFAULT_ORGANIZATION_KEY)
       .setLogin(user.getLogin())
@@ -105,14 +106,14 @@ public class UserTester {
   @SafeVarargs
   public final User generateMember(Organizations.Organization organization, Consumer<CreateRequest.Builder>... populators) {
     User user = generate(populators);
-    session.wsClient().organizationsOld().addMember(organization.getKey(), user.getLogin());
+    session.wsClient().organizations().addMember(new AddMemberRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()));
     return user;
   }
 
   @SafeVarargs
   public final User generateMemberOfDefaultOrganization(Consumer<CreateRequest.Builder>... populators) {
     User user = generate(populators);
-    session.wsClient().organizationsOld().addMember(DEFAULT_ORGANIZATION_KEY, user.getLogin());
+    session.wsClient().organizations().addMember(new AddMemberRequest().setOrganization(DEFAULT_ORGANIZATION_KEY).setLogin(user.getLogin()));
     return user;
   }
 
index 9bf77e9cde01bb95f3634ab611539593861e6b04..81b23171f15ca6a69384d62b97f9874149286cc8 100644 (file)
@@ -25,7 +25,6 @@ import org.sonarqube.ws.client.favorites.FavoritesService;
 import org.sonarqube.ws.client.issues.IssuesService;
 import org.sonarqube.ws.client.measures.MeasuresService;
 import org.sonarqube.ws.client.notifications.NotificationsService;
-import org.sonarqube.ws.client.organization.OrganizationService;
 import org.sonarqube.ws.client.organizations.OrganizationsService;
 import org.sonarqube.ws.client.permissions.PermissionsService;
 import org.sonarqube.ws.client.project.ProjectsService;
@@ -54,7 +53,6 @@ import org.sonarqube.ws.client.webhooks.WebhooksService;
 class DefaultWsClient implements WsClient {
 
   private final WsConnector wsConnector;
-  private final OrganizationService organizationsOld;
   private final OrganizationsService organizations;
   private final org.sonarqube.ws.client.permission.PermissionsService permissionsOld;
   private final PermissionsService permissions;
@@ -86,7 +84,6 @@ class DefaultWsClient implements WsClient {
 
   DefaultWsClient(WsConnector wsConnector) {
     this.wsConnector = wsConnector;
-    this.organizationsOld = new OrganizationService(wsConnector);
     this.organizations = new OrganizationsService(wsConnector);
     this.permissionsOld = new org.sonarqube.ws.client.permission.PermissionsService(wsConnector);
     this.permissions = new PermissionsService(wsConnector);
@@ -122,11 +119,6 @@ class DefaultWsClient implements WsClient {
     return wsConnector;
   }
 
-  @Override
-  public OrganizationService organizationsOld() {
-    return organizationsOld;
-  }
-
   @Override
   public OrganizationsService organizations() {
     return organizations;
index c6d200e935dbe577ac9c787431e134864c53dd57..33eb13f191c84e4521ac464ace842f39706d4320 100644 (file)
@@ -25,7 +25,6 @@ import org.sonarqube.ws.client.favorites.FavoritesService;
 import org.sonarqube.ws.client.issues.IssuesService;
 import org.sonarqube.ws.client.measures.MeasuresService;
 import org.sonarqube.ws.client.notifications.NotificationsService;
-import org.sonarqube.ws.client.organization.OrganizationService;
 import org.sonarqube.ws.client.organizations.OrganizationsService;
 import org.sonarqube.ws.client.permissions.PermissionsService;
 import org.sonarqube.ws.client.project.ProjectsService;
@@ -65,12 +64,6 @@ import org.sonarqube.ws.client.webhooks.WebhooksService;
  */
 public interface WsClient {
 
-  /**
-   * @deprecated since 7.0 use {@link #organizations()} instead
-   */
-  @Deprecated
-  OrganizationService organizationsOld();
-
   OrganizationsService organizations();
 
   /**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/CreateRequest.java
deleted file mode 100644 (file)
index 000426a..0000000
+++ /dev/null
@@ -1,100 +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.organization;
-
-import javax.annotation.concurrent.Immutable;
-
-@Immutable
-public class CreateRequest {
-  private final String name;
-  private final String key;
-  private final String description;
-  private final String url;
-  private final String avatar;
-
-  private CreateRequest(Builder builder) {
-    this.name = builder.name;
-    this.key = builder.key;
-    this.description = builder.description;
-    this.url = builder.url;
-    this.avatar = builder.avatar;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public String getKey() {
-    return key;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public String getUrl() {
-    return url;
-  }
-
-  public String getAvatar() {
-    return avatar;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String name;
-    private String key;
-    private String description;
-    private String url;
-    private String avatar;
-
-    public Builder setName(String name) {
-      this.name = name;
-      return this;
-    }
-
-    public Builder setKey(String key) {
-      this.key = key;
-      return this;
-    }
-
-    public Builder setDescription(String description) {
-      this.description = description;
-      return this;
-    }
-
-    public Builder setUrl(String url) {
-      this.url = url;
-      return this;
-    }
-
-    public Builder setAvatar(String avatar) {
-      this.avatar = avatar;
-      return this;
-    }
-
-    public CreateRequest build() {
-      return new CreateRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/OrganizationService.java
deleted file mode 100644 (file)
index 566558c..0000000
+++ /dev/null
@@ -1,118 +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.organization;
-
-import org.sonarqube.ws.Organizations.AddMemberWsResponse;
-import org.sonarqube.ws.Organizations.SearchMembersWsResponse;
-import org.sonarqube.ws.Organizations.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 java.util.Objects.requireNonNull;
-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.Organizations.CreateWsResponse;
-import static org.sonarqube.ws.Organizations.UpdateWsResponse;
-
-/**
- * @deprecated since 7.0, use {@link org.sonarqube.ws.client.organizations.OrganizationsService} instead
- */
-@Deprecated
-public class OrganizationService extends BaseService {
-
-  public OrganizationService(WsConnector wsConnector) {
-    super(wsConnector, "api/organizations");
-  }
-
-  public SearchWsResponse search(SearchRequest request) {
-    GetRequest get = new GetRequest(path("search"))
-      .setParam("organizations", inlineMultipleParamValue(request.getOrganizations()))
-      .setParam(PAGE, request.getPage())
-      .setParam(PAGE_SIZE, request.getPageSize());
-
-    return call(get, SearchWsResponse.parser());
-  }
-
-  public CreateWsResponse create(CreateRequest request) {
-    PostRequest post = new PostRequest(path("create"))
-      .setParam("name", request.getName())
-      .setParam("key", request.getKey())
-      .setParam("description", request.getDescription())
-      .setParam("url", request.getUrl())
-      .setParam("avatar", request.getAvatar());
-
-    return call(post, CreateWsResponse.parser());
-  }
-
-  public UpdateWsResponse update(UpdateRequest request) {
-    PostRequest post = new PostRequest(path("update"))
-      .setParam("key", request.getKey())
-      .setParam("name", request.getName())
-      .setParam("description", request.getDescription())
-      .setParam("url", request.getUrl())
-      .setParam("avatar", request.getAvatar());
-
-    return call(post, UpdateWsResponse.parser());
-  }
-
-  public void delete(String key) {
-    PostRequest post = new PostRequest(path("delete"))
-      .setParam("organization", key);
-
-    call(post).failIfNotSuccessful();
-  }
-
-  public SearchMembersWsResponse searchMembers(SearchMembersRequest request) {
-    GetRequest get = new GetRequest(path("search_members"))
-      .setParam("organization", request.getOrganization())
-      .setParam("selected", request.getSelected())
-      .setParam(TEXT_QUERY, request.getQuery())
-      .setParam(PAGE, request.getPage())
-      .setParam(PAGE_SIZE, request.getPageSize());
-
-    return call(get, SearchMembersWsResponse.parser());
-  }
-
-  public AddMemberWsResponse addMember(String organizationKey, String login) {
-    PostRequest post = new PostRequest(path("add_member"))
-      .setParam("organization", requireNonNull(organizationKey))
-      .setParam("login", requireNonNull(login));
-
-    return call(post, AddMemberWsResponse.parser());
-  }
-
-  public void removeMember(String organizationKey, String login) {
-    PostRequest post = new PostRequest(path("remove_member"))
-      .setParam("organization", requireNonNull(organizationKey))
-      .setParam("login", requireNonNull(login));
-
-    call(post);
-  }
-
-  public void updateProjectVisibility(UpdateProjectVisibilityRequest request) {
-    PostRequest post = new PostRequest(path("update_project_visibility"))
-      .setParam("organization", request.getOrganization())
-      .setParam("projectVisibility", request.getProjectVisibility());
-    call(post, UpdateWsResponse.parser());
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchMembersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchMembersRequest.java
deleted file mode 100644 (file)
index 341a930..0000000
+++ /dev/null
@@ -1,82 +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.organization;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class SearchMembersRequest {
-  private String organization;
-  private String selected;
-  private String query;
-  private Integer page;
-  private Integer pageSize;
-
-  @CheckForNull
-  public String getOrganization() {
-    return organization;
-  }
-
-  public SearchMembersRequest setOrganization(@Nullable String organization) {
-    this.organization = organization;
-    return this;
-  }
-
-  @CheckForNull
-  public String getSelected() {
-    return selected;
-  }
-
-  public SearchMembersRequest setSelected(@Nullable String selected) {
-    this.selected = selected;
-    return this;
-  }
-
-  @CheckForNull
-  public String getQuery() {
-    return query;
-  }
-
-  public SearchMembersRequest setQuery(@Nullable String query) {
-    this.query = query;
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getPage() {
-    return page;
-  }
-
-  public SearchMembersRequest setPage(@Nullable Integer page) {
-    this.page = page;
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getPageSize() {
-    return pageSize;
-  }
-
-  public SearchMembersRequest setPageSize(@Nullable Integer pageSize) {
-    this.pageSize = pageSize;
-    return this;
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/SearchRequest.java
deleted file mode 100644 (file)
index b3363ab..0000000
+++ /dev/null
@@ -1,84 +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.organization;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-import static java.util.Arrays.asList;
-
-@Immutable
-public class SearchRequest {
-  private final Integer page;
-  private final Integer pageSize;
-  private final List<String> organizations;
-
-  private SearchRequest(Builder builder) {
-    this.page = builder.page;
-    this.pageSize = builder.pageSize;
-    this.organizations = builder.organizations;
-  }
-
-  @CheckForNull
-  public Integer getPageSize() {
-    return pageSize;
-  }
-
-  @CheckForNull
-  public Integer getPage() {
-    return page;
-  }
-
-  @CheckForNull
-  public List<String> getOrganizations() {
-    return organizations;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static final class Builder {
-    private Integer page;
-    private Integer pageSize;
-    private List<String> organizations;
-
-    public Builder setPage(@Nullable Integer page) {
-      this.page = page;
-      return this;
-    }
-
-    public Builder setPageSize(@Nullable Integer pageSize) {
-      this.pageSize = pageSize;
-      return this;
-    }
-
-    public Builder setOrganizations(String... organizations) {
-      this.organizations = asList(organizations);
-      return this;
-    }
-
-    public SearchRequest build() {
-      return new SearchRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateProjectVisibilityRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateProjectVisibilityRequest.java
deleted file mode 100644 (file)
index e6e320a..0000000
+++ /dev/null
@@ -1,68 +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.organization;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-@Immutable
-public class UpdateProjectVisibilityRequest {
-  private final String organization;
-  private final String projectVisibility;
-
-  private UpdateProjectVisibilityRequest(Builder builder) {
-    this.organization = builder.organization;
-    this.projectVisibility = builder.projectVisibility;
-  }
-
-  @CheckForNull
-  public String getOrganization() {
-    return organization;
-  }
-
-  @CheckForNull
-  public String getProjectVisibility() {
-    return projectVisibility;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String organization;
-    private String projectVisibility;
-
-    public Builder setOrganization(@Nullable String organization) {
-      this.organization = organization;
-      return this;
-    }
-
-    public Builder setProjectVisibility(@Nullable String projectVisibility) {
-      this.projectVisibility = projectVisibility;
-      return this;
-    }
-
-    public UpdateProjectVisibilityRequest build() {
-      return new UpdateProjectVisibilityRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/UpdateRequest.java
deleted file mode 100644 (file)
index eb2de7b..0000000
+++ /dev/null
@@ -1,103 +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.organization;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-@Immutable
-public class UpdateRequest {
-  private final String key;
-  private final String name;
-  private final String description;
-  private final String url;
-  private final String avatar;
-
-  private UpdateRequest(Builder builder) {
-    this.name = builder.name;
-    this.key = builder.key;
-    this.description = builder.description;
-    this.url = builder.url;
-    this.avatar = builder.avatar;
-  }
-
-  @CheckForNull
-  public String getName() {
-    return name;
-  }
-
-  @CheckForNull
-  public String getKey() {
-    return key;
-  }
-
-  @CheckForNull
-  public String getDescription() {
-    return description;
-  }
-
-  @CheckForNull
-  public String getUrl() {
-    return url;
-  }
-
-  @CheckForNull
-  public String getAvatar() {
-    return avatar;
-  }
-
-  public static class Builder {
-    private String key;
-    private String name;
-    private String description;
-    private String url;
-    private String avatar;
-
-    public Builder setKey(@Nullable String key) {
-      this.key = key;
-      return this;
-    }
-
-    public Builder setName(@Nullable String name) {
-      this.name = name;
-      return this;
-    }
-
-    public Builder setDescription(@Nullable String description) {
-      this.description = description;
-      return this;
-    }
-
-    public Builder setUrl(@Nullable String url) {
-      this.url = url;
-      return this;
-    }
-
-    public Builder setAvatar(@Nullable String avatar) {
-      this.avatar = avatar;
-      return this;
-    }
-
-    public UpdateRequest build() {
-      return new UpdateRequest(this);
-    }
-  }
-}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organization/package-info.java
deleted file mode 100644 (file)
index 4a96eb8..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.organization;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/organization/OrganizationServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/organization/OrganizationServiceTest.java
deleted file mode 100644 (file)
index f15381a..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.organization;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.Organizations;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-
-public class OrganizationServiceTest {
-
-  @Rule
-  public ServiceTester<OrganizationService> serviceTester = new ServiceTester<>(new OrganizationService(mock(WsConnector.class)));
-
-  private OrganizationService underTest = serviceTester.getInstanceUnderTest();
-
-  @Test
-  public void search() {
-    underTest.search(SearchRequest.builder()
-      .setOrganizations("orga1", "orga2")
-      .setPage(2)
-      .setPageSize(10)
-      .build());
-    GetRequest getRequest = serviceTester.getGetRequest();
-
-    assertThat(serviceTester.getGetParser()).isSameAs(Organizations.SearchWsResponse.parser());
-    serviceTester.assertThat(getRequest)
-      .hasParam("organizations", "orga1,orga2")
-      .hasParam("p", 2)
-      .hasParam("ps", 10)
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void search_members() {
-    underTest.searchMembers(new SearchMembersRequest()
-      .setOrganization("orga")
-      .setSelected("selected")
-      .setQuery("john")
-      .setPage(2)
-      .setPageSize(10));
-    GetRequest getRequest = serviceTester.getGetRequest();
-
-    assertThat(serviceTester.getGetParser()).isSameAs(Organizations.SearchMembersWsResponse.parser());
-    serviceTester.assertThat(getRequest)
-      .hasParam("organization", "orga")
-      .hasParam("selected", "selected")
-      .hasParam("q", "john")
-      .hasParam("p", 2)
-      .hasParam("ps", 10)
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void add_member() {
-    underTest.addMember("O1", "login-1");
-
-    assertThat(serviceTester.getPostParser()).isSameAs(Organizations.AddMemberWsResponse.parser());
-    serviceTester.assertThat(serviceTester.getPostRequest())
-      .hasPath("add_member")
-      .hasParam("organization", "O1")
-      .hasParam("login", "login-1")
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void remove_member() {
-    underTest.removeMember("O1", "login-1");
-
-    serviceTester.assertThat(serviceTester.getPostRequest())
-      .hasPath("remove_member")
-      .hasParam("organization", "O1")
-      .hasParam("login", "login-1")
-      .andNoOtherParam();
-  }
-
-  @Test
-  public void update_project_visibility() {
-    underTest.updateProjectVisibility(UpdateProjectVisibilityRequest.builder()
-      .setOrganization("O1")
-      .setProjectVisibility("private")
-    .build());
-
-    serviceTester.assertThat(serviceTester.getPostRequest())
-      .hasPath("update_project_visibility")
-      .hasParam("organization", "O1")
-      .hasParam("projectVisibility", "private")
-      .andNoOtherParam();
-  }
-}
index 571b44399bbdeee6fe63dae4669aed10d2262ca6..7b655eecb994072bcfbfddd3279742413777d548 100644 (file)
@@ -34,6 +34,7 @@ import org.sonarqube.ws.Organizations.Organization;
 import org.sonarqube.ws.Projects.CreateWsResponse;
 import org.sonarqube.ws.Users.CreateWsResponse.User;
 import org.sonarqube.ws.client.issue.SearchRequest;
+import org.sonarqube.ws.client.organizations.AddMemberRequest;
 import org.sonarqube.ws.client.permission.AddUserRequest;
 import org.sonarqube.ws.client.project.CreateRequest;
 import util.ItUtils;
@@ -127,7 +128,7 @@ public class IssueTagsTest {
   }
 
   private void addMemberToOrganization(User member) {
-    tester.organizations().service().addMember(organization.getKey(), member.getLogin());
+    tester.organizations().service().addMember(new AddMemberRequest().setOrganization(organization.getKey()).setLogin(member.getLogin()));
   }
 
   private void grantUserPermission(String projectKey, User member) {
index 78498fa03a5154d8eb132bbaa13832100cf4a7eb..0304a639f53e8dc72c6245fd89f6e053d2465900 100644 (file)
@@ -34,7 +34,7 @@ import org.sonarqube.ws.Users.CreateWsResponse.User;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.WsResponse;
 import org.sonarqube.ws.client.ce.TaskRequest;
-import org.sonarqube.ws.client.organization.UpdateProjectVisibilityRequest;
+import org.sonarqube.ws.client.organizations.UpdateProjectVisibilityRequest;
 import org.sonarqube.ws.client.project.CreateRequest;
 import org.sonarqube.ws.client.project.UpdateVisibilityRequest;
 import util.ItUtils;
@@ -127,10 +127,9 @@ public class BillingTest {
   public void does_not_fail_to_update_default_projects_visibility_to_private() {
     tester.settings().setGlobalSettings("sonar.billing.preventUpdatingProjectsVisibilityToPrivate", "false");
 
-    tester.wsClient().organizationsOld().updateProjectVisibility(UpdateProjectVisibilityRequest.builder()
+    tester.wsClient().organizations().updateProjectVisibility(new UpdateProjectVisibilityRequest()
       .setOrganization(organization.getKey())
-      .setProjectVisibility("private")
-      .build());
+      .setProjectVisibility("private"));
 
     assertWsResponseAsAdmin(new GetRequest("api/navigation/organization").setParam("organization", organization.getKey()),
       "\"projectVisibility\":\"private\"");
@@ -142,8 +141,8 @@ public class BillingTest {
 
     expectHttpError(400,
       format("Organization %s cannot use private project", organization.getKey()),
-      () -> tester.wsClient().organizationsOld()
-        .updateProjectVisibility(UpdateProjectVisibilityRequest.builder().setOrganization(organization.getKey()).setProjectVisibility("private").build()));
+      () -> tester.wsClient().organizations()
+        .updateProjectVisibility(new UpdateProjectVisibilityRequest().setOrganization(organization.getKey()).setProjectVisibility("private")));
   }
 
   @Test
index 2fcb812f7bf9a152605cd3e99e22fc5d225622d2..18c4d6c3372736506669ea9488520fce5bc43c5a 100644 (file)
@@ -31,6 +31,7 @@ import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.Organizations.Organization;
 import org.sonarqube.ws.Users.CreateWsResponse.User;
 import org.sonarqube.ws.client.HttpException;
+import org.sonarqube.ws.client.organizations.RemoveMemberRequest;
 import org.sonarqube.ws.client.permission.AddUserRequest;
 
 public class OrganizationMembershipTest {
@@ -94,7 +95,7 @@ public class OrganizationMembershipTest {
     tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey()));
     tester.organizations().assertThatMemberOf(organization, user);
     // Admin is the creator of the organization so he was granted with admin permission
-    tester.wsClient().organizationsOld().removeMember(organization.getKey(), "admin");
+    tester.wsClient().organizations().removeMember(new RemoveMemberRequest().setOrganization(organization.getKey()).setLogin("admin"));
 
     expectedException.expect(HttpException.class);
     expectedException.expectMessage("The last administrator member cannot be removed");
@@ -125,6 +126,6 @@ public class OrganizationMembershipTest {
   }
 
   private void removeMembership(Organization organization, User user) {
-    tester.wsClient().organizationsOld().removeMember(organization.getKey(), user.getLogin());
+    tester.wsClient().organizations().removeMember(new RemoveMemberRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()));
   }
 }
index 462e4b2f1eefaec6f5330b4a5c7ca6d5a30c41e2..5b72379ff634568614d49881ea58347e7be802c1 100644 (file)
@@ -37,10 +37,12 @@ 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.organization.CreateRequest;
-import org.sonarqube.ws.client.organization.OrganizationService;
-import org.sonarqube.ws.client.organization.SearchRequest;
-import org.sonarqube.ws.client.organization.UpdateRequest;
+import org.sonarqube.ws.client.organizations.AddMemberRequest;
+import org.sonarqube.ws.client.organizations.CreateRequest;
+import org.sonarqube.ws.client.organizations.DeleteRequest;
+import org.sonarqube.ws.client.organizations.OrganizationsService;
+import org.sonarqube.ws.client.organizations.SearchRequest;
+import org.sonarqube.ws.client.organizations.UpdateRequest;
 import org.sonarqube.ws.client.permission.AddUserRequest;
 import org.sonarqube.ws.client.permission.PermissionsService;
 import org.sonarqube.ws.client.roots.SetRootRequest;
@@ -77,7 +79,7 @@ public class OrganizationTest {
 
   @Test
   public void default_organization_should_exist() {
-    Organization defaultOrg = tester.organizations().service().search(SearchRequest.builder().build())
+    Organization defaultOrg = tester.organizations().service().search(new SearchRequest())
       .getOrganizationsList()
       .stream()
       .filter(Organization::getGuarded)
@@ -89,19 +91,18 @@ public class OrganizationTest {
 
   @Test
   public void default_organization_can_not_be_deleted() {
-    expectBadRequestError(() -> tester.organizations().service().delete(DEFAULT_ORGANIZATION_KEY));
+    expectBadRequestError(() -> tester.organizations().service().delete(new DeleteRequest().setOrganization(DEFAULT_ORGANIZATION_KEY)));
   }
 
   @Test
   public void create_update_and_delete_organizations() {
-    OrganizationService service = tester.organizations().service();
+    OrganizationsService service = tester.organizations().service();
 
     Organization org = tester.organizations().generate(o -> o
       .setName(NAME)
       .setDescription(DESCRIPTION)
       .setUrl(URL)
-      .setAvatar(AVATAR_URL)
-      .build());
+      .setAvatar(AVATAR_URL));
     assertThat(org.getName()).isEqualTo(NAME);
     assertThat(org.getDescription()).isEqualTo(DESCRIPTION);
     assertThat(org.getUrl()).isEqualTo(URL);
@@ -111,35 +112,32 @@ public class OrganizationTest {
     assertThatBuiltInQualityProfilesExist(org);
 
     // update by key
-    service.update(new UpdateRequest.Builder()
+    service.update(new UpdateRequest()
       .setKey(org.getKey())
       .setName("new name")
       .setDescription("new description")
       .setUrl("new url")
-      .setAvatar("new avatar url")
-      .build());
+      .setAvatar("new avatar url"));
     verifyOrganization(org, "new name", "new description", "new url", "new avatar url");
 
     // remove optional fields
-    service.update(new UpdateRequest.Builder()
+    service.update(new UpdateRequest()
       .setKey(org.getKey())
       .setName("new name 2")
       .setDescription("")
       .setUrl("")
-      .setAvatar("")
-      .build());
+      .setAvatar(""));
     verifyOrganization(org, "new name 2", null, null, null);
 
     // delete organization
-    service.delete(org.getKey());
+    service.delete(new DeleteRequest().setOrganization(org.getKey()));
     assertThatOrganizationDoesNotExit(org);
     assertThatQualityProfilesDoNotExist(org);
 
     // create again
-    service.create(new CreateRequest.Builder()
+    service.create(new CreateRequest()
       .setName(NAME)
-      .setKey(org.getKey())
-      .build())
+      .setKey(org.getKey()))
       .getOrganization();
     verifyOrganization(org, NAME, null, null, null);
   }
@@ -149,9 +147,8 @@ public class OrganizationTest {
     // create organization without key
     String name = "Foo  Company to keyize";
     String expectedKey = "foo-company-to-keyize";
-    Organization createdOrganization = tester.organizations().service().create(new CreateRequest.Builder()
-      .setName(name)
-      .build())
+    Organization createdOrganization = tester.organizations().service().create(new CreateRequest()
+      .setName(name))
       .getOrganization();
     assertThat(createdOrganization.getKey()).isEqualTo(expectedKey);
     verifyOrganization(createdOrganization, name, null, null, null);
@@ -163,8 +160,8 @@ public class OrganizationTest {
     OrganizationTester anonymousTester = tester.asAnonymous().organizations();
 
     expectForbiddenError(() -> anonymousTester.generate());
-    expectUnauthorizedError(() -> anonymousTester.service().update(new UpdateRequest.Builder().setKey(org.getKey()).setName("new name").build()));
-    expectUnauthorizedError(() -> anonymousTester.service().delete(org.getKey()));
+    expectUnauthorizedError(() -> anonymousTester.service().update(new UpdateRequest().setKey(org.getKey()).setName("new name")));
+    expectUnauthorizedError(() -> anonymousTester.service().delete(new DeleteRequest().setOrganization(org.getKey())));
   }
 
   @Test
@@ -174,8 +171,8 @@ public class OrganizationTest {
     OrganizationTester userTester = tester.as(user.getLogin()).organizations();
 
     expectForbiddenError(() -> userTester.generate());
-    expectForbiddenError(() -> userTester.service().update(new UpdateRequest.Builder().setKey(org.getKey()).setName("new name").build()));
-    expectForbiddenError(() -> userTester.service().delete(org.getKey()));
+    expectForbiddenError(() -> userTester.service().update(new UpdateRequest().setKey(org.getKey()).setName("new name")));
+    expectForbiddenError(() -> userTester.service().delete(new DeleteRequest().setOrganization(org.getKey())));
   }
 
   @Test
@@ -187,7 +184,7 @@ public class OrganizationTest {
     Organization org = asUser.generate();
 
     // delete org, attempt recreate when no root anymore and ensure it can't anymore
-    asUser.service().delete(org.getKey());
+    asUser.service().delete(new DeleteRequest().setOrganization(org.getKey()));
 
     tester.wsClient().roots().unsetRoot(new UnsetRootRequest().setLogin(user.getLogin()));
     expectForbiddenError(() -> asUser.generate());
@@ -199,7 +196,7 @@ public class OrganizationTest {
     User user = tester.users().generate();
     Group group = tester.groups().generate(organization);
     // users.removeGroups("sonar-users");
-    tester.organizations().service().addMember(organization.getKey(), user.getLogin());
+    tester.organizations().service().addMember(new AddMemberRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()));
     addPermissionsToUser(organization.getKey(), user.getLogin(), "provisioning", "scan");
 
     runProjectAnalysis(orchestrator, "shared/xoo-sample",
@@ -255,7 +252,7 @@ public class OrganizationTest {
     ComponentsService componentsService = tester.wsClient().componentsOld();
     assertThat(searchSampleProject(organization.getKey(), componentsService).getComponentsList()).hasSize(1);
 
-    tester.organizations().service().delete(organization.getKey());
+    tester.organizations().service().delete(new DeleteRequest().setOrganization(organization.getKey()));
 
     expectNotFoundError(() -> searchSampleProject(organization.getKey(), componentsService));
     assertThatOrganizationDoesNotExit(organization);
@@ -265,7 +262,7 @@ public class OrganizationTest {
   public void return_groups_belonging_to_a_user_on_an_organization() throws Exception {
     Organization organization = tester.organizations().generate();
     User user = tester.users().generate();
-    tester.organizations().service().addMember(organization.getKey(), user.getLogin());
+    tester.organizations().service().addMember(new AddMemberRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()));
 
     Group group = tester.groups().generate(organization);
     tester.groups().addMemberToGroups(organization, user.getLogin(), group.getName());
@@ -294,7 +291,7 @@ public class OrganizationTest {
     assertThat(organization.getKey()).isNotEmpty();
     assertThat(organization.getGuarded()).isFalse();
 
-    List<Organization> reloadedOrgs = tester.organizations().service().search(SearchRequest.builder().build()).getOrganizationsList();
+    List<Organization> reloadedOrgs = tester.organizations().service().search(new SearchRequest()).getOrganizationsList();
     assertThat(reloadedOrgs)
       .filteredOn(o -> o.getKey().equals(organization.getKey()))
       .hasSize(1);
@@ -309,13 +306,13 @@ public class OrganizationTest {
   }
 
   private void assertThatOrganizationDoesNotExit(Organization org) {
-    SearchRequest request = new SearchRequest.Builder().setOrganizations(org.getKey()).build();
+    SearchRequest request = new SearchRequest().setOrganizations(singletonList(org.getKey()));
     assertThat(tester.organizations().service().search(request).getOrganizationsList()).isEmpty();
   }
 
   private void verifyOrganization(Organization createdOrganization, String name, String description, String url,
     String avatarUrl) {
-    SearchRequest request = new SearchRequest.Builder().setOrganizations(createdOrganization.getKey()).build();
+    SearchRequest request = new SearchRequest().setOrganizations(singletonList(createdOrganization.getKey()));
     List<Organization> result = tester.organizations().service().search(request).getOrganizationsList();
     assertThat(result).hasSize(1);
     Organization searchedOrganization = result.get(0);
index aeaf297a8445b970cf43a64811611b249e3ae1f5..c6802d79c12d377ff7e60702b860ea60ae7980cb 100644 (file)
@@ -29,7 +29,7 @@ import org.junit.Test;
 import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.Organizations;
 import org.sonarqube.ws.Users;
-import org.sonarqube.ws.client.organization.SearchRequest;
+import org.sonarqube.ws.client.organizations.SearchRequest;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -52,7 +52,7 @@ public class PersonalOrganizationTest {
   public void personal_organizations_are_created_for_new_users() {
     Users.CreateWsResponse.User user = tester.users().generate();
 
-    List<Organizations.Organization> existing = tester.wsClient().organizationsOld().search(SearchRequest.builder().build()).getOrganizationsList();
+    List<Organizations.Organization> existing = tester.wsClient().organizations().search(new SearchRequest()).getOrganizationsList();
     assertThat(existing)
       .filteredOn(Organizations.Organization::getGuarded)
       .filteredOn(o -> o.getKey().equals(user.getLogin()))
index ef5199d1b6471b302382b79495ce5955898a49e3..c3866bb6c0faaa580b65e8d11fca92edc60a1c60 100644 (file)
@@ -37,6 +37,7 @@ import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile;
 import org.sonarqube.ws.Users.CreateWsResponse.User;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.PostRequest;
+import org.sonarqube.ws.client.organizations.DeleteRequest;
 import org.sonarqube.ws.client.qualityprofile.AddProjectRequest;
 import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest;
 import org.sonarqube.ws.client.qualityprofile.CopyRequest;
@@ -152,7 +153,7 @@ public class CustomQualityProfilesTest {
     adminSession.service().changeParent(
       ChangeParentRequest.builder().setParentKey(builtInProfile.getKey()).setProfileKey(inheritedProfile2.getKey()).build());
 
-    tester.organizations().service().delete(org.getKey());
+    tester.organizations().service().delete(new DeleteRequest().setOrganization(org.getKey()));
 
     expectMissingError(() -> tester.qProfiles().service().search(new SearchRequest()
       .setOrganizationKey(org.getKey())));
index 0fdfabbdaed21f6e08321d33949a4bf6daf5e509..8c3b52cbeb2b6b51d61b0bf7e77ba8190dc23938 100644 (file)
@@ -31,6 +31,7 @@ import org.sonarqube.tests.Category6Suite;
 import org.sonarqube.ws.UserGroups.Group;
 import org.sonarqube.ws.Users.CreateWsResponse.User;
 import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.organizations.AddMemberRequest;
 
 public class OrganizationIdentityProviderTest {
 
@@ -83,7 +84,7 @@ public class OrganizationIdentityProviderTest {
     Group group = tester.groups().generate(null);
     User user = tester.users().generate();
     // Add user as member of default organization
-    tester.wsClient().organizationsOld().addMember("default-organization", user.getLogin());
+    tester.wsClient().organizations().addMember(new AddMemberRequest().setOrganization("default-organization").setLogin(user.getLogin()));
     tester.groups().assertThatUserIsMemberOf(null, user.getLogin(), "Members");
     enableUserCreationByAuthPlugin(user.getLogin());
     // No group is returned by the plugin