use of org.sonarqube.ws.Issues.ChangelogWsResponse in project sonarqube by SonarSource.
the class ChangelogActionTest method return_changelog_on_none_existing_user.
@Test
public void return_changelog_on_none_existing_user() throws Exception {
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin("UNKNOWN").setDiff("severity", "MAJOR", "BLOCKER"));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(1);
assertThat(result.getChangelogList().get(0).hasUser()).isFalse();
assertThat(result.getChangelogList().get(0).hasUserName()).isFalse();
assertThat(result.getChangelogList().get(0).hasEmail()).isFalse();
assertThat(result.getChangelogList().get(0).getDiffsList()).isNotEmpty();
}
use of org.sonarqube.ws.Issues.ChangelogWsResponse in project sonarqube by SonarSource.
the class ChangelogActionTest method changelog_of_file_move_contains_file_names.
@Test
public void changelog_of_file_move_contains_file_names() throws Exception {
RuleDto rule = db.rules().insertRule(newRuleDto());
ComponentDto project = db.components().insertProject(db.organizations().insert());
ComponentDto file1 = db.components().insertComponent(newFileDto(project));
ComponentDto file2 = db.components().insertComponent(newFileDto(project));
IssueDto issueDto = db.issues().insertIssue(newDto(rule, file2, project));
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setDiff("file", file1.uuid(), file2.uuid()));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(1);
assertThat(result.getChangelogList().get(0).hasUser()).isFalse();
assertThat(result.getChangelogList().get(0).getCreationDate()).isNotEmpty();
assertThat(result.getChangelogList().get(0).getDiffsList()).extracting(Diff::getKey, Diff::getOldValue, Diff::getNewValue).containsOnly(tuple("file", file1.longName(), file2.longName()));
}
use of org.sonarqube.ws.Issues.ChangelogWsResponse in project sonarqube by SonarSource.
the class ChangelogActionTest method return_many_changelog.
@Test
public void return_many_changelog() throws Exception {
UserDto user = db.users().insertUser();
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(user.getLogin()).setDiff("severity", "MAJOR", "BLOCKER"), new FieldDiffs().setDiff("status", "RESOLVED", "CLOSED"));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(2);
}
use of org.sonarqube.ws.Issues.ChangelogWsResponse in project sonarqube by SonarSource.
the class ChangelogActionTest method return_changelog_when_no_new_value.
@Test
public void return_changelog_when_no_new_value() throws Exception {
UserDto user = db.users().insertUser();
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(user.getLogin()).setDiff("severity", "MAJOR", null));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(1);
assertThat(result.getChangelogList().get(0).getDiffsList().get(0).hasNewValue()).isFalse();
}
use of org.sonarqube.ws.Issues.ChangelogWsResponse in project sonarqube by SonarSource.
the class ChangelogActionTest method return_changelog_when_no_old_value.
@Test
public void return_changelog_when_no_old_value() throws Exception {
UserDto user = db.users().insertUser();
IssueDto issueDto = db.issues().insertIssue(newIssue());
userSession.logIn("john").addProjectUuidPermissions(USER, issueDto.getProjectUuid());
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserLogin(user.getLogin()).setDiff("severity", null, "BLOCKER"));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(1);
assertThat(result.getChangelogList().get(0).getDiffsList().get(0).hasOldValue()).isFalse();
}
Aggregations