From: Daniel Schwarz Date: Sat, 2 Dec 2017 14:21:48 +0000 (+0100) Subject: Remove legacy sonar-ws code for permissions X-Git-Tag: 7.0-RC1~186 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b6514bf56a49f3e9ad9bd9593e9c678284cfcbf7;p=sonarqube.git Remove legacy sonar-ws code for permissions --- diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java index 6c3aea44441..e0cd34ed343 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java @@ -54,7 +54,6 @@ class DefaultWsClient implements WsClient { private final WsConnector wsConnector; private final OrganizationsService organizations; - private final org.sonarqube.ws.client.permission.PermissionsService permissionsOld; private final PermissionsService permissions; private final ComponentsService components; private final FavoritesService favoritesService; @@ -83,7 +82,6 @@ class DefaultWsClient implements WsClient { DefaultWsClient(WsConnector wsConnector) { this.wsConnector = wsConnector; this.organizations = new OrganizationsService(wsConnector); - this.permissionsOld = new org.sonarqube.ws.client.permission.PermissionsService(wsConnector); this.permissions = new PermissionsService(wsConnector); this.components = new ComponentsService(wsConnector); this.favoritesService = new FavoritesService(wsConnector); @@ -120,11 +118,6 @@ class DefaultWsClient implements WsClient { return organizations; } - @Override - public org.sonarqube.ws.client.permission.PermissionsService permissionsOld() { - return this.permissionsOld; - } - @Override public PermissionsService permissions() { return permissions; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java index 505c15111cc..82becf77c3d 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java @@ -74,12 +74,6 @@ public interface WsClient { NotificationsService notifications(); - /** - * @deprecated since 7.0 use {@link #permissions()} instead - */ - @Deprecated - org.sonarqube.ws.client.permission.PermissionsService permissionsOld(); - PermissionsService permissions(); /** diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupRequest.java deleted file mode 100644 index 4a70ebc5ebb..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupRequest.java +++ /dev/null @@ -1,93 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class AddGroupRequest { - private String permission; - private String groupId; - private String organization; - private String groupName; - private String projectId; - private String projectKey; - - public String getPermission() { - return permission; - } - - public AddGroupRequest setPermission(String permission) { - this.permission = requireNonNull(permission, "permission must not be null"); - return this; - } - - @CheckForNull - public String getGroupId() { - return groupId; - } - - public AddGroupRequest setGroupId(@Nullable String groupId) { - this.groupId = groupId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public AddGroupRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getGroupName() { - return groupName; - } - - public AddGroupRequest setGroupName(@Nullable String groupName) { - this.groupName = groupName; - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public AddGroupRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public AddGroupRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateRequest.java deleted file mode 100644 index a28c8ce7131..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddGroupToTemplateRequest.java +++ /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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class AddGroupToTemplateRequest { - private String groupId; - private String groupName; - private String permission; - private String templateId; - private String templateName; - - @CheckForNull - public String getGroupId() { - return groupId; - } - - public AddGroupToTemplateRequest setGroupId(@Nullable String groupId) { - this.groupId = groupId; - return this; - } - - @CheckForNull - public String getGroupName() { - return groupName; - } - - public AddGroupToTemplateRequest setGroupName(@Nullable String groupName) { - this.groupName = groupName; - return this; - } - - public String getPermission() { - return permission; - } - - public AddGroupToTemplateRequest setPermission(String permission) { - this.permission = requireNonNull(permission, "permission must not be null"); - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public AddGroupToTemplateRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public AddGroupToTemplateRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddProjectCreatorToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddProjectCreatorToTemplateRequest.java deleted file mode 100644 index a17c90cfc80..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddProjectCreatorToTemplateRequest.java +++ /dev/null @@ -1,99 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -import static java.util.Objects.requireNonNull; - -@Immutable -public class AddProjectCreatorToTemplateRequest { - private final String templateId; - private final String organization; - private final String templateName; - private final String permission; - - private AddProjectCreatorToTemplateRequest(Builder builder) { - this.templateId = builder.templateId; - this.organization = builder.organization; - this.templateName = builder.templateName; - this.permission = requireNonNull(builder.permission); - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public String getPermission() { - return permission; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String templateId; - private String organization; - private String templateName; - private String permission; - - private Builder() { - // enforce method constructor - } - - public Builder setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - public Builder setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - public Builder setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } - - public Builder setPermission(@Nullable String permission) { - this.permission = permission; - return this; - } - - public AddProjectCreatorToTemplateRequest build() { - return new AddProjectCreatorToTemplateRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserRequest.java deleted file mode 100644 index fa3c9beef44..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserRequest.java +++ /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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class AddUserRequest { - private String login; - private String permission; - private String projectId; - private String projectKey; - private String organization; - - public String getLogin() { - return login; - } - - public AddUserRequest setLogin(String login) { - this.login = requireNonNull(login, "login must not be null"); - return this; - } - - public String getPermission() { - return permission; - } - - public AddUserRequest setPermission(String permission) { - this.permission = requireNonNull(permission, "permission must not be null"); - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public AddUserRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public AddUserRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public AddUserRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserToTemplateRequest.java deleted file mode 100644 index 5b4c686471d..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/AddUserToTemplateRequest.java +++ /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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class AddUserToTemplateRequest { - private String login; - private String permission; - private String templateId; - private String organization; - private String templateName; - - public String getLogin() { - return login; - } - - public AddUserToTemplateRequest setLogin(String login) { - this.login = requireNonNull(login); - return this; - } - - public String getPermission() { - return permission; - } - - public AddUserToTemplateRequest setPermission(String permission) { - this.permission = requireNonNull(permission); - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public AddUserToTemplateRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public AddUserToTemplateRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public AddUserToTemplateRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateRequest.java deleted file mode 100644 index 525e1a53b77..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateRequest.java +++ /dev/null @@ -1,80 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class ApplyTemplateRequest { - private String projectId; - private String projectKey; - private String templateId; - private String organization; - private String templateName; - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public ApplyTemplateRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public ApplyTemplateRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public ApplyTemplateRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public ApplyTemplateRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public ApplyTemplateRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/BulkApplyTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/BulkApplyTemplateRequest.java deleted file mode 100644 index 6b78de83cd1..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/BulkApplyTemplateRequest.java +++ /dev/null @@ -1,128 +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.permission; - -import java.util.Collection; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.sonar.api.resources.Qualifiers; - -import static java.util.Collections.singleton; -import static java.util.Objects.requireNonNull; - -public class BulkApplyTemplateRequest { - private String templateId; - private String organization; - private String templateName; - private String query; - private Collection qualifiers = singleton(Qualifiers.PROJECT); - private String visibility; - private String analyzedBefore; - private boolean onProvisionedOnly = false; - private Collection projects; - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public BulkApplyTemplateRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public BulkApplyTemplateRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public BulkApplyTemplateRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public BulkApplyTemplateRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - public Collection getQualifiers() { - return qualifiers; - } - - public BulkApplyTemplateRequest setQualifiers(Collection qualifiers) { - this.qualifiers = requireNonNull(qualifiers); - return this; - } - - @CheckForNull - public String getVisibility() { - return visibility; - } - - public BulkApplyTemplateRequest setVisibility(@Nullable String visibility) { - this.visibility = visibility; - return this; - } - - @CheckForNull - public String getAnalyzedBefore() { - return analyzedBefore; - } - - public BulkApplyTemplateRequest setAnalyzedBefore(@Nullable String analyzedBefore) { - this.analyzedBefore = analyzedBefore; - return this; - } - - public boolean isOnProvisionedOnly() { - return onProvisionedOnly; - } - - public BulkApplyTemplateRequest setOnProvisionedOnly(boolean onProvisionedOnly) { - this.onProvisionedOnly = onProvisionedOnly; - return this; - } - - @CheckForNull - public Collection getProjects() { - return projects; - } - - public BulkApplyTemplateRequest setProjects(@Nullable Collection projects) { - this.projects = projects; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/CreateTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/CreateTemplateRequest.java deleted file mode 100644 index 6b1768a1a3a..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/CreateTemplateRequest.java +++ /dev/null @@ -1,71 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class CreateTemplateRequest { - private String description; - private String name; - private String projectKeyPattern; - private String organization; - - @CheckForNull - public String getDescription() { - return description; - } - - public CreateTemplateRequest setDescription(@Nullable String description) { - this.description = description; - return this; - } - - public String getName() { - return name; - } - - public CreateTemplateRequest setName(String name) { - this.name = requireNonNull(name); - return this; - } - - @CheckForNull - public String getProjectKeyPattern() { - return projectKeyPattern; - } - - public CreateTemplateRequest setProjectKeyPattern(@Nullable String projectKeyPattern) { - this.projectKeyPattern = projectKeyPattern; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public CreateTemplateRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/DeleteTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/DeleteTemplateRequest.java deleted file mode 100644 index 69582aec5bc..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/DeleteTemplateRequest.java +++ /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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class DeleteTemplateRequest { - private String templateId; - private String organization; - private String templateName; - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public DeleteTemplateRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public DeleteTemplateRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public DeleteTemplateRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsRequest.java deleted file mode 100644 index 641729bae9d..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/GroupsRequest.java +++ /dev/null @@ -1,92 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class GroupsRequest { - private String permission; - private String projectId; - private String projectKey; - private Integer page; - private Integer pageSize; - private String query; - - @CheckForNull - public String getPermission() { - return permission; - } - - public GroupsRequest setPermission(@Nullable String permission) { - this.permission = permission; - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public GroupsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public GroupsRequest setProjectKey(String projectKey) { - this.projectKey = projectKey; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public GroupsRequest setPage(int page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public GroupsRequest setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public GroupsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java deleted file mode 100644 index c87986ac518..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java +++ /dev/null @@ -1,247 +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.permission; - -import org.sonarqube.ws.Permissions; -import org.sonarqube.ws.Permissions.CreateTemplateWsResponse; -import org.sonarqube.ws.Permissions.SearchProjectPermissionsWsResponse; -import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse; -import org.sonarqube.ws.Permissions.UpdateTemplateWsResponse; -import org.sonarqube.ws.Permissions.UsersWsResponse; -import org.sonarqube.ws.Permissions.WsSearchGlobalPermissionsResponse; -import org.sonarqube.ws.client.BaseService; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.WsConnector; -import org.sonarqube.ws.client.project.ProjectsWsParameters; - -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_DESCRIPTION; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_NAME; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_ORGANIZATION; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY_PATTERN; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_QUALIFIER; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_ID; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN; - -/** - * @deprecated since 7.0, use {@link PermissionsService} instead - */ -@Deprecated -public class PermissionsService extends BaseService { - - public PermissionsService(WsConnector wsConnector) { - super(wsConnector, PermissionsWsParameters.CONTROLLER); - } - - public Permissions.WsGroupsResponse groups(GroupsRequest request) { - GetRequest get = new GetRequest(path("groups")) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) - .setParam("p", request.getPage()) - .setParam("ps", request.getPageSize()) - .setParam("q", request.getQuery()); - return call(get, Permissions.WsGroupsResponse.parser()); - } - - public void addGroup(AddGroupRequest request) { - call(new PostRequest(path("add_group")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) - .setParam(PARAM_GROUP_ID, request.getGroupId()) - .setParam(PARAM_GROUP_NAME, request.getGroupName())); - } - - public void addGroupToTemplate(AddGroupToTemplateRequest request) { - call(new PostRequest(path("add_group_to_template")) - .setParam(PARAM_GROUP_ID, request.getGroupId()) - .setParam(PARAM_GROUP_NAME, request.getGroupName()) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) - .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); - } - - public void addUser(AddUserRequest request) { - call(new PostRequest(path("add_user")) - .setParam(PARAM_USER_LOGIN, request.getLogin()) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) - .setParam(PARAM_ORGANIZATION, request.getOrganization())); - } - - public void addUserToTemplate(AddUserToTemplateRequest request) { - call(new PostRequest(path("add_user_to_template")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_USER_LOGIN, request.getLogin()) - .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) - .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); - } - - public void addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest request) { - call(new PostRequest(path("add_project_creator_to_template")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) - .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); - } - - public void applyTemplate(ApplyTemplateRequest request) { - call(new PostRequest(path("apply_template")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) - .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) - .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); - } - - public void bulkApplyTemplate(BulkApplyTemplateRequest request) { - call(new PostRequest(path("bulk_apply_template")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) - .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName()) - .setParam("q", request.getQuery()) - .setParam(ProjectsWsParameters.PARAM_QUALIFIERS, inlineMultipleParamValue(request.getQualifiers())) - .setParam(ProjectsWsParameters.PARAM_VISIBILITY, request.getVisibility()) - .setParam(ProjectsWsParameters.PARAM_ANALYZED_BEFORE, request.getAnalyzedBefore()) - .setParam(ProjectsWsParameters.PARAM_ON_PROVISIONED_ONLY, request.isOnProvisionedOnly()) - .setParam(ProjectsWsParameters.PARAM_PROJECTS, inlineMultipleParamValue(request.getProjects()))); - } - - public CreateTemplateWsResponse createTemplate(CreateTemplateRequest request) { - PostRequest post = new PostRequest(path("create_template")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_NAME, request.getName()) - .setParam(PARAM_DESCRIPTION, request.getDescription()) - .setParam(PARAM_PROJECT_KEY_PATTERN, request.getProjectKeyPattern()); - return call(post, CreateTemplateWsResponse.parser()); - } - - public void deleteTemplate(DeleteTemplateRequest request) { - call(new PostRequest(path("delete_template")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) - .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); - } - - public void removeGroup(RemoveGroupRequest request) { - call(new PostRequest(path("remove_group")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_GROUP_ID, request.getGroupId()) - .setParam(PARAM_GROUP_NAME, request.getGroupName()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey())); - } - - public void removeGroupFromTemplate(RemoveGroupFromTemplateRequest request) { - call(new PostRequest(path("remove_group_from_template")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_GROUP_ID, request.getGroupId()) - .setParam(PARAM_GROUP_NAME, request.getGroupName()) - .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) - .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); - } - - public void removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateRequest request) { - call( - new PostRequest(path("remove_project_creator_from_template")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) - .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); - } - - public void removeUser(RemoveUserRequest request) { - call(new PostRequest(path("remove_user")) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_USER_LOGIN, request.getLogin()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey())); - } - - public void removeUserFromTemplate(RemoveUserFromTemplateRequest request) { - call(new PostRequest(path("remove_user_from_template")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_USER_LOGIN, request.getLogin()) - .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) - .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); - } - - public WsSearchGlobalPermissionsResponse searchGlobalPermissions() { - GetRequest get = new GetRequest(path("search_global_permissions")); - return call(get, WsSearchGlobalPermissionsResponse.parser()); - } - - public SearchProjectPermissionsWsResponse searchProjectPermissions(SearchProjectPermissionsRequest request) { - GetRequest get = new GetRequest(path("search_project_permissions")) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) - .setParam(PARAM_QUALIFIER, request.getQualifier()) - .setParam("p", request.getPage()) - .setParam("ps", request.getPageSize()) - .setParam("q", request.getQuery()); - return call(get, SearchProjectPermissionsWsResponse.parser()); - } - - public SearchTemplatesWsResponse searchTemplates(SearchTemplatesRequest request) { - GetRequest get = new GetRequest(path("search_templates")) - .setParam("q", request.getQuery()); - return call(get, SearchTemplatesWsResponse.parser()); - } - - public void setDefaultTemplate(SetDefaultTemplateRequest request) { - call(new PostRequest(path("set_default_template")) - .setParam(PARAM_QUALIFIER, request.getQualifier()) - .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) - .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); - } - - public UpdateTemplateWsResponse updateTemplate(UpdateTemplateRequest request) { - return call(new PostRequest(path("update_template")) - .setParam(PARAM_DESCRIPTION, request.getDescription()) - .setParam(PARAM_ID, request.getId()) - .setParam(PARAM_NAME, request.getName()) - .setParam(PARAM_PROJECT_KEY_PATTERN, request.getProjectKeyPattern()), UpdateTemplateWsResponse.parser()); - } - - public UsersWsResponse users(UsersRequest request) { - return call(new GetRequest(path("users")) - .setParam(PARAM_ORGANIZATION, request.getOrganization()) - .setParam(PARAM_PERMISSION, request.getPermission()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) - .setParam("p", request.getPage()) - .setParam("ps", request.getPageSize()) - .setParam("q", request.getQuery()), UsersWsResponse.parser()); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupFromTemplateRequest.java deleted file mode 100644 index b64c3d6f1ab..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupFromTemplateRequest.java +++ /dev/null @@ -1,93 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class RemoveGroupFromTemplateRequest { - private String organization; - private String permission; - private String groupId; - private String groupName; - private String templateId; - private String templateName; - - public String getPermission() { - return permission; - } - - public RemoveGroupFromTemplateRequest setPermission(String permission) { - this.permission = requireNonNull(permission); - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public RemoveGroupFromTemplateRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getGroupId() { - return groupId; - } - - public RemoveGroupFromTemplateRequest setGroupId(@Nullable String groupId) { - this.groupId = groupId; - return this; - } - - @CheckForNull - public String getGroupName() { - return groupName; - } - - public RemoveGroupFromTemplateRequest setGroupName(@Nullable String groupName) { - this.groupName = groupName; - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public RemoveGroupFromTemplateRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public RemoveGroupFromTemplateRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupRequest.java deleted file mode 100644 index 290d3288305..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveGroupRequest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class RemoveGroupRequest { - private String organization; - private String groupId; - private String groupName; - private String permission; - private String projectId; - private String projectKey; - - @CheckForNull - public String getOrganization() { - return organization; - } - - public RemoveGroupRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getGroupId() { - return groupId; - } - - public RemoveGroupRequest setGroupId(@Nullable String groupId) { - this.groupId = groupId; - return this; - } - - @CheckForNull - public String getGroupName() { - return groupName; - } - - public RemoveGroupRequest setGroupName(@Nullable String groupName) { - this.groupName = groupName; - return this; - } - - public String getPermission() { - return permission; - } - - public RemoveGroupRequest setPermission(String permission) { - this.permission = permission; - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public RemoveGroupRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public RemoveGroupRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveProjectCreatorFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveProjectCreatorFromTemplateRequest.java deleted file mode 100644 index 49101053a82..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveProjectCreatorFromTemplateRequest.java +++ /dev/null @@ -1,99 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -import static java.util.Objects.requireNonNull; - -@Immutable -public class RemoveProjectCreatorFromTemplateRequest { - private final String templateId; - private final String organization; - private final String templateName; - private final String permission; - - private RemoveProjectCreatorFromTemplateRequest(Builder builder) { - this.templateId = builder.templateId; - this.organization = builder.organization; - this.templateName = builder.templateName; - this.permission = requireNonNull(builder.permission); - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public String getPermission() { - return permission; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String templateId; - private String organization; - private String templateName; - private String permission; - - private Builder() { - // enforce method constructor - } - - public Builder setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - public Builder setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - public Builder setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } - - public Builder setPermission(@Nullable String permission) { - this.permission = permission; - return this; - } - - public RemoveProjectCreatorFromTemplateRequest build() { - return new RemoveProjectCreatorFromTemplateRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateRequest.java deleted file mode 100644 index 4db6cc28eed..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserFromTemplateRequest.java +++ /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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class RemoveUserFromTemplateRequest { - private String login; - private String permission; - private String templateId; - private String organization; - private String templateName; - - public String getLogin() { - return login; - } - - public RemoveUserFromTemplateRequest setLogin(String login) { - this.login = requireNonNull(login); - return this; - } - - public String getPermission() { - return permission; - } - - public RemoveUserFromTemplateRequest setPermission(String permission) { - this.permission = requireNonNull(permission); - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public RemoveUserFromTemplateRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public RemoveUserFromTemplateRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public RemoveUserFromTemplateRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserRequest.java deleted file mode 100644 index 8e92b49fd78..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/RemoveUserRequest.java +++ /dev/null @@ -1,70 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class RemoveUserRequest { - private String permission; - private String login; - private String projectId; - private String projectKey; - - public String getPermission() { - return permission; - } - - public RemoveUserRequest setPermission(String permission) { - this.permission = requireNonNull(permission); - return this; - } - - public String getLogin() { - return login; - } - - public RemoveUserRequest setLogin(String login) { - this.login = requireNonNull(login); - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public RemoveUserRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public RemoveUserRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsRequest.java deleted file mode 100644 index 770dcbfe886..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchProjectPermissionsRequest.java +++ /dev/null @@ -1,92 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SearchProjectPermissionsRequest { - private String projectId; - private String projectKey; - private String qualifier; - private Integer page; - private Integer pageSize; - private String query; - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public SearchProjectPermissionsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public SearchProjectPermissionsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public SearchProjectPermissionsRequest setPage(int page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public SearchProjectPermissionsRequest setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public SearchProjectPermissionsRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - @CheckForNull - public String getQualifier() { - return qualifier; - } - - public SearchProjectPermissionsRequest setQualifier(@Nullable String qualifier) { - this.qualifier = qualifier; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesRequest.java deleted file mode 100644 index 33cf11ba2ad..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SearchTemplatesRequest.java +++ /dev/null @@ -1,47 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SearchTemplatesRequest { - private String query; - private String organizationUuid; - - @CheckForNull - public String getQuery() { - return query; - } - - public SearchTemplatesRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - public String getOrganizationUuid() { - return organizationUuid; - } - - public SearchTemplatesRequest setOrganizationUuid(String s) { - this.organizationUuid = s; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SetDefaultTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SetDefaultTemplateRequest.java deleted file mode 100644 index 14f6aae40c5..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/SetDefaultTemplateRequest.java +++ /dev/null @@ -1,70 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SetDefaultTemplateRequest { - private String qualifier; - private String templateId; - private String organization; - private String templateName; - - @CheckForNull - public String getQualifier() { - return qualifier; - } - - public SetDefaultTemplateRequest setQualifier(@Nullable String qualifier) { - this.qualifier = qualifier; - return this; - } - - @CheckForNull - public String getTemplateId() { - return templateId; - } - - public SetDefaultTemplateRequest setTemplateId(@Nullable String templateId) { - this.templateId = templateId; - return this; - } - - @CheckForNull - public String getOrganization() { - return organization; - } - - public SetDefaultTemplateRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getTemplateName() { - return templateName; - } - - public SetDefaultTemplateRequest setTemplateName(@Nullable String templateName) { - this.templateName = templateName; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UpdateTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UpdateTemplateRequest.java deleted file mode 100644 index 931af149676..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UpdateTemplateRequest.java +++ /dev/null @@ -1,71 +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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class UpdateTemplateRequest { - private String id; - private String description; - private String name; - private String projectKeyPattern; - - public String getId() { - return id; - } - - public UpdateTemplateRequest setId(String id) { - this.id = requireNonNull(id); - return this; - } - - @CheckForNull - public String getDescription() { - return description; - } - - public UpdateTemplateRequest setDescription(@Nullable String description) { - this.description = description; - return this; - } - - @CheckForNull - public String getName() { - return name; - } - - public UpdateTemplateRequest setName(@Nullable String name) { - this.name = name; - return this; - } - - @CheckForNull - public String getProjectKeyPattern() { - return projectKeyPattern; - } - - public UpdateTemplateRequest setProjectKeyPattern(@Nullable String projectKeyPattern) { - this.projectKeyPattern = projectKeyPattern; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UsersRequest.java deleted file mode 100644 index 08e4168b722..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/UsersRequest.java +++ /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.permission; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class UsersRequest { - private String organization; - private String permission; - private String projectId; - private String projectKey; - private String query; - private Integer page; - private Integer pageSize; - - @CheckForNull - public String getOrganization() { - return organization; - } - - public UsersRequest setOrganization(@Nullable String s) { - this.organization = s; - return this; - } - - @CheckForNull - public String getPermission() { - return permission; - } - - public UsersRequest setPermission(@Nullable String permission) { - this.permission = permission; - return this; - } - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public UsersRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public UsersRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } - - @CheckForNull - public String getQuery() { - return query; - } - - public UsersRequest setQuery(@Nullable String query) { - this.query = query; - return this; - } - - @CheckForNull - public Integer getPage() { - return page; - } - - public UsersRequest setPage(int page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public UsersRequest setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java deleted file mode 100644 index 9287748363f..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java +++ /dev/null @@ -1,530 +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.permission; - -import java.util.Arrays; -import org.junit.Rule; -import org.junit.Test; -import org.sonarqube.ws.Permissions; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -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; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_DESCRIPTION; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_NAME; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_ORGANIZATION; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY_PATTERN; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_QUALIFIER; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_ID; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME; -import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN; -import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ANALYZED_BEFORE; -import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ON_PROVISIONED_ONLY; -import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECTS; -import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_QUALIFIERS; -import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_VISIBILITY; - -public class PermissionsServiceTest { - private static final String ORGANIZATION_VALUE = "organization value"; - private static final String PERMISSION_VALUE = "permission value"; - private static final String PROJECT_ID_VALUE = "project id value"; - private static final String PROJECT_KEY_VALUE = "project key value"; - private static final String QUERY_VALUE = "query value"; - private static final int PAGE_VALUE = 66; - private static final int PAGE_SIZE_VALUE = 99; - private static final String GROUP_ID_VALUE = "group id value"; - private static final String GROUP_NAME_VALUE = "group name value"; - private static final String TEMPLATE_ID_VALUE = "template id value"; - private static final String TEMPLATE_NAME_VALUE = "template name value"; - private static final String LOGIN_VALUE = "login value"; - private static final String NAME_VALUE = "name value"; - private static final String DESCRIPTION_VALUE = "description value"; - private static final String PROJECT_KEY_PATTERN_VALUE = "project key pattern value"; - private static final String QUALIFIER_VALUE = "qualifier value"; - private static final String PARAM_Q = "q"; - private static final String PARAM_PS = "ps"; - private static final String PARAM_P = "p"; - - @Rule - public ServiceTester serviceTester = new ServiceTester<>(new PermissionsService(mock(WsConnector.class))); - - private PermissionsService underTest = serviceTester.getInstanceUnderTest(); - - @Test(expected = NullPointerException.class) - public void groups_throws_NPE_if_GroupWsRequest_argument_is_null() { - underTest.groups(null); - } - - @Test - public void groups_does_POST_on_WS_groups() { - GroupsRequest request = new GroupsRequest(); - underTest.groups(request - .setPermission(PERMISSION_VALUE) - .setProjectId(PROJECT_ID_VALUE) - .setProjectKey(PROJECT_KEY_VALUE) - .setPage(PAGE_VALUE) - .setPageSize(PAGE_SIZE_VALUE) - .setQuery(QUERY_VALUE)); - - assertThat(serviceTester.getGetParser()).isSameAs(Permissions.WsGroupsResponse.parser()); - GetRequest getRequest = serviceTester.getGetRequest(); - serviceTester.assertThat(getRequest) - .hasPath("groups") - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) - .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) - .hasParam(PARAM_P, PAGE_VALUE) - .hasParam(PARAM_PS, PAGE_SIZE_VALUE) - .hasParam(PARAM_Q, QUERY_VALUE) - .andNoOtherParam(); - } - - @Test - public void addGroup_does_POST_on_Ws_add_group() { - underTest.addGroup(new AddGroupRequest() - .setOrganization(ORGANIZATION_VALUE) - .setPermission(PERMISSION_VALUE) - .setProjectId(PROJECT_ID_VALUE) - .setProjectKey(PROJECT_KEY_VALUE) - .setGroupId(GROUP_ID_VALUE) - .setGroupName(GROUP_NAME_VALUE)); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("add_group") - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) - .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) - .hasParam(PARAM_GROUP_ID, GROUP_ID_VALUE) - .hasParam(PARAM_GROUP_NAME, GROUP_NAME_VALUE) - .andNoOtherParam(); - } - - @Test - public void addGroupToTemplate_does_POST_on_Ws_add_group_to_template() { - underTest.addGroupToTemplate( - new AddGroupToTemplateRequest() - .setGroupId(GROUP_ID_VALUE) - .setGroupName(GROUP_NAME_VALUE) - .setPermission(PERMISSION_VALUE) - .setTemplateId(TEMPLATE_ID_VALUE) - .setTemplateName(TEMPLATE_NAME_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("add_group_to_template") - .hasParam(PARAM_GROUP_ID, GROUP_ID_VALUE) - .hasParam(PARAM_GROUP_NAME, GROUP_NAME_VALUE) - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) - .andNoOtherParam(); - } - - @Test - public void addUser_does_POST_on_Ws_add_user() { - underTest.addUser(new AddUserRequest() - .setLogin(LOGIN_VALUE) - .setOrganization(ORGANIZATION_VALUE) - .setPermission(PERMISSION_VALUE) - .setProjectId(PROJECT_ID_VALUE) - .setProjectKey(PROJECT_KEY_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("add_user") - .hasParam(PARAM_USER_LOGIN, LOGIN_VALUE) - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) - .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) - .andNoOtherParam(); - } - - @Test - public void addUserToTemplate_does_POST_on_Ws_add_user_to_template() { - underTest.addUserToTemplate(new AddUserToTemplateRequest() - .setOrganization(ORGANIZATION_VALUE) - .setPermission(PERMISSION_VALUE) - .setLogin(LOGIN_VALUE) - .setTemplateId(TEMPLATE_ID_VALUE) - .setTemplateName(TEMPLATE_NAME_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("add_user_to_template") - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_USER_LOGIN, LOGIN_VALUE) - .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) - .andNoOtherParam(); - } - - @Test - public void applyTemplate_does_POST_on_Ws_apply_template() { - underTest.applyTemplate(new ApplyTemplateRequest() - .setOrganization(ORGANIZATION_VALUE) - .setProjectId(PROJECT_ID_VALUE) - .setProjectKey(PROJECT_KEY_VALUE) - .setTemplateId(TEMPLATE_ID_VALUE) - .setTemplateName(TEMPLATE_NAME_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("apply_template") - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) - .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) - .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) - .andNoOtherParam(); - } - - @Test - public void bulk_apply_template() { - underTest.bulkApplyTemplate(new BulkApplyTemplateRequest() - .setOrganization(ORGANIZATION_VALUE) - .setTemplateId(TEMPLATE_ID_VALUE) - .setTemplateName(TEMPLATE_NAME_VALUE) - .setQualifiers(Arrays.asList("TRK", "VW")) - .setQuery(QUERY_VALUE) - .setVisibility("private") - .setAnalyzedBefore("2017-04-01") - .setOnProvisionedOnly(true) - .setProjects(Arrays.asList("P1", "P2"))); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("bulk_apply_template") - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) - .hasParam("q", QUERY_VALUE) - .hasParam(PARAM_QUALIFIERS, "TRK,VW") - .hasParam(PARAM_VISIBILITY, "private") - .hasParam(PARAM_ANALYZED_BEFORE, "2017-04-01") - .hasParam(PARAM_ON_PROVISIONED_ONLY, "true") - .hasParam(PARAM_PROJECTS, "P1,P2") - .andNoOtherParam(); - } - - @Test - public void createTemplate_does_POST_on_Ws_create_template() { - underTest.createTemplate(new CreateTemplateRequest() - .setOrganization(ORGANIZATION_VALUE) - .setName(NAME_VALUE) - .setDescription(DESCRIPTION_VALUE) - .setProjectKeyPattern(PROJECT_KEY_PATTERN_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isSameAs(Permissions.CreateTemplateWsResponse.parser()); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("create_template") - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .hasParam(PARAM_NAME, NAME_VALUE) - .hasParam(PARAM_DESCRIPTION, DESCRIPTION_VALUE) - .hasParam(PARAM_PROJECT_KEY_PATTERN, PROJECT_KEY_PATTERN_VALUE) - .andNoOtherParam(); - } - - @Test - public void deleteTemplate_does_POST_on_Ws_delete_template() { - underTest.deleteTemplate(new DeleteTemplateRequest() - .setTemplateId(TEMPLATE_ID_VALUE) - .setTemplateName(TEMPLATE_NAME_VALUE) - .setOrganization(ORGANIZATION_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("delete_template") - .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .andNoOtherParam(); - } - - @Test - public void removeGroup_does_POST_on_Ws_remove_group() { - underTest.removeGroup(new RemoveGroupRequest() - .setPermission(PERMISSION_VALUE) - .setGroupId(GROUP_ID_VALUE) - .setGroupName(GROUP_NAME_VALUE) - .setProjectId(PROJECT_ID_VALUE) - .setProjectKey(PROJECT_KEY_VALUE) - .setOrganization(ORGANIZATION_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("remove_group") - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_GROUP_ID, GROUP_ID_VALUE) - .hasParam(PARAM_GROUP_NAME, GROUP_NAME_VALUE) - .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) - .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .andNoOtherParam(); - } - - @Test - public void removeGroupFromTemplate_does_POST_on_Ws_remove_group_from_template() { - underTest.removeGroupFromTemplate(new RemoveGroupFromTemplateRequest() - .setPermission(PERMISSION_VALUE) - .setGroupId(GROUP_ID_VALUE) - .setGroupName(GROUP_NAME_VALUE) - .setTemplateId(TEMPLATE_ID_VALUE) - .setTemplateName(TEMPLATE_NAME_VALUE) - .setOrganization(ORGANIZATION_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("remove_group_from_template") - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_GROUP_ID, GROUP_ID_VALUE) - .hasParam(PARAM_GROUP_NAME, GROUP_NAME_VALUE) - .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .andNoOtherParam(); - } - - @Test - public void removeUser_does_POST_on_Ws_remove_user() { - underTest.removeUser(new RemoveUserRequest() - .setPermission(PERMISSION_VALUE) - .setLogin(LOGIN_VALUE) - .setProjectId(PROJECT_ID_VALUE) - .setProjectKey(PROJECT_KEY_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("remove_user") - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_USER_LOGIN, LOGIN_VALUE) - .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) - .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) - .andNoOtherParam(); - } - - @Test - public void removeUserFromTemplate_does_POST_on_Ws_remove_user_from_template() { - underTest.removeUserFromTemplate(new RemoveUserFromTemplateRequest() - .setPermission(PERMISSION_VALUE) - .setLogin(LOGIN_VALUE) - .setTemplateId(TEMPLATE_ID_VALUE) - .setTemplateName(TEMPLATE_NAME_VALUE) - .setOrganization(ORGANIZATION_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("remove_user_from_template") - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_USER_LOGIN, LOGIN_VALUE) - .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .andNoOtherParam(); - } - - @Test - public void searchGlobalPermissions_does_GET_on_Ws_search_global_permissions() { - underTest.searchGlobalPermissions(); - - assertThat(serviceTester.getGetParser()).isSameAs(Permissions.WsSearchGlobalPermissionsResponse.parser()); - GetRequest getRequest = serviceTester.getGetRequest(); - serviceTester.assertThat(getRequest) - .hasPath("search_global_permissions") - .andNoOtherParam(); - } - - @Test - public void searchProjectPermissions_does_GET_on_Ws_search_project_permissions() { - underTest.searchProjectPermissions(new SearchProjectPermissionsRequest() - .setProjectId(PROJECT_ID_VALUE) - .setProjectKey(PROJECT_KEY_VALUE) - .setQualifier(QUALIFIER_VALUE) - .setPage(PAGE_VALUE) - .setPageSize(PAGE_SIZE_VALUE) - .setQuery(QUERY_VALUE) - ); - - assertThat(serviceTester.getGetParser()).isSameAs(Permissions.SearchProjectPermissionsWsResponse.parser()); - GetRequest getRequest = serviceTester.getGetRequest(); - serviceTester.assertThat(getRequest) - .hasPath("search_project_permissions") - .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) - .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) - .hasParam(PARAM_QUALIFIER, QUALIFIER_VALUE) - .hasParam(PARAM_P, PAGE_VALUE) - .hasParam(PARAM_PS, PAGE_SIZE_VALUE) - .hasParam(PARAM_Q, QUERY_VALUE) - .andNoOtherParam(); - } - - @Test - public void searchTemplates_does_GET_on_Ws_search_templates() { - underTest.searchTemplates(new SearchTemplatesRequest() - .setQuery(QUERY_VALUE) - ); - - assertThat(serviceTester.getGetParser()).isSameAs(Permissions.SearchTemplatesWsResponse.parser()); - GetRequest getRequest = serviceTester.getGetRequest(); - serviceTester.assertThat(getRequest) - .hasPath("search_templates") - .hasParam(PARAM_Q, QUERY_VALUE) - .andNoOtherParam(); - } - - @Test - public void setDefaultTemplate_does_POST_on_Ws_set_default_template() { - underTest.setDefaultTemplate(new SetDefaultTemplateRequest() - .setQualifier(QUALIFIER_VALUE) - .setTemplateId(TEMPLATE_ID_VALUE) - .setTemplateName(TEMPLATE_NAME_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("set_default_template") - .hasParam(PARAM_QUALIFIER, QUALIFIER_VALUE) - .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) - .andNoOtherParam(); - } - - @Test - public void updateTemplate_does_POST_on_Ws_update_template() { - underTest.updateTemplate(new UpdateTemplateRequest() - .setDescription(DESCRIPTION_VALUE) - .setId(TEMPLATE_ID_VALUE) - .setName(TEMPLATE_NAME_VALUE) - .setProjectKeyPattern(PROJECT_KEY_PATTERN_VALUE) - ); - - assertThat(serviceTester.getPostParser()).isSameAs(Permissions.UpdateTemplateWsResponse.parser()); - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("update_template") - .hasParam(PARAM_DESCRIPTION, DESCRIPTION_VALUE) - .hasParam(PARAM_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_NAME, TEMPLATE_NAME_VALUE) - .hasParam(PARAM_PROJECT_KEY_PATTERN, PROJECT_KEY_PATTERN_VALUE) - .andNoOtherParam(); - } - - @Test - public void add_project_creator_to_template() { - underTest.addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest.builder() - .setPermission(PERMISSION_VALUE) - .setTemplateId(TEMPLATE_ID_VALUE) - .setTemplateName(TEMPLATE_NAME_VALUE) - .setOrganization(ORGANIZATION_VALUE) - .build()); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest getRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(getRequest) - .hasPath("add_project_creator_to_template") - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .andNoOtherParam(); - } - - @Test - public void remove_project_creator_from_template() { - underTest.removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateRequest.builder() - .setPermission(PERMISSION_VALUE) - .setTemplateId(TEMPLATE_ID_VALUE) - .setTemplateName(TEMPLATE_NAME_VALUE) - .setOrganization(ORGANIZATION_VALUE) - .build()); - - assertThat(serviceTester.getPostParser()).isNull(); - PostRequest getRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(getRequest) - .hasPath("remove_project_creator_from_template") - .hasParam(PARAM_PERMISSION, PERMISSION_VALUE) - .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE) - .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE) - .hasParam(PARAM_ORGANIZATION, ORGANIZATION_VALUE) - .andNoOtherParam(); - } - - @Test - public void users() { - underTest.users(new UsersRequest() - .setOrganization("org") - .setProjectKey("project") - .setProjectId("ABCD") - .setPermission("user") - .setQuery("query") - .setPage(10) - .setPageSize(50) - ); - - assertThat(serviceTester.getGetParser()).isSameAs(Permissions.UsersWsResponse.parser()); - GetRequest getRequest = serviceTester.getGetRequest(); - - serviceTester.assertThat(getRequest) - .hasPath("users") - .hasParam("organization", "org") - .hasParam("projectKey", "project") - .hasParam("projectId", "ABCD") - .hasParam("permission", "user") - .hasParam("q", "query") - .hasParam("p", "10") - .hasParam("ps", "50") - .andNoOtherParam(); - } -} diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java index 02c80ef8f3b..66deb8abc71 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java @@ -32,9 +32,9 @@ import org.sonarqube.ws.Favorites.Favorite; import org.sonarqube.ws.Permissions; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.favorites.SearchRequest; -import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateRequest; -import org.sonarqube.ws.client.permission.RemoveProjectCreatorFromTemplateRequest; -import org.sonarqube.ws.client.permission.SearchTemplatesRequest; +import org.sonarqube.ws.client.permissions.AddProjectCreatorToTemplateRequest; +import org.sonarqube.ws.client.permissions.RemoveProjectCreatorFromTemplateRequest; +import org.sonarqube.ws.client.permissions.SearchTemplatesRequest; import static com.sonar.orchestrator.container.Server.ADMIN_LOGIN; import static com.sonar.orchestrator.container.Server.ADMIN_PASSWORD; @@ -105,20 +105,18 @@ public class FavoriteTest { } private void addProjectCreatorPermission() { - Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissionsOld().searchTemplates(new SearchTemplatesRequest()); + Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesRequest()); assertThat(permissionTemplates.getDefaultTemplatesCount()).isEqualTo(1); - adminWsClient.permissionsOld().addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest.builder() + adminWsClient.permissions().addProjectCreatorToTemplate(new AddProjectCreatorToTemplateRequest() .setTemplateId(permissionTemplates.getDefaultTemplates(0).getTemplateId()) - .setPermission("admin") - .build()); + .setPermission("admin")); } private void removeProjectCreatorPermission() { - Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissionsOld().searchTemplates(new SearchTemplatesRequest()); + Permissions.SearchTemplatesWsResponse permissionTemplates = adminWsClient.permissions().searchTemplates(new SearchTemplatesRequest()); assertThat(permissionTemplates.getDefaultTemplatesCount()).isEqualTo(1); - adminWsClient.permissionsOld().removeProjectCreatorFromTemplate(RemoveProjectCreatorFromTemplateRequest.builder() + adminWsClient.permissions().removeProjectCreatorFromTemplate(new RemoveProjectCreatorFromTemplateRequest() .setTemplateId(permissionTemplates.getDefaultTemplates(0).getTemplateId()) - .setPermission("admin") - .build()); + .setPermission("admin")); } } diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java index e567234c60a..7e465b4b04f 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java @@ -31,7 +31,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.ws.UserTokens; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.sonarqube.ws.client.usertokens.GenerateRequest; import org.sonarqube.ws.client.usertokens.RevokeRequest; import org.sonarqube.ws.client.usertokens.UserTokensService; @@ -147,7 +147,7 @@ public class PermissionTest { } private void addUserPermission(String login, String permission, @Nullable String projectKey) { - adminWsClient.permissionsOld().addUser(new AddUserRequest() + adminWsClient.permissions().addUser(new AddUserRequest() .setLogin(login) .setPermission(permission) .setProjectKey(projectKey)); diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java index ad2add0614f..6f6a4df3f49 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/ExecuteAnalysisPermissionTest.java @@ -27,9 +27,9 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.client.permission.AddGroupRequest; -import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateRequest; -import org.sonarqube.ws.client.permission.RemoveGroupRequest; +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 static org.assertj.core.api.Assertions.assertThat; @@ -112,24 +112,23 @@ public class ExecuteAnalysisPermissionTest { @Test public void execute_analysis_with_scan_on_default_template() { removeGlobalPermission("anyone", "scan"); - tester.wsClient().permissionsOld().addProjectCreatorToTemplate(AddProjectCreatorToTemplateRequest.builder() + tester.wsClient().permissions().addProjectCreatorToTemplate(new AddProjectCreatorToTemplateRequest() .setPermission("scan") - .setTemplateId("default_template") - .build()); + .setTemplateId("default_template")); runProjectAnalysis(orchestrator, "shared/xoo-sample", "sonar.login", USER_LOGIN, "sonar.password", USER_PASSWORD, "sonar.projectKey", "ANOTHER_PROJECT_KEY"); } private void addProjectPermission(String groupName, String projectKey, String permission) { - tester.wsClient().permissionsOld().addGroup(new AddGroupRequest().setGroupName(groupName).setProjectKey(projectKey).setPermission(permission)); + tester.wsClient().permissions().addGroup(new AddGroupRequest().setGroupName(groupName).setProjectKey(projectKey).setPermission(permission)); } private void addGlobalPermission(String groupName, String permission) { - tester.wsClient().permissionsOld().addGroup(new AddGroupRequest().setGroupName(groupName).setPermission(permission)); + tester.wsClient().permissions().addGroup(new AddGroupRequest().setGroupName(groupName).setPermission(permission)); } private void removeGlobalPermission(String groupName, String permission) { - tester.wsClient().permissionsOld().removeGroup(new RemoveGroupRequest().setGroupName(groupName).setPermission(permission)); + tester.wsClient().permissions().removeGroup(new RemoveGroupRequest().setGroupName(groupName).setPermission(permission)); } private static void executeLoggedAnalysis() { diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java index a77453f643f..72e9c16b235 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/IssuePermissionTest.java @@ -34,7 +34,7 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Issues; import org.sonarqube.ws.client.issues.BulkChangeRequest; import org.sonarqube.ws.client.issues.ChangelogRequest; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.sonarqube.ws.client.project.UpdateVisibilityRequest; import util.ItUtils; @@ -265,7 +265,7 @@ public class IssuePermissionTest { } private void addUserPermission(String login, String projectKey, String permission) { - tester.wsClient().permissionsOld().addUser( + tester.wsClient().permissions().addUser( new AddUserRequest() .setLogin(login) .setProjectKey(projectKey) diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java index 955605c06dd..018a247a568 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionSearchTest.java @@ -30,18 +30,7 @@ import org.sonarqube.ws.Permissions; import org.sonarqube.ws.Permissions.Permission; import org.sonarqube.ws.Permissions.SearchTemplatesWsResponse; import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.permission.AddGroupToTemplateRequest; -import org.sonarqube.ws.client.permission.AddGroupRequest; -import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateRequest; -import org.sonarqube.ws.client.permission.AddUserToTemplateRequest; -import org.sonarqube.ws.client.permission.AddUserRequest; -import org.sonarqube.ws.client.permission.CreateTemplateRequest; -import org.sonarqube.ws.client.permission.GroupsRequest; -import org.sonarqube.ws.client.permission.RemoveGroupFromTemplateRequest; -import org.sonarqube.ws.client.permission.RemoveProjectCreatorFromTemplateRequest; -import org.sonarqube.ws.client.permission.RemoveUserFromTemplateRequest; -import org.sonarqube.ws.client.permission.SearchTemplatesRequest; -import org.sonarqube.ws.client.permission.UsersRequest; +import org.sonarqube.ws.client.permissions.*; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -78,26 +67,26 @@ public class PermissionSearchTest { @Test public void permission_web_services() { - tester.wsClient().permissionsOld().addUser( + tester.wsClient().permissions().addUser( new AddUserRequest() .setPermission("admin") .setLogin(LOGIN)); - tester.wsClient().permissionsOld().addGroup( + tester.wsClient().permissions().addGroup( new AddGroupRequest() .setPermission("admin") .setGroupName(GROUP_NAME)); - Permissions.WsSearchGlobalPermissionsResponse searchGlobalPermissionsWsResponse = tester.wsClient().permissionsOld().searchGlobalPermissions(); + Permissions.WsSearchGlobalPermissionsResponse searchGlobalPermissionsWsResponse = tester.wsClient().permissions().searchGlobalPermissions(new SearchGlobalPermissionsRequest()); assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getKey()).isEqualTo("admin"); assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getUsersCount()).isEqualTo(1); // by default, a group has the global admin permission assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getGroupsCount()).isEqualTo(2); - Permissions.UsersWsResponse users = tester.wsClient().permissionsOld() + Permissions.UsersWsResponse users = tester.wsClient().permissions() .users(new UsersRequest().setPermission("admin")); assertThat(users.getUsersList()).extracting("login").contains(LOGIN); - Permissions.WsGroupsResponse groupsResponse = tester.wsClient().permissionsOld() + Permissions.WsGroupsResponse groupsResponse = tester.wsClient().permissions() .groups(new GroupsRequest() .setPermission("admin")); assertThat(groupsResponse.getGroupsList()).extracting("name").contains(GROUP_NAME); @@ -105,61 +94,59 @@ public class PermissionSearchTest { @Test public void template_permission_web_services() { - Permissions.CreateTemplateWsResponse createTemplateWsResponse = tester.wsClient().permissionsOld().createTemplate( + Permissions.CreateTemplateWsResponse createTemplateWsResponse = tester.wsClient().permissions().createTemplate( new CreateTemplateRequest() .setName("my-new-template") .setDescription("template-used-in-tests")); assertThat(createTemplateWsResponse.getPermissionTemplate().getName()).isEqualTo("my-new-template"); - tester.wsClient().permissionsOld().addUserToTemplate( + tester.wsClient().permissions().addUserToTemplate( new AddUserToTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setLogin(LOGIN)); - tester.wsClient().permissionsOld().addGroupToTemplate( + tester.wsClient().permissions().addGroupToTemplate( new AddGroupToTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setGroupName(GROUP_NAME)); - tester.wsClient().permissionsOld().addProjectCreatorToTemplate( - AddProjectCreatorToTemplateRequest.builder() + tester.wsClient().permissions().addProjectCreatorToTemplate( + new AddProjectCreatorToTemplateRequest() .setPermission("admin") - .setTemplateName("my-new-template") - .build()); + .setTemplateName("my-new-template")); - SearchTemplatesWsResponse searchTemplatesWsResponse = tester.wsClient().permissionsOld().searchTemplates( + SearchTemplatesWsResponse searchTemplatesWsResponse = tester.wsClient().permissions().searchTemplates( new SearchTemplatesRequest() - .setQuery("my-new-template")); + .setQ("my-new-template")); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getName()).isEqualTo("my-new-template"); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getKey()).isEqualTo("admin"); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getUsersCount()).isEqualTo(1); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getGroupsCount()).isEqualTo(1); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getWithProjectCreator()).isTrue(); - tester.wsClient().permissionsOld().removeGroupFromTemplate( + tester.wsClient().permissions().removeGroupFromTemplate( new RemoveGroupFromTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setGroupName(GROUP_NAME)); - tester.wsClient().permissionsOld().removeUserFromTemplate( + tester.wsClient().permissions().removeUserFromTemplate( new RemoveUserFromTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") .setLogin(LOGIN)); - tester.wsClient().permissionsOld().removeProjectCreatorFromTemplate( - RemoveProjectCreatorFromTemplateRequest.builder() + tester.wsClient().permissions().removeProjectCreatorFromTemplate( + new RemoveProjectCreatorFromTemplateRequest() .setPermission("admin") .setTemplateName("my-new-template") - .build() ); - SearchTemplatesWsResponse clearedSearchTemplatesWsResponse = tester.wsClient().permissionsOld().searchTemplates( + SearchTemplatesWsResponse clearedSearchTemplatesWsResponse = tester.wsClient().permissions().searchTemplates( new SearchTemplatesRequest() - .setQuery("my-new-template")); + .setQ("my-new-template")); assertThat(clearedSearchTemplatesWsResponse.getPermissionTemplates(0).getPermissionsList()) .extracting(Permission::getUsersCount, Permission::getGroupsCount, Permission::getWithProjectCreator) .hasSize(5) diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java index d88784cd1be..1e5e9f0cd43 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplatePageTest.java @@ -26,9 +26,9 @@ import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage; import org.sonarqube.ws.Permissions; -import org.sonarqube.ws.client.permission.AddUserToTemplateRequest; -import org.sonarqube.ws.client.permission.CreateTemplateRequest; -import org.sonarqube.ws.client.permission.UsersRequest; +import org.sonarqube.ws.client.permissions.AddUserToTemplateRequest; +import org.sonarqube.ws.client.permissions.CreateTemplateRequest; +import org.sonarqube.ws.client.permissions.UsersRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -48,8 +48,8 @@ public class PermissionTemplatePageTest { String userLogin = tester.users().generateMemberOfDefaultOrganization().getLogin(); String adminLogin = tester.users().generateAdministratorOnDefaultOrganization().getLogin(); - tester.wsClient().permissionsOld().createTemplate(new CreateTemplateRequest().setName("foo-template")); - tester.wsClient().permissionsOld().addUserToTemplate( + tester.wsClient().permissions().createTemplate(new CreateTemplateRequest().setName("foo-template")); + tester.wsClient().permissions().addUserToTemplate( new AddUserToTemplateRequest() .setPermission("admin") .setTemplateName("foo-template") @@ -58,7 +58,7 @@ public class PermissionTemplatePageTest { ProjectsManagementPage page = tester.openBrowser().logIn().submitCredentials(adminLogin).openProjectsManagement(); page.shouldHaveProject(project); page.bulkApplyPermissionTemplate("foo-template"); - Permissions.UsersWsResponse usersResponse = tester.wsClient().permissionsOld().users(new UsersRequest() + Permissions.UsersWsResponse usersResponse = tester.wsClient().permissions().users(new UsersRequest() .setProjectKey(project) .setPermission("admin") ); diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java index 6379e36a30a..bdfa61ca757 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/PermissionTemplateTest.java @@ -38,12 +38,7 @@ import org.sonarqube.ws.Projects.CreateWsResponse.Project; import org.sonarqube.ws.Users.CreateWsResponse; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.components.SearchProjectsRequest; -import org.sonarqube.ws.client.permission.AddUserToTemplateRequest; -import org.sonarqube.ws.client.permission.ApplyTemplateRequest; -import org.sonarqube.ws.client.permission.BulkApplyTemplateRequest; -import org.sonarqube.ws.client.permission.CreateTemplateRequest; -import org.sonarqube.ws.client.permission.PermissionsService; -import org.sonarqube.ws.client.permission.UsersRequest; +import org.sonarqube.ws.client.permissions.*; import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; import static org.assertj.core.api.Assertions.assertThat; @@ -90,7 +85,7 @@ public class PermissionTemplateTest { CreateWsResponse.User user = tester.users().generateMember(organization); CreateWsResponse.User anotherUser = tester.users().generateMember(organization); Permissions.PermissionTemplate template = createTemplate(organization).getPermissionTemplate(); - tester.wsClient().permissionsOld().addUserToTemplate(new AddUserToTemplateRequest() + tester.wsClient().permissions().addUserToTemplate(new AddUserToTemplateRequest() .setOrganization(organization.getKey()) .setTemplateId(template.getId()) .setLogin(user.getLogin()) @@ -99,7 +94,7 @@ public class PermissionTemplateTest { Project project2 = createPrivateProject(organization); Project untouchedProject = createPrivateProject(organization); - tester.wsClient().permissionsOld().bulkApplyTemplate(new BulkApplyTemplateRequest() + tester.wsClient().permissions().bulkApplyTemplate(new BulkApplyTemplateRequest() .setOrganization(organization.getKey()) .setTemplateId(template.getId()) .setProjects(Arrays.asList(project1.getKey(), project2.getKey()))); @@ -156,7 +151,7 @@ public class PermissionTemplateTest { */ private void createAndApplyTemplate(Organization organization, Project project, CreateWsResponse.User user) { String templateName = "For user"; - PermissionsService service = tester.wsClient().permissionsOld(); + PermissionsService service = tester.wsClient().permissions(); service.createTemplate(new CreateTemplateRequest() .setOrganization(organization.getKey()) .setName(templateName) @@ -173,7 +168,7 @@ public class PermissionTemplateTest { } private CreateTemplateWsResponse createTemplate(Organization organization) { - return tester.wsClient().permissionsOld().createTemplate(new CreateTemplateRequest() + return tester.wsClient().permissions().createTemplate(new CreateTemplateRequest() .setOrganization(organization.getKey()) .setName(randomAlphabetic(20))); } @@ -203,7 +198,7 @@ public class PermissionTemplateTest { .setOrganization(organization.getKey()) .setProjectKey(project.getKey()) .setPermission("user"); - Permissions.UsersWsResponse response = tester.wsClient().permissionsOld().users(request); + Permissions.UsersWsResponse response = tester.wsClient().permissions().users(request); Optional found = response.getUsersList().stream() .filter(u -> user.getLogin().equals(u.getLogin())) .findFirst(); diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java index 06c86e2947c..1fc4588d6cc 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/ProvisioningPermissionTest.java @@ -27,10 +27,10 @@ import org.junit.Test; import org.junit.rules.RuleChain; import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.Projects.CreateWsResponse.Project; -import org.sonarqube.ws.client.permission.AddGroupRequest; -import org.sonarqube.ws.client.permission.AddUserRequest; -import org.sonarqube.ws.client.permission.RemoveGroupRequest; -import org.sonarqube.ws.client.permission.RemoveUserRequest; +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 util.ItUtils; @@ -58,7 +58,7 @@ public class ProvisioningPermissionTest { @BeforeClass public static void init() { // remove default permission "provisioning" from anyone(); - tester.wsClient().permissionsOld().removeGroup(new RemoveGroupRequest().setGroupName("anyone").setPermission("provisioning")); + tester.wsClient().permissions().removeGroup(new RemoveGroupRequest().setGroupName("anyone").setPermission("provisioning")); tester.users().generate(u -> u.setLogin(ADMIN_WITH_PROVISIONING).setPassword(PASSWORD)); addUserPermission(ADMIN_WITH_PROVISIONING, "admin"); @@ -77,7 +77,7 @@ public class ProvisioningPermissionTest { @AfterClass public static void restoreData() throws Exception { - tester.wsClient().permissionsOld().addGroup(new AddGroupRequest().setGroupName("anyone").setPermission("provisioning")); + tester.wsClient().permissions().addGroup(new AddGroupRequest().setGroupName("anyone").setPermission("provisioning")); } /** @@ -130,10 +130,10 @@ public class ProvisioningPermissionTest { } private static void addUserPermission(String login, String permission) { - tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(login).setPermission(permission)); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(login).setPermission(permission)); } private static void removeUserPermission(String login, String permission) { - tester.wsClient().permissionsOld().removeUser(new RemoveUserRequest().setLogin(login).setPermission(permission)); + tester.wsClient().permissions().removeUser(new RemoveUserRequest().setLogin(login).setPermission(permission)); } } diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java index 67dc2382bb9..4bac6f1017e 100644 --- a/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/authorization/QualityProfileAdminPermissionTest.java @@ -24,7 +24,7 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.sonarqube.ws.client.qualityprofile.CreateRequest; import util.selenium.Selenese; @@ -49,7 +49,7 @@ public class QualityProfileAdminPermissionTest { tester.users().generate(u -> u.setLogin("not_profileadm").setPassword("userpwd")); tester.users().generate(u -> u.setLogin("profileadm").setPassword("papwd")); - tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin("profileadm").setPermission("profileadmin")); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin("profileadm").setPermission("profileadmin")); createProfile("xoo", "foo"); Selenese.runSelenese(orchestrator, diff --git a/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java index 1ba534bf60f..cc61358063f 100644 --- a/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/ce/ReportFailureNotificationTest.java @@ -48,7 +48,7 @@ import org.sonarqube.ws.Projects; import org.sonarqube.ws.Users; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.subethamail.wiser.Wiser; import org.subethamail.wiser.WiserMessage; @@ -109,12 +109,12 @@ public class ReportFailureNotificationTest { Projects.CreateWsResponse.Project project2 = tester.projects().provision(organization, t -> t.setName("Project2")); Projects.CreateWsResponse.Project project3 = tester.projects().provision(organization, t -> t.setName("Project3")); // user 1 is admin of project 1 and will subscribe to global notifications - tester.wsClient().permissionsOld().addUser(new AddUserRequest() + tester.wsClient().permissions().addUser(new AddUserRequest() .setLogin(user1.getLogin()) .setPermission("admin") .setProjectKey(project1.getKey())); // user 2 is admin of project 2 but won't subscribe to global notifications - tester.wsClient().permissionsOld().addUser(new AddUserRequest() + tester.wsClient().permissions().addUser(new AddUserRequest() .setLogin(user2.getLogin()) .setPermission("admin") .setProjectKey(project2.getKey())); diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java index 14f02c2b65d..9eed0add162 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueNotificationsTest.java @@ -53,7 +53,7 @@ import org.sonarqube.ws.client.WsClient; 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.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.subethamail.wiser.Wiser; import org.subethamail.wiser.WiserMessage; @@ -304,7 +304,7 @@ public class IssueNotificationsTest { .setName("userWithUserRole") .setEmail("userWithUserRole@nowhere.com")); tester.organizations().addMember(organization, userWithUserRole); - tester.wsClient().permissionsOld().addUser( + tester.wsClient().permissions().addUser( new AddUserRequest() .setLogin(userWithUserRole.getLogin()) .setProjectKey(PROJECT_KEY) diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java index f34e3be7589..6354d6f0b5b 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueTagsTest.java @@ -37,9 +37,8 @@ import org.sonarqube.ws.client.issues.SearchRequest; 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.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.sonarqube.ws.client.project.CreateRequest; -import util.ItUtils; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; @@ -134,7 +133,7 @@ public class IssueTagsTest { } private void grantUserPermission(String projectKey, User member) { - tester.wsClient().permissionsOld().addUser( + tester.wsClient().permissions().addUser( new AddUserRequest() .setLogin(member.getLogin()) .setPermission("user") diff --git a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java index 18c4d6c3372..d401be4a186 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipTest.java @@ -32,7 +32,7 @@ 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; +import org.sonarqube.ws.client.permissions.AddUserRequest; public class OrganizationMembershipTest { @@ -79,7 +79,7 @@ public class OrganizationMembershipTest { User user = tester.users().generate(); addMembership(organization, user); - tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); tester.organizations().assertThatMemberOf(organization, user); removeMembership(organization, user); @@ -92,7 +92,7 @@ public class OrganizationMembershipTest { User user = tester.users().generate(); addMembership(organization, user); - tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("admin").setOrganization(organization.getKey())); + tester.wsClient().permissions().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().organizations().removeMember(new RemoveMemberRequest().setOrganization(organization.getKey()).setLogin("admin")); diff --git a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java index dd40c775f24..092c1f7d833 100644 --- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationTest.java @@ -42,8 +42,8 @@ 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.permissions.AddUserRequest; +import org.sonarqube.ws.client.permissions.PermissionsService; import org.sonarqube.ws.client.roots.SetRootRequest; import org.sonarqube.ws.client.roots.UnsetRootRequest; @@ -230,7 +230,7 @@ public class OrganizationTest { } private void addPermissionsToUser(String orgKeyAndName, String login, String permission, String... otherPermissions) { - PermissionsService permissionsService = tester.wsClient().permissionsOld(); + PermissionsService permissionsService = tester.wsClient().permissions(); permissionsService.addUser(new AddUserRequest().setLogin(login).setOrganization(orgKeyAndName).setPermission(permission)); for (String otherPermission : otherPermissions) { permissionsService.addUser(new AddUserRequest().setLogin(login).setOrganization(orgKeyAndName).setPermission(otherPermission)); diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java index 926212d90fc..5607dc8fad0 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectVisibilityPageTest.java @@ -29,7 +29,7 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage; import org.sonarqube.ws.Components; import org.sonarqube.ws.client.components.SearchProjectsRequest; -import org.sonarqube.ws.client.permission.RemoveGroupRequest; +import org.sonarqube.ws.client.permissions.RemoveGroupRequest; import org.sonarqube.ws.client.project.UpdateVisibilityRequest; import static org.assertj.core.api.Assertions.assertThat; @@ -56,7 +56,7 @@ public class ProjectVisibilityPageTest { orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")).setProperties("sonar.projectKey", "sample2")); tester.wsClient().projects().updateVisibility(UpdateVisibilityRequest.builder().setProject("sample2").setVisibility("private").build()); // Remove 'Admin' permission for admin group on project 2 -> No one can access or admin this project, expect System Admin - tester.wsClient().permissionsOld().removeGroup(new RemoveGroupRequest().setProjectKey("sample2").setGroupName("sonar-administrators").setPermission("admin")); + tester.wsClient().permissions().removeGroup(new RemoveGroupRequest().setProjectKey("sample2").setGroupName("sonar-administrators").setPermission("admin")); tester.openBrowser().logIn().submitCredentials(adminUser) .openProjectsManagement("default-organization") diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java index 2cf644cfaa1..37cd43aa4cc 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java @@ -32,7 +32,7 @@ import org.sonarqube.qa.util.pageobjects.ProjectDashboardPage; import org.sonarqube.qa.util.pageobjects.QualityGatePage; import org.sonarqube.ws.Organizations; import org.sonarqube.ws.Users; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import util.issue.IssueRule; import static com.codeborne.selenide.Selenide.$; @@ -59,7 +59,7 @@ public class OrganizationQualityGateUiTest { organization = tester.organizations().generate(); gateAdmin = tester.users().generate(); tester.organizations().addMember(tester.organizations().getDefaultOrganization(), gateAdmin); - tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(gateAdmin.getLogin()).setPermission("gateadmin")); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(gateAdmin.getLogin()).setPermission("gateadmin")); user = tester.users().generate(); tester.organizations().addMember(organization, user); restoreProfile(orchestrator, getClass().getResource("/issue/with-many-rules.xml"), organization.getKey()); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java index 708af300823..37d2ae36805 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java @@ -55,7 +55,7 @@ import org.sonarqube.ws.Users; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsResponse; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.sonarqube.ws.client.qualitygates.CreateConditionRequest; import org.sonarqube.ws.client.qualitygates.CreateRequest; import org.sonarqube.ws.client.qualitygates.ProjectStatusRequest; @@ -256,7 +256,7 @@ public class QualityGateTest { // user is quality gate admin of default organization Organization organization = tester.organizations().getDefaultOrganization(); Users.CreateWsResponse.User user = tester.users().generateMember(organization); - tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("gateadmin").setOrganization(organization.getKey())); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(user.getLogin()).setPermission("gateadmin").setOrganization(organization.getKey())); TesterSession qGateAdminTester = tester.as(user.getLogin()); QualitygatesService qGateService = qGateAdminTester.qGates().service(); // perform administration operations diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java index c857eab45bd..abaf407ee20 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java @@ -31,8 +31,8 @@ import org.junit.Test; import org.sonarqube.ws.Users; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.permission.AddGroupRequest; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddGroupRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest; import org.sonarqube.ws.client.qualityprofile.CreateRequest; import org.subethamail.wiser.Wiser; @@ -77,7 +77,7 @@ public class BuiltInQualityProfilesNotificationTest { userRule = UserRule.from(orchestrator); Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); - wsClient.permissionsOld().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); + wsClient.permissions().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); orchestrator.restartServer(); @@ -100,12 +100,12 @@ public class BuiltInQualityProfilesNotificationTest { // Create a quality profile administrator (user having direct permission) Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); - wsClient.permissionsOld().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); + wsClient.permissions().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); // Create a quality profile administrator (user having permission from a group) Users.CreateWsResponse.User profileAdmin2 = userRule.generate(); String groupName = randomAlphanumeric(20); wsClient.wsConnector().call(new PostRequest("api/user_groups/create").setParam("name", groupName)).failIfNotSuccessful(); - wsClient.permissionsOld().addGroup(new AddGroupRequest().setPermission("profileadmin").setGroupName(groupName)); + wsClient.permissions().addGroup(new AddGroupRequest().setPermission("profileadmin").setGroupName(groupName)); wsClient.wsConnector().call(new PostRequest("api/user_groups/add_user").setParam("name", groupName).setParam("login", profileAdmin2.getLogin())).failIfNotSuccessful(); // Create a user not being quality profile administrator Users.CreateWsResponse.User noProfileAdmin = userRule.generate(); @@ -156,7 +156,7 @@ public class BuiltInQualityProfilesNotificationTest { userRule = UserRule.from(orchestrator); Users.CreateWsResponse.User profileAdmin1 = userRule.generate(); WsClient wsClient = ItUtils.newAdminWsClient(orchestrator); - wsClient.permissionsOld().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); + wsClient.permissions().addUser(new AddUserRequest().setLogin(profileAdmin1.getLogin()).setPermission("profileadmin")); // uninstall plugin V1 wsClient.wsConnector().call(new PostRequest("api/plugins/uninstall").setParam("key", "foo")).failIfNotSuccessful(); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java index 4d9b88c18cd..6ae433c2567 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesEditTest.java @@ -35,7 +35,7 @@ import org.sonarqube.ws.Qualityprofiles.SearchWsResponse; import org.sonarqube.ws.UserGroups; import org.sonarqube.ws.Users.CreateWsResponse.User; import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.sonarqube.ws.client.qualityprofile.AddGroupRequest; import org.sonarqube.ws.client.qualityprofile.RemoveGroupRequest; import org.sonarqube.ws.client.qualityprofile.RemoveUserRequest; @@ -226,7 +226,7 @@ public class QualityProfilesEditTest { Organization organization = tester.organizations().generate(); User user = tester.users().generateMember(organization); CreateWsResponse.QualityProfile xooProfile = tester.qProfiles().createXooProfile(organization); - tester.wsClient().permissionsOld().addUser(new AddUserRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()).setPermission("profileadmin")); + tester.wsClient().permissions().addUser(new AddUserRequest().setOrganization(organization.getKey()).setLogin(user.getLogin()).setPermission("profileadmin")); SearchWsResponse result = tester.as(user.getLogin()) .qProfiles().service().search(new SearchRequest().setOrganizationKey(organization.getKey())); diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java index a3f4c86e588..89137838d85 100644 --- a/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java +++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java @@ -29,10 +29,11 @@ import org.junit.rules.DisableOnDebug; import org.junit.rules.ExpectedException; import org.junit.rules.TestRule; import org.junit.rules.Timeout; +import org.sonarqube.qa.util.Tester; import org.sonarqube.ws.System; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -97,7 +98,7 @@ public class RestartTest { private void createSystemAdministrator(String login, String password) { WsClient wsClient = newAdminWsClient(orchestrator); createNonSystemAdministrator(wsClient, login, password); - wsClient.permissionsOld().addUser(new AddUserRequest().setLogin(login).setPermission("admin")); + wsClient.permissions().addUser(new AddUserRequest().setLogin(login).setPermission("admin")); } private void createNonSystemAdministrator(String login, String password) { diff --git a/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java b/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java index 5cc0d4cee00..d07fe443b97 100644 --- a/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/settings/SettingsTest.java @@ -35,9 +35,9 @@ import org.junit.rules.RuleChain; import org.sonarqube.tests.Category1Suite; import org.sonarqube.ws.Settings; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.permission.AddGroupRequest; -import org.sonarqube.ws.client.permission.AddUserRequest; -import org.sonarqube.ws.client.permission.RemoveGroupRequest; +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.settings.ResetRequest; import org.sonarqube.ws.client.settings.SetRequest; import org.sonarqube.ws.client.settings.SettingsService; @@ -81,7 +81,7 @@ public class SettingsTest { userRule.createUser("scanner-user", "scanner-user"); adminWsClient = newAdminWsClient(orchestrator); // Remove 'Execute Analysis' permission from anyone - adminWsClient.permissionsOld().removeGroup(new RemoveGroupRequest().setGroupName("anyone").setPermission("scan")); + adminWsClient.permissions().removeGroup(new RemoveGroupRequest().setGroupName("anyone").setPermission("scan")); // Anonymous user, without 'Execute Analysis' permission anonymousSettingsService = newWsClient(orchestrator).settings(); @@ -90,7 +90,7 @@ public class SettingsTest { userSettingsService = newUserWsClient(orchestrator, "setting-user", "setting-user").settings(); // User with 'Execute Analysis' permission - adminWsClient.permissionsOld().addUser(new AddUserRequest().setLogin("scanner-user").setPermission("scan")); + adminWsClient.permissions().addUser(new AddUserRequest().setLogin("scanner-user").setPermission("scan")); scanSettingsService = newUserWsClient(orchestrator, "scanner-user", "scanner-user").settings(); // User with 'Administer System' permission but without 'Execute Analysis' permission @@ -101,7 +101,7 @@ public class SettingsTest { public static void tearDown() throws Exception { userRule.deactivateUsers("setting-user", "scanner-user"); // Restore 'Execute Analysis' permission to anyone - adminWsClient.permissionsOld().addGroup(new AddGroupRequest().setGroupName("anyone").setPermission("scan")); + adminWsClient.permissions().addGroup(new AddGroupRequest().setGroupName("anyone").setPermission("scan")); } @After diff --git a/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java b/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java index 051483275f1..9052ad8b32c 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java @@ -38,7 +38,7 @@ import org.sonarqube.tests.Category4Suite; import org.sonarqube.ws.Users.SearchWsResponse.User; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.sonarqube.ws.client.user.CreateRequest; import util.selenium.Selenese; @@ -125,7 +125,7 @@ public class OAuth2IdentityProviderTest { enablePlugin(); tester.users().generate(u -> u.setLogin(USER_LOGIN)); // Give user global admin permission as we want to go to a page where authentication is required - tester.wsClient().permissionsOld().addUser(new AddUserRequest().setLogin(USER_LOGIN).setPermission("admin")); + tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(USER_LOGIN).setPermission("admin")); Navigation nav = tester.openBrowser(); // Try to go to the settings page diff --git a/tests/src/test/java/util/user/UserRule.java b/tests/src/test/java/util/user/UserRule.java index ed409b21139..77c8562bfea 100644 --- a/tests/src/test/java/util/user/UserRule.java +++ b/tests/src/test/java/util/user/UserRule.java @@ -35,7 +35,7 @@ import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.WsResponse; -import org.sonarqube.ws.client.permission.AddUserRequest; +import org.sonarqube.ws.client.permissions.AddUserRequest; import org.sonarqube.ws.client.roots.SetRootRequest; import org.sonarqube.ws.client.user.CreateRequest; import org.sonarqube.ws.client.user.SearchRequest; @@ -147,7 +147,7 @@ public class UserRule extends ExternalResource implements GroupManagement { public String createAdminUser(String login, String password) { createUser(login, password); - adminWsClient.permissionsOld().addUser(new AddUserRequest().setLogin(login).setPermission("admin")); + adminWsClient.permissions().addUser(new AddUserRequest().setLogin(login).setPermission("admin")); adminWsClient.userGroups().addUser(new org.sonarqube.ws.client.usergroups.AddUserRequest().setLogin(login).setName("sonar-administrators")); return login; }