]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4283 do not persist notifications of changes on new issues
authorSimon Brandhof <simon.brandhof@gmail.com>
Mon, 10 Jun 2013 19:29:21 +0000 (21:29 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Mon, 10 Jun 2013 19:30:26 +0000 (21:30 +0200)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/SendIssueNotificationsPostJob.java
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/SendIssueNotificationsPostJobTest.java

index 32a3d0a5b22b8b130ff8cb85596ce05f08a681cb..a93f38fd7833151cf2f1b5f933676f3234450436 100644 (file)
@@ -56,7 +56,7 @@ public class SendIssueNotificationsPostJob implements PostJob {
       if (issue.isNew() && issue.resolution() == null) {
         newIssues++;
       }
-      if (issue.isChanged()) {
+      if (!issue.isNew() && issue.isChanged()) {
         Rule rule = ruleFinder.findByKey(issue.ruleKey());
         // TODO warning - rules with status REMOVED are currently ignored, but should not
         if (rule != null) {
index fd9af8ea8ecbb5a1f374c6f811af609c4eb515b1..fc61ced163a4bd6db55a9cb78442c31af1bc0de8 100644 (file)
@@ -84,12 +84,12 @@ public class SendIssueNotificationsPostJobTest {
   }
 
   @Test
-  public void should_send_notif_if_issue_change() throws Exception {
-
+  public void should_send_notification_if_issue_change() throws Exception {
     when(project.getAnalysisDate()).thenReturn(DateUtils.parseDate("2013-05-18"));
     RuleKey ruleKey = RuleKey.of("squid", "AvoidCycles");
     Rule rule = new Rule("squid", "AvoidCycles");
     DefaultIssue issue = new DefaultIssue()
+      .setNew(false)
       .setChanged(true)
       .setFieldChange(mock(IssueChangeContext.class), "severity", "MINOR", "BLOCKER")
       .setRuleKey(ruleKey);
@@ -103,7 +103,7 @@ public class SendIssueNotificationsPostJobTest {
   }
 
   @Test
-  public void should_not_send_notif_if_issue_change_on_removed_rule() throws Exception {
+  public void should_not_send_notification_if_issue_change_on_removed_rule() throws Exception {
     IssueChangeContext changeContext = mock(IssueChangeContext.class);
 
     when(project.getAnalysisDate()).thenReturn(DateUtils.parseDate("2013-05-18"));