use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class AlertsEmailTemplateTest method shouldFormatAlertWithSeveralMessages.
@Test
public void shouldFormatAlertWithSeveralMessages() {
Notification notification = createNotification("Orange (was Red)", "violations > 4, coverage < 75%", "WARN", "false");
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("alerts/45"));
assertThat(message.getSubject(), is("Quality gate status changed on \"Foo\""));
assertThat(message.getMessage(), is("" + "Project: Foo\n" + "Quality gate status: Orange (was Red)\n" + "\n" + "Quality gate thresholds:\n" + " - violations > 4\n" + " - coverage < 75%\n" + "\n" + "See it in SonarQube: http://nemo.sonarsource.org/dashboard/index/org.sonar.foo:foo"));
}
use of org.sonar.api.notifications.Notification in project sonarqube by SonarSource.
the class NotificationQueueDto method toNotification.
public Notification toNotification() throws IOException, ClassNotFoundException {
if (this.data == null) {
return null;
}
ByteArrayInputStream byteArrayInputStream = null;
try {
byteArrayInputStream = new ByteArrayInputStream(this.data);
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
Object result = objectInputStream.readObject();
objectInputStream.close();
return (Notification) result;
} finally {
IOUtils.closeQuietly(byteArrayInputStream);
}
}
Aggregations