use of org.sonarqube.ws.client.issue.DoTransitionRequest in project sonarqube by SonarSource.
the class IssueWorkflowTest method scan_should_close_no_more_existing_confirmed.
/**
* SONAR-4329
*/
@Test
public void scan_should_close_no_more_existing_confirmed() {
// mark as confirmed
issuesService.doTransition(new DoTransitionRequest(issue.getKey(), "confirm"));
Issue falsePositive = issueRule.getByKey(issue.getKey());
assertThat(falsePositive.getStatus()).isEqualTo("CONFIRMED");
assertThat(falsePositive.hasResolution()).isFalse();
assertThat(falsePositive.getCreationDate()).isEqualTo(issue.getCreationDate());
// scan without any rules -> confirmed 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());
}
use of org.sonarqube.ws.client.issue.DoTransitionRequest in project sonarqube by SonarSource.
the class IssueWorkflowTest method scan_should_not_reopen_or_close_false_positives.
/**
* SONAR-4286
*/
@Test
public void scan_should_not_reopen_or_close_false_positives() {
// user marks issue 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());
// re-execute the same scan
analysisWithIssues.run();
// refresh
Issue reloaded = issueRule.getByKey(falsePositive.getKey());
assertThat(reloaded.getStatus()).isEqualTo("RESOLVED");
assertThat(reloaded.getResolution()).isEqualTo("FALSE-POSITIVE");
assertThat(reloaded.getCreationDate()).isEqualTo(issue.getCreationDate());
// TODO check that update date has not been changed
}
use of org.sonarqube.ws.client.issue.DoTransitionRequest in project sonarqube by SonarSource.
the class IssueWorkflowTest method user_should_reopen_false_positive.
/**
* SONAR-4286
*/
@Test
public void user_should_reopen_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());
// user reopens the issue
assertThat(transitions(falsePositive.getKey())).contains("reopen");
adminIssueClient().doTransition(falsePositive.getKey(), "reopen");
Issue reopened = issueRule.getByKey(issue.getKey());
assertThat(reopened.getStatus()).isEqualTo("REOPENED");
assertThat(reopened.hasResolution()).isFalse();
assertThat(reopened.getCreationDate()).isEqualTo(falsePositive.getCreationDate());
}
use of org.sonarqube.ws.client.issue.DoTransitionRequest in project sonarqube by SonarSource.
the class IssueWorkflowTest method scan_should_reopen_unresolved_issue_but_marked_as_resolved.
/**
* SONAR-4288
*/
@Test
public void scan_should_reopen_unresolved_issue_but_marked_as_resolved() {
// mark as resolved
issuesService.doTransition(new DoTransitionRequest(issue.getKey(), "resolve"));
Issue resolvedIssue = issueRule.getByKey(issue.getKey());
assertThat(resolvedIssue.getStatus()).isEqualTo("RESOLVED");
assertThat(resolvedIssue.getResolution()).isEqualTo("FIXED");
assertThat(resolvedIssue.getCreationDate()).isEqualTo(issue.getCreationDate());
assertThat(toDatetime(resolvedIssue.getUpdateDate())).isAfter(toDatetime(resolvedIssue.getCreationDate()));
assertThat(toDatetime(resolvedIssue.getUpdateDate())).isAfter(toDatetime(issue.getUpdateDate()));
// re-execute scan, with the same Q profile -> the issue has not been fixed
analysisWithIssues.run();
// reload issue
Issue reopenedIssue = issueRule.getByKey(issue.getKey());
// the issue has been reopened
assertThat(reopenedIssue.getStatus()).isEqualTo("REOPENED");
assertThat(reopenedIssue.hasResolution()).isFalse();
assertThat(reopenedIssue.getCreationDate()).isEqualTo(issue.getCreationDate());
assertThat(toDatetime(reopenedIssue.getUpdateDate())).isAfter(toDatetime(issue.getUpdateDate()));
}
use of org.sonarqube.ws.client.issue.DoTransitionRequest in project sonarqube by SonarSource.
the class IssueWorkflowTest method user_should_reopen_issue_marked_as_resolved.
/**
* SONAR-4288
*/
@Test
public void user_should_reopen_issue_marked_as_resolved() {
// user marks issue as resolved
issuesService.doTransition(new DoTransitionRequest(issue.getKey(), "resolve"));
Issue resolved = issueRule.getByKey(issue.getKey());
assertThat(resolved.getStatus()).isEqualTo("RESOLVED");
assertThat(resolved.getResolution()).isEqualTo("FIXED");
assertThat(resolved.getCreationDate()).isEqualTo(issue.getCreationDate());
// user reopens the issue
assertThat(transitions(resolved.getKey())).contains("reopen");
adminIssueClient().doTransition(resolved.getKey(), "reopen");
Issue reopened = issueRule.getByKey(resolved.getKey());
assertThat(reopened.getStatus()).isEqualTo("REOPENED");
assertThat(reopened.hasResolution()).isFalse();
assertThat(reopened.getCreationDate()).isEqualTo(resolved.getCreationDate());
assertThat(toDatetime(reopened.getUpdateDate())).isAfterOrEqualsTo(toDatetime(resolved.getUpdateDate()));
}
Aggregations