diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-08-28 17:13:21 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-09-13 15:50:48 +0200 |
commit | af99398a59677d6a1d8d94fbf3529327ac891ef2 (patch) | |
tree | cac6be4448105a3daee6f8c062b839cce0f85d89 /tests/plugins | |
parent | 1c95f883c3ffee922a56ad3431e2b07a2378488e (diff) | |
download | sonarqube-af99398a59677d6a1d8d94fbf3529327ac891ef2.tar.gz sonarqube-af99398a59677d6a1d8d94fbf3529327ac891ef2.zip |
SONAR-9739 add integration test for WS api/system/health
Diffstat (limited to 'tests/plugins')
-rw-r--r-- | tests/plugins/server-plugin/src/main/java/ServerStartupLock.java | 23 |
1 files changed, 20 insertions, 3 deletions
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<String> path = configuration.get("sonar.test.serverStartupLock.path"); + Optional<String> 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()); + } + } } |