]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR−9721 fix InfoAction class dependency on web followers 2461/head
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 31 Aug 2017 16:34:54 +0000 (18:34 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 1 Sep 2017 07:46:59 +0000 (09:46 +0200)
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
server/sonar-server/src/main/java/org/sonar/server/platform/ws/InfoActionModule.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/telemetry/TelemetryModule.java
server/sonar-server/src/test/java/org/sonar/server/platform/ws/InfoActionModuleTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/telemetry/TelemetryModuleTest.java

index 57f67a4874a7a0ecb2485cc325b1738011352684..2f6b37b75e0b6d37d87630a66c21b9a87176ffb0 100644 (file)
@@ -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 (file)
index 0000000..78bff02
--- /dev/null
@@ -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);
+  }
+}
index bb2e4a9b298faa559128458fca1d2ff7f2b0fdbf..447f11e5a0edc81a0ceff401f4cae3be48ef8da7 100644 (file)
@@ -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 (file)
index 0000000..674b61c
--- /dev/null
@@ -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);
+  }
+
+}
index 57c07eb666f37fa5fec44ebbb0c12ee731b1acbe..3edc6524aa8033114128b2c64f080cc04ea192b2 100644 (file)
@@ -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);
   }
 }