diff options
author | Daniel Schwarz <daniel.schwarz@sonarsource.com> | 2017-09-18 13:28:57 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-09-26 23:49:38 +0200 |
commit | 257d4d9b268cdd2e517d75c42f2eee83a80cfdd1 (patch) | |
tree | 8d8bd0379d6b1b13ff9d6c6538a357bd1a7874a6 /sonar-ws | |
parent | 50a29c569f8448a939877de1918ab3ff937366b8 (diff) | |
download | sonarqube-257d4d9b268cdd2e517d75c42f2eee83a80cfdd1.tar.gz sonarqube-257d4d9b268cdd2e517d75c42f2eee83a80cfdd1.zip |
SONAR-9802 allow to change the log level of a cluster
Diffstat (limited to 'sonar-ws')
-rw-r--r-- | sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java | 9 | ||||
-rw-r--r-- | sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java | 21 |
2 files changed, 30 insertions, 0 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 cb8c55aec61..916072d2157 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 @@ -24,6 +24,7 @@ import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsConnector; +import org.sonarqube.ws.client.WsResponse; public class SystemService extends BaseService { public SystemService(WsConnector wsConnector) { @@ -41,4 +42,12 @@ public class SystemService extends BaseService { public WsSystem.StatusResponse status() { return call(new GetRequest(path("status")), WsSystem.StatusResponse.parser()); } + + public void changeLogLevel(String level) { + call(new PostRequest(path("change_log_level")).setParam("level", level)); + } + + public WsResponse info() { + return call(new GetRequest(path("info"))); + } } 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 a473bda635e..145642a5278 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 @@ -64,4 +64,25 @@ public class SystemServiceTest { .hasPath("restart") .andNoOtherParam(); } + + @Test + public void test_changeLogLevel() throws Exception { + underTest.changeLogLevel("TRACE"); + + PostRequest postRequest = serviceTester.getPostRequest(); + serviceTester.assertThat(postRequest) + .hasPath("change_log_level") + .hasParam("level", "TRACE") + .andNoOtherParam(); + } + + @Test + public void test_info() throws Exception { + underTest.info(); + + GetRequest getRequest = serviceTester.getGetRequest(); + serviceTester.assertThat(getRequest) + .hasPath("info") + .andNoOtherParam(); + } } |