use of org.sonar.core.issue.DefaultIssueComment in project sonarqube by SonarSource.
the class PersistIssuesStep method insertChanges.
private static void insertChanges(IssueChangeMapper mapper, DefaultIssue issue) {
for (IssueComment comment : issue.comments()) {
DefaultIssueComment c = (DefaultIssueComment) comment;
if (c.isNew()) {
IssueChangeDto changeDto = IssueChangeDto.of(c);
mapper.insert(changeDto);
}
}
FieldDiffs diffs = issue.currentChange();
if (!issue.isNew() && diffs != null) {
IssueChangeDto changeDto = IssueChangeDto.of(issue.key(), diffs);
mapper.insert(changeDto);
}
}
use of org.sonar.core.issue.DefaultIssueComment in project sonarqube by SonarSource.
the class IssueStorage method insertChanges.
private void insertChanges(IssueChangeMapper mapper, DefaultIssue issue) {
for (IssueComment comment : issue.comments()) {
DefaultIssueComment c = (DefaultIssueComment) comment;
if (c.isNew()) {
IssueChangeDto changeDto = IssueChangeDto.of(c);
mapper.insert(changeDto);
}
}
FieldDiffs diffs = issue.currentChange();
if (!issue.isNew() && diffs != null) {
IssueChangeDto changeDto = IssueChangeDto.of(issue.key(), diffs);
mapper.insert(changeDto);
}
}
use of org.sonar.core.issue.DefaultIssueComment in project sonarqube by SonarSource.
the class ServerIssueStorageTest method should_insert_new_issues.
@Test
public void should_insert_new_issues() {
dbTester.prepareDbUnit(getClass(), "should_insert_new_issues.xml");
DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment");
// override generated key
comment.setKey("FGHIJ");
Date date = DateUtils.parseDateTime("2013-05-18T12:00:00+0000");
DefaultIssue issue = new DefaultIssue().setKey("ABCDE").setType(RuleType.BUG).setNew(true).setRuleKey(RuleKey.of("squid", "AvoidCycle")).setProjectKey("struts").setLine(5000).setEffort(Duration.create(10L)).setResolution("OPEN").setStatus("OPEN").setSeverity("BLOCKER").setAttribute("foo", "bar").addComment(comment).setCreationDate(date).setUpdateDate(date).setCloseDate(date).setComponentKey("struts:Action");
storage.save(issue);
dbTester.assertDbUnit(getClass(), "should_insert_new_issues-result.xml", new String[] { "id", "created_at", "updated_at", "issue_change_creation_date" }, "issues", "issue_changes");
}
use of org.sonar.core.issue.DefaultIssueComment in project sonarqube by SonarSource.
the class IssueStorageTest method batch_insert_new_issues.
@Test
public void batch_insert_new_issues() {
FakeBatchSaver saver = new FakeBatchSaver(dbClient, new FakeRuleFinder());
DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment");
// override generated key
comment.setKey("FGHIJ");
Date date = DateUtils.parseDateTime("2013-05-18T12:00:00+0000");
DefaultIssue issue = new DefaultIssue().setKey("ABCDE").setType(RuleType.BUG).setNew(true).setRuleKey(RuleKey.of("squid", "AvoidCycle")).setLine(5000).setEffort(Duration.create(10L)).setResolution("OPEN").setStatus("OPEN").setSeverity("BLOCKER").setAttribute("foo", "bar").addComment(comment).setCreationDate(date).setUpdateDate(date).setCloseDate(date).setComponentUuid("uuid-100").setProjectUuid("uuid-10").setComponentKey("struts:Action");
saver.save(issue);
dbTester.assertDbUnit(getClass(), "should_insert_new_issues-result.xml", new String[] { "id", "created_at", "updated_at", "issue_change_creation_date" }, "issues", "issue_changes");
}
Aggregations