]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9905 Notification daemon must not be started twice 2675/head
authorEric Hartmann <hartmann.eric@gmail.com>
Mon, 16 Oct 2017 15:05:19 +0000 (17:05 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 17 Oct 2017 08:06:30 +0000 (10:06 +0200)
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java
tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java

index 0b622830025bd433dbacb6f36a573e5086ff9155..aeed2de2dac5463c610ee0d424fdd5cbb86ae4ab 100644 (file)
@@ -150,6 +150,8 @@ import org.sonar.server.property.ws.PropertiesWs;
 import org.sonar.server.qualitygate.QualityGateModule;
 import org.sonar.server.qualityprofile.BuiltInQProfileDefinitionsBridge;
 import org.sonar.server.qualityprofile.BuiltInQProfileRepositoryImpl;
+import org.sonar.server.qualityprofile.BuiltInQualityProfilesNotificationDispatcher;
+import org.sonar.server.qualityprofile.BuiltInQualityProfilesNotificationTemplate;
 import org.sonar.server.qualityprofile.QProfileBackuperImpl;
 import org.sonar.server.qualityprofile.QProfileComparison;
 import org.sonar.server.qualityprofile.QProfileCopier;
@@ -455,6 +457,11 @@ public class PlatformLevel4 extends PlatformLevel {
       MacroInterpreter.class,
 
       // Notifications
+      // Those class are required in order to be able to send emails during startup
+      // Without having two NotificationModule (one in StartupLevel and one in Level4)
+      BuiltInQualityProfilesNotificationTemplate.class,
+      BuiltInQualityProfilesNotificationDispatcher.class,
+
       NotificationModule.class,
       NotificationWsModule.class,
       EmailsWsModule.class,
index ad0d0e8f73a37df3cab8e4105fb9718579e03d7e..f8c07e82b44a8966c69684599002acc1ce0dac33 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.server.platform.platformlevel;
 
 import org.sonar.server.app.ProcessCommandWrapper;
 import org.sonar.server.es.IndexerStartupTask;
-import org.sonar.server.notification.NotificationModule;
 import org.sonar.server.organization.DefaultOrganizationEnforcer;
 import org.sonar.server.platform.ServerLifecycleNotifier;
 import org.sonar.server.platform.web.RegisterServletFilters;
@@ -29,8 +28,6 @@ import org.sonar.server.qualitygate.RegisterQualityGates;
 import org.sonar.server.qualityprofile.BuiltInQProfileInsertImpl;
 import org.sonar.server.qualityprofile.BuiltInQProfileLoader;
 import org.sonar.server.qualityprofile.BuiltInQProfileUpdateImpl;
-import org.sonar.server.qualityprofile.BuiltInQualityProfilesNotificationDispatcher;
-import org.sonar.server.qualityprofile.BuiltInQualityProfilesNotificationTemplate;
 import org.sonar.server.qualityprofile.BuiltInQualityProfilesUpdateListener;
 import org.sonar.server.qualityprofile.RegisterQualityProfiles;
 import org.sonar.server.rule.RegisterRules;
@@ -40,8 +37,8 @@ import org.sonar.server.startup.DisplayLogOnDeprecatedProjects;
 import org.sonar.server.startup.GeneratePluginIndex;
 import org.sonar.server.startup.RegisterMetrics;
 import org.sonar.server.startup.RegisterPermissionTemplates;
-import org.sonar.server.startup.RenameDeprecatedPropertyKeys;
 import org.sonar.server.startup.RegisterPlugins;
+import org.sonar.server.startup.RenameDeprecatedPropertyKeys;
 import org.sonar.server.user.DoPrivileged;
 import org.sonar.server.user.ThreadLocalUserSession;
 
@@ -64,10 +61,6 @@ public class PlatformLevelStartup extends PlatformLevel {
       RegisterRules.class);
     add(BuiltInQProfileLoader.class);
     addIfStartupLeader(
-      // TODO Should we put it in level 2 ?
-      NotificationModule.class,
-      BuiltInQualityProfilesNotificationDispatcher.class,
-      BuiltInQualityProfilesNotificationTemplate.class,
       BuiltInQualityProfilesUpdateListener.class,
       BuiltInQProfileInsertImpl.class,
       BuiltInQProfileUpdateImpl.class,
index f97dd1b7ba288d6d82c471b684b5e7cfbe9a8f01..ffd7d24bac2032be439e0ebd55d7246f7b666841 100644 (file)
@@ -89,6 +89,7 @@ public class BuiltInQualityProfilesNotificationTest {
   public void send_mail_if_quality_profile_is_updated() throws Exception {
     orchestrator = Orchestrator.builderEnv()
       .addPlugin(pluginArtifact("foo-plugin-v1"))
+      .setServerProperty("sonar.notifications.delay", "1")
       .setServerProperty("email.smtp_host.secured", "localhost")
       .setServerProperty("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort()))
       .build();