aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-03-18 11:07:48 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-03-18 18:09:34 +0100
commitaddaff54eadb44912307a5eca033437ab62be143 (patch)
tree5ccccbaea95c168f61cb29c2a73742d25541a9c2 /sonar-ws
parent76c63eb793a012323f167457e86fea2aa873ff22 (diff)
downloadsonarqube-addaff54eadb44912307a5eca033437ab62be143.tar.gz
sonarqube-addaff54eadb44912307a5eca033437ab62be143.zip
SONAR-7106 WS api/permissions/bulk_apply_template add to WS client
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java9
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java19
2 files changed, 28 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java
index 9cd36757050..76a553792ea 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java
@@ -105,6 +105,15 @@ public class PermissionsService extends BaseService {
.setParam(PARAM_TEMPLATE_NAME, request.getTemplateName()));
}
+ public void bulkApplyTemplate(BulkApplyTemplateWsRequest request) {
+ call(new PostRequest(path("bulk_apply_template"))
+ .setParam(PARAM_TEMPLATE_ID, request.getTemplateId())
+ .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())
+ .setParam("q", request.getQuery())
+ .setParam(PARAM_QUALIFIER, request.getQualifier())
+ );
+ }
+
public CreateTemplateWsResponse createTemplate(CreateTemplateWsRequest request) {
PostRequest post = new PostRequest(path("create_template"))
.setParam(PARAM_NAME, request.getName())
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java
index c05dc5fae37..5cdf798fbbd 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java
@@ -206,6 +206,25 @@ public class PermissionsServiceTest {
}
@Test
+ public void bulk_apply_template() {
+ underTest.bulkApplyTemplate(new BulkApplyTemplateWsRequest()
+ .setTemplateId(TEMPLATE_ID_VALUE)
+ .setTemplateName(TEMPLATE_NAME_VALUE)
+ .setQualifier(QUALIFIER_VALUE)
+ .setQuery(QUERY_VALUE));
+
+ assertThat(serviceTester.getPostParser()).isNull();
+ PostRequest postRequest = serviceTester.getPostRequest();
+ serviceTester.assertThat(postRequest)
+ .hasPath("bulk_apply_template")
+ .hasParam(PARAM_TEMPLATE_ID, TEMPLATE_ID_VALUE)
+ .hasParam(PARAM_TEMPLATE_NAME, TEMPLATE_NAME_VALUE)
+ .hasParam("q", QUERY_VALUE)
+ .hasParam(PARAM_QUALIFIER, QUALIFIER_VALUE)
+ .andNoOtherParam();
+ }
+
+ @Test
public void createTemplate_does_POST_on_Ws_create_template() {
underTest.createTemplate(new CreateTemplateWsRequest()
.setName(NAME_VALUE)