aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
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 /sonar-ws
parent1c95f883c3ffee922a56ad3431e2b07a2378488e (diff)
downloadsonarqube-af99398a59677d6a1d8d94fbf3529327ac891ef2.tar.gz
sonarqube-af99398a59677d6a1d8d94fbf3529327ac891ef2.zip
SONAR-9739 add integration test for WS api/system/health
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java6
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java13
2 files changed, 18 insertions, 1 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java
index 4072b5c1234..ef31bfaed45 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java
@@ -19,7 +19,9 @@
*/
package org.sonarqube.ws.client.system;
+import org.sonarqube.ws.WsSystem;
import org.sonarqube.ws.client.BaseService;
+import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
@@ -28,6 +30,10 @@ public class SystemService extends BaseService {
super(wsConnector, "api/system");
}
+ public WsSystem.HealthResponse health() {
+ return call(new GetRequest(path("health")), WsSystem.HealthResponse.parser());
+ }
+
public void restart() {
call(new PostRequest(path("restart")));
}
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java
index 42c93c38f9d..d9fe6011c4f 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java
@@ -21,6 +21,7 @@ package org.sonarqube.ws.client.system;
import org.junit.Rule;
import org.junit.Test;
+import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.ServiceTester;
import org.sonarqube.ws.client.WsConnector;
@@ -35,7 +36,17 @@ public class SystemServiceTest {
private SystemService underTest = serviceTester.getInstanceUnderTest();
@Test
- public void testName() throws Exception {
+ public void test_health() throws Exception {
+ underTest.health();
+
+ GetRequest getRequest = serviceTester.getGetRequest();
+ serviceTester.assertThat(getRequest)
+ .hasPath("health")
+ .andNoOtherParam();
+ }
+
+ @Test
+ public void test_restart() throws Exception {
underTest.restart();
PostRequest postRequest = serviceTester.getPostRequest();