aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-05-23 14:59:34 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2013-05-23 17:46:59 +0200
commitf1187355aa041dc5dd183574bf43a52ca535db5f (patch)
tree216884f51336af7941227496ecd0606b9f9e26e7 /sonar-ws-client
parent6a0ee5725ed9fd514f177d9c07ade38cf1cf8272 (diff)
downloadsonarqube-f1187355aa041dc5dd183574bf43a52ca535db5f.tar.gz
sonarqube-f1187355aa041dc5dd183574bf43a52ca535db5f.zip
SONAR-3755 remove code related to reviews and violations
Diffstat (limited to 'sonar-ws-client')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/Review.java270
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewCreateQuery.java104
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java303
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewUpdateQuery.java132
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java43
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/ViolationQuery.java63
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java60
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java1
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshaller.java9
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewCreateQueryTest.java60
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java95
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewUpdateQueryTest.java66
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/services/ViolationQueryTest.java5
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshallerTest.java104
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java20
-rw-r--r--sonar-ws-client/src/test/resources/violations/violation-with-review.json1
16 files changed, 22 insertions, 1314 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Review.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Review.java
deleted file mode 100644
index c44cfbe58fe..00000000000
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Review.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.wsclient.services;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @since 2.8
- */
-public class Review extends Model {
-
- private Long id;
- private Date createdAt = null;
- private Date updatedAt = null;
- private String authorLogin = null;
- private String assigneeLogin = null;
- private String title = null;
- private String type = null;
- private String status = null;
- private String severity = null;
- private String resourceKee = null;
- private Integer line = null;
- private String resolution = null;
- private Long violationId;
- private List<Review.Comment> comments = new ArrayList<Review.Comment>();
-
- /**
- * @return id
- */
- public Long getId() {
- return id;
- }
-
- public Review setId(Long id) {
- this.id = id;
- return this;
- }
-
- /**
- * @return date of creation
- */
- public Date getCreatedAt() {
- return createdAt;
- }
-
- public Review setCreatedAt(Date createdAt) {
- this.createdAt = createdAt;
- return this;
- }
-
- /**
- * @return date of last modification
- */
- public Date getUpdatedAt() {
- return updatedAt;
- }
-
- public Review setUpdatedAt(Date updatedAt) {
- this.updatedAt = updatedAt;
- return this;
- }
-
- /**
- * @return user that initiated review
- */
- public String getAuthorLogin() {
- return authorLogin;
- }
-
- public Review setAuthorLogin(String s) {
- this.authorLogin = s;
- return this;
- }
-
- /**
- * @return assignee
- */
- public String getAssigneeLogin() {
- return assigneeLogin;
- }
-
- public Review setAssigneeLogin(String s) {
- this.assigneeLogin = s;
- return this;
- }
-
- /**
- * @return title
- */
- public String getTitle() {
- return title;
- }
-
- public Review setTitle(String s) {
- this.title = s;
- return this;
- }
-
- /**
- * @deprecated since 2.9.
- */
- @Deprecated
- public String getType() {
- return type;
- }
-
- /**
- * @deprecated since 2.9.
- */
- @Deprecated
- public Review setType(String s) {
- this.type = s;
- return this;
- }
-
- /**
- * @return status
- */
- public String getStatus() {
- return status;
- }
-
- public Review setStatus(String status) {
- this.status = status;
- return this;
- }
-
- /**
- * @return severity
- */
- public String getSeverity() {
- return severity;
- }
-
- public Review setSeverity(String severity) {
- this.severity = severity;
- return this;
- }
-
- /**
- * @return resourceKee
- */
- public String getResourceKee() {
- return resourceKee;
- }
-
- public Review setResourceKee(String resourceKee) {
- this.resourceKee = resourceKee;
- return this;
- }
-
- /**
- * @return line
- */
- public Integer getLine() {
- return line;
- }
-
- public Review setLine(Integer line) {
- this.line = line;
- return this;
- }
-
- /**
- * @since 2.9
- */
- public String getResolution() {
- return resolution;
- }
-
- /**
- * @since 2.9
- */
- public Review setResolution(String resolution) {
- this.resolution = resolution;
- return this;
- }
-
- /**
- * @since 2.9
- * @return violation id
- */
- public Long getViolationId() {
- return violationId;
- }
-
- public Review setViolationId(Long violationId) {
- this.violationId = violationId;
- return this;
- }
-
- /**
- * @return comments
- */
- public List<Review.Comment> getComments() {
- return comments;
- }
-
- public Review addComments(Long id, Date updatedAt, String authorLogin, String text) {
- this.comments.add(new Review.Comment(id, updatedAt, authorLogin, text));
- return this;
- }
-
- /**
- * @since 2.8
- */
- public static final class Comment extends Model {
-
- private Long id = null;
- private String authorLogin = null;
- private Date updatedAt = null;
- private String text = null;
-
- private Comment(Long id, Date updatedAt, String authorLogin, String text) {
- this.id = id;
- this.updatedAt = updatedAt;
- this.authorLogin = authorLogin;
- this.text = text;
- }
-
- /**
- * @since 2.9
- * @return id
- */
- public Long getId() {
- return id;
- }
-
- /**
- * @return user that created this comment
- */
- public String getAuthorLogin() {
- return authorLogin;
- }
-
- /**
- * @return date of last modification
- */
- public Date getUpdatedAt() {
- return updatedAt;
- }
-
- /**
- * @return text
- */
- public String getText() {
- return text;
- }
- }
-
-}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewCreateQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewCreateQuery.java
deleted file mode 100644
index 9f726bcf016..00000000000
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewCreateQuery.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.wsclient.services;
-
-/**
- * @since 2.9
- */
-public class ReviewCreateQuery extends CreateQuery<Review> {
-
- private Long violationId;
- private String comment;
- private String assignee;
- private String status;
- private String resolution;
-
- public ReviewCreateQuery() {
- }
-
- public Long getViolationId() {
- return violationId;
- }
-
- public ReviewCreateQuery setViolationId(Long violationId) {
- this.violationId = violationId;
- return this;
- }
-
- public String getComment() {
- return comment;
- }
-
- public ReviewCreateQuery setComment(String comment) {
- this.comment = comment;
- return this;
- }
-
- public String getAssignee() {
- return assignee;
- }
-
- public ReviewCreateQuery setAssignee(String userLogin) {
- this.assignee = userLogin;
- return this;
- }
-
- public String getStatus() {
- return status;
- }
-
- public ReviewCreateQuery setStatus(String status) {
- this.status = status;
- return this;
- }
-
- public String getResolution() {
- return resolution;
- }
-
- public ReviewCreateQuery setResolution(String resolution) {
- this.resolution = resolution;
- return this;
- }
-
- @Override
- public String getUrl() {
- StringBuilder url = new StringBuilder();
- url.append(ReviewQuery.BASE_URL).append('?');
- appendUrlParameter(url, "violation_id", getViolationId());
- appendUrlParameter(url, "assignee", getAssignee());
- appendUrlParameter(url, "status", getStatus());
- appendUrlParameter(url, "resolution", getResolution());
- return url.toString();
- }
-
- /**
- * Property {@link #comment} is transmitted through request body as content may exceed URL size allowed by the server.
- */
- @Override
- public String getBody() {
- return comment;
- }
-
- @Override
- public Class<Review> getModelClass() {
- return Review.class;
- }
-}
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
deleted file mode 100644
index 6ff9b182708..00000000000
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewQuery.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.wsclient.services;
-
-/**
- * @since 2.8
- */
-public class ReviewQuery extends Query<Review> {
-
- public static final String BASE_URL = "/api/reviews";
-
- public static final String OUTPUT_PLAIN = "PLAIN";
- public static final String OUTPUT_HTML = "HTML";
-
- /**
- * @deprecated since 2.9, but kept for backward compatibility
- */
- @Deprecated
- private String reviewType;
- private Long id;
- private Long[] ids;
- private String[] statuses;
- private String[] severities;
- private String[] projectKeysOrIds;
- private String[] resourceKeysOrIds;
- private String[] authorLogins;
- private String[] assigneeLogins;
- private String output;
- private String[] resolutions;
-
- public ReviewQuery() {
- }
-
- /**
- * @deprecated since 2.9
- * @return NULL
- */
- @Deprecated
- public String getReviewType() {
- return reviewType;
- }
-
- /**
- * @deprecated since 2.9
- * @param reviewType
- * the reviewType to set
- */
- @Deprecated
- public ReviewQuery setReviewType(String reviewType) {
- this.reviewType = reviewType;
- return this;
- }
-
- /**
- * @return the id
- */
- public Long getId() {
- return id;
- }
-
- /**
- * @param id
- * the id to set
- */
- public ReviewQuery setId(Long id) {
- this.id = id;
- return this;
- }
-
- /**
- * @return the ids
- */
- public Long[] getIds() {
- return ids;
- }
-
- /**
- * @param ids
- * the ids to set
- */
- public ReviewQuery setIds(Long... ids) {
- this.ids = ids;
- return this;
- }
-
- /**
- * @return the statuses
- */
- public String[] getStatuses() {
- return statuses;
- }
-
- /**
- * @param statuses
- * the statuses to set
- */
- public ReviewQuery setStatuses(String... statuses) {
- this.statuses = statuses;
- return this;
- }
-
- /**
- * @return the severities
- */
- public String[] getSeverities() {
- return severities;
- }
-
- /**
- * @param severities
- * the severities to set
- */
- public ReviewQuery setSeverities(String... severities) {
- this.severities = severities;
- return this;
- }
-
- /**
- * @return the projectKeysOrIds
- */
- public String[] getProjectKeysOrIds() {
- return projectKeysOrIds;
- }
-
- /**
- * @param projectKeysOrIds
- * the projectKeysOrIds to set
- */
- public ReviewQuery setProjectKeysOrIds(String... projectKeysOrIds) {
- this.projectKeysOrIds = projectKeysOrIds;
- return this;
- }
-
- /**
- * @return the resourceKeysOrIds
- */
- public String[] getResourceKeysOrIds() {
- return resourceKeysOrIds;
- }
-
- /**
- * @param resourceKeysOrIds
- * the resourceKeysOrIds to set
- */
- public ReviewQuery setResourceKeysOrIds(String... resourceKeysOrIds) {
- this.resourceKeysOrIds = resourceKeysOrIds;
- return this;
- }
-
- /**
- * @deprecated since 3.0. Searching by user ID is not possible anymore. Use {@link #getAuthorLogins()} instead.
- */
- @Deprecated
- public String[] getAuthorLoginsOrIds() {
- return authorLogins;
- }
-
- /**
- * @deprecated since 3.0. Searching by user ID is not possible anymore. Use {@link #setAuthorLogins(String...)} instead.
- */
- @Deprecated
- public ReviewQuery setAuthorLoginsOrIds(String... authorLoginsOrIds) {
- setAuthorLogins(authorLoginsOrIds);
- return this;
- }
-
- /**
- * @return the authorLogins
- */
- public String[] getAuthorLogins() {
- return authorLogins;
- }
-
- /**
- * @param authorLogins
- * the authorLogins to set
- */
- public ReviewQuery setAuthorLogins(String... authorLogins) {
- this.authorLogins = authorLogins;
- return this;
- }
-
- /**
- * @deprecated since 3.0. Searching by user ID is not possible anymore. Use {@link #getAssigneeLogins()} instead.
- */
- @Deprecated
- public String[] getAssigneeLoginsOrIds() {
- return assigneeLogins;
- }
-
- /**
- * @deprecated since 3.0. Searching by user ID is not possible anymore. Use {@link #setAssigneeLogins(String...)} instead.
- */
- @Deprecated
- public ReviewQuery setAssigneeLoginsOrIds(String... assigneeLoginsOrIds) {
- setAssigneeLogins(assigneeLoginsOrIds);
- return this;
- }
-
- /**
- * @return the assigneeLogins
- */
- public String[] getAssigneeLogins() {
- return assigneeLogins;
- }
-
- /**
- * @param assigneeLogins
- * the assigneeLogins to set
- */
- public ReviewQuery setAssigneeLogins(String... assigneeLogins) {
- this.assigneeLogins = assigneeLogins;
- return this;
- }
-
- /**
- * @return the output
- */
- public String getOutput() {
- return output;
- }
-
- /**
- *
- * @param output
- * the output
- */
- public ReviewQuery setOutput(String output) {
- this.output = output;
- return this;
- }
-
- /**
- * @since 2.9
- */
- public String[] getResolutions() {
- return resolutions;
- }
-
- /**
- * @since 2.9
- */
- public ReviewQuery setResolutions(String... resolutions) {
- this.resolutions = resolutions;
- return this;
- }
-
- @Override
- public String getUrl() {
- StringBuilder url = new StringBuilder(BASE_URL);
- url.append('?');
- if (id != null) {
- appendUrlParameter(url, "ids", id);
- } else if (ids != null) {
- appendUrlParameter(url, "ids", ids);
- }
- appendUrlParameter(url, "statuses", statuses);
- appendUrlParameter(url, "severities", severities);
- appendUrlParameter(url, "projects", projectKeysOrIds);
- appendUrlParameter(url, "resources", resourceKeysOrIds);
- appendUrlParameter(url, "authors", authorLogins);
- appendUrlParameter(url, "assignees", assigneeLogins);
- appendUrlParameter(url, "output", output);
- appendUrlParameter(url, "resolutions", resolutions);
- if (resolutions == null && reviewType != null) {
- // Use of the 2.8 deprecated API: handle backward compatibility
- appendUrlParameter(url, "review_type", reviewType);
- }
-
- return url.toString();
- }
-
- @Override
- public Class<Review> getModelClass() {
- return Review.class;
- }
-
- public static ReviewQuery createForReview(Long id) {
- return new ReviewQuery().setId(id);
- }
-
- public static ReviewQuery createForResource(Resource resource) {
- return new ReviewQuery().setResourceKeysOrIds(resource.getId().toString());
- }
-
-}
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
deleted file mode 100644
index 1fcc0c58d12..00000000000
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ReviewUpdateQuery.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.wsclient.services;
-
-/**
- * @since 2.9
- */
-public final class ReviewUpdateQuery extends UpdateQuery<Review> {
-
- private long reviewId;
- private String action;
- private String comment;
- private String assignee;
- private String resolution;
-
- /**
- * Creates query to add comment to review.
- */
- public static ReviewUpdateQuery addComment(long id, String comment) {
- return new ReviewUpdateQuery(id, "add_comment").setComment(comment);
- }
-
- /**
- * Creates query to reassign review.
- */
- public static ReviewUpdateQuery reassign(long id, String assignee) {
- return new ReviewUpdateQuery(id, "reassign").setAssignee(assignee);
- }
-
- /**
- * Creates query to resolve review.
- * If resolution "FALSE-POSITIVE", then you must provide comment using {@link #setComment(String)}.
- * Otherwise comment is optional.
- *
- * @param resolution
- * can be "FIXED" or "FALSE-POSITIVE"
- */
- public static ReviewUpdateQuery resolve(long id, String resolution) {
- return new ReviewUpdateQuery(id, "resolve").setResolution(resolution);
- }
-
- /**
- * Creates query to reopen review.
- * If review was resolved as "FALSE-POSITIVE", then you must provide comment using {@link #setComment(String)}.
- * Otherwise comment is optional.
- */
- public static ReviewUpdateQuery reopen(long id) {
- return new ReviewUpdateQuery(id, "reopen");
- }
-
- private ReviewUpdateQuery(long id, String action) {
- this.reviewId = id;
- this.action = action;
- }
-
- public long getReviewId() {
- return reviewId;
- }
-
- public ReviewUpdateQuery setComment(String comment) {
- this.comment = comment;
- return this;
- }
-
- public String getComment() {
- return comment;
- }
-
- public String getAssignee() {
- return assignee;
- }
-
- public ReviewUpdateQuery setAssignee(String userLogin) {
- this.assignee = userLogin;
- return this;
- }
-
- public String getResolution() {
- return resolution;
- }
-
- /**
- * @param resolution
- * can be "FIXED" or "FALSE-POSITIVE"
- */
- public ReviewUpdateQuery setResolution(String resolution) {
- this.resolution = resolution;
- return this;
- }
-
- @Override
- public String getUrl() {
- StringBuilder url = new StringBuilder();
- url.append(ReviewQuery.BASE_URL)
- .append('/').append(action)
- .append('/').append(reviewId)
- .append('?');
- appendUrlParameter(url, "assignee", getAssignee());
- appendUrlParameter(url, "resolution", getResolution());
- return url.toString();
- }
-
- /**
- * Property {@link #comment} transmitted through request body as content may exceed URL size allowed by the server.
- */
- @Override
- public String getBody() {
- return comment;
- }
-
- @Override
- public Class<Review> getModelClass() {
- return Review.class;
- }
-}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java
index f8c413bdcd4..485db0910a1 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Violation.java
@@ -21,9 +21,13 @@ package org.sonar.wsclient.services;
import java.util.Date;
+/**
+ * @deprecated in 3.6. Replaced by issues.
+ */
+@Deprecated
public class Violation extends Model {
- private Long id = null;
+ private String id = null;
private String message = null;
private String severity = null;
private Integer line = null;
@@ -31,11 +35,9 @@ public class Violation extends Model {
private String ruleName = null;
private String resourceKey = null;
private String resourceName = null;
- private String resourceScope = null;
private String resourceQualifier = null;
private Date createdAt = null;
private boolean switchedOff;
- private Review review = null;
public String getMessage() {
return message;
@@ -138,15 +140,6 @@ public class Violation extends Model {
return this;
}
- public String getResourceScope() {
- return resourceScope;
- }
-
- public Violation setResourceScope(String resourceScope) {
- this.resourceScope = resourceScope;
- return this;
- }
-
public String getResourceQualifier() {
return resourceQualifier;
}
@@ -193,32 +186,12 @@ public class Violation extends Model {
return switchedOff;
}
- /**
- * @since 2.8
- */
- public Review getReview() {
- return review;
- }
-
- /**
- * @since 2.8
- */
- public Violation setReview(Review review) {
- this.review = review;
- return this;
- }
-
- /**
- * @since 2.9
- */
- public Long getId() {
+ public String getKey() {
return id;
}
- /**
- * @since 2.9
- */
- public void setId(Long id) {
+ public Violation setKey(String id) {
this.id = id;
+ return this;
}
}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ViolationQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ViolationQuery.java
index c6809101ec3..38a9fb71a5b 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ViolationQuery.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ViolationQuery.java
@@ -19,34 +19,25 @@
*/
package org.sonar.wsclient.services;
+/**
+ * @deprecated in 3.6. Replaced by issues.
+ */
+@Deprecated
public class ViolationQuery extends Query<Violation> {
public static final String BASE_URL = "/api/violations";
private String resourceKeyOrId;
private int depth = 0;
- private String[] scopes;
private String[] qualifiers;
private String[] ruleKeys;
- private String[] categories;
private String[] severities;
private Integer limit;
- private Boolean includeReview;
- private String output;
public ViolationQuery(String resourceKeyOrId) {
this.resourceKeyOrId = resourceKeyOrId;
}
- public String[] getScopes() {
- return scopes;
- }
-
- public ViolationQuery setScopes(String... scopes) {
- this.scopes = scopes;
- return this;
- }
-
public String[] getQualifiers() {
return qualifiers;
}
@@ -65,15 +56,6 @@ public class ViolationQuery extends Query<Violation> {
return this;
}
- public String[] getCategories() {
- return categories;
- }
-
- public ViolationQuery setCategories(String... categories) {
- this.categories = categories;
- return this;
- }
-
/**
* @since 2.5
*/
@@ -130,36 +112,6 @@ public class ViolationQuery extends Query<Violation> {
return this;
}
- /**
- * @since 2.8
- */
- public Boolean getIncludeReview() {
- return includeReview;
- }
-
- /**
- * @since 2.8
- */
- public ViolationQuery setIncludeReview(Boolean includeReview) {
- this.includeReview = includeReview;
- return this;
- }
-
- /**
- * @since 2.8
- */
- public String getOutput() {
- return output;
- }
-
- /**
- * @since 2.8
- */
- public ViolationQuery setOutput(String output) {
- this.output = output;
- return this;
- }
-
@Override
public String getUrl() {
StringBuilder url = new StringBuilder(BASE_URL);
@@ -169,15 +121,10 @@ public class ViolationQuery extends Query<Violation> {
url.append("depth=").append(depth).append("&");
}
appendUrlParameter(url, "limit", limit);
- appendUrlParameter(url, "scopes", scopes);
appendUrlParameter(url, "qualifiers", qualifiers);
appendUrlParameter(url, "rules", ruleKeys);
- appendUrlParameter(url, "categories", categories);
appendUrlParameter(url, "priorities", severities);
- appendUrlParameter(url, "include_review", includeReview);
- appendUrlParameter(url, "output", output);
-
- return url.toString();
+ return url.toString();
}
@Override
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java
deleted file mode 100644
index 09a1d18b54c..00000000000
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshaller.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.wsclient.unmarshallers;
-
-import org.sonar.wsclient.services.Review;
-import org.sonar.wsclient.services.WSUtils;
-
-/**
- * @since 2.8
- */
-public class ReviewUnmarshaller extends AbstractUnmarshaller<Review> {
-
- @Override
- protected Review parse(Object json) {
- WSUtils utils = WSUtils.getINSTANCE();
-
- Review review = new Review();
- review.setId(utils.getLong(json, "id"));
- review.setCreatedAt(utils.getDateTime(json, "createdAt"));
- review.setUpdatedAt(utils.getDateTime(json, "updatedAt"));
- review.setAuthorLogin(utils.getString(json, "author"));
- review.setAssigneeLogin(utils.getString(json, "assignee"));
- review.setTitle(utils.getString(json, "title"));
- review.setStatus(utils.getString(json, "status"));
- review.setSeverity(utils.getString(json, "severity"));
- review.setResourceKee(utils.getString(json, "resource"));
- review.setLine(utils.getInteger(json, "line"));
- review.setResolution(utils.getString(json, "resolution"));
- review.setViolationId(utils.getLong(json, "violationId"));
- review.setType(utils.getString(json, "type"));
-
- Object comments = utils.getField(json, "comments");
- if (comments != null) {
- for (int i = 0; i < utils.getArraySize(comments); i++) {
- Object comment = utils.getArrayElement(comments, i);
- review.addComments(utils.getLong(comment, "id"), utils.getDateTime(comment, "updatedAt"), utils.getString(comment, "author"),
- utils.getString(comment, "text"));
- }
- }
-
- return review;
- }
-}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java
index f2e8069a833..75e99385d6c 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java
@@ -47,7 +47,6 @@ public final class Unmarshallers {
unmarshallers.put(Rule.class, new RuleUnmarshaller());
unmarshallers.put(TimeMachine.class, new TimeMachineUnmarshaller());
unmarshallers.put(Profile.class, new ProfileUnmarshaller());
- unmarshallers.put(Review.class, new ReviewUnmarshaller());
unmarshallers.put(ManualMeasure.class, new ManualMeasureUnmarshaller());
unmarshallers.put(Authentication.class, new AuthenticationUnmarshaller());
unmarshallers.put(ResourceSearchResult.class, new ResourceSearchUnmarshaller());
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshaller.java
index 36f1327aee5..25e5b5b585c 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshaller.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshaller.java
@@ -29,19 +29,13 @@ public class ViolationUnmarshaller extends AbstractUnmarshaller<Violation> {
WSUtils utils = WSUtils.getINSTANCE();
Violation violation = new Violation();
- violation.setId(utils.getLong(json, "id"));
+ violation.setKey(utils.getString(json, "id"));
violation.setMessage(utils.getString(json, "message"));
violation.setLine(utils.getInteger(json, "line"));
violation.setSeverity(utils.getString(json, "priority"));
violation.setCreatedAt(utils.getDateTime(json, "createdAt"));
violation.setSwitchedOff(utils.getBoolean(json, "switchedOff"));
- Object review = utils.getField(json, "review");
- if (review != null) {
- ReviewUnmarshaller reviewUnmarshaller = new ReviewUnmarshaller();
- violation.setReview(reviewUnmarshaller.parse(review));
- }
-
Object rule = utils.getField(json, "rule");
if (rule != null) {
violation.setRuleKey(utils.getString(rule, "key"));
@@ -53,7 +47,6 @@ public class ViolationUnmarshaller extends AbstractUnmarshaller<Violation> {
violation.setResourceKey(utils.getString(resource, "key"));
violation.setResourceName(utils.getString(resource, "name"));
violation.setResourceQualifier(utils.getString(resource, "qualifier"));
- violation.setResourceScope(utils.getString(resource, "scope"));
}
return violation;
}
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewCreateQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewCreateQueryTest.java
deleted file mode 100644
index a3fa37b3a78..00000000000
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewCreateQueryTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.wsclient.services;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-public class ReviewCreateQueryTest extends QueryTestCase {
-
- @Test
- public void testCreateReview() {
- ReviewCreateQuery query = new ReviewCreateQuery()
- .setViolationId(13L)
- .setComment("Hello World!");
- assertThat(query.getUrl(), is("/api/reviews?violation_id=13&"));
- assertThat(query.getBody(), is("Hello World!"));
- assertThat(query.getModelClass().getName(), is(Review.class.getName()));
- }
-
- @Test
- public void testCreateAssignedReview() {
- ReviewCreateQuery query = new ReviewCreateQuery()
- .setViolationId(13L)
- .setAssignee("fabrice")
- .setComment("Hello World!");
- assertThat(query.getUrl(), is("/api/reviews?violation_id=13&assignee=fabrice&"));
- assertThat(query.getBody(), is("Hello World!"));
- }
-
- @Test
- public void testCreateResolvedReview() {
- ReviewCreateQuery query = new ReviewCreateQuery()
- .setViolationId(13L)
- .setStatus("RESOLVED")
- .setResolution("FALSE-POSITIVE")
- .setComment("Hello World!");
- assertThat(query.getUrl(), is("/api/reviews?violation_id=13&status=RESOLVED&resolution=FALSE-POSITIVE&"));
- assertThat(query.getBody(), is("Hello World!"));
- }
-
-}
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
deleted file mode 100644
index 6573973c64c..00000000000
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewQueryTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.wsclient.services;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.junit.Test;
-
-public class ReviewQueryTest extends QueryTestCase {
-
- @Test
- public void queryForResource() {
- Resource resource = mock(Resource.class);
- when(resource.getId()).thenReturn(69);
- ReviewQuery query = ReviewQuery.createForResource(resource);
- assertThat(query.getUrl(), is("/api/reviews?resources=69&"));
- assertThat(query.getModelClass().getName(), is(Review.class.getName()));
- }
-
- @Test
- public void queryById() {
- assertThat(new ReviewQuery().setId(13L).getUrl(), is("/api/reviews?ids=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()
- .setStatuses("OPEN")
- .setSeverities("MINOR", "INFO")
- .setProjectKeysOrIds("com.sonar.foo:bar")
- .setResourceKeysOrIds("2", "3")
- .setAuthorLogins("foo")
- .setAssigneeLogins("admin")
- .setOutput("html");
- assertThat(
- query.getUrl(),
- is("/api/reviews?statuses=OPEN&severities=MINOR,INFO&projects=com.sonar.foo%3Abar&resources=2,3&authors=foo&assignees=admin&output=html&"));
- }
-
- @Test
- public void resourceTreeViolationsForSonar2_8() {
- ReviewQuery query = new ReviewQuery();
- query.setIds(10L, 11L).setReviewType("FALSE_POSITIVE").setStatuses("OPEN").setSeverities("MINOR", "INFO")
- .setProjectKeysOrIds("com.sonar.foo:bar").setResourceKeysOrIds("2", "3").setAuthorLogins("foo").setAssigneeLogins("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=foo&assignees=admin&output=html&review_type=FALSE_POSITIVE&"));
- }
-
- // http://jira.codehaus.org/browse/SONAR-3283
- @Test
- public void testDeprecatedQueryByUserOrAssigneeId() throws Exception {
- // the de deprecated setters
- ReviewQuery query = new ReviewQuery()
- .setAuthorLoginsOrIds("20")
- .setAssigneeLoginsOrIds("40");
- assertThat(query.getAuthorLogins(), is(new String[] {"20"}));
- assertThat(query.getAssigneeLogins(), is(new String[] {"40"}));
-
- // and test the deprecated getters
- query = new ReviewQuery()
- .setAuthorLogins("foo")
- .setAssigneeLogins("bar");
- assertThat(query.getAuthorLoginsOrIds(), is(new String[] {"foo"}));
- assertThat(query.getAssigneeLoginsOrIds(), is(new String[] {"bar"}));
- }
-}
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
deleted file mode 100644
index e81e3f91534..00000000000
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ReviewUpdateQueryTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.wsclient.services;
-
-import static org.hamcrest.Matchers.nullValue;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-public class ReviewUpdateQueryTest extends QueryTestCase {
-
- @Test
- public void testAddComment() {
- ReviewUpdateQuery query = ReviewUpdateQuery.addComment(13, "Hello World!");
- assertThat(query.getUrl(), is("/api/reviews/add_comment/13?"));
- assertThat(query.getBody(), is("Hello World!"));
- assertThat(query.getModelClass().getName(), is(Review.class.getName()));
- }
-
- @Test
- public void testReassign() {
- ReviewUpdateQuery query = ReviewUpdateQuery.reassign(13, "fabrice");
- assertThat(query.getUrl(), is("/api/reviews/reassign/13?assignee=fabrice&"));
- assertThat(query.getBody(), nullValue());
- }
-
- @Test
- public void testResolveAsFalsePositive() {
- ReviewUpdateQuery query = ReviewUpdateQuery.resolve(13, "FALSE-POSITIVE").setComment("Hello World!");
- assertThat(query.getUrl(), is("/api/reviews/resolve/13?resolution=FALSE-POSITIVE&"));
- assertThat(query.getBody(), is("Hello World!"));
- }
-
- @Test
- public void testResolveAsFixed() {
- ReviewUpdateQuery query = ReviewUpdateQuery.resolve(13, "FIXED");
- assertThat(query.getUrl(), is("/api/reviews/resolve/13?resolution=FIXED&"));
- assertThat(query.getBody(), nullValue());
- }
-
- @Test
- public void testReopen() {
- ReviewUpdateQuery query = ReviewUpdateQuery.reopen(13);
- assertThat(query.getUrl(), is("/api/reviews/reopen/13?"));
- assertThat(query.getBody(), nullValue());
- }
-
-}
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ViolationQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ViolationQueryTest.java
index 0acea23d356..6da64d96cc1 100644
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ViolationQueryTest.java
+++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ViolationQueryTest.java
@@ -40,10 +40,9 @@ public class ViolationQueryTest extends QueryTestCase {
.setLimit(20)
.setSeverities("MAJOR", "BLOCKER")
.setQualifiers("FIL")
- .setRuleKeys("checkstyle:foo", "pmd:bar")
- .setOutput("html");
+ .setRuleKeys("checkstyle:foo", "pmd:bar");
assertThat(
query.getUrl(),
- is("/api/violations?resource=myproject&depth=-1&limit=20&qualifiers=FIL&rules=checkstyle%3Afoo,pmd%3Abar&priorities=MAJOR,BLOCKER&output=html&"));
+ is("/api/violations?resource=myproject&depth=-1&limit=20&qualifiers=FIL&rules=checkstyle%3Afoo,pmd%3Abar&priorities=MAJOR,BLOCKER&"));
}
}
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshallerTest.java
deleted file mode 100644
index 1d3492862b9..00000000000
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ReviewUnmarshallerTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.wsclient.unmarshallers;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-import org.sonar.wsclient.services.Review;
-import org.sonar.wsclient.services.Review.Comment;
-
-import java.util.List;
-
-public class ReviewUnmarshallerTest extends UnmarshallerTestCase {
-
- @Test
- public void testEmptyJSON() {
- Review review = new ReviewUnmarshaller().toModel("[]");
- assertThat(review, nullValue());
- }
-
- @Test
- public void testToModels() {
- List<Review> reviews = new ReviewUnmarshaller().toModels(loadFile("/reviews/reviews-2.9.json"));
- assertThat(reviews.size(), is(2));
-
- Review review = reviews.get(0);
- assertThat(review.getId(), is(3L));
- assertNotNull(review.getCreatedAt());
- assertNotNull(review.getUpdatedAt());
- assertThat(review.getAuthorLogin(), is("admin"));
- assertThat(review.getAssigneeLogin(), is("admin"));
- assertThat(review.getTitle(), is("'static' modifier out of order with the JLS suggestions."));
- assertThat(review.getStatus(), is("RESOLVED"));
- assertThat(review.getResolution(), is("FALSE-POSITIVE"));
- assertThat(review.getSeverity(), is("MINOR"));
- assertThat(review.getResourceKee(), is("org.codehaus.sonar:sonar-channel:org.sonar.channel.CodeReaderConfiguration"));
- assertThat(review.getLine(), is(33));
- assertThat(review.getViolationId(), is(1L));
- List<Comment> comments = review.getComments();
- assertThat(comments.size(), is(4));
- Comment comment = comments.get(0);
- assertThat(comment.getId(), is(1L));
- assertNotNull(comment.getUpdatedAt());
- assertThat(comment.getAuthorLogin(), is("admin"));
- assertThat(comment.getText(), is("This is a review.<br/>And this is on multiple lines...<br/><br/><code>Wouhou!!!!!</code>"));
-
- review = reviews.get(1);
- assertThat(review.getAssigneeLogin(), nullValue());
- assertThat(review.getStatus(), is("OPEN"));
- assertThat(review.getResolution(), nullValue());
- }
-
- /*
- * Test Unmarshaller with JSON data received from a Sonar 2.8
- */
- @Test
- public void testToModelsForSonar2_8() {
- List<Review> reviews = new ReviewUnmarshaller().toModels(loadFile("/reviews/reviews-2.8.json"));
- assertThat(reviews.size(), is(2));
-
- Review review = reviews.get(0);
- assertThat(review.getAssigneeLogin(), nullValue());
-
- review = reviews.get(1);
- assertThat(review.getId(), is(3L));
- assertNotNull(review.getCreatedAt());
- assertNotNull(review.getUpdatedAt());
- assertThat(review.getAuthorLogin(), is("admin"));
- assertThat(review.getAssigneeLogin(), is("admin"));
- assertThat(review.getTitle(), is("'static' modifier out of order with the JLS suggestions."));
- assertThat(review.getType(), is("VIOLATION"));
- assertThat(review.getStatus(), is("OPEN"));
- assertThat(review.getSeverity(), is("MINOR"));
- assertThat(review.getResourceKee(), is("org.codehaus.sonar:sonar-channel:org.sonar.channel.CodeReaderConfiguration"));
- assertThat(review.getLine(), is(33));
- List<Comment> comments = review.getComments();
- assertThat(comments.size(), is(4));
- Comment comment = comments.get(0);
- assertNotNull(comment.getUpdatedAt());
- assertThat(comment.getAuthorLogin(), is("admin"));
- assertThat(comment.getText(), is("This is a review.<br/>And this is on multiple lines...<br/><br/><code>Wouhou!!!!!</code>"));
- }
-
-}
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java
index d6449899f5d..1eccd7e3158 100644
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java
+++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java
@@ -29,9 +29,13 @@ import static org.junit.Assert.assertThat;
import java.util.List;
import org.junit.Test;
-import org.sonar.wsclient.services.Review;
import org.sonar.wsclient.services.Violation;
+/**
+ * @deprecated in 3.6. Replaced by issues.
+ */
+@Deprecated
+
public class ViolationUnmarshallerTest extends UnmarshallerTestCase {
@Test
@@ -43,7 +47,7 @@ public class ViolationUnmarshallerTest extends UnmarshallerTestCase {
assertThat(violations.size(), is(2));
violation = violations.get(0);
- assertThat(violation.getId(), is(1L));
+ assertThat(violation.getKey(), is("1"));
assertThat(violation.getMessage(), is("throw java.lang.Exception"));
assertThat(violation.hasLine(), is(true));
assertThat(violation.getLine(), is(97));
@@ -55,9 +59,7 @@ public class ViolationUnmarshallerTest extends UnmarshallerTestCase {
is("org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool"));
assertThat(violation.getResourceName(), is("TraceableResourceLimitingPool"));
assertThat(violation.getResourceQualifier(), is("CLA"));
- assertThat(violation.getResourceScope(), is("FIL"));
assertThat(violation.isSwitchedOff(), is(false));
- assertThat(violation.getReview(), nullValue());
}
@Test
@@ -75,16 +77,6 @@ public class ViolationUnmarshallerTest extends UnmarshallerTestCase {
assertThat(violation.isSwitchedOff(), is(true));
}
- @Test
- public void testViolationDecoratedWithReview() {
- Violation violation = new ViolationUnmarshaller().toModel(loadFile("/violations/violation-with-review.json"));
- Review review = violation.getReview();
- assertNotNull(review);
- assertThat(review.getId(), is(3L));
- assertThat(review.getComments().size(), is(4));
- assertThat(review.getComments().get(1).getText(), is("<em>Bold on multiple line?</em>"));
- }
-
/**
* See http://jira.codehaus.org/browse/SONAR-2386
*/
diff --git a/sonar-ws-client/src/test/resources/violations/violation-with-review.json b/sonar-ws-client/src/test/resources/violations/violation-with-review.json
deleted file mode 100644
index 1cc185766f4..00000000000
--- a/sonar-ws-client/src/test/resources/violations/violation-with-review.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"id":1,"message":"'static' modifier out of order with the JLS suggestions.","line":33,"priority":"MINOR","createdAt":"2011-04-26T15:17:46+0200","rule":{"key":"checkstyle:com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck","name":"Modifier Order"},"resource":{"key":"org.codehaus.sonar:sonar-channel:org.sonar.channel.CodeReaderConfiguration","name":"CodeReaderConfiguration","scope":"FIL","qualifier":"CLA","language":"java"},"review":{"id":3,"createdAt":"2011-04-26T15:44:42+0200","updatedAt":"2011-04-26T15:44:42+0200","author":"admin","assignee":"admin","title":"'static' modifier out of order with the JLS suggestions.","type":"VIOLATION","status":"OPEN","severity":"MINOR","resource":"org.codehaus.sonar:sonar-channel:org.sonar.channel.CodeReaderConfiguration","line":33,"comments":[{"author":"admin","updatedAt":"2011-04-26T15:44:42+0200","text":"This is a review.<br/>And this is on multiple lines...<br/><br/>''Wouhou!!!!!''"},{"author":"admin","updatedAt":"2011-04-26T17:10:19+0200","text":"<em>Bold on multiple line?</em>"},{"author":"admin","updatedAt":"2011-04-26T17:11:02+0200","text":"And the bullets:<br/><ul><li>1 bullet</li>\n<li>2 bullets</li></ul>"},{"author":"admin","updatedAt":"2011-04-26T17:27:37+0200","text":"Wazzaa"}]}}] \ No newline at end of file