diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-06-10 21:29:21 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-06-10 21:30:26 +0200 |
commit | ed5105e4294e2e3a2887e9d09c0384fbadb57a35 (patch) | |
tree | 78612e1f3bba23361adc42f41d64acf53211661c /plugins/sonar-core-plugin | |
parent | 9e5fe807e20689fef2d8936c6aa2667b1732461a (diff) | |
download | sonarqube-ed5105e4294e2e3a2887e9d09c0384fbadb57a35.tar.gz sonarqube-ed5105e4294e2e3a2887e9d09c0384fbadb57a35.zip |
SONAR-4283 do not persist notifications of changes on new issues
Diffstat (limited to 'plugins/sonar-core-plugin')
2 files changed, 4 insertions, 4 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/SendIssueNotificationsPostJob.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/SendIssueNotificationsPostJob.java index 32a3d0a5b22..a93f38fd783 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/SendIssueNotificationsPostJob.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/SendIssueNotificationsPostJob.java @@ -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) { diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/SendIssueNotificationsPostJobTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/SendIssueNotificationsPostJobTest.java index fd9af8ea8ec..fc61ced163a 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/SendIssueNotificationsPostJobTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/SendIssueNotificationsPostJobTest.java @@ -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")); |