diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2011-06-15 15:07:28 +0200 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2011-06-15 15:07:28 +0200 |
commit | a4f0b855424d328fdf02821fcd0a32087f7a1e05 (patch) | |
tree | d956f4cf7c9d108e0c96fa9284da4eb70ddd7d34 /sonar-ws-client | |
parent | ed54ab5b3084d39287c6d14a75f9848bddd3550d (diff) | |
download | sonarqube-a4f0b855424d328fdf02821fcd0a32087f7a1e05.tar.gz sonarqube-a4f0b855424d328fdf02821fcd0a32087f7a1e05.zip |
SONAR-2520 Add support for RESOLVED and REOPENED statuses for reviews
- Modifications on the Web UI side to allow to resolve reviews
- Modifications on the batch side to reopen reviews that were
specified as resolved but the violation has not been fixed
- Modifications on the WS server side to allow to change the status
of a review to RESOLVED or REOPENED
- Modifications on the WS client to reflect those server side changes
Diffstat (limited to 'sonar-ws-client')
-rw-r--r-- | sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewUpdateQuery.java | 28 | ||||
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewUpdateQueryTest.java | 6 |
2 files changed, 34 insertions, 0 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewUpdateQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewUpdateQuery.java index 244ef0b5b4d..262cc9e4bfe 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewUpdateQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewUpdateQuery.java @@ -29,6 +29,7 @@ public class ReviewUpdateQuery extends UpdateQuery<Review> { private String newText; private String assignee; private Boolean falsePositive; + private String status; public ReviewUpdateQuery() { } @@ -96,6 +97,23 @@ public class ReviewUpdateQuery extends UpdateQuery<Review> { return query; } + /** + * Builds a request that will change the status of a an existing review.<br/> + * <br/> + * Currently, only "RESOLVED" and "REOPENED" are supported. + * + * @param reviewId + * The id of the review + * @param status + * The new status + */ + public static ReviewUpdateQuery changeStatusQuery(Long reviewId, String status) { + ReviewUpdateQuery query = new ReviewUpdateQuery(); + query.setReviewId(reviewId); + query.setStatus(status); + return query; + } + public Long getReviewId() { return reviewId; } @@ -141,6 +159,15 @@ public class ReviewUpdateQuery extends UpdateQuery<Review> { return this; } + public String getStatus() { + return status; + } + + public ReviewUpdateQuery setStatus(String status) { + this.status = status; + return this; + } + @Override public String getUrl() { StringBuilder url = new StringBuilder(); @@ -152,6 +179,7 @@ public class ReviewUpdateQuery extends UpdateQuery<Review> { appendUrlParameter(url, "new_text", getNewText()); appendUrlParameter(url, "assignee", getAssignee()); appendUrlParameter(url, "false_positive", getFalsePositive()); + appendUrlParameter(url, "status", getStatus()); return url.toString(); } diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewUpdateQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewUpdateQueryTest.java index ee28a908ab6..10620d92b82 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewUpdateQueryTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewUpdateQueryTest.java @@ -51,4 +51,10 @@ public class ReviewUpdateQueryTest extends QueryTestCase { assertThat(query.getUrl(), is("/api/reviews/?id=13&new_text=Hello+World%21&false_positive=true&")); } + @Test + public void testChangeStatus() { + ReviewUpdateQuery query = ReviewUpdateQuery.changeStatusQuery(13L, "RESOLVED"); + assertThat(query.getUrl(), is("/api/reviews/?id=13&status=RESOLVED&")); + } + }
\ No newline at end of file |