From: Sébastien Lesaint Date: Thu, 31 Aug 2017 16:34:54 +0000 (+0200) Subject: SONAR−9721 fix InfoAction class dependency on web followers X-Git-Tag: 6.6-RC1~494 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F2461%2Fhead;p=sonarqube.git SONAR−9721 fix InfoAction class dependency on web followers --- 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 57f67a4874a..2f6b37b75e0 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 @@ -115,7 +115,7 @@ import org.sonar.server.platform.web.WebPagesFilter; import org.sonar.server.platform.web.requestid.HttpRequestIdModule; import org.sonar.server.platform.ws.ChangeLogLevelAction; import org.sonar.server.platform.ws.DbMigrationStatusAction; -import org.sonar.server.platform.ws.InfoAction; +import org.sonar.server.platform.ws.InfoActionModule; import org.sonar.server.platform.ws.L10nWs; import org.sonar.server.platform.ws.LogsAction; import org.sonar.server.platform.ws.MigrateDbAction; @@ -472,7 +472,7 @@ public class PlatformLevel4 extends PlatformLevel { // System ServerLogging.class, RestartAction.class, - InfoAction.class, + InfoActionModule.class, PingAction.class, UpgradesAction.class, StatusAction.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ws/InfoActionModule.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/InfoActionModule.java new file mode 100644 index 00000000000..78bff02585c --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ws/InfoActionModule.java @@ -0,0 +1,31 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.platform.ws; + +import org.sonar.core.platform.Module; +import org.sonar.server.telemetry.TelemetryDataLoader; + +public class InfoActionModule extends Module { + @Override + protected void configureModule() { + add(TelemetryDataLoader.class, + InfoAction.class); + } +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/telemetry/TelemetryModule.java b/server/sonar-server/src/main/java/org/sonar/server/telemetry/TelemetryModule.java index bb2e4a9b298..447f11e5a0e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/telemetry/TelemetryModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/telemetry/TelemetryModule.java @@ -24,9 +24,7 @@ import org.sonar.core.platform.Module; public class TelemetryModule extends Module { @Override protected void configureModule() { - add( - TelemetryDataLoader.class, - TelemetryDaemon.class, + add(TelemetryDaemon.class, TelemetryClient.class); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/InfoActionModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/InfoActionModuleTest.java new file mode 100644 index 00000000000..674b61c572d --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/InfoActionModuleTest.java @@ -0,0 +1,38 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.platform.ws; + +import org.junit.Test; +import org.sonar.core.platform.ComponentContainer; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER; + +public class InfoActionModuleTest { + @Test + public void verify_count_of_added_components() { + ComponentContainer container = new ComponentContainer(); + + new InfoActionModule().configure(container); + + assertThat(container.size()).isEqualTo(2 + COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER); + } + +} diff --git a/server/sonar-server/src/test/java/org/sonar/server/telemetry/TelemetryModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/telemetry/TelemetryModuleTest.java index 57c07eb666f..3edc6524aa8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/telemetry/TelemetryModuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/telemetry/TelemetryModuleTest.java @@ -23,12 +23,15 @@ import org.junit.Test; import org.sonar.core.platform.ComponentContainer; import static org.assertj.core.api.Assertions.assertThat; +import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER; public class TelemetryModuleTest { @Test public void verify_count_of_added_components() { ComponentContainer container = new ComponentContainer(); + new TelemetryModule().configure(container); - assertThat(container.size()).isEqualTo(3 + 2); + + assertThat(container.size()).isEqualTo(2 + COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER); } }