]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4366 SONAR-5095 Update quality gate email template in source code
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 9 Apr 2014 09:52:54 +0000 (11:52 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 9 Apr 2014 09:53:09 +0000 (11:53 +0200)
plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplate.java
plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/templates/alerts/AlertsEmailTemplateTest.java

index ebff4b23801c62b44afa588c01b2a73081c6c4a8..bd7fa46c3c6d53b51ffb58db7f11395c0d6cbb3c 100644 (file)
@@ -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");
index b772b923e96862ff752569b16245e070ca3ecfc3..5cd4f0cf2a54a7025384954039048d750d5fd652 100644 (file)
@@ -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"));