aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-ws-client')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewUpdateQuery.java28
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewUpdateQueryTest.java6
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