]> source.dussan.org Git - sonarqube.git/commitdiff
separate Action from indirect dependencies in system WS
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 13 Aug 2019 11:54:45 +0000 (13:54 +0200)
committerSonarTech <sonartech@sonarsource.com>
Wed, 14 Aug 2019 18:21:14 +0000 (20:21 +0200)
28 files changed:
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/AbstractSystemInfoWriter.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelActionModule.java [deleted file]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelServiceModule.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ClusterSystemInfoWriter.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/HealthActionModule.java [deleted file]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/HealthCheckerModule.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SafeModeHealthActionModule.java [deleted file]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SafeModeHealthCheckerModule.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SafemodeSystemWsModule.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/StandaloneSystemInfoWriter.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SystemInfoWriter.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SystemInfoWriterModule.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SystemWsModule.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/WebSystemInfoModule.java [deleted file]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelActionModuleTest.java [deleted file]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelServiceModuleTest.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthActionModuleTest.java [deleted file]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthCheckerModuleTest.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/InfoActionTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SafeModeHealthActionModuleTest.java [deleted file]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SafeModeHealthCheckerModuleTest.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SafemodeSystemWsModuleTest.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SystemInfoWriterModuleTest.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SystemWsModuleTest.java [new file with mode: 0644]
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SystemWsTest.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/WebSystemInfoModuleTest.java [deleted file]
server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java
server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelSafeMode.java

diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/AbstractSystemInfoWriter.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/AbstractSystemInfoWriter.java
new file mode 100644 (file)
index 0000000..c6d2b88
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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 java.util.Collection;
+import org.sonar.api.utils.text.JsonWriter;
+import org.sonar.process.systeminfo.SystemInfoUtils;
+import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
+import org.sonar.server.health.Health;
+import org.sonar.server.telemetry.TelemetryDataLoader;
+
+import static org.sonar.server.telemetry.TelemetryDataJsonWriter.writeTelemetryData;
+
+public abstract class AbstractSystemInfoWriter implements SystemInfoWriter {
+  private static final String[] ORDERED_SECTION_NAMES = {
+    // standalone
+    "System", "Database", "Plugins",
+
+    // cluster
+    "Web JVM State", "Web Database Connection", "Web Logging", "Web JVM Properties",
+    "Compute Engine Tasks", "Compute Engine JVM State", "Compute Engine Database Connection", "Compute Engine Logging", "Compute Engine JVM Properties",
+    "Search State", "Search Indexes"};
+
+  private final TelemetryDataLoader telemetry;
+
+  AbstractSystemInfoWriter(TelemetryDataLoader telemetry) {
+    this.telemetry = telemetry;
+  }
+
+  protected void writeSections(Collection<ProtobufSystemInfo.Section> sections, JsonWriter json) {
+    SystemInfoUtils
+      .order(sections, ORDERED_SECTION_NAMES)
+      .forEach(section -> writeSection(section, json));
+  }
+
+  private void writeSection(ProtobufSystemInfo.Section section, JsonWriter json) {
+    json.name(section.getName());
+    json.beginObject();
+    for (ProtobufSystemInfo.Attribute attribute : section.getAttributesList()) {
+      writeAttribute(attribute, json);
+    }
+    json.endObject();
+  }
+
+  private void writeAttribute(ProtobufSystemInfo.Attribute attribute, JsonWriter json) {
+    switch (attribute.getValueCase()) {
+      case BOOLEAN_VALUE:
+        json.prop(attribute.getKey(), attribute.getBooleanValue());
+        break;
+      case LONG_VALUE:
+        json.prop(attribute.getKey(), attribute.getLongValue());
+        break;
+      case DOUBLE_VALUE:
+        json.prop(attribute.getKey(), attribute.getDoubleValue());
+        break;
+      case STRING_VALUE:
+        json.prop(attribute.getKey(), attribute.getStringValue());
+        break;
+      case VALUE_NOT_SET:
+        json.name(attribute.getKey()).beginArray().values(attribute.getStringValuesList()).endArray();
+        break;
+      default:
+        throw new IllegalArgumentException("Unsupported type: " + attribute.getValueCase());
+    }
+  }
+
+  protected void writeHealth(Health health, JsonWriter json) {
+    json.prop("Health", health.getStatus().name());
+    json.name("Health Causes").beginArray().values(health.getCauses()).endArray();
+  }
+
+  protected void writeTelemetry(JsonWriter json) {
+    json.name("Statistics");
+    writeTelemetryData(json, telemetry.load());
+  }
+}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelActionModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelActionModule.java
deleted file mode 100644 (file)
index d8ef16a..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.platform.WebServer;
-
-public class ChangeLogLevelActionModule extends Module {
-  private final WebServer webServer;
-
-  public ChangeLogLevelActionModule(WebServer webServer) {
-    this.webServer = webServer;
-  }
-
-  @Override
-  protected void configureModule() {
-    add(ChangeLogLevelAction.class);
-    if (webServer.isStandalone()) {
-      add(ChangeLogLevelStandaloneService.class);
-    } else {
-      add(ChangeLogLevelClusterService.class);
-    }
-  }
-}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelServiceModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/ChangeLogLevelServiceModule.java
new file mode 100644 (file)
index 0000000..ad0664b
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.platform.WebServer;
+
+public class ChangeLogLevelServiceModule extends Module {
+  private final WebServer webServer;
+
+  public ChangeLogLevelServiceModule(WebServer webServer) {
+    this.webServer = webServer;
+  }
+
+  @Override
+  protected void configureModule() {
+    if (webServer.isStandalone()) {
+      add(ChangeLogLevelStandaloneService.class);
+    } else {
+      add(ChangeLogLevelClusterService.class);
+    }
+  }
+}
index 97c92f8323f9a4d3bf5255c387b76adabd785770..06b3bb4972be388a1dfb6a1a4be7a8ae83b54b8f 100644 (file)
@@ -29,7 +29,7 @@ import org.sonar.server.platform.monitoring.cluster.NodeInfo;
 import org.sonar.server.platform.monitoring.cluster.SearchNodesInfoLoader;
 import org.sonar.server.telemetry.TelemetryDataLoader;
 
