aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Hartmann <hartmann.eric@gmail.com>2017-10-16 17:05:19 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-10-17 10:06:30 +0200
commitc8afbfd7e00b8f27ce097efab84e186b3afebe6e (patch)
treeeadc256a8b19e3c68c8fbab98c224b227984cd08
parent139facb4c713471036fe72f00bdfa1e86ee33f5e (diff)
downloadsonarqube-c8afbfd7e00b8f27ce097efab84e186b3afebe6e.tar.gz
sonarqube-c8afbfd7e00b8f27ce097efab84e186b3afebe6e.zip
SONAR-9905 Notification daemon must not be started twice
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java9
-rw-r--r--tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java1
3 files changed, 9 insertions, 8 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
index 0b622830025..aeed2de2dac 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
@@ -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,
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java
index ad0d0e8f73a..f8c07e82b44 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java
@@ -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,
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java
index f97dd1b7ba2..ffd7d24bac2 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java
@@ -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();