From c91f6e066a0d4917b2cbace325db9ac6a12c2913 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Wed, 30 Jan 2013 15:08:34 +0100 Subject: SONAR-3959 Add NotificationDispatcherMetadata class --- .../emailnotifications/EmailNotificationsPlugin.java | 16 +++++++++++++--- .../emailnotifications/EmailNotificationsPluginTest.java | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'plugins/sonar-email-notifications-plugin/src') diff --git a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java index 16c3d9bf00a..d62857fbca8 100644 --- a/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java +++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java @@ -20,8 +20,8 @@ package org.sonar.plugins.emailnotifications; import com.google.common.collect.ImmutableList; -import org.sonar.api.ServerExtension; import org.sonar.api.SonarPlugin; +import org.sonar.api.notifications.NotificationDispatcherMetadata; import org.sonar.plugins.emailnotifications.alerts.AlertsEmailTemplate; import org.sonar.plugins.emailnotifications.alerts.AlertsOnMyFavouriteProject; import org.sonar.plugins.emailnotifications.newviolations.NewViolationsEmailTemplate; @@ -32,18 +32,28 @@ import org.sonar.plugins.emailnotifications.reviews.ReviewEmailTemplate; import java.util.List; public class EmailNotificationsPlugin extends SonarPlugin { - public List> getExtensions() { + public List getExtensions() { return ImmutableList.of( EmailNotificationChannel.class, + // Notify incoming violations on my favourite projects NewViolationsOnMyFavouriteProject.class, + NotificationDispatcherMetadata.create("NewViolationsOnMyFavouriteProject") + .setProperty(NotificationDispatcherMetadata.GLOBAL_NOTIFICATION, "true"), NewViolationsEmailTemplate.class, + // Notify reviews changes ChangesInReviewAssignedToMeOrCreatedByMe.class, + NotificationDispatcherMetadata.create("ChangesInReviewAssignedToMeOrCreatedByMe") + .setProperty(NotificationDispatcherMetadata.GLOBAL_NOTIFICATION, "true"), ReviewEmailTemplate.class, + // Notify alerts on my favourite projects AlertsOnMyFavouriteProject.class, + NotificationDispatcherMetadata.create("AlertsOnMyFavouriteProject") + .setProperty(NotificationDispatcherMetadata.GLOBAL_NOTIFICATION, "true"), AlertsEmailTemplate.class - ); + + ); } } diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java index aeb4755d940..55096f5565b 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java +++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java @@ -26,6 +26,6 @@ import static org.fest.assertions.Assertions.assertThat; public class EmailNotificationsPluginTest { @Test public void should_get_extensions() { - assertThat(new EmailNotificationsPlugin().getExtensions()).hasSize(7); + assertThat(new EmailNotificationsPlugin().getExtensions()).hasSize(10); } } -- cgit v1.2.3