aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>2017-04-27 18:31:04 +0200
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>2017-05-03 19:49:09 +0200
commitb6c626d517f2a9783688b80a8dac0d5ba8a1f794 (patch)
tree81dea057e93bd27701c12f19904532ccaf62e580 /sonar-ws
parentbe31eae8b4497281b32cb609d05590c590b83af0 (diff)
downloadsonarqube-b6c626d517f2a9783688b80a8dac0d5ba8a1f794.tar.gz
sonarqube-b6c626d517f2a9783688b80a8dac0d5ba8a1f794.zip
SONAR-8865 remove old documents from rules/extension index when updating
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesService.java9
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/rule/RulesServiceTest.java16
2 files changed, 24 insertions, 1 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesService.java
index 2e35abbb99b..668e6ed69dc 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesService.java
@@ -19,6 +19,8 @@
*/
package org.sonarqube.ws.client.rule;
+import javax.annotation.Nullable;
+import org.sonarqube.ws.Rules;
import org.sonarqube.ws.Rules.SearchResponse;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
@@ -71,4 +73,11 @@ public class RulesService extends BaseService {
.setParam(PARAM_TYPES, inlineMultipleParamValue(request.getTypes())),
SearchResponse.parser());
}
+
+ public Rules.ShowResponse show(@Nullable String organization, String key) {
+ GetRequest request = new GetRequest(path("show"))
+ .setParam("organization", organization)
+ .setParam("key", key);
+ return call(request, Rules.ShowResponse.parser());
+ }
}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/rule/RulesServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/rule/RulesServiceTest.java
index a42a7a1e814..96d5eb7e5a3 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/rule/RulesServiceTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/rule/RulesServiceTest.java
@@ -23,6 +23,7 @@ import com.google.common.collect.Lists;
import java.util.List;
import org.junit.Rule;
import org.junit.Test;
+import org.sonarqube.ws.Rules;
import org.sonarqube.ws.Rules.SearchResponse;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.ServiceTester;
@@ -85,7 +86,7 @@ public class RulesServiceTest {
private RulesService underTest = serviceTester.getInstanceUnderTest();
@Test
- public void search() {
+ public void test_search() {
underTest.search(new SearchWsRequest()
.setActivation(ACTIVATION_VALUE)
.setActiveSeverities(ACTIVE_SEVERITIES_VALUE)
@@ -136,4 +137,17 @@ public class RulesServiceTest {
.hasParam(PARAM_TYPES, TYPES_VALUE_INLINED)
.andNoOtherParam();
}
+
+ @Test
+ public void test_show() {
+ underTest.show("the-org", "the-rule/key");
+
+ assertThat(serviceTester.getGetParser()).isSameAs(Rules.ShowResponse.parser());
+ GetRequest getRequest = serviceTester.getGetRequest();
+ serviceTester.assertThat(getRequest)
+ .hasPath("show")
+ .hasParam("organization", "the-org")
+ .hasParam("key", "the-rule/key")
+ .andNoOtherParam();
+ }
}