From af99398a59677d6a1d8d94fbf3529327ac891ef2 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 28 Aug 2017 17:13:21 +0200 Subject: SONAR-9739 add integration test for WS api/system/health --- .../src/main/java/ServerStartupLock.java | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'tests/plugins/server-plugin') diff --git a/tests/plugins/server-plugin/src/main/java/ServerStartupLock.java b/tests/plugins/server-plugin/src/main/java/ServerStartupLock.java index 85aaef2213d..f7c4d7e6863 100644 --- a/tests/plugins/server-plugin/src/main/java/ServerStartupLock.java +++ b/tests/plugins/server-plugin/src/main/java/ServerStartupLock.java @@ -20,25 +20,31 @@ import java.io.File; import java.util.Optional; +import org.sonar.api.SonarRuntime; import org.sonar.api.Startable; +import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.config.Configuration; import org.sonar.api.server.ServerSide; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; @ServerSide +@ComputeEngineSide public class ServerStartupLock implements Startable { - private final Configuration configuration; private static final Logger LOGGER = Loggers.get(ServerStartupLock.class); - public ServerStartupLock(Configuration configuration) { + private final Configuration configuration; + private final SonarRuntime runtime; + + public ServerStartupLock(Configuration configuration, SonarRuntime runtime) { this.configuration = configuration; + this.runtime = runtime; } @Override public void start() { - Optional path = configuration.get("sonar.test.serverStartupLock.path"); + Optional path = configuration.get(propertyKey()); if (path.isPresent()) { File lock = new File(path.get()); try { @@ -58,4 +64,15 @@ public class ServerStartupLock implements Startable { public void stop() { // nothing to do } + + private String propertyKey() { + switch (runtime.getSonarQubeSide()) { + case SERVER: + return "sonar.web.startupLock.path"; + case COMPUTE_ENGINE: + return "sonar.ce.startupLock.path"; + default: + throw new IllegalArgumentException("Unsupported runtime: " + runtime.getSonarQubeSide()); + } + } } -- cgit v1.2.3