Search in sources :

Example 1 with Transition

use of org.sonar.server.issue.workflow.Transition in project sonarqube by SonarSource.

the class TransitionServiceTest method list_transitions.

@Test
public void list_transitions() throws Exception {
    IssueDto issue = newIssue().setStatus(STATUS_OPEN).setResolution(null);
    userSession.logIn("john").addProjectUuidPermissions(ISSUE_ADMIN, issue.getProjectUuid());
    List<Transition> result = underTest.listTransitions(issue.toDefaultIssue());
    assertThat(result).extracting(Transition::key).containsOnly("confirm", "resolve", "falsepositive", "wontfix");
}
Also used : Transition(org.sonar.server.issue.workflow.Transition) IssueDto(org.sonar.db.issue.IssueDto) Test(org.junit.Test)

Example 2 with Transition

use of org.sonar.server.issue.workflow.Transition in project sonarqube by SonarSource.

the class TransitionServiceTest method list_transitions_returns_only_transitions_that_do_not_requires_issue_admin_permission.

@Test
public void list_transitions_returns_only_transitions_that_do_not_requires_issue_admin_permission() throws Exception {
    userSession.logIn("john");
    IssueDto issue = newIssue().setStatus(STATUS_OPEN).setResolution(null);
    List<Transition> result = underTest.listTransitions(issue.toDefaultIssue());
    assertThat(result).extracting(Transition::key).containsOnly("confirm", "resolve");
}
Also used : Transition(org.sonar.server.issue.workflow.Transition) IssueDto(org.sonar.db.issue.IssueDto) Test(org.junit.Test)

Example 3 with Transition

use of org.sonar.server.issue.workflow.Transition in project sonarqube by SonarSource.

the class TransitionServiceTest method list_transitions_returns_nothing_when_not_logged.

@Test
public void list_transitions_returns_nothing_when_not_logged() throws Exception {
    IssueDto issue = newIssue().setStatus(STATUS_OPEN).setResolution(null);
    List<Transition> result = underTest.listTransitions(issue.toDefaultIssue());
    assertThat(result).isEmpty();
}
Also used : Transition(org.sonar.server.issue.workflow.Transition) IssueDto(org.sonar.db.issue.IssueDto) Test(org.junit.Test)

Example 4 with Transition

use of org.sonar.server.issue.workflow.Transition in project sonarqube by SonarSource.

the class SearchResponseFormat method formatIssueTransitions.

private static void formatIssueTransitions(SearchResponseData data, Issues.Issue.Builder wsIssue, IssueDto dto) {
    Issues.Transitions.Builder wsTransitions = Issues.Transitions.newBuilder();
    List<Transition> transitions = data.getTransitionsForIssueKey(dto.getKey());
    if (transitions != null) {
        for (Transition transition : transitions) {
            wsTransitions.addTransitions(transition.key());
        }
    }
    wsIssue.setTransitions(wsTransitions);
}
Also used : Transition(org.sonar.server.issue.workflow.Transition)

Aggregations

Transition (org.sonar.server.issue.workflow.Transition)4 Test (org.junit.Test)3 IssueDto (org.sonar.db.issue.IssueDto)3