.setRuleKey(batchIssueDto.getRuleRepo(), batchIssueDto.getRuleKey())
.setMessage(batchIssueDto.getMessage())
.setResolution(batchIssueDto.getResolution())
- .setOverriddenSeverity(batchIssueDto.isManualSeverity() ? batchIssueDto.getSeverity() : null)
- .setStatus(batchIssueDto.getStatus());
+ .setSeverity(batchIssueDto.getSeverity())
+ .setManualSeverity(batchIssueDto.isManualSeverity())
+ .setStatus(batchIssueDto.getStatus())
+ .setCreationDate(batchIssueDto.getCreationDate());
}
return null;
}
MockUserSession.set().setLogin("henry").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION).addComponentPermission(UserRole.USER, PROJECT_KEY, PROJECT_KEY);
WsTester.TestRequest request = tester.newGetRequest("batch", "issues").setParam("key", PROJECT_KEY);
- request.execute().assertJson(getClass(), "issues_on_project-expected.json");
+ request.execute().assertJson(getClass(), "issues_on_project-expected.json", false);
}
@Test
MockUserSession.set().setLogin("henry").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION).addComponentPermission(UserRole.USER, PROJECT_KEY, PROJECT_KEY);
WsTester.TestRequest request = tester.newGetRequest("batch", "issues").setParam("key", PROJECT_KEY);
- request.execute().assertJson(getClass(), "return_only_manual_severity-expected.json");
+ request.execute().assertJson(getClass(), "return_only_manual_severity-expected.json", false);
}
@Test
MockUserSession.set().setLogin("henry").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION).addComponentPermission(UserRole.USER, PROJECT_KEY, MODULE_KEY);
WsTester.TestRequest request = tester.newGetRequest("batch", "issues").setParam("key", MODULE_KEY);
- request.execute().assertJson(getClass(), "issues_on_module-expected.json");
+ request.execute().assertJson(getClass(), "issues_on_module-expected.json", false);
}
@Test(expected = ForbiddenException.class)
assertThat(batchIssueDto.getComponentKey()).isEqualTo("Sample.java");
assertThat(batchIssueDto.getChecksum()).isEqualTo("123456");
assertThat(batchIssueDto.getAssigneeLogin()).isEqualTo("john");
+ assertThat(batchIssueDto.getCreationDate()).isNotNull();
}
@Test
assertThat(batchIssueDto.getComponentKey()).isEqualTo("Sample.java");
assertThat(batchIssueDto.getChecksum()).isEqualTo("123456");
assertThat(batchIssueDto.getAssigneeLogin()).isEqualTo("john");
+ assertThat(batchIssueDto.getCreationDate()).isNotNull();
}
@Test
"message": "Do not use this method",
"resolution": "FALSE-POSITIVE",
"status": "RESOLVED",
+ "severity": "BLOCKER",
+ "manualSeverity": false,
"checksum": "123456",
"assigneeLogin": "john"
}
"message": "Do not use this method",
"resolution": "FALSE-POSITIVE",
"status": "RESOLVED",
+ "severity": "BLOCKER",
+ "manualSeverity": false,
"checksum": "123456",
"assigneeLogin": "john"
}
"line": 201,
"message": "Do not use this method",
"status": "OPEN",
- "overriddenSeverity": "CRITICAL",
+ "severity": "CRITICAL",
+ "manualSeverity": true,
"checksum": "234567",
"assigneeLogin": "john"
}
import javax.annotation.Nullable;
import java.io.Serializable;
+import java.util.Date;
public class PreviousIssue implements Serializable {
private String ruleRepo;
private Integer line;
private String message;
- // For manual issues and when user has overriden severity
- private String overriddenSeverity;
+ private String severity;
+ private Boolean manualSeverity;
private String resolution;
private String status;
private String checksum;
private String assigneeLogin;
+ private Date creationDate;
public PreviousIssue setKey(String key) {
this.key = key;
return status;
}
- public PreviousIssue setOverriddenSeverity(@Nullable String overriddenSeverity) {
- this.overriddenSeverity = overriddenSeverity;
+ public PreviousIssue setSeverity(@Nullable String severity) {
+ this.severity = severity;
return this;
}
- public String overriddenSeverity() {
- return overriddenSeverity;
+ public String severity() {
+ return severity;
+ }
+
+ public boolean isManualSeverity() {
+ return manualSeverity;
+ }
+
+ public PreviousIssue setManualSeverity(boolean manualSeverity) {
+ this.manualSeverity = manualSeverity;
+ return this;
}
public PreviousIssue setChecksum(String checksum) {
return ruleKey;
}
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+ public PreviousIssue setCreationDate(Date creationDate) {
+ this.creationDate = creationDate;
+ return this;
+ }
}
issue1.setRuleKey("repokey", "rulekey");
issue1.setLine(2);
issue1.setMessage("message");
- issue1.setOverriddenSeverity("severity");
+ issue1.setSeverity("severity");
+ issue1.setManualSeverity(true);
issue1.setResolution("resolution");
issue1.setStatus("status");
issue1.setChecksum("checksum");
JSONAssert
.assertEquals(
- "[{\"key\": \"key1\", \"componentKey\": \"key\", \"ruleKey\": \"rulekey\", \"ruleRepo\": \"repokey\", \"line\": 2,\"message\": \"message\", \"overriddenSeverity\": \"severity\", \"resolution\": \"resolution\", \"status\": \"status\", \"checksum\": \"checksum\",\"assigneeLogin\": \"login\"},"
+ "[{\"key\": \"key1\", \"componentKey\": \"key\", \"ruleKey\": \"rulekey\", \"ruleRepo\": \"repokey\", \"line\": 2,\"message\": \"message\", " +
+ "\"severity\": \"severity\", \"manualSeverity\": true, \"resolution\": \"resolution\", \"status\": \"status\", \"checksum\": \"checksum\",\"assigneeLogin\": \"login\"},"
+
"{\"key\": \"key2\"}]",
out.getBuffer().toString(), true);
-
}
private static class PreviousIssueFunction implements PreviousIssueHelper.Function<PreviousIssue, PreviousIssue> {
StringWriter out = new StringWriter();
PreviousIssueHelper helper = PreviousIssueHelper.create(out);
StringReader reader = new StringReader(
- "[{\"key\": \"key1\", \"componentKey\": \"key\", \"ruleKey\": \"rulekey\", \"ruleRepo\": \"repokey\", \"line\": 2,\"message\": \"message\", \"overriddenSeverity\": \"severity\", \"resolution\": \"resolution\", \"status\": \"status\", \"checksum\": \"checksum\",\"assigneeLogin\": \"login\"},"
+ "[{\"key\": \"key1\", \"componentKey\": \"key\", \"ruleKey\": \"rulekey\", \"ruleRepo\": \"repokey\", \"line\": 2,\"message\": \"message\", " +
+ "\"severity\": \"severity\", \"manualSeverity\": true, \"resolution\": \"resolution\", \"status\": \"status\", \"checksum\": \"checksum\",\"assigneeLogin\": \"login\"},"
+
"{\"key\": \"key2\"}]");
assertThat(issue1.ruleKey()).isEqualTo("rulekey");
assertThat(issue1.line()).isEqualTo(2);
assertThat(issue1.message()).isEqualTo("message");
- assertThat(issue1.overriddenSeverity()).isEqualTo("severity");
+ assertThat(issue1.severity()).isEqualTo("severity");
+ assertThat(issue1.isManualSeverity()).isTrue();
assertThat(issue1.resolution()).isEqualTo("resolution");
assertThat(issue1.status()).isEqualTo("status");
assertThat(issue1.checksum()).isEqualTo("checksum");
issue.setStatus(ref.status());
issue.setAssignee(ref.assigneeLogin());
- String overriddenSeverity = ref.overriddenSeverity();
+ String overriddenSeverity = ref.severity();
if (overriddenSeverity != null) {
// Severity overriden by user
issue.setSeverity(overriddenSeverity);
issue.setResolution(previous.resolution());
issue.setMessage(previous.message());
issue.setLine(previous.line());
- String overriddenSeverity = previous.overriddenSeverity();
+ String overriddenSeverity = previous.severity();
if (overriddenSeverity != null) {
issue.setSeverity(overriddenSeverity);
} else {
.setComponentKey("sample:xources/hello/HelloJava.xoo")
.setRuleKey("xoo", "OneIssuePerLine")
.setLine(1)
- .setOverriddenSeverity("MAJOR")
+ .setSeverity("MAJOR")
.setChecksum(DigestUtils.md5Hex("packagehello;"))
.setStatus("OPEN"))
.build();
package org.sonar.core.issue.db;
+import java.util.Date;
+
public class BatchIssueDto {
private String kee;
private String componentKey;
private String ruleKey;
private String ruleRepo;
+ private Date creationDate;
public String getAssigneeLogin() {
return assigneeLogin;
this.severity = severity;
return this;
}
+
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+ public BatchIssueDto setCreationDate(Date creationDate) {
+ this.creationDate = creationDate;
+ return this;
+ }
}
i.resolution as resolution,
i.checksum as checksum,
i.assignee as assigneeLogin,
+ i.issue_creation_date as creationDate,
r.plugin_rule_key as ruleKey,
r.plugin_name as ruleRepo,
component.kee as componentKey
i.resolution as resolution,
i.checksum as checksum,
i.assignee as assigneeLogin,
+ i.issue_creation_date as creationDate,
r.plugin_rule_key as ruleKey,
r.plugin_name as ruleRepo,
component.kee as componentKey