]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2747 Improve email message
authorFabrice Bellingard <bellingard@gmail.com>
Wed, 8 Feb 2012 09:41:04 +0000 (10:41 +0100)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 8 Feb 2012 09:41:04 +0000 (10:41 +0100)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/NewViolationsDecorator.java
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/NewViolationsDecoratorTest.java
plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsEmailTemplate.java
plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/newviolations/NewViolationsEmailTemplateTest.java

index d714cada4fac42371343be1b302c3303fa8ce425..4cd71f04f5d9254c3692b7d71a5176b24574e466 100644 (file)
@@ -223,8 +223,7 @@ public class NewViolationsDecorator implements Decorator {
             .setFieldValue("projectName", project.getLongName())
             .setFieldValue("projectKey", project.getKey())
             .setFieldValue("projectId", String.valueOf(project.getId()))
-            .setFieldValue("fromDate", dateformat.format(pastSnapshot.getTargetDate()))
-            .setFieldValue("toDate", dateformat.format(new Date()));
+            .setFieldValue("fromDate", dateformat.format(pastSnapshot.getTargetDate()));
         notificationManager.scheduleForSending(notification);
       }
     }
index a5ee668fa1c812d61ed60e0be31f4e83dae56928..f5f803bc952abcb56eb9dcb52f7a7b73b01cf85a 100644 (file)
@@ -247,8 +247,7 @@ public class NewViolationsDecoratorTest {
         .setFieldValue("projectName", "LongName")
         .setFieldValue("projectKey", "key")
         .setFieldValue("projectId", "45")
-        .setFieldValue("fromDate", dateformat.format(pastDate.getTime()))
-        .setFieldValue("toDate", dateformat.format(new Date()));
+        .setFieldValue("fromDate", dateformat.format(pastDate.getTime()));
     verify(notificationManager, times(1)).scheduleForSending(eq(notification));
   }
 
index bfd105102d90475213787d7e9e2d8d6e07837cf6..690b60335b21539b25872874c135bc6430f5f373 100644 (file)
@@ -47,11 +47,9 @@ public class NewViolationsEmailTemplate extends EmailTemplate {
     String projectName = notification.getFieldValue("projectName");
     String violationsCount = notification.getFieldValue("count");
     String fromDate = notification.getFieldValue("fromDate");
-    String toDate = notification.getFieldValue("toDate");
 
     sb.append("Project: ").append(projectName).append('\n');
-    sb.append(violationsCount).append(" new violations on last analysis");
-    sb.append(" (introduced between ").append(fromDate).append(" and ").append(toDate).append(")").append('\n');
+    sb.append(violationsCount).append(" new violations introduced since ").append(fromDate).append('\n');
     appendFooter(sb, notification);
 
     EmailMessage message = new EmailMessage()
index 4fc6c2209456ac33a0f7a6d62004a3dca801b475..fdca5da00919bc819587c9ef61b64f8b92afa12e 100644 (file)
@@ -67,15 +67,14 @@ public class NewViolationsEmailTemplateTest {
         .setFieldValue("projectName", "Foo")
         .setFieldValue("projectKey", "org.sonar.foo:foo")
         .setFieldValue("projectId", "45")
-        .setFieldValue("fromDate", "2012-01-02")
-        .setFieldValue("toDate", "2012-01-15");
+        .setFieldValue("fromDate", "2012-01-02");
 
     EmailMessage message = template.format(notification);
     assertThat(message.getMessageId(), is("new-violations/45"));
     assertThat(message.getSubject(), is("New violations for project Foo"));
     assertThat(message.getMessage(), is("" +
       "Project: Foo\n" +
-      "32 new violations on last analysis (introduced between 2012-01-02 and 2012-01-15)\n" +
+      "32 new violations introduced since 2012-01-02\n" +
       "\n" +
       "See it in Sonar: http://nemo.sonarsource.org/drilldown/measures/org.sonar.foo:foo?metric=new_violations&period=1\n"));
   }