]> source.dussan.org Git - sonarqube.git/commitdiff
Rename Parameters to WsPermissionsParameters
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 7 Sep 2015 14:45:38 +0000 (16:45 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 28 Sep 2015 14:34:53 +0000 (16:34 +0200)
39 files changed:
server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupToTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddUserToTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/ApplyTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/CreateTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/DeleteTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/GroupsAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/Parameters.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionRequest.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionRequestValidator.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupFromTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveUserFromTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/SetDefaultTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/UpdateTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsGroupRef.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsPermissionParameters.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsProjectRef.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsTemplateRef.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupToTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserToTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/ApplyTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/CreateTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/DeleteTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/GroupsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupFromTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserFromTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/SetDefaultTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/UpdateTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/UsersActionTest.java

index 8d6e381d631e17487cf51541b4fc34f2537b0a4a..4ac3370b230cc994a89ab36e479cf49b8d82ba5b 100644 (file)
@@ -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 {
 
index b81c5d3f34b03a68c13fde3f6715fce0fb2677e2..741b4dcf18963b0b937298fde89aa89f9ddd035d 100644 (file)
@@ -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;
 
index 612789bef85e1365b2bc69942b6a7a8d69d4d114..b98d9cbf43a1e396219b7c94900706792d37b8ed 100644 (file)
@@ -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 {
 
index 5b22979722236c997eff31dae521b30b0d81e1dd..16a2f53a0f993e6428927ec0f65a55f963f438db 100644 (file)
@@ -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 {
index 54c74cde7497dd6372b22ebda49ee0c0712073ce..7556a66d110f600c81361babd07c52616f93ecf6 100644 (file)
@@ -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;
index 8a4b959b647e00b08d61b735115dacc96e0d6dae..69f2f6fbe187547e0636caa820c264c6bc188238 100644 (file)
@@ -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;
index 233f6dec2d99ea6ab61d900ee9050a1ebb7b8bd8..4acc8fcdff699a7bd81e52e79a9b31cdbf76c8ab 100644 (file)
@@ -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;
 
index 0ebcc3fdb10bb7e12915af35111a8c0bf3dab596..198b3da2355b37de16dbea3c41862b17d8edeca0 100644 (file)
@@ -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 (file)
index 65b620c..0000000
+++ /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" +
-    "<ul>" +
-    "<li>Possible values for global permissions: %s</li>" +
-    "<li>Possible values for project permissions %s</li>" +
-    "</ul>",
-    GlobalPermissions.ALL_ON_ONE_LINE,
-    ProjectPermissions.ALL_ON_ONE_LINE);
-  private static final String PROJECT_PERMISSION_PARAM_DESCRIPTION = format("Permission" +
-    "<ul>" +
-    "<li>Possible values for project permissions %s</li>" +
-    "</ul>",
-    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");
-  }
-}
index bc42c1d69dff5c97505fd21ec4a469c71d08191e..fcce33c3cd93f0e253e78a3b6e4dedfbce652075 100644 (file)
@@ -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;
index f21e5608208fabf6e02857f2be5ce7fa2ace7b38..528152fba771e4260381463feb78f8a1debbdf6d 100644 (file)
@@ -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 {
index 7c18ae20ede1a7ed1085083574c2788ee61281df..2a1da412fb308a858539641f7f9a85e8a14c6ec6 100644 (file)
@@ -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 {
 
index 6aa46efae65ff8bb5216baf7fb67a0499cf801a0..3661409334514c09858c2c7244aa1fd330bbba90 100644 (file)
@@ -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 {
index 03ff653fa6d7a4a66bed7279224587181a98690e..0dfaaa174a5fa797af62dc8f73783531bb386030 100644 (file)
@@ -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 {
 
index 573e7007bb4a3bfa318e75f83fedede357d881f6..dd22e79b2a2b138e28fb6837e75fd0b8aa1f34c8 100644 (file)
@@ -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 {
index fa56dab3bd60bc0fe99e1ecf5e072ea79531e44c..8bbec5caa6c5fd08afd224d045135170ad62ef34 100644 (file)
@@ -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 {
index 5fc18d16d782ccfe5e6ba3b510d4941f2c1f0caf..79a54ed1e78ab87ea17f1e3d1a5be336a6eb269f 100644 (file)
@@ -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;
 
index 2c4ae44df62f25afdff90affd85537651e7f0a4d..d7ba4b5b0f574fefb373d033f92f90f5d3f68e42 100644 (file)
@@ -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;
index e1aa68b768601177e5e2c644a55687c67bcfaf2e..83d48ebfb6e753bcc91e15887740b1b8a2bc22b5 100644 (file)
@@ -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 {
index f015d39b2291b0ebc949f9e5e74d89c7adc0d691..2c735193a12a733855c626da24fcdb1af81f1551 100644 (file)
@@ -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 (file)
index 0000000..274c2c2
--- /dev/null
@@ -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" +
+    "<ul>" +
+    "<li>Possible values for global permissions: %s</li>" +
+    "<li>Possible values for project permissions %s</li>" +
+    "</ul>",
+    GlobalPermissions.ALL_ON_ONE_LINE,
+    ProjectPermissions.ALL_ON_ONE_LINE);
+  private static final String PROJECT_PERMISSION_PARAM_DESCRIPTION = format("Permission" +
+    "<ul>" +
+    "<li>Possible values for project permissions %s</li>" +
+    "</ul>",
+    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");
+  }
+}
index fba0dbe5411f6d574d1dfa561e86bbdaddeaf535..feda183aba9d3d8a925b20f6a1c41d8533c2c8f6 100644 (file)
@@ -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;
 
 /**
index 20b67e57bf06b7bd68d4b04df0a67845d99d6e29..82377eea06d03dcf13b50906cb596a1af7bc93be 100644 (file)
@@ -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;
 
 /**
index 221c7985d39dc3cf61257286ddc85ed49a7b8983..2544e3dc145d1071a0e05b68b721794ffdbcf13c 100644 (file)
@@ -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)
index 1f587ae6a8a3d487b1f3de4633c83a0551b63b0c..d84111c2965149f406dd1c391b13fbd746d46f38 100644 (file)
@@ -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();
index 2d9f96bdd316d757c262e754b6b0eb1c1896d1bf..7b6e00e49f1e76b7eb78b89da640215ea02f056f 100644 (file)
@@ -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)
index d7a1a0ebce9244ed822768794edbdfbfae2d51bc..6a28cbda890d1c4d794b73d252787398cf1b34d1 100644 (file)
@@ -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();
index a56ae1e7c6399b5d49b3023d0dd5c8dfdea4b984..27f64b19f6ec63257510cdd10432cd314c09ad0c 100644 (file)
@@ -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 {
index dd3115c28d2054cba8deb8407243c2a6aab3d630..160aebb1afee20fb3345eeaaa117e0230f5edd9d 100644 (file)
@@ -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 {
index 60f63ba9ca44f231ad1b12b4019a871bdcf9b8a5..33575ba5b1947de76d0c67d6640c5097c7ebf124 100644 (file)
@@ -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 {
 
index 707ce4eb5c41c239dae890fc61a99d0b7146e4af..3ca4b95c5de367909eb090efc18ecf1dfb1f9a0a 100644 (file)
@@ -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)
index 0fadbf6a91c22790a2a9ea2094c365e4d6b86145..0add9e68cd83048d76435489297520a82f8809c0 100644 (file)
@@ -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)
index 30d7dbec135f7f851fbfb4ce7f0e9519c340de23..517a9885abe7598108d1dd8b9513bd5e40998075 100644 (file)
@@ -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();
index bfdb74c7c47f0965b215ffeb16d05fe3ca02dba7..ff47ab463ec4f0afd7dee47a0aa2308a087e21d7 100644 (file)
@@ -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;
 
index 81582e4d8ed919eb8e1f4e5a96528641d55f908f..7d71fdd1eb6483241fb1617a51924df38bd28ad1 100644 (file)
@@ -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();
index aead1d2453e6f23d9eedaf206b0f81245863074a..a2c2649fa7ac929b8119a3ed2e6fb3d01b33b5a9 100644 (file)
@@ -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 {
index f68de3c4aa0cff3c7e3c95b7b1ad90fe4d90471a..defa13e539c00bd1b542a6ef715ee14dc43e92ff 100644 (file)
@@ -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 {
index fe9fe83acbe883c2c5953f5edef5ab630dab4b36..82d2404779c095ea0646cfadba0e3da1ea7f9662 100644 (file)
@@ -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 {
index f6bb2642ce174764d61a3be16933a81b4cef2995..864de4c130a55222ce5fe17a5e6116a3c691157a 100644 (file)
@@ -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)