From: Teryk Bellahsene Date: Mon, 7 Sep 2015 14:45:38 +0000 (+0200) Subject: Rename Parameters to WsPermissionsParameters X-Git-Tag: 5.2-RC1~232 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=adb1bccb465775981bb6b6c85c1df4d3ad9191dd;p=sonarqube.git Rename Parameters to WsPermissionsParameters --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.java index 8d6e381d631..4ac3370b230 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.java @@ -29,10 +29,10 @@ import org.sonar.server.permission.PermissionChange; import org.sonar.server.permission.PermissionUpdater; import org.sonar.server.permission.ws.PermissionRequest.Builder; -import static org.sonar.server.permission.ws.Parameters.createGroupIdParameter; -import static org.sonar.server.permission.ws.Parameters.createGroupNameParameter; -import static org.sonar.server.permission.ws.Parameters.createPermissionParameter; -import static org.sonar.server.permission.ws.Parameters.createProjectParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createGroupIdParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createGroupNameParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createPermissionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectParameter; public class AddGroupAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupToTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupToTemplateAction.java index b81c5d3f34b..741b4dcf189 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupToTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupToTemplateAction.java @@ -34,11 +34,11 @@ import org.sonar.server.user.UserSession; import static org.sonar.api.security.DefaultGroups.ANYONE; import static org.sonar.db.user.GroupMembershipQuery.IN; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.createGroupIdParameter; -import static org.sonar.server.permission.ws.Parameters.createGroupNameParameter; -import static org.sonar.server.permission.ws.Parameters.createProjectPermissionParameter; -import static org.sonar.server.permission.ws.Parameters.createTemplateParameters; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.createGroupIdParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createGroupNameParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectPermissionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateParameters; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateNotAnyoneAndAdminPermission; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserAction.java index 612789bef85..b98d9cbf43a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserAction.java @@ -29,9 +29,9 @@ import org.sonar.server.permission.PermissionChange; import org.sonar.server.permission.PermissionUpdater; import org.sonar.server.permission.ws.PermissionRequest.Builder; -import static org.sonar.server.permission.ws.Parameters.createPermissionParameter; -import static org.sonar.server.permission.ws.Parameters.createProjectParameter; -import static org.sonar.server.permission.ws.Parameters.createUserLoginParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createPermissionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createUserLoginParameter; public class AddUserAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserToTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserToTemplateAction.java index 5b229797222..16a2f53a0f9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserToTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserToTemplateAction.java @@ -36,11 +36,11 @@ import org.sonar.server.user.UserSession; import static com.google.common.collect.FluentIterable.from; import static org.sonar.db.user.GroupMembershipQuery.IN; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_USER_LOGIN; -import static org.sonar.server.permission.ws.Parameters.createProjectPermissionParameter; -import static org.sonar.server.permission.ws.Parameters.createTemplateParameters; -import static org.sonar.server.permission.ws.Parameters.createUserLoginParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_USER_LOGIN; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectPermissionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateParameters; +import static org.sonar.server.permission.ws.WsPermissionParameters.createUserLoginParameter; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission; public class AddUserToTemplateAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/ApplyTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/ApplyTemplateAction.java index 54c74cde749..7556a66d110 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/ApplyTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/ApplyTemplateAction.java @@ -31,8 +31,8 @@ import org.sonar.server.permission.ApplyPermissionTemplateQuery; import org.sonar.server.permission.PermissionService; import static java.util.Collections.singletonList; -import static org.sonar.server.permission.ws.Parameters.createProjectParameter; -import static org.sonar.server.permission.ws.Parameters.createTemplateParameters; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateParameters; public class ApplyTemplateAction implements PermissionsWsAction { private final DbClient dbClient; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/CreateTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/CreateTemplateAction.java index 8a4b959b647..69f2f6fbe18 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/CreateTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/CreateTemplateAction.java @@ -33,11 +33,11 @@ import org.sonarqube.ws.WsPermissions.WsCreatePermissionTemplateResponse; import static java.lang.String.format; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser; -import static org.sonar.server.permission.ws.Parameters.PARAM_DESCRIPTION; -import static org.sonar.server.permission.ws.Parameters.PARAM_NAME; -import static org.sonar.server.permission.ws.Parameters.PARAM_PATTERN; -import static org.sonar.server.permission.ws.Parameters.createTemplateDescriptionParameter; -import static org.sonar.server.permission.ws.Parameters.createTemplateProjectKeyPatternParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_DESCRIPTION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PATTERN; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateDescriptionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateProjectKeyPatternParameter; import static org.sonar.server.permission.ws.PermissionRequestValidator.MSG_TEMPLATE_WITH_SAME_NAME; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPattern; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateTemplateNameFormat; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/DeleteTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/DeleteTemplateAction.java index 233f6dec2d9..4acc8fcdff6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/DeleteTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/DeleteTemplateAction.java @@ -30,7 +30,7 @@ import org.sonar.db.permission.PermissionTemplateDto; import org.sonar.server.user.UserSession; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser; -import static org.sonar.server.permission.ws.Parameters.createTemplateParameters; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateParameters; import static org.sonar.server.permission.ws.WsTemplateRef.fromRequest; import static org.sonar.server.ws.WsUtils.checkRequest; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/GroupsAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/GroupsAction.java index 0ebcc3fdb10..198b3da2355 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/GroupsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/GroupsAction.java @@ -43,8 +43,8 @@ import org.sonarqube.ws.WsPermissions.WsGroupsResponse; import static com.google.common.base.Objects.firstNonNull; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkProjectAdminUserByComponentDto; import static org.sonar.server.permission.ws.PermissionQueryParser.fromSelectionModeToMembership; -import static org.sonar.server.permission.ws.Parameters.createPermissionParameter; -import static org.sonar.server.permission.ws.Parameters.createProjectParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createPermissionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectParameter; import static org.sonar.server.ws.WsUtils.writeProtobuf; public class GroupsAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/Parameters.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/Parameters.java deleted file mode 100644 index 65b620ce4b8..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/Parameters.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.sonar.server.permission.ws; - -import org.sonar.api.server.ws.WebService.NewAction; -import org.sonar.core.permission.GlobalPermissions; -import org.sonar.core.permission.ProjectPermissions; -import org.sonar.core.util.Uuids; - -import static java.lang.String.format; - -class Parameters { - - static final String PARAM_PERMISSION = "permission"; - static final String PARAM_GROUP_NAME = "groupName"; - static final String PARAM_GROUP_ID = "groupId"; - static final String PARAM_PROJECT_ID = "projectId"; - static final String PARAM_PROJECT_KEY = "projectKey"; - static final String PARAM_USER_LOGIN = "login"; - static final String PARAM_TEMPLATE_ID = "templateId"; - static final String PARAM_TEMPLATE_NAME = "templateName"; - - static final String PARAM_ID = "id"; - static final String PARAM_NAME = "name"; - static final String PARAM_DESCRIPTION = "description"; - static final String PARAM_PATTERN = "projectKeyPattern"; - - static final String PARAM_QUALIFIER = "qualifier"; - - private static final String PERMISSION_PARAM_DESCRIPTION = format("Permission" + - "", - GlobalPermissions.ALL_ON_ONE_LINE, - ProjectPermissions.ALL_ON_ONE_LINE); - private static final String PROJECT_PERMISSION_PARAM_DESCRIPTION = format("Permission" + - "", - ProjectPermissions.ALL_ON_ONE_LINE); - - private Parameters() { - // static methods only - } - - static void createPermissionParameter(NewAction action) { - action.createParam(PARAM_PERMISSION) - .setDescription(PERMISSION_PARAM_DESCRIPTION) - .setRequired(true); - } - - static void createProjectPermissionParameter(NewAction action) { - action.createParam(PARAM_PERMISSION) - .setDescription(PROJECT_PERMISSION_PARAM_DESCRIPTION) - .setRequired(true); - } - - static void createGroupNameParameter(NewAction action) { - action.createParam(PARAM_GROUP_NAME) - .setDescription("Group name or 'anyone' (case insensitive)") - .setExampleValue("sonar-administrators"); - } - - static void createGroupIdParameter(NewAction action) { - action.createParam(PARAM_GROUP_ID) - .setDescription("Group id") - .setExampleValue("42"); - } - - static void createProjectParameter(NewAction action) { - createProjectIdParameter(action); - createProjectKeyParameter(action); - } - - private static void createProjectIdParameter(NewAction action) { - action.createParam(PARAM_PROJECT_ID) - .setDescription("Project id") - .setExampleValue("ce4c03d6-430f-40a9-b777-ad877c00aa4d"); - } - - private static void createProjectKeyParameter(NewAction action) { - action.createParam(PARAM_PROJECT_KEY) - .setDescription("Project key") - .setExampleValue("org.apache.hbas:hbase"); - } - - static void createUserLoginParameter(NewAction action) { - action.createParam(PARAM_USER_LOGIN) - .setRequired(true) - .setDescription("User login") - .setExampleValue("g.hopper"); - } - - static void createTemplateParameters(NewAction action) { - createTemplateIdParameter(action); - createTemplateNameParameter(action); - } - - private static void createTemplateIdParameter(NewAction action) { - action.createParam(PARAM_TEMPLATE_ID) - .setDescription("Template id") - .setExampleValue(Uuids.UUID_EXAMPLE_01); - } - - private static void createTemplateNameParameter(NewAction action) { - action.createParam(PARAM_TEMPLATE_NAME) - .setDescription("Template name") - .setExampleValue("Default Permission Template for Projects"); - } - - static void createTemplateProjectKeyPatternParameter(NewAction action) { - action.createParam(PARAM_PATTERN) - .setDescription("Project key pattern. Must be a valid Java regular expression") - .setExampleValue(".*\\.finance\\..*"); - } - - static void createTemplateDescriptionParameter(NewAction action) { - action.createParam(PARAM_DESCRIPTION) - .setDescription("Description") - .setExampleValue("Permissions for all projects related to the financial service"); - } - - static void createIdParameter(NewAction action) { - action.createParam(PARAM_ID) - .setRequired(true) - .setDescription("Id") - .setExampleValue("af8cb8cc-1e78-4c4e-8c00-ee8e814009a5"); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionRequest.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionRequest.java index bc42c1d69df..fcce33c3cd9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionRequest.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionRequest.java @@ -30,8 +30,8 @@ import static org.sonar.api.server.ws.WebService.Param.SELECTED; import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateGlobalPermission; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_USER_LOGIN; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_USER_LOGIN; class PermissionRequest { private final String permission; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionRequestValidator.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionRequestValidator.java index f21e5608208..528152fba77 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionRequestValidator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionRequestValidator.java @@ -32,9 +32,9 @@ import static com.google.common.base.Strings.isNullOrEmpty; import static java.lang.String.format; import static org.apache.commons.lang.StringUtils.isBlank; import static org.sonar.api.security.DefaultGroups.isAnyone; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_QUALIFIER; -import static org.sonar.server.permission.ws.Parameters.PARAM_PATTERN; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_QUALIFIER; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PATTERN; import static org.sonar.server.ws.WsUtils.checkRequest; public class PermissionRequestValidator { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupAction.java index 7c18ae20ede..2a1da412fb3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupAction.java @@ -29,10 +29,10 @@ import org.sonar.server.permission.PermissionChange; import org.sonar.server.permission.PermissionUpdater; import org.sonar.server.permission.ws.PermissionRequest.Builder; -import static org.sonar.server.permission.ws.Parameters.createGroupIdParameter; -import static org.sonar.server.permission.ws.Parameters.createGroupNameParameter; -import static org.sonar.server.permission.ws.Parameters.createPermissionParameter; -import static org.sonar.server.permission.ws.Parameters.createProjectParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createGroupIdParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createGroupNameParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createPermissionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectParameter; public class RemoveGroupAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupFromTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupFromTemplateAction.java index 6aa46efae65..36614093345 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupFromTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupFromTemplateAction.java @@ -30,11 +30,11 @@ import org.sonar.db.user.GroupDto; import org.sonar.server.user.UserSession; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.createGroupIdParameter; -import static org.sonar.server.permission.ws.Parameters.createGroupNameParameter; -import static org.sonar.server.permission.ws.Parameters.createProjectPermissionParameter; -import static org.sonar.server.permission.ws.Parameters.createTemplateParameters; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.createGroupIdParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createGroupNameParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectPermissionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateParameters; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission; public class RemoveGroupFromTemplateAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserAction.java index 03ff653fa6d..0dfaaa174a5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserAction.java @@ -29,9 +29,9 @@ import org.sonar.server.permission.PermissionChange; import org.sonar.server.permission.PermissionUpdater; import org.sonar.server.permission.ws.PermissionRequest.Builder; -import static org.sonar.server.permission.ws.Parameters.createPermissionParameter; -import static org.sonar.server.permission.ws.Parameters.createProjectParameter; -import static org.sonar.server.permission.ws.Parameters.createUserLoginParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createPermissionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createUserLoginParameter; public class RemoveUserAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserFromTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserFromTemplateAction.java index 573e7007bb4..dd22e79b2a2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserFromTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserFromTemplateAction.java @@ -30,11 +30,11 @@ import org.sonar.db.user.UserDto; import org.sonar.server.user.UserSession; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_USER_LOGIN; -import static org.sonar.server.permission.ws.Parameters.createProjectPermissionParameter; -import static org.sonar.server.permission.ws.Parameters.createTemplateParameters; -import static org.sonar.server.permission.ws.Parameters.createUserLoginParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_USER_LOGIN; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectPermissionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateParameters; +import static org.sonar.server.permission.ws.WsPermissionParameters.createUserLoginParameter; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission; public class RemoveUserFromTemplateAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsAction.java index fa56dab3bd6..8bbec5caa6c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsAction.java @@ -39,7 +39,7 @@ import org.sonarqube.ws.WsPermissions.WsSearchProjectPermissionsResponse.Project import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkProjectAdminUserByComponentKey; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkProjectAdminUserByComponentUuid; -import static org.sonar.server.permission.ws.Parameters.createProjectParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectParameter; import static org.sonar.server.ws.WsUtils.writeProtobuf; public class SearchProjectPermissionsAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SetDefaultTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SetDefaultTemplateAction.java index 5fc18d16d78..79a54ed1e78 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SetDefaultTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/SetDefaultTemplateAction.java @@ -38,8 +38,8 @@ import static com.google.common.collect.Ordering.natural; import static java.lang.String.format; import static org.sonar.server.permission.DefaultPermissionTemplates.defaultRootQualifierTemplateProperty; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser; -import static org.sonar.server.permission.ws.Parameters.PARAM_QUALIFIER; -import static org.sonar.server.permission.ws.Parameters.createTemplateParameters; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_QUALIFIER; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateParameters; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateQualifier; import static org.sonar.server.permission.ws.ResourceTypeToQualifier.RESOURCE_TYPE_TO_QUALIFIER; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UpdateTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UpdateTemplateAction.java index 2c4ae44df62..d7ba4b5b0f5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UpdateTemplateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UpdateTemplateAction.java @@ -36,13 +36,13 @@ import org.sonarqube.ws.WsPermissions.WsUpdatePermissionTemplateResponse; import static com.google.common.base.Objects.firstNonNull; import static java.lang.String.format; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser; -import static org.sonar.server.permission.ws.Parameters.PARAM_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_DESCRIPTION; -import static org.sonar.server.permission.ws.Parameters.PARAM_NAME; -import static org.sonar.server.permission.ws.Parameters.PARAM_PATTERN; -import static org.sonar.server.permission.ws.Parameters.createIdParameter; -import static org.sonar.server.permission.ws.Parameters.createTemplateDescriptionParameter; -import static org.sonar.server.permission.ws.Parameters.createTemplateProjectKeyPatternParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_DESCRIPTION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PATTERN; +import static org.sonar.server.permission.ws.WsPermissionParameters.createIdParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateDescriptionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createTemplateProjectKeyPatternParameter; import static org.sonar.server.permission.ws.PermissionRequestValidator.MSG_TEMPLATE_WITH_SAME_NAME; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPattern; import static org.sonar.server.permission.ws.PermissionRequestValidator.validateTemplateNameFormat; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java index e1aa68b7686..83d48ebfb6e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java @@ -43,8 +43,8 @@ import static com.google.common.base.Objects.firstNonNull; import static com.google.common.base.Strings.nullToEmpty; import static org.sonar.server.permission.PermissionPrivilegeChecker.checkProjectAdminUserByComponentDto; import static org.sonar.server.permission.ws.PermissionQueryParser.fromSelectionModeToMembership; -import static org.sonar.server.permission.ws.Parameters.createPermissionParameter; -import static org.sonar.server.permission.ws.Parameters.createProjectParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createPermissionParameter; +import static org.sonar.server.permission.ws.WsPermissionParameters.createProjectParameter; import static org.sonar.server.ws.WsUtils.writeProtobuf; public class UsersAction implements PermissionsWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsGroupRef.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsGroupRef.java index f015d39b229..2c735193a12 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsGroupRef.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsGroupRef.java @@ -24,8 +24,8 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.server.ws.Request; -import static org.sonar.server.permission.ws.Parameters.PARAM_GROUP_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_GROUP_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_GROUP_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_GROUP_NAME; import static org.sonar.server.ws.WsUtils.checkRequest; /** diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsPermissionParameters.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsPermissionParameters.java new file mode 100644 index 00000000000..274c2c2991b --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsPermissionParameters.java @@ -0,0 +1,148 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube 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. + * + * SonarQube 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.sonar.server.permission.ws; + +import org.sonar.api.server.ws.WebService.NewAction; +import org.sonar.core.permission.GlobalPermissions; +import org.sonar.core.permission.ProjectPermissions; +import org.sonar.core.util.Uuids; + +import static java.lang.String.format; + +class WsPermissionParameters { + + static final String PARAM_PERMISSION = "permission"; + static final String PARAM_GROUP_NAME = "groupName"; + static final String PARAM_GROUP_ID = "groupId"; + static final String PARAM_PROJECT_ID = "projectId"; + static final String PARAM_PROJECT_KEY = "projectKey"; + static final String PARAM_USER_LOGIN = "login"; + static final String PARAM_TEMPLATE_ID = "templateId"; + static final String PARAM_TEMPLATE_NAME = "templateName"; + + static final String PARAM_ID = "id"; + static final String PARAM_NAME = "name"; + static final String PARAM_DESCRIPTION = "description"; + static final String PARAM_PATTERN = "projectKeyPattern"; + + static final String PARAM_QUALIFIER = "qualifier"; + + private static final String PERMISSION_PARAM_DESCRIPTION = format("Permission" + + "", + GlobalPermissions.ALL_ON_ONE_LINE, + ProjectPermissions.ALL_ON_ONE_LINE); + private static final String PROJECT_PERMISSION_PARAM_DESCRIPTION = format("Permission" + + "", + ProjectPermissions.ALL_ON_ONE_LINE); + + private WsPermissionParameters() { + // static methods only + } + + static void createPermissionParameter(NewAction action) { + action.createParam(PARAM_PERMISSION) + .setDescription(PERMISSION_PARAM_DESCRIPTION) + .setRequired(true); + } + + static void createProjectPermissionParameter(NewAction action) { + action.createParam(PARAM_PERMISSION) + .setDescription(PROJECT_PERMISSION_PARAM_DESCRIPTION) + .setRequired(true); + } + + static void createGroupNameParameter(NewAction action) { + action.createParam(PARAM_GROUP_NAME) + .setDescription("Group name or 'anyone' (case insensitive)") + .setExampleValue("sonar-administrators"); + } + + static void createGroupIdParameter(NewAction action) { + action.createParam(PARAM_GROUP_ID) + .setDescription("Group id") + .setExampleValue("42"); + } + + static void createProjectParameter(NewAction action) { + createProjectIdParameter(action); + createProjectKeyParameter(action); + } + + private static void createProjectIdParameter(NewAction action) { + action.createParam(PARAM_PROJECT_ID) + .setDescription("Project id") + .setExampleValue("ce4c03d6-430f-40a9-b777-ad877c00aa4d"); + } + + private static void createProjectKeyParameter(NewAction action) { + action.createParam(PARAM_PROJECT_KEY) + .setDescription("Project key") + .setExampleValue("org.apache.hbas:hbase"); + } + + static void createUserLoginParameter(NewAction action) { + action.createParam(PARAM_USER_LOGIN) + .setRequired(true) + .setDescription("User login") + .setExampleValue("g.hopper"); + } + + static void createTemplateParameters(NewAction action) { + createTemplateIdParameter(action); + createTemplateNameParameter(action); + } + + private static void createTemplateIdParameter(NewAction action) { + action.createParam(PARAM_TEMPLATE_ID) + .setDescription("Template id") + .setExampleValue(Uuids.UUID_EXAMPLE_01); + } + + private static void createTemplateNameParameter(NewAction action) { + action.createParam(PARAM_TEMPLATE_NAME) + .setDescription("Template name") + .setExampleValue("Default Permission Template for Projects"); + } + + static void createTemplateProjectKeyPatternParameter(NewAction action) { + action.createParam(PARAM_PATTERN) + .setDescription("Project key pattern. Must be a valid Java regular expression") + .setExampleValue(".*\\.finance\\..*"); + } + + static void createTemplateDescriptionParameter(NewAction action) { + action.createParam(PARAM_DESCRIPTION) + .setDescription("Description") + .setExampleValue("Permissions for all projects related to the financial service"); + } + + static void createIdParameter(NewAction action) { + action.createParam(PARAM_ID) + .setRequired(true) + .setDescription("Id") + .setExampleValue("af8cb8cc-1e78-4c4e-8c00-ee8e814009a5"); + } +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsProjectRef.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsProjectRef.java index fba0dbe5411..feda183aba9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsProjectRef.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsProjectRef.java @@ -24,8 +24,8 @@ import com.google.common.base.Optional; import javax.annotation.CheckForNull; import org.sonar.api.server.ws.Request; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_KEY; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_KEY; import static org.sonar.server.ws.WsUtils.checkRequest; /** diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsTemplateRef.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsTemplateRef.java index 20b67e57bf0..82377eea06d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsTemplateRef.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsTemplateRef.java @@ -24,8 +24,8 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.server.ws.Request; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_NAME; import static org.sonar.server.ws.WsUtils.checkRequest; /** diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java index 221c7985d39..2544e3dc145 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java @@ -49,11 +49,11 @@ import static org.mockito.Mockito.verify; import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN; import static org.sonar.db.component.ComponentTesting.newProjectDto; import static org.sonar.server.permission.ws.AddGroupAction.ACTION; -import static org.sonar.server.permission.ws.Parameters.PARAM_GROUP_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_GROUP_NAME; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_KEY; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_GROUP_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_GROUP_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_ID; import static org.sonar.server.permission.ws.PermissionsWs.ENDPOINT; @Category(DbTests.class) diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupToTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupToTemplateActionTest.java index 1f587ae6a8a..d84111c2965 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupToTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupToTemplateActionTest.java @@ -58,11 +58,11 @@ import static org.sonar.api.web.UserRole.ISSUE_ADMIN; import static org.sonar.db.permission.PermissionTemplateTesting.newPermissionTemplateDto; import static org.sonar.db.user.GroupMembershipQuery.IN; import static org.sonar.db.user.GroupTesting.newGroupDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_GROUP_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_GROUP_NAME; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_GROUP_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_GROUP_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_NAME; @Category(DbTests.class) public class AddGroupToTemplateActionTest { @@ -211,13 +211,13 @@ public class AddGroupToTemplateActionTest { private void newRequest(@Nullable String groupName, @Nullable String templateKey, @Nullable String permission) { TestRequest request = ws.newRequest(); if (groupName != null) { - request.setParam(Parameters.PARAM_GROUP_NAME, groupName); + request.setParam(WsPermissionParameters.PARAM_GROUP_NAME, groupName); } if (templateKey != null) { request.setParam(PARAM_TEMPLATE_ID, templateKey); } if (permission != null) { - request.setParam(Parameters.PARAM_PERMISSION, permission); + request.setParam(WsPermissionParameters.PARAM_PERMISSION, permission); } request.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java index 2d9f96bdd31..7b6e00e49f1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java @@ -49,10 +49,10 @@ import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN; import static org.sonar.db.component.ComponentTesting.newFileDto; import static org.sonar.db.component.ComponentTesting.newProjectDto; import static org.sonar.server.permission.ws.AddUserAction.ACTION; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_KEY; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_USER_LOGIN; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_USER_LOGIN; import static org.sonar.server.permission.ws.PermissionsWs.ENDPOINT; @Category(DbTests.class) diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserToTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserToTemplateActionTest.java index d7a1a0ebce9..6a28cbda890 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserToTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserToTemplateActionTest.java @@ -55,9 +55,9 @@ import static org.sonar.api.web.UserRole.ISSUE_ADMIN; import static org.sonar.db.permission.PermissionTemplateTesting.newPermissionTemplateDto; import static org.sonar.db.user.GroupMembershipQuery.IN; import static org.sonar.db.user.UserTesting.newUserDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_NAME; -import static org.sonar.server.permission.ws.Parameters.PARAM_USER_LOGIN; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_USER_LOGIN; @Category(DbTests.class) public class AddUserToTemplateActionTest { @@ -183,10 +183,10 @@ public class AddUserToTemplateActionTest { request.setParam(PARAM_USER_LOGIN, userLogin); } if (templateKey != null) { - request.setParam(Parameters.PARAM_TEMPLATE_ID, templateKey); + request.setParam(WsPermissionParameters.PARAM_TEMPLATE_ID, templateKey); } if (permission != null) { - request.setParam(Parameters.PARAM_PERMISSION, permission); + request.setParam(WsPermissionParameters.PARAM_PERMISSION, permission); } request.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/ApplyTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/ApplyTemplateActionTest.java index a56ae1e7c63..27f64b19f6e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/ApplyTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/ApplyTemplateActionTest.java @@ -68,10 +68,10 @@ import static org.sonar.db.permission.PermissionTemplateTesting.newPermissionTem import static org.sonar.db.user.GroupMembershipQuery.IN; import static org.sonar.db.user.GroupTesting.newGroupDto; import static org.sonar.db.user.UserTesting.newUserDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_KEY; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_NAME; @Category(DbTests.class) public class ApplyTemplateActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/CreateTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/CreateTemplateActionTest.java index dd3115c28d2..160aebb1afe 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/CreateTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/CreateTemplateActionTest.java @@ -43,9 +43,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.sonar.db.permission.PermissionTemplateTesting.newPermissionTemplateDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_DESCRIPTION; -import static org.sonar.server.permission.ws.Parameters.PARAM_NAME; -import static org.sonar.server.permission.ws.Parameters.PARAM_PATTERN; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_DESCRIPTION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PATTERN; import static org.sonar.test.JsonAssert.assertJson; public class CreateTemplateActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/DeleteTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/DeleteTemplateActionTest.java index 60f63ba9ca4..33575ba5b19 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/DeleteTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/DeleteTemplateActionTest.java @@ -52,8 +52,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.mockito.internal.util.collections.Sets.newSet; import static org.sonar.db.permission.PermissionTemplateTesting.newPermissionTemplateDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_NAME; public class DeleteTemplateActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/GroupsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/GroupsActionTest.java index 707ce4eb5c4..3ca4b95c5de 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/GroupsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/GroupsActionTest.java @@ -53,9 +53,9 @@ import static org.sonar.api.web.UserRole.ISSUE_ADMIN; import static org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION; import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN; import static org.sonar.db.component.ComponentTesting.newProjectDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_KEY; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_ID; import static org.sonar.test.JsonAssert.assertJson; @Category(DbTests.class) diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java index 0fadbf6a91c..0add9e68cd8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java @@ -49,11 +49,11 @@ import static org.mockito.Mockito.verify; import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN; import static org.sonar.db.component.ComponentTesting.newFileDto; import static org.sonar.db.component.ComponentTesting.newProjectDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_GROUP_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_GROUP_NAME; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_KEY; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_GROUP_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_GROUP_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_ID; import static org.sonar.server.permission.ws.RemoveGroupAction.ACTION; @Category(DbTests.class) diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupFromTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupFromTemplateActionTest.java index 30d7dbec135..517a9885abe 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupFromTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupFromTemplateActionTest.java @@ -55,11 +55,11 @@ import static org.sonar.api.web.UserRole.CODEVIEWER; import static org.sonar.db.permission.PermissionTemplateTesting.newPermissionTemplateDto; import static org.sonar.db.user.GroupMembershipQuery.IN; import static org.sonar.db.user.GroupTesting.newGroupDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_GROUP_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_GROUP_NAME; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_GROUP_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_GROUP_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_NAME; @Category(DbTests.class) public class RemoveGroupFromTemplateActionTest { @@ -214,13 +214,13 @@ public class RemoveGroupFromTemplateActionTest { private void newRequest(@Nullable String groupName, @Nullable String templateKey, @Nullable String permission) { TestRequest request = ws.newRequest(); if (groupName != null) { - request.setParam(Parameters.PARAM_GROUP_NAME, groupName); + request.setParam(WsPermissionParameters.PARAM_GROUP_NAME, groupName); } if (templateKey != null) { request.setParam(PARAM_TEMPLATE_ID, templateKey); } if (permission != null) { - request.setParam(Parameters.PARAM_PERMISSION, permission); + request.setParam(WsPermissionParameters.PARAM_PERMISSION, permission); } request.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java index bfdb74c7c47..ff47ab463ec 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java @@ -48,10 +48,10 @@ import static org.mockito.Mockito.verify; import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN; import static org.sonar.db.component.ComponentTesting.newFileDto; import static org.sonar.db.component.ComponentTesting.newProjectDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_KEY; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_USER_LOGIN; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_USER_LOGIN; import static org.sonar.server.permission.ws.PermissionsWs.ENDPOINT; import static org.sonar.server.permission.ws.RemoveUserAction.ACTION; diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserFromTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserFromTemplateActionTest.java index 81582e4d8ed..7d71fdd1eb6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserFromTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserFromTemplateActionTest.java @@ -55,9 +55,9 @@ import static org.sonar.api.web.UserRole.ISSUE_ADMIN; import static org.sonar.db.permission.PermissionTemplateTesting.newPermissionTemplateDto; import static org.sonar.db.user.GroupMembershipQuery.IN; import static org.sonar.db.user.UserTesting.newUserDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_NAME; -import static org.sonar.server.permission.ws.Parameters.PARAM_USER_LOGIN; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_USER_LOGIN; @Category(DbTests.class) public class RemoveUserFromTemplateActionTest { @@ -207,10 +207,10 @@ public class RemoveUserFromTemplateActionTest { request.setParam(PARAM_USER_LOGIN, userLogin); } if (templateKey != null) { - request.setParam(Parameters.PARAM_TEMPLATE_ID, templateKey); + request.setParam(WsPermissionParameters.PARAM_TEMPLATE_ID, templateKey); } if (permission != null) { - request.setParam(Parameters.PARAM_PERMISSION, permission); + request.setParam(WsPermissionParameters.PARAM_PERMISSION, permission); } request.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java index aead1d2453e..a2c2649fa7a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java @@ -60,7 +60,7 @@ import static org.sonar.db.component.ComponentTesting.newProjectDto; import static org.sonar.db.component.ComponentTesting.newView; import static org.sonar.db.user.GroupTesting.newGroupDto; import static org.sonar.db.user.UserTesting.newUserDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_ID; import static org.sonar.test.JsonAssert.assertJson; public class SearchProjectPermissionsActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SetDefaultTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SetDefaultTemplateActionTest.java index f68de3c4aa0..defa13e539c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SetDefaultTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/SetDefaultTemplateActionTest.java @@ -60,9 +60,9 @@ import static org.sonar.api.resources.Qualifiers.PROJECT; import static org.sonar.api.resources.Qualifiers.VIEW; import static org.sonar.server.permission.DefaultPermissionTemplates.DEFAULT_TEMPLATE_PROPERTY; import static org.sonar.server.permission.DefaultPermissionTemplates.defaultRootQualifierTemplateProperty; -import static org.sonar.server.permission.ws.Parameters.PARAM_QUALIFIER; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_TEMPLATE_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_QUALIFIER; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_TEMPLATE_NAME; @Category(DbTests.class) public class SetDefaultTemplateActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/UpdateTemplateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/UpdateTemplateActionTest.java index fe9fe83acbe..82d2404779c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/UpdateTemplateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/UpdateTemplateActionTest.java @@ -47,10 +47,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.sonar.db.permission.PermissionTemplateTesting.newPermissionTemplateDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_DESCRIPTION; -import static org.sonar.server.permission.ws.Parameters.PARAM_ID; -import static org.sonar.server.permission.ws.Parameters.PARAM_NAME; -import static org.sonar.server.permission.ws.Parameters.PARAM_PATTERN; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_DESCRIPTION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_NAME; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PATTERN; import static org.sonar.test.JsonAssert.assertJson; public class UpdateTemplateActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/UsersActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/UsersActionTest.java index f6bb2642ce1..864de4c130a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/UsersActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/UsersActionTest.java @@ -50,9 +50,9 @@ import static org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION; import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN; import static org.sonar.db.component.ComponentTesting.newProjectDto; import static org.sonar.db.user.UserTesting.newUserDto; -import static org.sonar.server.permission.ws.Parameters.PARAM_PERMISSION; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_KEY; -import static org.sonar.server.permission.ws.Parameters.PARAM_PROJECT_ID; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PERMISSION; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.permission.ws.WsPermissionParameters.PARAM_PROJECT_ID; import static org.sonar.test.JsonAssert.assertJson; @Category(DbTests.class)