diff options
author | Eric Giffon <eric.giffon@sonarsource.com> | 2023-05-23 14:48:53 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-05-30 20:02:52 +0000 |
commit | eaf6bcb414be379c352fb66fdaa5e88461c36163 (patch) | |
tree | b669010b0d59c88d759e0be3d0d581d05198cc29 /server/sonar-ce-task-projectanalysis/src/it | |
parent | 8adbfc336b8582e251497020c8dcec514cefe07e (diff) | |
download | sonarqube-eaf6bcb414be379c352fb66fdaa5e88461c36163.tar.gz sonarqube-eaf6bcb414be379c352fb66fdaa5e88461c36163.zip |
SONAR-19340 Raise security hotspots events from CE
Diffstat (limited to 'server/sonar-ce-task-projectanalysis/src/it')
3 files changed, 22 insertions, 8 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/issue/DefaultAssigneeIT.java b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/issue/DefaultAssigneeIT.java index 3d04097a7f6..e7b36137021 100644 --- a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/issue/DefaultAssigneeIT.java +++ b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/issue/DefaultAssigneeIT.java @@ -27,6 +27,7 @@ import org.sonar.ce.task.projectanalysis.component.ConfigurationRepository; import org.sonar.ce.task.projectanalysis.component.TestSettingsRepository; import org.sonar.db.DbTester; import org.sonar.db.user.UserDto; +import org.sonar.db.user.UserIdDto; import static org.assertj.core.api.Assertions.assertThat; @@ -43,7 +44,7 @@ public class DefaultAssigneeIT { @Test public void no_default_assignee() { - assertThat(underTest.loadDefaultAssigneeUuid()).isNull(); + assertThat(underTest.loadDefaultAssigneeUserId()).isNull(); } @Test @@ -51,14 +52,17 @@ public class DefaultAssigneeIT { settings.setProperty(CoreProperties.DEFAULT_ISSUE_ASSIGNEE, "erik"); UserDto userDto = db.users().insertUser("erik"); - assertThat(underTest.loadDefaultAssigneeUuid()).isEqualTo(userDto.getUuid()); + UserIdDto userId = underTest.loadDefaultAssigneeUserId(); + assertThat(userId).isNotNull(); + assertThat(userId.getUuid()).isEqualTo(userDto.getUuid()); + assertThat(userId.getLogin()).isEqualTo(userDto.getLogin()); } @Test public void configured_login_does_not_exist() { settings.setProperty(CoreProperties.DEFAULT_ISSUE_ASSIGNEE, "erik"); - assertThat(underTest.loadDefaultAssigneeUuid()).isNull(); + assertThat(underTest.loadDefaultAssigneeUserId()).isNull(); } @Test @@ -66,17 +70,23 @@ public class DefaultAssigneeIT { settings.setProperty(CoreProperties.DEFAULT_ISSUE_ASSIGNEE, "erik"); db.users().insertUser(user -> user.setLogin("erik").setActive(false)); - assertThat(underTest.loadDefaultAssigneeUuid()).isNull(); + assertThat(underTest.loadDefaultAssigneeUserId()).isNull(); } @Test public void default_assignee_is_cached() { settings.setProperty(CoreProperties.DEFAULT_ISSUE_ASSIGNEE, "erik"); UserDto userDto = db.users().insertUser("erik"); - assertThat(underTest.loadDefaultAssigneeUuid()).isEqualTo(userDto.getUuid()); + UserIdDto userId = underTest.loadDefaultAssigneeUserId(); + assertThat(userId).isNotNull(); + assertThat(userId.getUuid()).isEqualTo(userDto.getUuid()); + assertThat(userId.getLogin()).isEqualTo(userDto.getLogin()); // The setting is updated but the assignee hasn't changed settings.setProperty(CoreProperties.DEFAULT_ISSUE_ASSIGNEE, "other"); - assertThat(underTest.loadDefaultAssigneeUuid()).isEqualTo(userDto.getUuid()); + userId = underTest.loadDefaultAssigneeUserId(); + assertThat(userId).isNotNull(); + assertThat(userId.getUuid()).isEqualTo(userDto.getUuid()); + assertThat(userId.getLogin()).isEqualTo(userDto.getLogin()); } } diff --git a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/issue/ScmAccountToUserLoaderIT.java b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/issue/ScmAccountToUserLoaderIT.java index 9e91e0b66a9..86d15f426d2 100644 --- a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/issue/ScmAccountToUserLoaderIT.java +++ b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/issue/ScmAccountToUserLoaderIT.java @@ -25,6 +25,7 @@ import org.slf4j.event.Level; import org.sonar.api.testfixtures.log.LogTester; import org.sonar.db.DbTester; import org.sonar.db.user.UserDto; +import org.sonar.db.user.UserIdDto; import org.sonar.server.es.EsTester; import static java.util.Arrays.asList; @@ -49,7 +50,10 @@ public class ScmAccountToUserLoaderIT { ScmAccountToUserLoader underTest = new ScmAccountToUserLoader(db.getDbClient()); assertThat(underTest.load("missing")).isNull(); - assertThat(underTest.load("jesuis@charlie.com")).isEqualTo(user.getUuid()); + UserIdDto result = underTest.load("jesuis@charlie.com"); + assertThat(result).isNotNull(); + assertThat(result.getUuid()).isEqualTo(user.getUuid()); + assertThat(result.getLogin()).isEqualTo(user.getLogin()); } @Test diff --git a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/PersistPushEventsStepIT.java b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/PersistPushEventsStepIT.java index 8ae97ad8528..5d06b6ea3de 100644 --- a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/PersistPushEventsStepIT.java +++ b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/PersistPushEventsStepIT.java @@ -74,7 +74,7 @@ public class PersistPushEventsStepIT { @Test public void description() { - assertThat(underTest.getDescription()).isEqualTo("Publishing taint vulnerabilities events"); + assertThat(underTest.getDescription()).isEqualTo("Publishing taint vulnerabilities and security hotspots events"); } @Test |