use of org.sonar.core.issue.FieldDiffs in project sonarqube by SonarSource.
the class ChangelogActionTest method test_example.
@Test
public void test_example() {
UserDto user = db.users().insertUser(newUserDto("john.smith", "John Smith", "john@smith.com"));
IssueDto issueDto = insertNewIssue();
userSession.logIn("john").addProjectPermission(USER, project, file);
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date()).setCreationDate(DateUtils.parseDateTime("2014-03-04T23:03:44+0100")));
String result = tester.newRequest().setParam("issue", issueDto.getKey()).execute().getInput();
assertJson(result).isSimilarTo(getClass().getResource("changelog-example.json"));
}
use of org.sonar.core.issue.FieldDiffs in project sonarqube by SonarSource.
the class ChangelogActionTest method replace_technical_debt_key_by_effort.
@Test
public void replace_technical_debt_key_by_effort() {
UserDto user = insertUser();
IssueDto issueDto = insertNewIssue();
userSession.logIn("john").addProjectPermission(USER, project, file);
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("technicalDebt", "10", "20").setCreationDate(new Date()));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(1);
assertThat(result.getChangelogList().get(0).getDiffsList()).extracting(Diff::getKey, Diff::getOldValue, Diff::getNewValue).containsOnly(tuple("effort", "10", "20"));
}
use of org.sonar.core.issue.FieldDiffs in project sonarqube by SonarSource.
the class ChangelogActionTest method return_changelog.
@Test
public void return_changelog() {
UserDto user = insertUser();
IssueDto issueDto = insertNewIssue();
userSession.logIn("john").addProjectPermission(USER, project, file);
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date()));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(1);
assertThat(result.getChangelogList().get(0).getUser()).isNotNull().isEqualTo(user.getLogin());
assertThat(result.getChangelogList().get(0).getUserName()).isNotNull().isEqualTo(user.getName());
assertThat(result.getChangelogList().get(0).getIsUserActive()).isTrue();
assertThat(result.getChangelogList().get(0).getAvatar()).isNotNull().isEqualTo("93942e96f5acd83e2e047ad8fe03114d");
assertThat(result.getChangelogList().get(0).getCreationDate()).isNotEmpty();
assertThat(result.getChangelogList().get(0).getDiffsList()).extracting(Diff::getKey, Diff::getOldValue, Diff::getNewValue).containsOnly(tuple("severity", "MAJOR", "BLOCKER"));
}
use of org.sonar.core.issue.FieldDiffs in project sonarqube by SonarSource.
the class ChangelogActionTest method return_changelog_when_no_new_value.
@Test
public void return_changelog_when_no_new_value() {
UserDto user = insertUser();
IssueDto issueDto = insertNewIssue();
userSession.logIn("john").addProjectPermission(USER, project, file);
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", "MAJOR", null).setCreationDate(new Date()));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(1);
assertThat(result.getChangelogList().get(0).getDiffsList().get(0).hasNewValue()).isFalse();
}
use of org.sonar.core.issue.FieldDiffs in project sonarqube by SonarSource.
the class ChangelogActionTest method return_changelog_on_deactivated_user.
@Test
public void return_changelog_on_deactivated_user() {
UserDto user = db.users().insertDisabledUser();
IssueDto issueDto = insertNewIssue();
userSession.logIn("john").addProjectPermission(USER, project, file);
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date()));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(1);
assertThat(result.getChangelogList().get(0).getUser()).isEqualTo(user.getLogin());
assertThat(result.getChangelogList().get(0).getIsUserActive()).isFalse();
assertThat(result.getChangelogList().get(0).getUserName()).isEqualTo(user.getName());
assertThat(result.getChangelogList().get(0).hasAvatar()).isFalse();
assertThat(result.getChangelogList().get(0).getDiffsList()).isNotEmpty();
}
Aggregations