import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Objects;
+import java.util.Optional;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.utils.log.Loggers;
import org.sonar.ce.task.projectexport.component.ComponentRepository;
" i.component_uuid, i.message, i.line, i.checksum, i.status," +
" i.resolution, i.severity, i.manual_severity, i.gap, effort," +
" i.assignee, i.author_login, i.tags, i.issue_creation_date," +
- " i.issue_update_date, i.issue_close_date, i.locations, i.project_uuid" +
+ " i.issue_update_date, i.issue_close_date, i.locations, i.project_uuid," +
+ " i.rule_description_context_key " +
" from issues i" +
" join rules r on r.uuid = i.rule_uuid and r.status <> ?" +
" join components p on p.uuid = i.project_uuid" +
.setIssueUpdatedAt(rs.getLong(20))
.setIssueClosedAt(rs.getLong(21))
.setProjectUuid(rs.getString(23));
+ Optional.ofNullable(rs.getString(24)).ifPresent(builder::setRuleDescriptionContextKey);
setLocations(builder, rs, issueUuid);
return builder.build();
}
.setAssigneeUuid("assignee-uuid")
.setAuthorLogin("author")
.setTagsString("tags")
+ .setRuleDescriptionContextKey("test_rule_description_context_key")
.setIssueCreationTime(963L)
.setIssueUpdateTime(852L)
.setIssueCloseTime(741L);
assertThat(issue.getAssignee()).isEqualTo(issueDto.getAssigneeUuid());
assertThat(issue.getAuthor()).isEqualTo(issueDto.getAuthorLogin());
assertThat(issue.getTags()).isEqualTo(issueDto.getTagsString());
+ assertThat(issue.getRuleDescriptionContextKey()).isEqualTo(issue.getRuleDescriptionContextKey());
assertThat(issue.getIssueCreatedAt()).isEqualTo(issueDto.getIssueCreationTime());
assertThat(issue.getIssueUpdatedAt()).isEqualTo(issueDto.getIssueUpdateTime());
assertThat(issue.getIssueClosedAt()).isEqualTo(issueDto.getIssueCloseTime());
assertThat(issue.getIssueCreatedAt()).isEqualTo(DumpElement.NO_DATETIME);
assertThat(issue.getIssueUpdatedAt()).isEqualTo(DumpElement.NO_DATETIME);
assertThat(issue.getIssueClosedAt()).isEqualTo(DumpElement.NO_DATETIME);
+ assertThat(issue.hasRuleDescriptionContextKey()).isFalse();
}
@Test