diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-04-09 11:52:54 +0200 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-04-09 11:53:09 +0200 |
commit | 9ebbf453753c426f7601a448637a9ab0a393040d (patch) | |
tree | aaf0b197df8412efca8b079fff27b4d9e71afe11 /plugins/sonar-email-notifications-plugin/src | |
parent | f8ed488b21d0feba54c408c44c031adc3cc59b49 (diff) | |
download | sonarqube-9ebbf453753c426f7601a448637a9ab0a393040d.tar.gz sonarqube-9ebbf453753c426f7601a448637a9ab0a393040d.zip |
SONAR-4366 SONAR-5095 Update quality gate email template in source code
Diffstat (limited to 'plugins/sonar-email-notifications-plugin/src')
2 files changed, 16 insertions, 18 deletions
diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplate.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplate.java index ebff4b23801..bd7fa46c3c6 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplate.java +++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplate.java @@ -28,7 +28,7 @@ import org.sonar.plugins.emailnotifications.api.EmailTemplate; /** * Creates email message for notification "alerts". - * + * * @since 3.5 */ public class AlertsEmailTemplate extends EmailTemplate { @@ -70,9 +70,9 @@ public class AlertsEmailTemplate extends EmailTemplate { if (Metric.Level.OK.toString().equals(alertLevel)) { subjectBuilder.append("\"").append(projectName).append("\" is back to green"); } else if (isNewAlert) { - subjectBuilder.append("New alert on \"").append(projectName).append("\""); + subjectBuilder.append("New quality gate threshold reached on \"").append(projectName).append("\""); } else { - subjectBuilder.append("Alert level changed on \"").append(projectName).append("\""); + subjectBuilder.append("Quality gate status changed on \"").append(projectName).append("\""); } return subjectBuilder.toString(); } @@ -80,14 +80,14 @@ public class AlertsEmailTemplate extends EmailTemplate { private String generateMessageBody(String projectName, String projectKey, String alertName, String alertText, boolean isNewAlert) { StringBuilder messageBody = new StringBuilder(); messageBody.append("Project: ").append(projectName).append("\n"); - messageBody.append("Alert level: ").append(alertName).append("\n\n"); + messageBody.append("Quality gate status: ").append(alertName).append("\n\n"); String[] alerts = StringUtils.split(alertText, ","); if (alerts.length > 0) { if (isNewAlert) { - messageBody.append("New alert"); + messageBody.append("New quality gate threshold"); } else { - messageBody.append("Alert"); + messageBody.append("Quality gate threshold"); } if (alerts.length == 1) { messageBody.append(": ").append(alerts[0].trim()).append("\n"); diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplateTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplateTest.java index b772b923e96..5cd4f0cf2a5 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplateTest.java +++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplateTest.java @@ -19,8 +19,6 @@ */ package org.sonar.plugins.emailnotifications.templates.alerts; -import org.sonar.plugins.emailnotifications.templates.alerts.AlertsEmailTemplate; - import org.junit.Before; import org.junit.Test; import org.sonar.api.config.EmailSettings; @@ -57,12 +55,12 @@ public class AlertsEmailTemplateTest { EmailMessage message = template.format(notification); assertThat(message.getMessageId(), is("alerts/45")); - assertThat(message.getSubject(), is("Alert level changed on \"Foo\"")); + assertThat(message.getSubject(), is("Quality gate status changed on \"Foo\"")); assertThat(message.getMessage(), is("" + "Project: Foo\n" + - "Alert level: Orange (was Red)\n" + + "Quality gate status: Orange (was Red)\n" + "\n" + - "Alerts:\n" + + "Quality gate thresholds:\n" + " - violations > 4\n" + " - coverage < 75%\n" + "\n" + @@ -75,12 +73,12 @@ public class AlertsEmailTemplateTest { EmailMessage message = template.format(notification); assertThat(message.getMessageId(), is("alerts/45")); - assertThat(message.getSubject(), is("New alert on \"Foo\"")); + assertThat(message.getSubject(), is("New quality gate threshold reached on \"Foo\"")); assertThat(message.getMessage(), is("" + "Project: Foo\n" + - "Alert level: Orange (was Red)\n" + + "Quality gate status: Orange (was Red)\n" + "\n" + - "New alerts:\n" + + "New quality gate thresholds:\n" + " - violations > 4\n" + " - coverage < 75%\n" + "\n" + @@ -93,12 +91,12 @@ public class AlertsEmailTemplateTest { EmailMessage message = template.format(notification); assertThat(message.getMessageId(), is("alerts/45")); - assertThat(message.getSubject(), is("New alert on \"Foo\"")); + assertThat(message.getSubject(), is("New quality gate threshold reached on \"Foo\"")); assertThat(message.getMessage(), is("" + "Project: Foo\n" + - "Alert level: Orange (was Red)\n" + + "Quality gate status: Orange (was Red)\n" + "\n" + - "New alert: violations > 4\n" + + "New quality gate threshold: violations > 4\n" + "\n" + "See it in SonarQube: http://nemo.sonarsource.org/dashboard/index/org.sonar.foo:foo")); } @@ -112,7 +110,7 @@ public class AlertsEmailTemplateTest { assertThat(message.getSubject(), is("\"Foo\" is back to green")); assertThat(message.getMessage(), is("" + "Project: Foo\n" + - "Alert level: Green (was Red)\n" + + "Quality gate status: Green (was Red)\n" + "\n" + "\n" + "See it in SonarQube: http://nemo.sonarsource.org/dashboard/index/org.sonar.foo:foo")); |