]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7106 WS api/permissions/bulk_apply_template add to WS client
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 18 Mar 2016 10:07:48 +0000 (11:07 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 18 Mar 2016 17:09:34 +0000 (18:09 +0100)
sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsService.java
sonar-ws/src/test/java/org/sonarqube/ws/client/permission/PermissionsServiceTest.java

index 9cd367570505329cf722df12c680b0744dff1e6e..76a553792ea20c54feaa59c42d81628349c92c8e 100644 (file)
@@ -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())
index c05dc5fae377dd5e489174fd8ea256030f754207..5cdf798fbbd0bffafe8f8a3abf26019c2ce802aa 100644 (file)
@@ -205,6 +205,25 @@ public class PermissionsServiceTest {
       .andNoOtherParam();
   }
 
+  @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()