]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6947 PermissionsWsParameters in sonar-ws
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Thu, 12 Nov 2015 09:19:38 +0000 (10:19 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 17 Nov 2015 12:40:59 +0000 (13:40 +0100)
48 files changed:
server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/AddGroupAction.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/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/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/PermissionsWs.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParameters.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/permission/ws/RemoveGroupAction.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/SearchProjectPermissionsAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/TemplateGroupsAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/TemplateUsersAction.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/WsProjectRef.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/WsTemplateRef.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/AddGroupToTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/AddUserToTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/ApplyTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/CreateTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/RemoveGroupFromTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SetDefaultTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/UpdateTemplateAction.java
server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/WsGroupRef.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/AddUserActionTest.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/PermissionsWsTest.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/RemoveUserActionTest.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/TemplateGroupsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/TemplateUsersActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/UsersActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddGroupToTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/ApplyTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/CreateTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/DeleteTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveGroupFromTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/RemoveUserFromTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/SetDefaultTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/UpdateTemplateActionTest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java
sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsParameters.java [new file with mode: 0644]

index ef3d0c9dc9bdd44e6cff98ee9eba71dff27e0f0e..5d1ffda5a582c42c9b79d4c2a0e5d5ad813842e5 100644 (file)
@@ -45,7 +45,7 @@ import static com.google.common.collect.Ordering.natural;
 import static java.lang.String.format;
 import static org.sonar.server.component.ResourceTypeFunctions.RESOURCE_TYPE_TO_QUALIFIER;
 import static org.sonar.server.component.ws.WsComponentsParameters.PARAM_QUALIFIERS;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_QUALIFIER;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_QUALIFIER;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 
index 37797db28032d213d0442f0b5846b1ddcbb0aaec..6642c58839eaa489018a8bb21cbb3fc603cd5e06 100644 (file)
@@ -29,15 +29,15 @@ import org.sonar.server.permission.PermissionChange;
 import org.sonar.server.permission.PermissionUpdater;
 import org.sonarqube.ws.client.permission.AddGroupWsRequest;
 
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_GROUP_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_GROUP_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_KEY;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createGroupIdParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createGroupNameParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectParameter;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createGroupIdParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createGroupNameParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameter;
 import static org.sonar.server.permission.ws.WsProjectRef.newOptionalWsProjectRef;
 import static org.sonar.server.usergroups.ws.WsGroupRef.newWsGroupRef;
 
index 5528f88032607928c89f26d17f20824da37b987f..367dd9e4c54257fa43238f1312fe498b857e9fd9 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.PermissionsWsParameters.createPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createUserLoginParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createUserLoginParameter;
 
 public class AddUserAction implements PermissionsWsAction {
 
index 58bcca990e196488b6338d1c728c607dddb8cde9..2a2b008b5bd0b4477cf62807f4f30ca172239a0a 100644 (file)
@@ -31,7 +31,7 @@ import org.sonar.server.permission.ws.template.DefaultPermissionTemplateFinder;
 import org.sonar.server.user.UserSession;
 
 import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateParameters;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters;
 import static org.sonar.server.permission.ws.WsTemplateRef.fromRequest;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 
index 0a98ce631b424718ec9e10f62a03cf460012e392..1ca8bf8f4b28eb2aea427c44f21c3590ff75bc0d 100644 (file)
@@ -45,11 +45,11 @@ import static org.sonar.server.permission.PermissionPrivilegeChecker.checkProjec
 import static org.sonar.server.permission.ws.PermissionQueryParser.fromSelectionModeToMembership;
 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.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_KEY;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectParameter;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameter;
 import static org.sonar.server.permission.ws.WsProjectRef.newOptionalWsProjectRef;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 
index 4650889c0f96870efbbff99c12ab126fb91f3fe4..f9a09cce5d7964c4204636936c3817061f31ac40 100644 (file)
@@ -31,8 +31,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.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_USER_LOGIN;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN;
 
 class PermissionRequest {
   private final String permission;
index 3a6cf38249d2c0d307c767986373d6c3a2c206aa..28678daaae10024e01cc1fa7d5a2df3c2bfd1068 100644 (file)
@@ -33,9 +33,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.PermissionsWsParameters.PARAM_PATTERN;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_QUALIFIER;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PATTERN;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_QUALIFIER;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 
 public class PermissionRequestValidator {
index a106538f562f4e9897bbfe56a38958f120b3ed4c..ea9e8cfe5da0001f55467071e58a7764acaced38 100644 (file)
@@ -22,9 +22,9 @@ package org.sonar.server.permission.ws;
 
 import org.sonar.api.server.ws.WebService;
 
-public class PermissionsWs implements WebService {
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.ENDPOINT;
 
-  public static final String ENDPOINT = "api/permissions";
+public class PermissionsWs implements WebService {
 
   private final PermissionsWsAction[] actions;
 
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParameters.java
deleted file mode 100644 (file)
index 7c0b865..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;
-
-public class PermissionsWsParameters {
-
-  public static final String PARAM_PERMISSION = "permission";
-  public static final String PARAM_GROUP_NAME = "groupName";
-  public static final String PARAM_GROUP_ID = "groupId";
-  public static final String PARAM_PROJECT_ID = "projectId";
-  public static final String PARAM_PROJECT_KEY = "projectKey";
-  public static final String PARAM_USER_LOGIN = "login";
-  public static final String PARAM_TEMPLATE_UUID = "templateId";
-  public static final String PARAM_TEMPLATE_NAME = "templateName";
-
-  public static final String PARAM_ID = "id";
-  public static final String PARAM_NAME = "name";
-  public static final String PARAM_DESCRIPTION = "description";
-  public static final String PARAM_PATTERN = "projectKeyPattern";
-
-  public 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 PermissionsWsParameters() {
-    // static methods only
-  }
-
-  public static void createPermissionParameter(NewAction action) {
-    action.createParam(PARAM_PERMISSION)
-      .setDescription(PERMISSION_PARAM_DESCRIPTION)
-      .setRequired(true);
-  }
-
-  public static void createProjectPermissionParameter(NewAction action) {
-    action.createParam(PARAM_PERMISSION)
-      .setDescription(PROJECT_PERMISSION_PARAM_DESCRIPTION)
-      .setRequired(true);
-  }
-
-  public static void createGroupNameParameter(NewAction action) {
-    action.createParam(PARAM_GROUP_NAME)
-      .setDescription("Group name or 'anyone' (case insensitive)")
-      .setExampleValue("sonar-administrators");
-  }
-
-  public static void createGroupIdParameter(NewAction action) {
-    action.createParam(PARAM_GROUP_ID)
-      .setDescription("Group id")
-      .setExampleValue("42");
-  }
-
-  public 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");
-  }
-
-  public static void createUserLoginParameter(NewAction action) {
-    action.createParam(PARAM_USER_LOGIN)
-      .setRequired(true)
-      .setDescription("User login")
-      .setExampleValue("g.hopper");
-  }
-
-  public static void createTemplateParameters(NewAction action) {
-    createTemplateIdParameter(action);
-    createTemplateNameParameter(action);
-  }
-
-  private static void createTemplateIdParameter(NewAction action) {
-    action.createParam(PARAM_TEMPLATE_UUID)
-      .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");
-  }
-
-  public static void createTemplateProjectKeyPatternParameter(NewAction action) {
-    action.createParam(PARAM_PATTERN)
-      .setDescription("Project key pattern. Must be a valid Java regular expression")
-      .setExampleValue(".*\\.finance\\..*");
-  }
-
-  public static void createTemplateDescriptionParameter(NewAction action) {
-    action.createParam(PARAM_DESCRIPTION)
-      .setDescription("Description")
-      .setExampleValue("Permissions for all projects related to the financial service");
-  }
-
-  public 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/PermissionsWsParametersBuilder.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java
new file mode 100644 (file)
index 0000000..2d7bdac
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * 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;
+
+public class PermissionsWsParametersBuilder {
+
+  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 PermissionsWsParametersBuilder() {
+    // static methods only
+  }
+
+  public static void createPermissionParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION)
+      .setDescription(PERMISSION_PARAM_DESCRIPTION)
+      .setRequired(true);
+  }
+
+  public static void createProjectPermissionParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION)
+      .setDescription(PROJECT_PERMISSION_PARAM_DESCRIPTION)
+      .setRequired(true);
+  }
+
+  public static void createGroupNameParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME)
+      .setDescription("Group name or 'anyone' (case insensitive)")
+      .setExampleValue("sonar-administrators");
+  }
+
+  public static void createGroupIdParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID)
+      .setDescription("Group id")
+      .setExampleValue("42");
+  }
+
+  public static void createProjectParameter(NewAction action) {
+    createProjectIdParameter(action);
+    createProjectKeyParameter(action);
+  }
+
+  private static void createProjectIdParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID)
+      .setDescription("Project id")
+      .setExampleValue("ce4c03d6-430f-40a9-b777-ad877c00aa4d");
+  }
+
+  private static void createProjectKeyParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY)
+      .setDescription("Project key")
+      .setExampleValue("org.apache.hbas:hbase");
+  }
+
+  public static void createUserLoginParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN)
+      .setRequired(true)
+      .setDescription("User login")
+      .setExampleValue("g.hopper");
+  }
+
+  public static void createTemplateParameters(NewAction action) {
+    createTemplateIdParameter(action);
+    createTemplateNameParameter(action);
+  }
+
+  private static void createTemplateIdParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID)
+      .setDescription("Template id")
+      .setExampleValue(Uuids.UUID_EXAMPLE_01);
+  }
+
+  private static void createTemplateNameParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME)
+      .setDescription("Template name")
+      .setExampleValue("Default Permission Template for Projects");
+  }
+
+  public static void createTemplateProjectKeyPatternParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PATTERN)
+      .setDescription("Project key pattern. Must be a valid Java regular expression")
+      .setExampleValue(".*\\.finance\\..*");
+  }
+
+  public static void createTemplateDescriptionParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_DESCRIPTION)
+      .setDescription("Description")
+      .setExampleValue("Permissions for all projects related to the financial service");
+  }
+
+  public static void createIdParameter(NewAction action) {
+    action.createParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_ID)
+      .setRequired(true)
+      .setDescription("Id")
+      .setExampleValue("af8cb8cc-1e78-4c4e-8c00-ee8e814009a5");
+  }
+}
index 2a9b0ee571120fd10e6a7cdfd40e00cee952a36b..de317b88a21ee46cb370cc6f82626922756905fa 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.PermissionsWsParameters.createGroupIdParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createGroupNameParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createGroupIdParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createGroupNameParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameter;
 
 public class RemoveGroupAction implements PermissionsWsAction {
 
index 85b1d8b79d631319b27c00c141ab5b268ae4365c..127307e1513492aae62b16fcdbe589c52679ce48 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.PermissionsWsParameters.createPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createUserLoginParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createUserLoginParameter;
 
 public class RemoveUserAction implements PermissionsWsAction {
 
index d0e4ccfabd1512d47c2cf913c16c379c6e403c11..e8d40818fa4cf2eb489246fb7ba0a74d6e0f9e33 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.PermissionsWsParameters.createProjectParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameter;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 
 public class SearchProjectPermissionsAction implements PermissionsWsAction {
index fee0309378a47d8638ee8fb020696a0b6c066b59..10a03a4c346c3d0c3bd21ce4b1e6730dead04367 100644 (file)
@@ -38,9 +38,9 @@ import org.sonarqube.ws.WsPermissions.WsGroupsResponse;
 import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser;
 import static org.sonar.server.permission.ws.PermissionQueryParser.fromSelectionModeToMembership;
 import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateParameters;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 
 public class TemplateGroupsAction implements PermissionsWsAction {
index 9482612d499e6ec9d502bfa5a184da2cb8feab9b..0a2dc2669a61ade7202c10a36ff114706c08f127 100644 (file)
@@ -39,9 +39,9 @@ import static java.lang.String.format;
 import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser;
 import static org.sonar.server.permission.ws.PermissionQueryParser.fromSelectionModeToMembership;
 import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateParameters;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 
 public class TemplateUsersAction implements PermissionsWsAction {
index 967471638a6d55819db6e623e557c52cfa49eead..f1462147476240b274cf0677470a97a7a26555a4 100644 (file)
@@ -44,8 +44,8 @@ import static com.google.common.base.Strings.nullToEmpty;
 import static org.sonar.api.utils.Paging.forPageIndex;
 import static org.sonar.server.permission.PermissionPrivilegeChecker.checkProjectAdminUserByComponentDto;
 import static org.sonar.server.permission.ws.PermissionQueryParser.fromSelectionModeToMembership;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameter;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 
 public class UsersAction implements PermissionsWsAction {
index d71b6861442b216482d16054b0ea307857fc0b31..81f3b767bd37a6ee20e11742d7bd6e0949c1e9c7 100644 (file)
@@ -25,8 +25,8 @@ import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 import org.sonar.api.server.ws.Request;
 
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 
 /**
index 6fa2b2c7f554eee1e9c925b101de31ff3804e4bb..40d519e41d6776710e99d0f008679f54315a1c15 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.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 
 /**
index 8aab8b8ec703bfed9e3fbfb2446a36f429d3745c..eee677ed970fb0fdb1fad51f3257807ed5754419 100644 (file)
@@ -40,15 +40,15 @@ import static org.sonar.db.user.GroupMembershipQuery.IN;
 import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser;
 import static org.sonar.server.permission.ws.PermissionRequestValidator.validateNotAnyoneAndAdminPermission;
 import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_GROUP_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_GROUP_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createGroupIdParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createGroupNameParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateParameters;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createGroupIdParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createGroupNameParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters;
 import static org.sonar.server.permission.ws.WsTemplateRef.newTemplateRef;
 import static org.sonar.server.usergroups.ws.WsGroupRef.newWsGroupRef;
 
index 0d1d89249664a6d3c898a49a585fa93dc431b8b6..5d29aa33209ce65e49e216db7972f2cec6595f8f 100644 (file)
@@ -39,11 +39,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.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_USER_LOGIN;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateParameters;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createUserLoginParameter;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createUserLoginParameter;
 import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission;
 
 public class AddUserToTemplateAction implements PermissionsWsAction {
index f1a93a983d53a173dad3e0d97cf4a8bd7d502bca..169b1490094b7d51f9bbf3812c6009c3f57dd69e 100644 (file)
@@ -35,8 +35,8 @@ import org.sonar.server.permission.ws.WsProjectRef;
 import org.sonar.server.permission.ws.WsTemplateRef;
 
 import static java.util.Collections.singletonList;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateParameters;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters;
 
 public class ApplyTemplateAction implements PermissionsWsAction {
   private final DbClient dbClient;
index 38eb3127239f27386a4607501a7e1bfafb712900..e2d4c5d4786c6e544d942d4200706f697cf76a4a 100644 (file)
@@ -34,11 +34,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.PermissionsWsParameters.PARAM_DESCRIPTION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PATTERN;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateDescriptionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateProjectKeyPatternParameter;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_DESCRIPTION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PATTERN;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateDescriptionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.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 5f1387757d9582dc49dfb56fea2c00554c9834cb..a79f6877298a90023bc8b92f983d65f6352b5a9d 100644 (file)
@@ -34,11 +34,11 @@ import org.sonar.server.permission.ws.WsTemplateRef;
 import org.sonar.server.user.UserSession;
 
 import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createGroupIdParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createGroupNameParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateParameters;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createGroupIdParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createGroupNameParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters;
 import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission;
 
 public class RemoveGroupFromTemplateAction implements PermissionsWsAction {
index c793545c9a2cea660b0f4f92d1b57889007ae868..3a1254cd483d49fe7a43bc498326cc0d7fe2263d 100644 (file)
@@ -33,11 +33,11 @@ import org.sonar.server.permission.ws.WsTemplateRef;
 import org.sonar.server.user.UserSession;
 
 import static org.sonar.server.permission.PermissionPrivilegeChecker.checkGlobalAdminUser;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_USER_LOGIN;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createProjectPermissionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateParameters;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createUserLoginParameter;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createProjectPermissionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createUserLoginParameter;
 import static org.sonar.server.permission.ws.PermissionRequestValidator.validateProjectPermission;
 
 public class RemoveUserFromTemplateAction implements PermissionsWsAction {
index 82ca38f7153f9acd7da412c68358e8ca186036e5..73d1e8fa284d9b5db45ad9ef3d1a48810a393691 100644 (file)
@@ -41,8 +41,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.PermissionsWsParameters.PARAM_QUALIFIER;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateParameters;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_QUALIFIER;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters;
 import static org.sonar.server.permission.ws.PermissionRequestValidator.validateQualifier;
 import static org.sonar.server.component.ResourceTypeFunctions.RESOURCE_TYPE_TO_QUALIFIER;
 
index 5522eae7289bfe6d3a4b8060053715f32143b424..631b881e9d453ce198f5b87a6bff22af41caf08a 100644 (file)
@@ -39,13 +39,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.PermissionsWsParameters.PARAM_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_DESCRIPTION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PATTERN;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createIdParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateDescriptionParameter;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.createTemplateProjectKeyPatternParameter;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_DESCRIPTION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PATTERN;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createIdParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateDescriptionParameter;
+import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.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 153d0637417dc90e81700f89a3280d18d7ed23b4..a353f45db11cd293dbdba96730aeb30052c52dcb 100644 (file)
@@ -23,7 +23,6 @@ package org.sonar.server.usergroups.ws;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 import org.sonar.api.server.ws.Request;
-import org.sonar.server.permission.ws.PermissionsWsParameters;
 
 import static org.sonar.server.ws.WsUtils.checkRequest;
 
@@ -43,8 +42,8 @@ public class WsGroupRef {
   }
 
   public static WsGroupRef newWsGroupRefFromPermissionRequest(Request wsRequest) {
-    Long id = wsRequest.paramAsLong(PermissionsWsParameters.PARAM_GROUP_ID);
-    String name = wsRequest.param(PermissionsWsParameters.PARAM_GROUP_NAME);
+    Long id = wsRequest.paramAsLong(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID);
+    String name = wsRequest.param(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME);
 
     return new WsGroupRef(id, name);
   }
index 63fc66fb51be136aa3224a1bf241c120b1bc4df6..dacd4e47decad109d87adc17e36d46b84dc22643 100644 (file)
@@ -54,11 +54,11 @@ import static org.sonar.db.component.ComponentTesting.newProjectDto;
 import static org.sonar.db.component.ComponentTesting.newView;
 import static org.sonar.server.permission.ws.AddGroupAction.ACTION;
 import static org.sonar.server.permission.ws.PermissionsWs.ENDPOINT;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_GROUP_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_GROUP_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
 
 @Category(DbTests.class)
 public class AddGroupActionTest {
index 08136ea912d85bdfedc435ef35a119695707b751..3b8b51cbd57bb204c5315bd677dd986ccbdc989b 100644 (file)
@@ -54,10 +54,10 @@ import static org.sonar.db.component.ComponentTesting.newProjectDto;
 import static org.sonar.db.component.ComponentTesting.newView;
 import static org.sonar.server.permission.ws.AddUserAction.ACTION;
 import static org.sonar.server.permission.ws.PermissionsWs.ENDPOINT;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_KEY;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_USER_LOGIN;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN;
 
 @Category(DbTests.class)
 public class AddUserActionTest {
index 7e77eb15fa11cd11e369553c920889efa545c91c..4d025ce9eecedbef5ff035a29a68e01fdfc7c55a 100644 (file)
@@ -58,9 +58,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.component.ComponentTesting.newView;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
 import static org.sonar.test.JsonAssert.assertJson;
 
 @Category(DbTests.class)
index 05d459db6d6c760c7975cd32fe55630a5b47e85c..142e448050a5f91a4a8d5fa986eb458be95cb918 100644 (file)
@@ -63,7 +63,7 @@ public class PermissionsWsTest {
     assertThat(action.isPost()).isFalse();
     assertThat(action.isInternal()).isTrue();
     assertThat(action.since()).isEqualTo("5.2");
-    assertThat(action.param(PermissionsWsParameters.PARAM_PERMISSION).isRequired()).isTrue();
+    assertThat(action.param(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION).isRequired()).isTrue();
   }
 
   @Test
@@ -74,7 +74,7 @@ public class PermissionsWsTest {
     assertThat(action.isPost()).isFalse();
     assertThat(action.isInternal()).isTrue();
     assertThat(action.since()).isEqualTo("5.2");
-    assertThat(action.param(PermissionsWsParameters.PARAM_PERMISSION).isRequired()).isTrue();
+    assertThat(action.param(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION).isRequired()).isTrue();
   }
 
   private WebService.Controller controller() {
index e06c769e9f073c286e8c634d3be6c9f081c93890..fc61fc7e1c9c1a519acb49aebb0f2e0f586109cc 100644 (file)
@@ -53,11 +53,11 @@ 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.db.component.ComponentTesting.newView;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_GROUP_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_GROUP_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_KEY;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
 import static org.sonar.server.permission.ws.RemoveGroupAction.ACTION;
 
 @Category(DbTests.class)
index f15d13d37c78babbbeb0d1d609a78c5512e87943..c152c42a9a3585bb159d5da759277028747adc60 100644 (file)
@@ -52,10 +52,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.db.component.ComponentTesting.newView;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_KEY;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_USER_LOGIN;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN;
 import static org.sonar.server.permission.ws.PermissionsWs.ENDPOINT;
 import static org.sonar.server.permission.ws.RemoveUserAction.ACTION;
 
index 03bd47c57e5297ab37f5cd690c6956e1f80c6aea..792392e14e266d5c2f7fc132c5e71bb06acf3482 100644 (file)
@@ -61,7 +61,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.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
 import static org.sonar.test.JsonAssert.assertJson;
 
 public class SearchProjectPermissionsActionTest {
index 4c59eac6fb050349f5d0a0d73f4cf847663962ce..05a88d99cd47f11444da4ad1185ab0903699c151 100644 (file)
@@ -62,9 +62,9 @@ import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN;
 import static org.sonar.db.permission.PermissionTemplateTesting.newPermissionTemplateDto;
 import static org.sonar.db.permission.PermissionTemplateTesting.newPermissionTemplateGroupDto;
 import static org.sonar.db.user.GroupTesting.newGroupDto;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
 import static org.sonar.test.JsonAssert.assertJson;
 
 @Category(DbTests.class)
index a9902e044ddd007941971183b5914e99a8109060..289383186605210e502ba642bfb91b29d6ef32cb 100644 (file)
@@ -122,7 +122,7 @@ public class TemplateUsersActionTest {
   @Test
   public void search_for_users_by_template_name() throws IOException {
     InputStream responseStream = newRequest(UserRole.USER, null)
-      .setParam(PermissionsWsParameters.PARAM_TEMPLATE_NAME, template1.getName())
+      .setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME, template1.getName())
       .setMediaType(PROTOBUF)
       .execute().getInputStream();
 
@@ -134,7 +134,7 @@ public class TemplateUsersActionTest {
   @Test
   public void search_using_text_query() throws IOException {
     InputStream responseStream = newRequest(UserRole.USER, null)
-      .setParam(PermissionsWsParameters.PARAM_TEMPLATE_NAME, template1.getName())
+      .setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME, template1.getName())
       .setParam(WebService.Param.TEXT_QUERY, "ame-1")
       .setMediaType(PROTOBUF)
       .execute().getInputStream();
@@ -147,7 +147,7 @@ public class TemplateUsersActionTest {
   @Test
   public void search_using_selected() throws IOException {
     InputStream responseStream = newRequest(UserRole.USER, null)
-      .setParam(PermissionsWsParameters.PARAM_TEMPLATE_NAME, template1.getName())
+      .setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME, template1.getName())
       .setParam(WebService.Param.SELECTED, "all")
       .setMediaType(PROTOBUF)
       .execute().getInputStream();
@@ -161,7 +161,7 @@ public class TemplateUsersActionTest {
   @Test
   public void search_with_pagination() throws IOException {
     InputStream responseStream = newRequest(UserRole.USER, null)
-      .setParam(PermissionsWsParameters.PARAM_TEMPLATE_NAME, template1.getName())
+      .setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME, template1.getName())
       .setParam(WebService.Param.SELECTED, "all")
       .setParam(WebService.Param.PAGE, "2")
       .setParam(WebService.Param.PAGE_SIZE, "1")
@@ -194,7 +194,7 @@ public class TemplateUsersActionTest {
     expectedException.expect(BadRequestException.class);
 
     newRequest(UserRole.USER, template1.getUuid())
-      .setParam(PermissionsWsParameters.PARAM_TEMPLATE_NAME, template1.getName())
+      .setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME, template1.getName())
       .execute();
   }
 
@@ -236,9 +236,9 @@ public class TemplateUsersActionTest {
 
   private TestRequest newRequest(String permission, @Nullable String templateUuid) {
     TestRequest request = ws.newRequest();
-    request.setParam(PermissionsWsParameters.PARAM_PERMISSION, permission);
+    request.setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION, permission);
     if (templateUuid != null) {
-      request.setParam(PermissionsWsParameters.PARAM_TEMPLATE_UUID, templateUuid);
+      request.setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID, templateUuid);
     }
 
     return request;
index b7c41b0617370697bdc26c0e49ac4b09641f1718..34999ae0deb58b3f82335d40ff72f1e88470d821 100644 (file)
@@ -53,9 +53,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.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
 import static org.sonar.test.JsonAssert.assertJson;
 
 @Category(DbTests.class)
index d2667d6a7880163c8539d982fa360945be0da1d5..71c23d05a579665b3d5a1265768441351cb5cb42 100644 (file)
@@ -47,7 +47,7 @@ import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.exceptions.UnauthorizedException;
 import org.sonar.server.permission.ws.PermissionDependenciesFinder;
-import org.sonar.server.permission.ws.PermissionsWsParameters;
+import org.sonar.server.permission.ws.PermissionsWsParametersBuilder;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.usergroups.ws.UserGroupFinder;
 import org.sonar.server.ws.TestRequest;
@@ -63,11 +63,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.PermissionsWsParameters.PARAM_GROUP_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_GROUP_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
 
 @Category(DbTests.class)
 public class AddGroupToTemplateActionTest {
@@ -217,13 +217,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(PermissionsWsParameters.PARAM_GROUP_NAME, groupName);
+      request.setParam(PermissionsWsParametersBuilder.PARAM_GROUP_NAME, groupName);
     }
     if (templateKey != null) {
       request.setParam(PARAM_TEMPLATE_UUID, templateKey);
     }
     if (permission != null) {
-      request.setParam(PermissionsWsParameters.PARAM_PERMISSION, permission);
+      request.setParam(PermissionsWsParametersBuilder.PARAM_PERMISSION, permission);
     }
 
     request.execute();
index 1391b9981931e27012aebe52b361a2baeb95765e..4e5ba547cbc2854202adf91e440567fd4baaa7b5 100644 (file)
@@ -46,7 +46,7 @@ import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.exceptions.UnauthorizedException;
 import org.sonar.server.permission.ws.PermissionDependenciesFinder;
-import org.sonar.server.permission.ws.PermissionsWsParameters;
+import org.sonar.server.permission.ws.PermissionsWsParametersBuilder;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.usergroups.ws.UserGroupFinder;
 import org.sonar.server.ws.TestRequest;
@@ -60,9 +60,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.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_USER_LOGIN;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN;
 
 @Category(DbTests.class)
 public class AddUserToTemplateActionTest {
@@ -189,10 +189,10 @@ public class AddUserToTemplateActionTest {
       request.setParam(PARAM_USER_LOGIN, userLogin);
     }
     if (templateKey != null) {
-      request.setParam(PermissionsWsParameters.PARAM_TEMPLATE_UUID, templateKey);
+      request.setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID, templateKey);
     }
     if (permission != null) {
-      request.setParam(PermissionsWsParameters.PARAM_PERMISSION, permission);
+      request.setParam(PermissionsWsParametersBuilder.PARAM_PERMISSION, permission);
     }
 
     request.execute();
index eb4ceead7949d46cf7500872e75b6f0358cf9595..ed56934385e2f51ab6026bfd7846b9d1f6e2a83c 100644 (file)
@@ -72,10 +72,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.PermissionsWsParameters.PARAM_PROJECT_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PROJECT_KEY;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
 
 @Category(DbTests.class)
 public class ApplyTemplateActionTest {
index 4789e934557e192442e130096680283363f56cc2..d5296a494f92031484a79144cb5b51897b09140d 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.PermissionsWsParameters.PARAM_DESCRIPTION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PATTERN;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_DESCRIPTION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PATTERN;
 import static org.sonar.test.JsonAssert.assertJson;
 
 public class CreateTemplateActionTest {
index 83f56144c542bf2c4d23528c9edac93ed19ca2a8..a95725377418e6f08504e2ab722d11dc3aed6ace 100644 (file)
@@ -57,8 +57,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.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
 
 public class DeleteTemplateActionTest {
 
index 37a89b0457e725eacac11783bb50e1b0c38acc5a..c85fcd7a8dce8262e33eb9963c8a0b563fed2ce9 100644 (file)
@@ -46,7 +46,7 @@ import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.exceptions.UnauthorizedException;
 import org.sonar.server.permission.ws.PermissionDependenciesFinder;
-import org.sonar.server.permission.ws.PermissionsWsParameters;
+import org.sonar.server.permission.ws.PermissionsWsParametersBuilder;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.usergroups.ws.UserGroupFinder;
 import org.sonar.server.ws.TestRequest;
@@ -60,11 +60,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.PermissionsWsParameters.PARAM_GROUP_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_GROUP_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
 
 @Category(DbTests.class)
 public class RemoveGroupFromTemplateActionTest {
@@ -220,13 +220,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(PermissionsWsParameters.PARAM_GROUP_NAME, groupName);
+      request.setParam(PermissionsWsParametersBuilder.PARAM_GROUP_NAME, groupName);
     }
     if (templateKey != null) {
       request.setParam(PARAM_TEMPLATE_UUID, templateKey);
     }
     if (permission != null) {
-      request.setParam(PermissionsWsParameters.PARAM_PERMISSION, permission);
+      request.setParam(PermissionsWsParametersBuilder.PARAM_PERMISSION, permission);
     }
 
     request.execute();
index 538db3114443a458f7e55b97e0d5e33b5dd66ce1..254dbf9cbe5ec98460b4ff2e9d5d1d06b5dbda89 100644 (file)
@@ -46,7 +46,7 @@ import org.sonar.server.exceptions.ForbiddenException;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.exceptions.UnauthorizedException;
 import org.sonar.server.permission.ws.PermissionDependenciesFinder;
-import org.sonar.server.permission.ws.PermissionsWsParameters;
+import org.sonar.server.permission.ws.PermissionsWsParametersBuilder;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.usergroups.ws.UserGroupFinder;
 import org.sonar.server.ws.TestRequest;
@@ -60,9 +60,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.PermissionsWsParameters.PARAM_PERMISSION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_USER_LOGIN;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_USER_LOGIN;
 
 @Category(DbTests.class)
 public class RemoveUserFromTemplateActionTest {
@@ -213,10 +213,10 @@ public class RemoveUserFromTemplateActionTest {
       request.setParam(PARAM_USER_LOGIN, userLogin);
     }
     if (templateKey != null) {
-      request.setParam(PermissionsWsParameters.PARAM_TEMPLATE_UUID, templateKey);
+      request.setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID, templateKey);
     }
     if (permission != null) {
-      request.setParam(PermissionsWsParameters.PARAM_PERMISSION, permission);
+      request.setParam(PermissionsWsParametersBuilder.PARAM_PERMISSION, permission);
     }
 
     request.execute();
index 7925bc707c73bc6b8ff74f3603f048e7d3e0f3cd..6bc7b584ad9e176bd60a557666a95122b33cd558 100644 (file)
@@ -62,9 +62,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.PermissionsWsParameters.PARAM_QUALIFIER;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_QUALIFIER;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
 
 @Category(DbTests.class)
 public class SetDefaultTemplateActionTest {
index 8aa7f028c36be2b3a5f5d957163804c05221289f..5feb5a49bbb7bf9ca806d62c0506dce58812ea8f 100644 (file)
@@ -51,10 +51,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.PermissionsWsParameters.PARAM_DESCRIPTION;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_ID;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_NAME;
-import static org.sonar.server.permission.ws.PermissionsWsParameters.PARAM_PATTERN;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_DESCRIPTION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PATTERN;
 import static org.sonar.test.JsonAssert.assertJson;
 
 public class UpdateTemplateActionTest {
index 27c898a614b81c1afb7a93bbad3b309e8a5da705..ba152378b6b3db4e79df5b8153ba316acef92417 100644 (file)
@@ -25,10 +25,15 @@ import org.sonarqube.ws.client.WsClient;
 
 import static org.sonarqube.ws.client.WsRequest.newGetRequest;
 import static org.sonarqube.ws.client.WsRequest.newPostRequest;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PERMISSION;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_ID;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_PROJECT_KEY;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_NAME;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_UUID;
 
 public class PermissionsWsClient {
-  private static final String ENDPOINT = "api/permissions/";
-
   private final WsClient wsClient;
 
   public PermissionsWsClient(WsClient wsClient) {
@@ -37,9 +42,9 @@ public class PermissionsWsClient {
 
   public WsPermissions.WsGroupsResponse groups(GroupsWsRequest request) {
     return wsClient.execute(newGetRequest(action("groups"))
-      .setParam("permission", request.getPermission())
-      .setParam("projectId", request.getProjectId())
-      .setParam("projectKey", request.getProjectKey())
+      .setParam(PARAM_PERMISSION, request.getPermission())
+      .setParam(PARAM_PROJECT_ID, request.getProjectId())
+      .setParam(PARAM_PROJECT_KEY, request.getProjectKey())
       .setParam("p", request.getPage())
       .setParam("ps", request.getPageSize())
       .setParam("selected", request.getSelected())
@@ -49,23 +54,23 @@ public class PermissionsWsClient {
 
   public void addGroup(AddGroupWsRequest request) {
     wsClient.execute(newPostRequest(action("add_group"))
-      .setParam("permission", request.getPermission())
-      .setParam("projectId", request.getProjectId())
-      .setParam("projectKey", request.getProjectKey())
-      .setParam("groupId", request.getGroupId())
-      .setParam("groupName", request.getGroupName()));
+      .setParam(PARAM_PERMISSION, request.getPermission())
+      .setParam(PARAM_PROJECT_ID, request.getProjectId())
+      .setParam(PARAM_PROJECT_KEY, request.getProjectKey())
+      .setParam(PARAM_GROUP_ID, request.getGroupId())
+      .setParam(PARAM_GROUP_NAME, request.getGroupName()));
   }
 
   public void addGroupToTemplate(AddGroupToTemplateWsRequest request) {
     wsClient.execute(newPostRequest(action("add_group_to_template"))
-      .setParam("groupId", request.getGroupId())
-      .setParam("groupName", request.getGroupName())
-      .setParam("permission", request.getPermission())
-      .setParam("templateId", request.getTemplateId())
-      .setParam("templateName", request.getTemplateName()));
+      .setParam(PARAM_GROUP_ID, request.getGroupId())
+      .setParam(PARAM_GROUP_NAME, request.getGroupName())
+      .setParam(PARAM_PERMISSION, request.getPermission())
+      .setParam(PARAM_TEMPLATE_UUID, request.getTemplateId())
+      .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName()));
   }
 
   private static String action(String action) {
-    return ENDPOINT + action;
+    return PermissionsWsParameters.ENDPOINT + "/" + action;
   }
 }
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsParameters.java
new file mode 100644 (file)
index 0000000..eaf91fd
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.sonarqube.ws.client.permission;
+
+public class PermissionsWsParameters {
+  public static final String ENDPOINT = "api/permissions";
+
+  public static final String PARAM_PERMISSION = "permission";
+  public static final String PARAM_GROUP_NAME = "groupName";
+  public static final String PARAM_GROUP_ID = "groupId";
+  public static final String PARAM_PROJECT_ID = "projectId";
+  public static final String PARAM_PROJECT_KEY = "projectKey";
+  public static final String PARAM_USER_LOGIN = "login";
+  public static final String PARAM_TEMPLATE_UUID = "templateId";
+  public static final String PARAM_TEMPLATE_NAME = "templateName";
+  public static final String PARAM_ID = "id";
+  public static final String PARAM_NAME = "name";
+  public static final String PARAM_DESCRIPTION = "description";
+  public static final String PARAM_PATTERN = "projectKeyPattern";
+  public static final String PARAM_QUALIFIER = "qualifier";
+}