aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-07-18 15:44:48 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-07-22 00:31:16 +0200
commit6182f01a60369b10bd0f5a2e065d7f844496da5b (patch)
tree64f47830483b147ef9ecadb8ea8c723a9ced283a /server
parentb18e284c549f4e46d0ad806cfbcc76e348027bd7 (diff)
downloadsonarqube-6182f01a60369b10bd0f5a2e065d7f844496da5b.tar.gz
sonarqube-6182f01a60369b10bd0f5a2e065d7f844496da5b.zip
SONAR-9516 add integration tests on permission templates WS
including ES resiliency tests
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/ApplyTemplateAction.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/CreateTemplateAction.java4
2 files changed, 5 insertions, 3 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/ApplyTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/ApplyTemplateAction.java
index 65f57f7ccaf..7847af840fd 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/ApplyTemplateAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/ApplyTemplateAction.java
@@ -38,6 +38,7 @@ import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.crea
import static org.sonar.server.permission.ws.PermissionsWsParametersBuilder.createTemplateParameters;
import static org.sonar.server.permission.ws.ProjectWsRef.newWsProjectRef;
import static org.sonar.server.permission.ws.template.WsTemplateRef.newTemplateRef;
+import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_ORGANIZATION;
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_ID;
@@ -62,7 +63,8 @@ public class ApplyTemplateAction implements PermissionsWsAction {
.setProjectId(request.param(PARAM_PROJECT_ID))
.setProjectKey(request.param(PARAM_PROJECT_KEY))
.setTemplateId(request.param(PARAM_TEMPLATE_ID))
- .setTemplateName(request.param(PARAM_TEMPLATE_NAME));
+ .setTemplateName(request.param(PARAM_TEMPLATE_NAME))
+ .setOrganization(request.param(PARAM_ORGANIZATION));
}
@Override
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/CreateTemplateAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/CreateTemplateAction.java
index 8354a36eaf5..6ba87c03a46 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/CreateTemplateAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/CreateTemplateAction.java
@@ -70,7 +70,7 @@ public class CreateTemplateAction implements PermissionsWsAction {
.setName(request.mandatoryParam(PARAM_NAME))
.setDescription(request.param(PARAM_DESCRIPTION))
.setProjectKeyPattern(request.param(PARAM_PROJECT_KEY_PATTERN))
- .setOrganizationKey(request.param(PARAM_ORGANIZATION));
+ .setOrganization(request.param(PARAM_ORGANIZATION));
}
private static CreateTemplateWsResponse buildResponse(PermissionTemplateDto permissionTemplateDto) {
@@ -106,7 +106,7 @@ public class CreateTemplateAction implements PermissionsWsAction {
private CreateTemplateWsResponse doHandle(CreateTemplateWsRequest request) {
try (DbSession dbSession = dbClient.openSession(false)) {
- OrganizationDto org = wsSupport.findOrganization(dbSession, request.getOrganizationKey());
+ OrganizationDto org = wsSupport.findOrganization(dbSession, request.getOrganization());
checkGlobalAdmin(userSession, org.getUuid());
validateTemplateNameForCreation(dbSession, org, request.getName());