aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-06-28 14:07:42 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-06-28 19:22:48 +0400
commit6eabbf7ffb16a904cd288590dd9b13ba37d660c0 (patch)
tree71bb45306114b11f7f4c9be0100dc871d7ca1288 /sonar-ws-client
parent4e1655566e26035164f644b0a933e7c0e7891436 (diff)
downloadsonarqube-6eabbf7ffb16a904cd288590dd9b13ba37d660c0.tar.gz
sonarqube-6eabbf7ffb16a904cd288590dd9b13ba37d660c0.zip
SONAR-2453,SONAR-2404 Allow search for reviews by resolutions
Diffstat (limited to 'sonar-ws-client')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java26
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java28
2 files changed, 29 insertions, 25 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java
index 07cc0da834e..0892ed83e82 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java
@@ -43,7 +43,7 @@ public class ReviewQuery extends Query<Review> {
private String[] authorLoginsOrIds;
private String[] assigneeLoginsOrIds;
private String output;
- private String falsePositives;
+ private String[] resolutions;
public ReviewQuery() {
}
@@ -215,28 +215,16 @@ public class ReviewQuery extends Query<Review> {
/**
* @since 2.9
- * @return the false_positives
*/
- public String getFalsePositives() {
- return falsePositives;
+ public String[] getResolutions() {
+ return resolutions;
}
/**
- * Sets the 'false_positives' parameter that can be:
- * <ul>
- * <li>only</li>
- * <li>with</li>
- * <li>without</li>
- * </ul>
- * , 'with' being the default one on the server side. <br>
- * <br>
- *
* @since 2.9
- * @param falsePositives
- * the false_positives
*/
- public ReviewQuery setFalsePositives(String falsePositives) {
- this.falsePositives = falsePositives;
+ public ReviewQuery setResolutions(String... resolutions) {
+ this.resolutions = resolutions;
return this;
}
@@ -256,8 +244,8 @@ public class ReviewQuery extends Query<Review> {
appendUrlParameter(url, "authors", authorLoginsOrIds);
appendUrlParameter(url, "assignees", assigneeLoginsOrIds);
appendUrlParameter(url, "output", output);
- appendUrlParameter(url, "false_positives", falsePositives);
- if (falsePositives == null && reviewType != null) {
+ appendUrlParameter(url, "resolutions", resolutions);
+ if (resolutions == null && reviewType != null) {
// Use of the 2.8 deprecated API: handle backward compatibility
appendUrlParameter(url, "review_type", reviewType);
}
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java
index ddb58c41d83..18fec4bc693 100644
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java
+++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
public class ReviewQueryTest extends QueryTestCase {
@Test
- public void testSimpleQueryForResource() {
+ public void queryForResource() {
Resource resource = mock(Resource.class);
when(resource.getId()).thenReturn(69);
ReviewQuery query = ReviewQuery.createForResource(resource);
@@ -38,14 +38,30 @@ public class ReviewQueryTest extends QueryTestCase {
}
@Test
+ public void queryById() {
+ assertThat(new ReviewQuery().setId(13L).getUrl(), is("/api/reviews?id=13&"));
+ assertThat(new ReviewQuery().setIds(10L, 11L).getUrl(), is("/api/reviews?ids=10,11&"));
+ }
+
+ @Test
+ public void queryByResolution() {
+ ReviewQuery query = new ReviewQuery().setStatuses("RESOLVED").setResolutions("FALSE-POSITIVE");
+ assertThat(query.getUrl(), is("/api/reviews?statuses=RESOLVED&resolutions=FALSE-POSITIVE&"));
+ }
+
+ @Test
public void resourceTreeViolations() {
- ReviewQuery query = new ReviewQuery();
- query.setIds(10L, 11L).setStatuses("OPEN").setSeverities("MINOR", "INFO").setProjectKeysOrIds("com.sonar.foo:bar")
- .setResourceKeysOrIds("2", "3").setAuthorLoginsOrIds("20").setAssigneeLoginsOrIds("admin").setOutput("html")
- .setFalsePositives("without");
+ ReviewQuery query = new ReviewQuery()
+ .setStatuses("OPEN")
+ .setSeverities("MINOR", "INFO")
+ .setProjectKeysOrIds("com.sonar.foo:bar")
+ .setResourceKeysOrIds("2", "3")
+ .setAuthorLoginsOrIds("20")
+ .setAssigneeLoginsOrIds("admin")
+ .setOutput("html");
assertThat(
query.getUrl(),
- is("/api/reviews?ids=10,11&statuses=OPEN&severities=MINOR,INFO&projects=com.sonar.foo%3Abar&resources=2,3&authors=20&assignees=admin&output=html&false_positives=without&"));
+ is("/api/reviews?statuses=OPEN&severities=MINOR,INFO&projects=com.sonar.foo%3Abar&resources=2,3&authors=20&assignees=admin&output=html&"));
}
@Test