Search in sources :

Example 1 with DoTransitionRequest

use of org.sonarqube.ws.client.issue.DoTransitionRequest in project sonarqube by SonarSource.

the class IssueWorkflowTest method user_should_not_reopen_closed_issue.

@Test
public void user_should_not_reopen_closed_issue() {
    issuesService.doTransition(new DoTransitionRequest(issue.getKey(), "resolve"));
    // re-execute scan without rules -> the issue is closed
    analysisWithoutIssues.run();
    // user try to reopen the issue
    assertThat(transitions(issue.getKey())).isEmpty();
}
Also used : DoTransitionRequest(org.sonarqube.ws.client.issue.DoTransitionRequest) Test(org.junit.Test)

Example 2 with DoTransitionRequest

use of org.sonarqube.ws.client.issue.DoTransitionRequest 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());
}
Also used : Issue(org.sonarqube.ws.Issues.Issue) DoTransitionRequest(org.sonarqube.ws.client.issue.DoTransitionRequest) Test(org.junit.Test)

Example 3 with DoTransitionRequest

use of org.sonarqube.ws.client.issue.DoTransitionRequest in project sonarqube by SonarSource.

the class IssueWorkflowTest method user_should_confirm_issue.

/**
   * SONAR-4329
   */
@Test
public void user_should_confirm_issue() {
    // mark as confirmed
    issuesService.doTransition(new DoTransitionRequest(issue.getKey(), "confirm"));
    Issue confirmed = issueRule.getByKey(issue.getKey());
    assertThat(confirmed.getStatus()).isEqualTo("CONFIRMED");
    assertThat(confirmed.hasResolution()).isFalse();
    assertThat(confirmed.getCreationDate()).isEqualTo(issue.getCreationDate());
    // user unconfirm the issue
    assertThat(transitions(confirmed.getKey())).contains("unconfirm");
    issuesService.doTransition(new DoTransitionRequest(confirmed.getKey(), "unconfirm"));
    Issue unconfirmed = issueRule.getByKey(issue.getKey());
    assertThat(unconfirmed.getStatus()).isEqualTo("REOPENED");
    assertThat(unconfirmed.hasResolution()).isFalse();
    assertThat(unconfirmed.getCreationDate()).isEqualTo(confirmed.getCreationDate());
}
Also used : Issue(org.sonarqube.ws.Issues.Issue) DoTransitionRequest(org.sonarqube.ws.client.issue.DoTransitionRequest) Test(org.junit.Test)

Example 4 with DoTransitionRequest

use of org.sonarqube.ws.client.issue.DoTransitionRequest in project sonarqube by SonarSource.

the class IssueWorkflowTest method scan_should_close_resolved_issue.

/**
   * SONAR-4288
   */
@Test
public void scan_should_close_resolved_issue() {
    // 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(resolvedIssue.hasCloseDate()).isFalse();
    // re-execute scan without rules -> the issue is removed with resolution "REMOVED"
    analysisWithoutIssues.run();
    // reload issue
    Issue closedIssue = issueRule.getByKey(issue.getKey());
    assertThat(closedIssue.getStatus()).isEqualTo("CLOSED");
    assertThat(closedIssue.getResolution()).isEqualTo("REMOVED");
    assertThat(closedIssue.getCreationDate()).isEqualTo(issue.getCreationDate());
    assertThat(toDatetime(closedIssue.getUpdateDate())).isAfter(toDatetime(resolvedIssue.getUpdateDate()));
    assertThat(closedIssue.hasCloseDate()).isTrue();
    assertThat(toDatetime(closedIssue.getCloseDate())).isAfter(toDatetime(closedIssue.getCreationDate()));
}
Also used : Issue(org.sonarqube.ws.Issues.Issue) DoTransitionRequest(org.sonarqube.ws.client.issue.DoTransitionRequest) Test(org.junit.Test)

Example 5 with DoTransitionRequest

use of org.sonarqube.ws.client.issue.DoTransitionRequest in project sonarqube by SonarSource.

the class IssueWorkflowTest method user_should_mark_as_false_positive_confirmed_issue.

/**
   * SONAR-4329
   */
@Test
public void user_should_mark_as_false_positive_confirmed_issue() {
    // mark as confirmed
    issuesService.doTransition(new DoTransitionRequest(issue.getKey(), "confirm"));
    Issue confirmed = issueRule.getByKey(issue.getKey());
    assertThat(confirmed.getStatus()).isEqualTo("CONFIRMED");
    assertThat(confirmed.hasResolution()).isFalse();
    assertThat(confirmed.getCreationDate()).isEqualTo(issue.getCreationDate());
    // user mark the issue as false-positive
    assertThat(transitions(confirmed.getKey())).contains("falsepositive");
    issuesService.doTransition(new DoTransitionRequest(confirmed.getKey(), "falsepositive"));
    Issue falsePositive = issueRule.getByKey(issue.getKey());
    assertThat(falsePositive.getStatus()).isEqualTo("RESOLVED");
    assertThat(falsePositive.getResolution()).isEqualTo("FALSE-POSITIVE");
    assertThat(falsePositive.getCreationDate()).isEqualTo(confirmed.getCreationDate());
}
Also used : Issue(org.sonarqube.ws.Issues.Issue) DoTransitionRequest(org.sonarqube.ws.client.issue.DoTransitionRequest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)10 DoTransitionRequest (org.sonarqube.ws.client.issue.DoTransitionRequest)10 Issue (org.sonarqube.ws.Issues.Issue)9