use of org.sonarqube.ws.Issues.Issue in project sonarqube by SonarSource.
the class IssueBulkChangeTest method should_apply_bulk_change_on_many_actions.
@Test
public void should_apply_bulk_change_on_many_actions() {
xooSampleLittleIssuesAnalysis.run();
String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
BulkChangeWsResponse bulkChangeResponse = issuesService.bulkChange(BulkChangeRequest.builder().setIssues(asList(issueKeys)).setDoTransition("confirm").setAssign("admin").setSetSeverity("BLOCKER").setComment(COMMENT_AS_MARKDOWN).build());
assertThat(bulkChangeResponse.getSuccess()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
for (Issue issue : issueRule.getByKeys(issueKeys)) {
assertThat(issue.getStatus()).isEqualTo("CONFIRMED");
assertThat(issue.getAssignee()).isEqualTo("admin");
assertThat(issue.getSeverity()).isEqualTo(BLOCKER);
assertThat(issue.getComments().getCommentsList()).hasSize(1);
assertThat(issue.getComments().getComments(0).getHtmlText()).isEqualTo(COMMENT_AS_HTML);
}
}
use of org.sonarqube.ws.Issues.Issue in project sonarqube by SonarSource.
the class IssueBulkChangeTest method should_assign.
@Test
public void should_assign() {
xooSampleLittleIssuesAnalysis.run();
String[] issueKeys = searchIssueKeys(BULK_EDITED_ISSUE_COUNT);
BulkChangeWsResponse bulkChangeResponse = buldChangeAssigneeOfIssues(issueKeys, "admin");
assertThat(bulkChangeResponse.getSuccess()).isEqualTo(BULK_EDITED_ISSUE_COUNT);
for (Issue issue : issueRule.getByKeys(issueKeys)) {
assertThat(issue.getAssignee()).isEqualTo("admin");
}
}
use of org.sonarqube.ws.Issues.Issue in project sonarqube by SonarSource.
the class IssueTrackingTest method track_issues_based_on_blocks_recognition.
/**
* SONAR-3072
*/
@Test
public void track_issues_based_on_blocks_recognition() throws Exception {
ORCHESTRATOR.getServer().associateProjectToQualityProfile(SAMPLE_PROJECT_KEY, "xoo", "issue-on-tag-foobar");
// version 1
ORCHESTRATOR.getServer().associateProjectToQualityProfile(SAMPLE_PROJECT_KEY, "xoo", "issue-on-tag-foobar");
runProjectAnalysis(ORCHESTRATOR, "issue/xoo-tracking-v1", "sonar.projectDate", OLD_DATE);
List<Issue> issues = searchUnresolvedIssuesByComponent("sample:src/main/xoo/sample/Sample.xoo");
assertThat(issues).hasSize(1);
Date issueDate = toDate(issues.iterator().next().getCreationDate());
// version 2
runProjectAnalysis(ORCHESTRATOR, "issue/xoo-tracking-v2", "sonar.projectDate", NEW_DATE_STR);
issues = searchUnresolvedIssuesByComponent("sample:src/main/xoo/sample/Sample.xoo");
assertThat(issues).hasSize(3);
// issue created during the first scan and moved during the second scan
assertThat(toDate(getIssueOnLine(6, "xoo:HasTag", issues).getCreationDate())).isEqualTo(issueDate);
// issues created during the second scan
assertThat(toDate(getIssueOnLine(10, "xoo:HasTag", issues).getCreationDate())).isAfter(issueDate);
assertThat(toDate(getIssueOnLine(14, "xoo:HasTag", issues).getCreationDate())).isAfter(issueDate);
}
use of org.sonarqube.ws.Issues.Issue in project sonarqube by SonarSource.
the class IssueTrackingTest method track_existing_unchanged_issues_on_module.
/**
* SONAR-4310
*/
@Test
public void track_existing_unchanged_issues_on_module() throws Exception {
// The custom rule on module is enabled
ORCHESTRATOR.getServer().associateProjectToQualityProfile(SAMPLE_PROJECT_KEY, "xoo", "one-issue-per-module");
runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample");
// Only one issue is created
assertThat(searchIssues(new SearchWsRequest()).getIssuesList()).hasSize(1);
Issue issue = getRandomIssue();
// Re analysis of the same project
runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample");
// No new issue should be created
assertThat(searchIssues(new SearchWsRequest()).getIssuesList()).hasSize(1);
// The issue on module should stay open and be the same from the first analysis
Issue reloadIssue = getIssueByKey(issue.getKey());
assertThat(reloadIssue.getCreationDate()).isEqualTo(issue.getCreationDate());
assertThat(reloadIssue.getStatus()).isEqualTo("OPEN");
assertThat(reloadIssue.hasResolution()).isFalse();
}
use of org.sonarqube.ws.Issues.Issue in project sonarqube by SonarSource.
the class IssueWorkflowTest method scan_should_close_no_more_existing_false_positive.
/**
* SONAR-4286
*/
@Test
public void scan_should_close_no_more_existing_false_positive() {
// user marks as false-positive
issuesService.doTransition(new DoTransitionRequest(issue.getKey(), "falsepositive"));
Issue falsePositive = issueRule.getByKey(issue.getKey());
assertThat(falsePositive.getStatus()).isEqualTo("RESOLVED");
assertThat(falsePositive.getResolution()).isEqualTo("FALSE-POSITIVE");
assertThat(falsePositive.getCreationDate()).isEqualTo(issue.getCreationDate());
// scan without any rules -> false-positive is closed
analysisWithoutIssues.run();
Issue closed = issueRule.getByKey(issue.getKey());
assertThat(closed.getStatus()).isEqualTo("CLOSED");
assertThat(closed.getResolution()).isEqualTo("REMOVED");
assertThat(closed.getCreationDate()).isEqualTo(issue.getCreationDate());
}
Aggregations