aboutsummaryrefslogtreecommitdiffstats
path: root/tests/plugins/server-plugin/src/main/java
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-08-28 17:13:21 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-09-13 15:50:48 +0200
commitaf99398a59677d6a1d8d94fbf3529327ac891ef2 (patch)
treecac6be4448105a3daee6f8c062b839cce0f85d89 /tests/plugins/server-plugin/src/main/java
parent1c95f883c3ffee922a56ad3431e2b07a2378488e (diff)
downloadsonarqube-af99398a59677d6a1d8d94fbf3529327ac891ef2.tar.gz
sonarqube-af99398a59677d6a1d8d94fbf3529327ac891ef2.zip
SONAR-9739 add integration test for WS api/system/health
Diffstat (limited to 'tests/plugins/server-plugin/src/main/java')
-rw-r--r--tests/plugins/server-plugin/src/main/java/ServerStartupLock.java23
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());
+ }
+ }
}