-public class ClusterSystemInfoWriter extends SystemInfoWriter {
+public class ClusterSystemInfoWriter extends AbstractSystemInfoWriter {
   private final GlobalInfoLoader globalInfoLoader;
   private final AppNodesInfoLoader appNodesInfoLoader;
   private final SearchNodesInfoLoader searchNodesInfoLoader;
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/HealthActionModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/HealthActionModule.java
deleted file mode 100644 (file)
index 453d287..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.health.AppNodeClusterCheck;
-import org.sonar.server.health.CeStatusNodeCheck;
-import org.sonar.server.health.DbConnectionNodeCheck;
-import org.sonar.server.health.EsStatusClusterCheck;
-import org.sonar.server.health.EsStatusNodeCheck;
-import org.sonar.server.health.HealthCheckerImpl;
-import org.sonar.server.health.WebServerStatusNodeCheck;
-import org.sonar.server.platform.WebServer;
-
-public class HealthActionModule extends Module {
-  private final WebServer webServer;
-
-  public HealthActionModule(WebServer webServer) {
-    this.webServer = webServer;
-  }
-
-  @Override
-  protected void configureModule() {
-    // NodeHealthCheck implementations
-    add(WebServerStatusNodeCheck.class,
-      DbConnectionNodeCheck.class,
-      CeStatusNodeCheck.class);
-    if (webServer.isStandalone()) {
-      add(EsStatusNodeCheck.class);
-    } else {
-      // ClusterHealthCheck implementations
-      add(EsStatusClusterCheck.class,
-        AppNodeClusterCheck.class);
-    }
-
-    add(HealthCheckerImpl.class,
-      HealthActionSupport.class,
-      HealthAction.class);
-  }
-}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/HealthCheckerModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/HealthCheckerModule.java
new file mode 100644 (file)
index 0000000..8707f7d
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.health.AppNodeClusterCheck;
+import org.sonar.server.health.CeStatusNodeCheck;
+import org.sonar.server.health.DbConnectionNodeCheck;
+import org.sonar.server.health.EsStatusClusterCheck;
+import org.sonar.server.health.EsStatusNodeCheck;
+import org.sonar.server.health.HealthCheckerImpl;
+import org.sonar.server.health.WebServerStatusNodeCheck;
+import org.sonar.server.platform.WebServer;
+
+public class HealthCheckerModule extends Module {
+  private final WebServer webServer;
+
+  public HealthCheckerModule(WebServer webServer) {
+    this.webServer = webServer;
+  }
+
+  @Override
+  protected void configureModule() {
+    // NodeHealthCheck implementations
+    add(WebServerStatusNodeCheck.class,
+      DbConnectionNodeCheck.class,
+      CeStatusNodeCheck.class);
+    if (webServer.isStandalone()) {
+      add(EsStatusNodeCheck.class);
+    } else {
+      // ClusterHealthCheck implementations
+      add(EsStatusClusterCheck.class,
+        AppNodeClusterCheck.class);
+    }
+
+    add(HealthCheckerImpl.class);
+  }
+}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SafeModeHealthActionModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SafeModeHealthActionModule.java
deleted file mode 100644 (file)
index 96f8f7b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.health.DbConnectionNodeCheck;
-import org.sonar.server.health.EsStatusNodeCheck;
-import org.sonar.server.health.HealthCheckerImpl;
-import org.sonar.server.health.WebServerSafemodeNodeCheck;
-
-public class SafeModeHealthActionModule extends Module {
-  @Override
-  protected void configureModule() {
-    add(
-      // NodeHealthCheck implementations
-      WebServerSafemodeNodeCheck.class,
-      DbConnectionNodeCheck.class,
-      EsStatusNodeCheck.class,
-
-      HealthCheckerImpl.class,
-      HealthActionSupport.class,
-      SafeModeHealthAction.class);
-  }
-}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SafeModeHealthCheckerModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SafeModeHealthCheckerModule.java
new file mode 100644 (file)
index 0000000..f1bd069
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.health.DbConnectionNodeCheck;
+import org.sonar.server.health.EsStatusNodeCheck;
+import org.sonar.server.health.HealthCheckerImpl;
+import org.sonar.server.health.WebServerSafemodeNodeCheck;
+
+public class SafeModeHealthCheckerModule extends Module {
+  @Override
+  protected void configureModule() {
+    add(
+      // NodeHealthCheck implementations
+      WebServerSafemodeNodeCheck.class,
+      DbConnectionNodeCheck.class,
+      EsStatusNodeCheck.class,
+
+      HealthCheckerImpl.class);
+  }
+}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SafemodeSystemWsModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SafemodeSystemWsModule.java
new file mode 100644 (file)
index 0000000..9a3919c
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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;
+
+public class SafemodeSystemWsModule extends Module {
+  @Override
+  protected void configureModule() {
+    add(
+      StatusAction.class,
+      MigrateDbAction.class,
+      DbMigrationStatusAction.class,
+      HealthActionSupport.class,
+      SafeModeHealthAction.class,
+      SystemWs.class
+
+    );
+  }
+}
index 3557fa3caf4b636b0187e0dc4ce5f8f7a2e9f387..a883a75c54814e9cf1bc7b046ecd45f686cabfd9 100644 (file)
@@ -31,7 +31,7 @@ import org.sonar.server.telemetry.TelemetryDataLoader;
 
 import static java.util.Arrays.stream;
 
-public class StandaloneSystemInfoWriter extends SystemInfoWriter {
+public class StandaloneSystemInfoWriter extends AbstractSystemInfoWriter {
   private final CeHttpClient ceHttpClient;
   private final HealthChecker healthChecker;
   private final SystemInfoSection[] systemInfoSections;
index 5c0b046a02800981cace0f59240ebec1e67886be..fd6726573b88423e74b440ec108323cd1e91ee43 100644 (file)
  */
 package org.sonar.server.platform.ws;
 
-import java.util.Collection;
 import org.sonar.api.utils.text.JsonWriter;
-import org.sonar.process.systeminfo.SystemInfoUtils;
-import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
-import org.sonar.server.health.Health;
-import org.sonar.server.telemetry.TelemetryDataLoader;
 
-import static org.sonar.server.telemetry.TelemetryDataJsonWriter.writeTelemetryData;
-
-public abstract class SystemInfoWriter {
-  private static final String[] ORDERED_SECTION_NAMES = {
-    // standalone
-    "System", "Database", "Plugins",
-
-    // cluster
-    "Web JVM State", "Web Database Connection", "Web Logging", "Web JVM Properties",
-    "Compute Engine Tasks", "Compute Engine JVM State", "Compute Engine Database Connection", "Compute Engine Logging", "Compute Engine JVM Properties",
-    "Search State", "Search Indexes"};
-
-  private final TelemetryDataLoader telemetry;
-
-  SystemInfoWriter(TelemetryDataLoader telemetry) {
-    this.telemetry = telemetry;
-  }
-
-  public abstract void write(JsonWriter json) throws Exception;
-
-  protected void writeSections(Collection<ProtobufSystemInfo.Section> sections, JsonWriter json) {
-    SystemInfoUtils
-      .order(sections, ORDERED_SECTION_NAMES)
-      .forEach(section -> writeSection(section, json));
-  }
-
-  private void writeSection(ProtobufSystemInfo.Section section, JsonWriter json) {
-    json.name(section.getName());
-    json.beginObject();
-    for (ProtobufSystemInfo.Attribute attribute : section.getAttributesList()) {
-      writeAttribute(attribute, json);
-    }
-    json.endObject();
-  }
-
-  private void writeAttribute(ProtobufSystemInfo.Attribute attribute, JsonWriter json) {
-    switch (attribute.getValueCase()) {
-      case BOOLEAN_VALUE:
-        json.prop(attribute.getKey(), attribute.getBooleanValue());
-        break;
-      case LONG_VALUE:
-        json.prop(attribute.getKey(), attribute.getLongValue());
-        break;
-      case DOUBLE_VALUE:
-        json.prop(attribute.getKey(), attribute.getDoubleValue());
-        break;
-      case STRING_VALUE:
-        json.prop(attribute.getKey(), attribute.getStringValue());
-        break;
-      case VALUE_NOT_SET:
-        json.name(attribute.getKey()).beginArray().values(attribute.getStringValuesList()).endArray();
-        break;
-      default:
-        throw new IllegalArgumentException("Unsupported type: " + attribute.getValueCase());
-    }
-  }
-
-  protected void writeHealth(Health health, JsonWriter json) {
-    json.prop("Health", health.getStatus().name());
-    json.name("Health Causes").beginArray().values(health.getCauses()).endArray();
-  }
-
-  protected void writeTelemetry(JsonWriter json) {
-    json.name("Statistics");
-    writeTelemetryData(json, telemetry.load());
-  }
+public interface SystemInfoWriter {
+  void write(JsonWriter json) throws Exception;
 }
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SystemInfoWriterModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SystemInfoWriterModule.java
new file mode 100644 (file)
index 0000000..1da4de9
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.process.systeminfo.JvmPropertiesSection;
+import org.sonar.process.systeminfo.JvmStateSection;
+import org.sonar.server.platform.WebServer;
+import org.sonar.server.platform.monitoring.DbConnectionSection;
+import org.sonar.server.platform.monitoring.DbSection;
+import org.sonar.server.platform.monitoring.EsIndexesSection;
+import org.sonar.server.platform.monitoring.EsStateSection;
+import org.sonar.server.platform.monitoring.LoggingSection;
+import org.sonar.server.platform.monitoring.PluginsSection;
+import org.sonar.server.platform.monitoring.SettingsSection;
+import org.sonar.server.platform.monitoring.StandaloneSystemSection;
+import org.sonar.server.platform.monitoring.cluster.AppNodesInfoLoaderImpl;
+import org.sonar.server.platform.monitoring.cluster.CeQueueGlobalSection;
+import org.sonar.server.platform.monitoring.cluster.EsClusterStateSection;
+import org.sonar.server.platform.monitoring.cluster.GlobalInfoLoader;
+import org.sonar.server.platform.monitoring.cluster.GlobalSystemSection;
+import org.sonar.server.platform.monitoring.cluster.NodeSystemSection;
+import org.sonar.server.platform.monitoring.cluster.ProcessInfoProvider;
+import org.sonar.server.platform.monitoring.cluster.SearchNodesInfoLoaderImpl;
+
+public class SystemInfoWriterModule extends Module {
+  private final WebServer webServer;
+
+  public SystemInfoWriterModule(WebServer webServer) {
+    this.webServer = webServer;
+  }
+
+  @Override
+  protected void configureModule() {
+    boolean standalone = webServer.isStandalone();
+
+    add(
+      new JvmPropertiesSection("Web JVM Properties"),
+      new JvmStateSection("Web JVM State"),
+      DbSection.class,
+      DbConnectionSection.class,
+      EsIndexesSection.class,
+      LoggingSection.class,
+      PluginsSection.class,
+      SettingsSection.class
+
+      );
+    if (standalone) {
+      add(
+        EsStateSection.class,
+        StandaloneSystemSection.class,
+        StandaloneSystemInfoWriter.class
+
+      );
+    } else {
+      add(
+        CeQueueGlobalSection.class,
+        EsClusterStateSection.class,
+        GlobalSystemSection.class,
+        NodeSystemSection.class,
+
+        ProcessInfoProvider.class,
+        GlobalInfoLoader.class,
+        AppNodesInfoLoaderImpl.class,
+        SearchNodesInfoLoaderImpl.class,
+        ClusterSystemInfoWriter.class
+
+      );
+    }
+  }
+
+}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SystemWsModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/SystemWsModule.java
new file mode 100644 (file)
index 0000000..38b377b
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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;
+
+public class SystemWsModule extends Module {
+
+  @Override
+  protected void configureModule() {
+    add(
+      ChangeLogLevelAction.class,
+      DbMigrationStatusAction.class,
+      HealthActionSupport.class,
+      HealthAction.class,
+      InfoAction.class,
+      LogsAction.class,
+      MigrateDbAction.class,
+      PingAction.class,
+      RestartAction.class,
+      StatusAction.class,
+      UpgradesAction.class,
+      SystemWs.class
+
+    );
+  }
+}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/WebSystemInfoModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/WebSystemInfoModule.java
deleted file mode 100644 (file)
index 276b14b..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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.api.config.Configuration;
-import org.sonar.core.platform.Module;
-import org.sonar.process.systeminfo.JvmPropertiesSection;
-import org.sonar.process.systeminfo.JvmStateSection;
-import org.sonar.server.platform.WebServer;
-import org.sonar.server.platform.monitoring.DbConnectionSection;
-import org.sonar.server.platform.monitoring.DbSection;
-import org.sonar.server.platform.monitoring.EsIndexesSection;
-import org.sonar.server.platform.monitoring.EsStateSection;
-import org.sonar.server.platform.monitoring.LoggingSection;
-import org.sonar.server.platform.monitoring.PluginsSection;
-import org.sonar.server.platform.monitoring.SettingsSection;
-import org.sonar.server.platform.monitoring.StandaloneSystemSection;
-import org.sonar.server.platform.monitoring.cluster.AppNodesInfoLoaderImpl;
-import org.sonar.server.platform.monitoring.cluster.CeQueueGlobalSection;
-import org.sonar.server.platform.monitoring.cluster.EsClusterStateSection;
-import org.sonar.server.platform.monitoring.cluster.GlobalInfoLoader;
-import org.sonar.server.platform.monitoring.cluster.GlobalSystemSection;
-import org.sonar.server.platform.monitoring.cluster.NodeSystemSection;
-import org.sonar.server.platform.monitoring.cluster.ProcessInfoProvider;
-import org.sonar.server.platform.monitoring.cluster.SearchNodesInfoLoaderImpl;
-
-public class WebSystemInfoModule extends Module {
-  private final WebServer webServer;
-
-  public WebSystemInfoModule(WebServer webServer) {
-    this.webServer = webServer;
-  }
-
-  @Override
-  protected void configureModule() {
-    boolean standalone = webServer.isStandalone();
-
-    add(
-      new JvmPropertiesSection("Web JVM Properties"),
-      new JvmStateSection("Web JVM State"),
-      DbSection.class,
-      DbConnectionSection.class,
-      EsIndexesSection.class,
-      LoggingSection.class,
-      PluginsSection.class,
-      SettingsSection.class,
-      InfoAction.class
-
-      );
-    if (standalone) {
-      add(
-        EsStateSection.class,
-        StandaloneSystemSection.class,
-        StandaloneSystemInfoWriter.class
-
-      );
-    } else {
-      add(
-        CeQueueGlobalSection.class,
-        EsClusterStateSection.class,
-        GlobalSystemSection.class,
-        NodeSystemSection.class,
-
-        ProcessInfoProvider.class,
-        GlobalInfoLoader.class,
-        AppNodesInfoLoaderImpl.class,
-        SearchNodesInfoLoaderImpl.class,
-        ClusterSystemInfoWriter.class
-
-      );
-    }
-  }
-
-}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelActionModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelActionModuleTest.java
deleted file mode 100644 (file)
index d69daf0..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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 java.util.Collection;
-import org.junit.Test;
-import org.picocontainer.ComponentAdapter;
-import org.sonar.core.platform.ComponentContainer;
-import org.sonar.server.platform.WebServer;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
-
-public class ChangeLogLevelActionModuleTest {
-  private WebServer webServer = mock(WebServer.class);
-  private ChangeLogLevelActionModule underTest = new ChangeLogLevelActionModule(webServer);
-
-  @Test
-  public void provide_returns_ChangeLogLevelClusterService_if_cluster_not_on_SonarCloud() {
-    when(webServer.isStandalone()).thenReturn(false);
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
-    assertThat(adapters)
-      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 2)
-      .extracting(ComponentAdapter::getComponentKey)
-      .contains(ChangeLogLevelClusterService.class, ChangeLogLevelAction.class)
-      .doesNotContain(ChangeLogLevelStandaloneService.class);
-  }
-
-  @Test
-  public void provide_returns_ChangeLogLevelStandaloneService_if_SQ_standalone() {
-    when(webServer.isStandalone()).thenReturn(true);
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    verifyInStandaloneSQ(container);
-  }
-
-  private void verifyInStandaloneSQ(ComponentContainer container) {
-    Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
-    assertThat(adapters)
-      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 2)
-      .extracting(ComponentAdapter::getComponentKey)
-      .contains(ChangeLogLevelStandaloneService.class, ChangeLogLevelAction.class)
-      .doesNotContain(ChangeLogLevelClusterService.class);
-  }
-
-}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelServiceModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/ChangeLogLevelServiceModuleTest.java
new file mode 100644 (file)
index 0000000..9a964e5
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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 java.util.Collection;
+import org.junit.Test;
+import org.picocontainer.ComponentAdapter;
+import org.sonar.core.platform.ComponentContainer;
+import org.sonar.server.platform.WebServer;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
+
+public class ChangeLogLevelServiceModuleTest {
+  private WebServer webServer = mock(WebServer.class);
+  private ChangeLogLevelServiceModule underTest = new ChangeLogLevelServiceModule(webServer);
+
+  @Test
+  public void provide_returns_ChangeLogLevelClusterService_if_cluster_not_on_SonarCloud() {
+    when(webServer.isStandalone()).thenReturn(false);
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
+    assertThat(adapters)
+      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 1)
+      .extracting(ComponentAdapter::getComponentKey)
+      .contains(ChangeLogLevelClusterService.class)
+      .doesNotContain(ChangeLogLevelStandaloneService.class);
+  }
+
+  @Test
+  public void provide_returns_ChangeLogLevelStandaloneService_if_SQ_standalone() {
+    when(webServer.isStandalone()).thenReturn(true);
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    verifyInStandaloneSQ(container);
+  }
+
+  private void verifyInStandaloneSQ(ComponentContainer container) {
+    Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
+    assertThat(adapters)
+      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 1)
+      .extracting(ComponentAdapter::getComponentKey)
+      .contains(ChangeLogLevelStandaloneService.class)
+      .doesNotContain(ChangeLogLevelClusterService.class);
+  }
+
+}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthActionModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthActionModuleTest.java
deleted file mode 100644 (file)
index f628ad9..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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 java.util.Collection;
-import java.util.List;
-import java.util.Random;
-import java.util.stream.Collectors;
-import org.junit.Test;
-import org.picocontainer.ComponentAdapter;
-import org.sonar.core.platform.ComponentContainer;
-import org.sonar.server.health.AppNodeClusterCheck;
-import org.sonar.server.health.CeStatusNodeCheck;
-import org.sonar.server.health.ClusterHealthCheck;
-import org.sonar.server.health.DbConnectionNodeCheck;
-import org.sonar.server.health.EsStatusClusterCheck;
-import org.sonar.server.health.EsStatusNodeCheck;
-import org.sonar.server.health.HealthCheckerImpl;
-import org.sonar.server.health.NodeHealthCheck;
-import org.sonar.server.health.WebServerStatusNodeCheck;
-import org.sonar.server.platform.WebServer;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class HealthActionModuleTest {
-  private WebServer webServer = mock(WebServer.class);
-  private HealthActionModule underTest = new HealthActionModule(webServer);
-
-  @Test
-  public void verify_action_and_HealthChecker() {
-    boolean standalone = new Random().nextBoolean();
-    when(webServer.isStandalone()).thenReturn(standalone);
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    assertThat(classesAddedToContainer(container))
-      .describedAs("Verifying action and HealthChecker with standalone=%s", standalone)
-      .contains(HealthCheckerImpl.class)
-      .contains(HealthActionSupport.class)
-      .contains(HealthAction.class)
-      .doesNotContain(SafeModeHealthAction.class);
-  }
-
-  @Test
-  public void verify_installed_NodeHealthChecks_implementations_when_standalone() {
-    when(webServer.isStandalone()).thenReturn(true);
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    List<Class<?>> checks = classesAddedToContainer(container).stream().filter(NodeHealthCheck.class::isAssignableFrom).collect(Collectors.toList());
-    assertThat(checks)
-      .hasSize(4)
-      .contains(WebServerStatusNodeCheck.class)
-      .contains(DbConnectionNodeCheck.class)
-      .contains(EsStatusNodeCheck.class)
-      .contains(CeStatusNodeCheck.class);
-  }
-
-  @Test
-  public void verify_installed_NodeHealthChecks_implementations_when_clustered() {
-    when(webServer.isStandalone()).thenReturn(false);
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    List<Class<?>> checks = classesAddedToContainer(container).stream().filter(NodeHealthCheck.class::isAssignableFrom).collect(Collectors.toList());
-    assertThat(checks)
-      .hasSize(3)
-      .contains(WebServerStatusNodeCheck.class)
-      .contains(DbConnectionNodeCheck.class)
-      .contains(CeStatusNodeCheck.class)
-      .doesNotContain(EsStatusNodeCheck.class);
-  }
-
-  @Test
-  public void verify_installed_ClusterHealthChecks_implementations_in_standalone() {
-    when(webServer.isStandalone()).thenReturn(true);
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    List<Class<?>> checks = classesAddedToContainer(container).stream().filter(ClusterHealthCheck.class::isAssignableFrom).collect(Collectors.toList());
-    assertThat(checks).isEmpty();
-  }
-
-  @Test
-  public void verify_installed_ClusterHealthChecks_implementations_in_clustering() {
-    when(webServer.isStandalone()).thenReturn(false);
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    List<Class<?>> checks = classesAddedToContainer(container).stream().filter(ClusterHealthCheck.class::isAssignableFrom).collect(Collectors.toList());
-    assertThat(checks)
-      .hasSize(2)
-      .contains(EsStatusClusterCheck.class)
-      .contains(AppNodeClusterCheck.class);
-  }
-
-  private List<Class<?>> classesAddedToContainer(ComponentContainer container) {
-    Collection<ComponentAdapter<?>> componentAdapters = container.getPicoContainer().getComponentAdapters();
-    return componentAdapters.stream().map(ComponentAdapter::getComponentImplementation).collect(Collectors.toList());
-  }
-}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthCheckerModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthCheckerModuleTest.java
new file mode 100644 (file)
index 0000000..1819b59
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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 java.util.Collection;
+import java.util.List;
+import java.util.Random;
+import java.util.stream.Collectors;
+import org.junit.Test;
+import org.picocontainer.ComponentAdapter;
+import org.sonar.core.platform.ComponentContainer;
+import org.sonar.server.health.AppNodeClusterCheck;
+import org.sonar.server.health.CeStatusNodeCheck;
+import org.sonar.server.health.ClusterHealthCheck;
+import org.sonar.server.health.DbConnectionNodeCheck;
+import org.sonar.server.health.EsStatusClusterCheck;
+import org.sonar.server.health.EsStatusNodeCheck;
+import org.sonar.server.health.HealthCheckerImpl;
+import org.sonar.server.health.NodeHealthCheck;
+import org.sonar.server.health.WebServerStatusNodeCheck;
+import org.sonar.server.platform.WebServer;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class HealthCheckerModuleTest {
+  private WebServer webServer = mock(WebServer.class);
+  private HealthCheckerModule underTest = new HealthCheckerModule(webServer);
+
+  @Test
+  public void verify_HealthChecker() {
+    boolean standalone = new Random().nextBoolean();
+    when(webServer.isStandalone()).thenReturn(standalone);
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    assertThat(classesAddedToContainer(container))
+      .describedAs("Verifying action and HealthChecker with standalone=%s", standalone)
+      .contains(HealthCheckerImpl.class)
+      .doesNotContain(HealthActionSupport.class)
+      .doesNotContain(HealthAction.class)
+      .doesNotContain(SafeModeHealthAction.class);
+  }
+
+  @Test
+  public void verify_installed_NodeHealthChecks_implementations_when_standalone() {
+    when(webServer.isStandalone()).thenReturn(true);
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    List<Class<?>> checks = classesAddedToContainer(container).stream().filter(NodeHealthCheck.class::isAssignableFrom).collect(Collectors.toList());
+    assertThat(checks)
+      .hasSize(4)
+      .contains(WebServerStatusNodeCheck.class)
+      .contains(DbConnectionNodeCheck.class)
+      .contains(EsStatusNodeCheck.class)
+      .contains(CeStatusNodeCheck.class);
+  }
+
+  @Test
+  public void verify_installed_NodeHealthChecks_implementations_when_clustered() {
+    when(webServer.isStandalone()).thenReturn(false);
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    List<Class<?>> checks = classesAddedToContainer(container).stream().filter(NodeHealthCheck.class::isAssignableFrom).collect(Collectors.toList());
+    assertThat(checks)
+      .hasSize(3)
+      .contains(WebServerStatusNodeCheck.class)
+      .contains(DbConnectionNodeCheck.class)
+      .contains(CeStatusNodeCheck.class)
+      .doesNotContain(EsStatusNodeCheck.class);
+  }
+
+  @Test
+  public void verify_installed_ClusterHealthChecks_implementations_in_standalone() {
+    when(webServer.isStandalone()).thenReturn(true);
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    List<Class<?>> checks = classesAddedToContainer(container).stream().filter(ClusterHealthCheck.class::isAssignableFrom).collect(Collectors.toList());
+    assertThat(checks).isEmpty();
+  }
+
+  @Test
+  public void verify_installed_ClusterHealthChecks_implementations_in_clustering() {
+    when(webServer.isStandalone()).thenReturn(false);
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    List<Class<?>> checks = classesAddedToContainer(container).stream().filter(ClusterHealthCheck.class::isAssignableFrom).collect(Collectors.toList());
+    assertThat(checks)
+      .hasSize(2)
+      .contains(EsStatusClusterCheck.class)
+      .contains(AppNodeClusterCheck.class);
+  }
+
+  private List<Class<?>> classesAddedToContainer(ComponentContainer container) {
+    Collection<ComponentAdapter<?>> componentAdapters = container.getPicoContainer().getComponentAdapters();
+    return componentAdapters.stream().map(ComponentAdapter::getComponentImplementation).collect(Collectors.toList());
+  }
+}
index 8d63f470c4194c899a6e6bd64dd4e64a78a8d17c..b4d2eac3ed2957e4d622cd3278e818518402d4db 100644 (file)
@@ -38,7 +38,7 @@ public class InfoActionTest {
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
 
-  private SystemInfoWriter jsonWriter = new SystemInfoWriter(null) {
+  private SystemInfoWriter jsonWriter = new AbstractSystemInfoWriter(null) {
     @Override
     public void write(JsonWriter json) {
       json.prop("key", "value");
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SafeModeHealthActionModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SafeModeHealthActionModuleTest.java
deleted file mode 100644 (file)
index d328fac..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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 java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-import org.junit.Test;
-import org.picocontainer.ComponentAdapter;
-import org.sonar.core.platform.ComponentContainer;
-import org.sonar.server.health.DbConnectionNodeCheck;
-import org.sonar.server.health.EsStatusNodeCheck;
-import org.sonar.server.health.HealthCheckerImpl;
-import org.sonar.server.health.NodeHealthCheck;
-import org.sonar.server.health.WebServerSafemodeNodeCheck;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SafeModeHealthActionModuleTest {
-  private SafeModeHealthActionModule underTest = new SafeModeHealthActionModule();
-
-  @Test
-  public void verify_action_and_HealthChecker() {
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    assertThat(classesAddedToContainer(container))
-      .contains(HealthCheckerImpl.class)
-      .contains(HealthActionSupport.class)
-      .contains(SafeModeHealthAction.class)
-      .doesNotContain(HealthAction.class);
-  }
-
-  @Test
-  public void verify_installed_HealthChecks_implementations() {
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    List<Class<?>> checks = classesAddedToContainer(container).stream().filter(NodeHealthCheck.class::isAssignableFrom).collect(Collectors.toList());
-    assertThat(checks)
-      .hasSize(3)
-      .contains(WebServerSafemodeNodeCheck.class)
-      .contains(DbConnectionNodeCheck.class)
-      .contains(EsStatusNodeCheck.class);
-  }
-
-  private List<Class<?>> classesAddedToContainer(ComponentContainer container) {
-    Collection<ComponentAdapter<?>> componentAdapters = container.getPicoContainer().getComponentAdapters();
-    return componentAdapters.stream().map(ComponentAdapter::getComponentImplementation).collect(Collectors.toList());
-  }
-
-}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SafeModeHealthCheckerModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SafeModeHealthCheckerModuleTest.java
new file mode 100644 (file)
index 0000000..4506531
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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 java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.junit.Test;
+import org.picocontainer.ComponentAdapter;
+import org.sonar.core.platform.ComponentContainer;
+import org.sonar.server.health.DbConnectionNodeCheck;
+import org.sonar.server.health.EsStatusNodeCheck;
+import org.sonar.server.health.HealthCheckerImpl;
+import org.sonar.server.health.NodeHealthCheck;
+import org.sonar.server.health.WebServerSafemodeNodeCheck;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class SafeModeHealthCheckerModuleTest {
+  private SafeModeHealthCheckerModule underTest = new SafeModeHealthCheckerModule();
+
+  @Test
+  public void verify_HealthChecker() {
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    assertThat(classesAddedToContainer(container))
+      .contains(HealthCheckerImpl.class)
+      .doesNotContain(HealthActionSupport.class)
+      .doesNotContain(SafeModeHealthAction.class)
+      .doesNotContain(HealthAction.class);
+  }
+
+  @Test
+  public void verify_installed_HealthChecks_implementations() {
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    List<Class<?>> checks = classesAddedToContainer(container).stream().filter(NodeHealthCheck.class::isAssignableFrom).collect(Collectors.toList());
+    assertThat(checks)
+      .hasSize(3)
+      .contains(WebServerSafemodeNodeCheck.class)
+      .contains(DbConnectionNodeCheck.class)
+      .contains(EsStatusNodeCheck.class);
+  }
+
+  private List<Class<?>> classesAddedToContainer(ComponentContainer container) {
+    Collection<ComponentAdapter<?>> componentAdapters = container.getPicoContainer().getComponentAdapters();
+    return componentAdapters.stream().map(ComponentAdapter::getComponentImplementation).collect(Collectors.toList());
+  }
+
+}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SafemodeSystemWsModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SafemodeSystemWsModuleTest.java
new file mode 100644 (file)
index 0000000..066fe78
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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 SafemodeSystemWsModuleTest {
+  @Test
+  public void verify_count_of_added_components() {
+    ComponentContainer container = new ComponentContainer();
+    new SafemodeSystemWsModule().configure(container);
+    assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 6);
+  }
+
+}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SystemInfoWriterModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SystemInfoWriterModuleTest.java
new file mode 100644 (file)
index 0000000..664472e
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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 java.util.Collection;
+import org.junit.Test;
+import org.picocontainer.ComponentAdapter;
+import org.sonar.core.platform.ComponentContainer;
+import org.sonar.server.platform.WebServer;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
+
+public class SystemInfoWriterModuleTest {
+  private WebServer webServer = mock(WebServer.class);
+  private SystemInfoWriterModule underTest = new SystemInfoWriterModule(webServer);
+
+  @Test
+  public void verify_system_info_configuration_in_cluster_mode() {
+    when(webServer.isStandalone()).thenReturn(false);
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
+    assertThat(adapters)
+      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 17);
+  }
+
+  @Test
+  public void verify_system_info_configuration_in_standalone_mode() {
+    when(webServer.isStandalone()).thenReturn(true);
+    ComponentContainer container = new ComponentContainer();
+
+    underTest.configure(container);
+
+    verifyConfigurationStandaloneSQ(container);
+  }
+
+  public void verifyConfigurationStandaloneSQ(ComponentContainer container) {
+    Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
+    assertThat(adapters)
+      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 11);
+  }
+
+}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SystemWsModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/SystemWsModuleTest.java
new file mode 100644 (file)
index 0000000..855c2ad
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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 SystemWsModuleTest {
+  @Test
+  public void verify_count_of_added_components() {
+    ComponentContainer container = new ComponentContainer();
+    new SystemWsModule().configure(container);
+    assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 12);
+  }
+
+
+}
index 733c12cae028617f820a4c24c5473f5fe5d045b4..de93a9d8d1e2239bc8edf01b4f2b87d565164210 100644 (file)
@@ -36,7 +36,7 @@ public class SystemWsTest {
   public void define() {
     RestartAction action1 = new RestartAction(mock(UserSession.class), mock(ProcessCommandWrapper.class),
       mock(RestartFlagHolder.class), mock(WebServer.class));
-    InfoAction action2 = new InfoAction(new AnonymousMockUserSession(), mock(SystemInfoWriter.class));
+    InfoAction action2 = new InfoAction(new AnonymousMockUserSession(), mock(AbstractSystemInfoWriter.class));
     SystemWs ws = new SystemWs(action1, action2);
     WebService.Context context = new WebService.Context();
 
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/WebSystemInfoModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/WebSystemInfoModuleTest.java
deleted file mode 100644 (file)
index fb6485a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 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 java.util.Collection;
-import org.junit.Test;
-import org.picocontainer.ComponentAdapter;
-import org.sonar.core.platform.ComponentContainer;
-import org.sonar.server.platform.WebServer;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
-
-public class WebSystemInfoModuleTest {
-  private WebServer webServer = mock(WebServer.class);
-  private WebSystemInfoModule underTest = new WebSystemInfoModule(webServer);
-
-  @Test
-  public void verify_system_info_configuration_in_cluster_mode() {
-    when(webServer.isStandalone()).thenReturn(false);
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
-    assertThat(adapters)
-      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 18);
-  }
-
-  @Test
-  public void verify_system_info_configuration_in_standalone_mode() {
-    when(webServer.isStandalone()).thenReturn(true);
-    ComponentContainer container = new ComponentContainer();
-
-    underTest.configure(container);
-
-    verifyConfigurationStandaloneSQ(container);
-  }
-
-  public void verifyConfigurationStandaloneSQ(ComponentContainer container) {
-    Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
-    assertThat(adapters)
-      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 12);
-  }
-
-}
index b72635af2a9e5994e9ccdf974e20bdc22694684e..c367e84d7111ee01d2692e11fd7b225399707e04 100644 (file)
@@ -120,19 +120,12 @@ import org.sonar.server.platform.web.DeprecatedPropertiesWsFilter;
 import org.sonar.server.platform.web.WebServiceFilter;
 import org.sonar.server.platform.web.WebServiceReroutingFilter;
 import org.sonar.server.platform.web.requestid.HttpRequestIdModule;
-import org.sonar.server.platform.ws.ChangeLogLevelActionModule;
-import org.sonar.server.platform.ws.DbMigrationStatusAction;
-import org.sonar.server.platform.ws.HealthActionModule;
+import org.sonar.server.platform.ws.ChangeLogLevelServiceModule;
+import org.sonar.server.platform.ws.HealthCheckerModule;
 import org.sonar.server.platform.ws.L10nWs;
-import org.sonar.server.platform.ws.LogsAction;
-import org.sonar.server.platform.ws.MigrateDbAction;
-import org.sonar.server.platform.ws.PingAction;
-import org.sonar.server.platform.ws.RestartAction;
 import org.sonar.server.platform.ws.ServerWs;
-import org.sonar.server.platform.ws.StatusAction;
-import org.sonar.server.platform.ws.SystemWs;
-import org.sonar.server.platform.ws.UpgradesAction;
-import org.sonar.server.platform.ws.WebSystemInfoModule;
+import org.sonar.server.platform.ws.SystemWsModule;
+import org.sonar.server.platform.ws.SystemInfoWriterModule;
 import org.sonar.server.plugins.PluginDownloader;
 import org.sonar.server.plugins.PluginUninstaller;
 import org.sonar.server.plugins.ServerExtensionInstaller;
@@ -469,16 +462,9 @@ public class PlatformLevel4 extends PlatformLevel {
 
       // System
       ServerLogging.class,
-      RestartAction.class,
-      PingAction.class,
-      UpgradesAction.class,
-      StatusAction.class,
-      MigrateDbAction.class,
-      LogsAction.class,
-      ChangeLogLevelActionModule.class,
-      DbMigrationStatusAction.class,
-      HealthActionModule.class,
-      SystemWs.class,
+      ChangeLogLevelServiceModule.class,
+      HealthCheckerModule.class,
+      SystemWsModule.class,
 
       // Plugins WS
       PluginUpdateAggregator.class,
@@ -537,7 +523,7 @@ public class PlatformLevel4 extends PlatformLevel {
     );
 
     // system info
-    add(WebSystemInfoModule.class);
+    add(SystemInfoWriterModule.class);
 
     addAll(level4AddedComponents);
   }
index 81c6adf532e6ac854a945f54f379edb797775a28..6eacf03ff4db8441ab68f49b95c99cb17b8a5899 100644 (file)
@@ -27,13 +27,10 @@ import org.sonar.server.platform.db.migration.DatabaseMigrationImpl;
 import org.sonar.server.platform.db.migration.MigrationEngineModule;
 import org.sonar.server.platform.db.migration.NoopDatabaseMigrationImpl;
 import org.sonar.server.platform.web.WebServiceFilter;
-import org.sonar.server.platform.ws.DbMigrationStatusAction;
 import org.sonar.server.platform.ws.IndexAction;
 import org.sonar.server.platform.ws.L10nWs;
-import org.sonar.server.platform.ws.MigrateDbAction;
-import org.sonar.server.platform.ws.SafeModeHealthActionModule;
-import org.sonar.server.platform.ws.StatusAction;
-import org.sonar.server.platform.ws.SystemWs;
+import org.sonar.server.platform.ws.SafeModeHealthCheckerModule;
+import org.sonar.server.platform.ws.SafemodeSystemWsModule;
 import org.sonar.server.ws.WebServiceEngine;
 import org.sonar.server.ws.ws.WebServicesWsModule;
 
@@ -52,11 +49,8 @@ public class PlatformLevelSafeMode extends PlatformLevel {
       IndexAction.class,
 
       // Server WS
-      StatusAction.class,
-      MigrateDbAction.class,
-      DbMigrationStatusAction.class,
-      SafeModeHealthActionModule.class,
-      SystemWs.class,
+      SafeModeHealthCheckerModule.class,
+      SafemodeSystemWsModule.class,
 
       // Listing WS
       WebServicesWsModule.class,