use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class NotificationQueueDaoTest method should_count_notification_queue.
@Test
public void should_count_notification_queue() {
NotificationQueueDto notificationQueueDto = toNotificationQueueDto(new Notification("email"));
assertThat(dao.count()).isZero();
dao.insert(Arrays.asList(notificationQueueDto));
assertThat(dao.count()).isOne();
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class DefaultNotificationManagerTest method shouldGetFromQueueAndDelete.
@Test
public void shouldGetFromQueueAndDelete() {
Notification notification = new Notification("test");
NotificationQueueDto dto = NotificationQueueDto.toNotificationQueueDto(notification);
List<NotificationQueueDto> dtos = Arrays.asList(dto);
when(notificationQueueDao.selectOldest(1)).thenReturn(dtos);
assertThat(underTest.<Notification>getFromQueue()).isNotNull();
InOrder inOrder = inOrder(notificationQueueDao);
inOrder.verify(notificationQueueDao).selectOldest(1);
inOrder.verify(notificationQueueDao).delete(dtos);
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class QGChangeEmailTemplateTest method shouldFormatNewAlertWithThresholdProperlyFormatted.
@UseDataProvider("alertTextAndFormattedText")
@Test
public void shouldFormatNewAlertWithThresholdProperlyFormatted(String alertText, String expectedFormattedAlertText) {
Notification notification = createNotification("Failed", alertText, "ERROR", "true");
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("alerts/45"));
assertThat(message.getSubject(), is("New quality gate threshold reached on \"Foo\""));
assertThat(message.getMessage(), is("" + "Project: Foo\n" + "Version: V1-SNAP\n" + "Quality gate status: Failed\n" + "\n" + "New quality gate threshold: " + expectedFormattedAlertText + "\n" + "\n" + "More details at: http://nemo.sonarsource.org/dashboard?id=org.sonar.foo:foo"));
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class QGChangeEmailTemplateTest method shouldFormatNewAlertWithOneMessage.
@Test
public void shouldFormatNewAlertWithOneMessage() {
Notification notification = createNotification("Failed", "violations > 4", "ERROR", "true");
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("alerts/45"));
assertThat(message.getSubject(), is("New quality gate threshold reached on \"Foo\""));
assertThat(message.getMessage(), is("" + "Project: Foo\n" + "Version: V1-SNAP\n" + "Quality gate status: Failed\n" + "\n" + "New quality gate threshold: violations > 4\n" + "\n" + "More details at: http://nemo.sonarsource.org/dashboard?id=org.sonar.foo:foo"));
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class QGChangeEmailTemplateTest method shouldFormatNewAlertWithoutVersion.
@Test
public void shouldFormatNewAlertWithoutVersion() {
Notification notification = createNotification("Failed", "violations > 4", "ERROR", "true").setFieldValue("projectVersion", null);
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("alerts/45"));
assertThat(message.getSubject(), is("New quality gate threshold reached on \"Foo\""));
assertThat(message.getMessage(), is("" + "Project: Foo\n" + "Quality gate status: Failed\n" + "\n" + "New quality gate threshold: violations > 4\n" + "\n" + "More details at: http://nemo.sonarsource.org/dashboard?id=org.sonar.foo:foo"));
}
Aggregations