Search in sources :

Example 1 with Changelog

use of org.sonarqube.ws.Issues.ChangelogWsResponse.Changelog in project sonarqube by SonarSource.

the class IssueChangelogTest method update_changelog_when_assigning_issue_by_user.

@Test
public void update_changelog_when_assigning_issue_by_user() throws Exception {
    runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample");
    Issue issue = searchRandomIssue();
    assertIssueHasNoChange(issue.key());
    adminIssueClient().assign(issue.key(), "admin");
    List<Changelog> changes = changelog(issue.key()).getChangelogList();
    assertThat(changes).hasSize(1);
    Changelog change = changes.get(0);
    assertThat(change.getUser()).isEqualTo("admin");
    assertThat(change.getCreationDate()).isNotNull();
    assertThat(change.getDiffsList()).extracting(Changelog.Diff::getKey, Changelog.Diff::hasOldValue, Changelog.Diff::getNewValue).containsOnly(tuple("assignee", false, "Administrator"));
}
Also used : Issue(org.sonar.wsclient.issue.Issue) Changelog(org.sonarqube.ws.Issues.ChangelogWsResponse.Changelog) Test(org.junit.Test)

Example 2 with Changelog

use of org.sonarqube.ws.Issues.ChangelogWsResponse.Changelog in project sonarqube by SonarSource.

the class IssueChangelogTest method display_file_name_in_changelog_during_file_move.

@Test
public void display_file_name_in_changelog_during_file_move() {
    // version 1
    runProjectAnalysis(ORCHESTRATOR, "issue/xoo-tracking-v1");
    // version 2
    runProjectAnalysis(ORCHESTRATOR, "issue/xoo-tracking-v3");
    Issue issue = searchRandomIssue();
    List<Changelog> changes = changelog(issue.key()).getChangelogList();
    assertThat(changes).hasSize(1);
    Changelog change = changes.get(0);
    assertThat(change.hasUser()).isFalse();
    assertThat(change.getCreationDate()).isNotNull();
    assertThat(change.getDiffsList()).extracting(Changelog.Diff::getKey, Changelog.Diff::getOldValue, Changelog.Diff::getNewValue).containsOnly(tuple("file", "src/main/xoo/sample/Sample.xoo", "src/main/xoo/sample/Sample2.xoo"));
}
Also used : Issue(org.sonar.wsclient.issue.Issue) Changelog(org.sonarqube.ws.Issues.ChangelogWsResponse.Changelog) Test(org.junit.Test)

Example 3 with Changelog

use of org.sonarqube.ws.Issues.ChangelogWsResponse.Changelog in project sonarqube by SonarSource.

the class IssueChangelogTest method update_changelog_when_reopening_unresolved_issue_by_scan.

@Test
public void update_changelog_when_reopening_unresolved_issue_by_scan() throws Exception {
    runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample");
    Issue issue = searchRandomIssue();
    assertIssueHasNoChange(issue.key());
    // re analyse the project after resolving an issue in order to reopen it
    adminIssueClient().doTransition(issue.key(), "resolve");
    runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample");
    List<Changelog> changes = changelog(issue.key()).getChangelogList();
    assertThat(changes).hasSize(2);
    // Change done by the user (first change is be the oldest one)
    Changelog change1 = changes.get(0);
    assertThat(change1.getUser()).isEqualTo("admin");
    assertThat(change1.getCreationDate()).isNotNull();
    assertThat(change1.getDiffsList()).extracting(Changelog.Diff::getKey, Changelog.Diff::getOldValue, Changelog.Diff::getNewValue).containsOnly(tuple("resolution", "", "FIXED"), tuple("status", "OPEN", "RESOLVED"));
    // Change done by scan
    Changelog change2 = changes.get(1);
    assertThat(change2.hasUser()).isFalse();
    assertThat(change2.getCreationDate()).isNotNull();
    assertThat(change2.getDiffsList()).extracting(Changelog.Diff::getKey, Changelog.Diff::getOldValue, Changelog.Diff::getNewValue).containsOnly(tuple("resolution", "", ""), tuple("status", "RESOLVED", "REOPENED"));
}
Also used : Issue(org.sonar.wsclient.issue.Issue) Changelog(org.sonarqube.ws.Issues.ChangelogWsResponse.Changelog) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 Issue (org.sonar.wsclient.issue.Issue)3 Changelog (org.sonarqube.ws.Issues.ChangelogWsResponse.Changelog)3