aboutsummaryrefslogtreecommitdiffstats
path: root/it/it-tests
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-12-14 10:47:50 +0100
committerGitHub <noreply@github.com>2016-12-14 10:47:50 +0100
commit10ae35e46bd3deeb5a4d974b31ca606108bc2f50 (patch)
tree42752db13e54edc71bbf89b6a47e19580c71faa3 /it/it-tests
parent90a1e2480844aa318112e22d66aaef1bb445b088 (diff)
downloadsonarqube-10ae35e46bd3deeb5a4d974b31ca606108bc2f50.tar.gz
sonarqube-10ae35e46bd3deeb5a4d974b31ca606108bc2f50.zip
SONAR-8535 SONAR-7304 sanitize WS api/server/*
- SONAR-8535 drop api/server/index - SONAR-8535 drop api/server/setup - SONAR-7304 refactor api/server/version in Java Signed-off-by: Simon Brandhof <simon.brandhof@sonarsource.com>
Diffstat (limited to 'it/it-tests')
-rw-r--r--it/it-tests/src/test/java/it/serverSystem/ServerSystemRestartingOrchestrator.java11
-rw-r--r--it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java19
2 files changed, 20 insertions, 10 deletions
diff --git a/it/it-tests/src/test/java/it/serverSystem/ServerSystemRestartingOrchestrator.java b/it/it-tests/src/test/java/it/serverSystem/ServerSystemRestartingOrchestrator.java
index 8161521a34b..090d38fadd8 100644
--- a/it/it-tests/src/test/java/it/serverSystem/ServerSystemRestartingOrchestrator.java
+++ b/it/it-tests/src/test/java/it/serverSystem/ServerSystemRestartingOrchestrator.java
@@ -22,17 +22,19 @@ package it.serverSystem;
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.locator.FileLocation;
import java.io.File;
+import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.sonar.wsclient.services.Server;
-import org.sonar.wsclient.services.ServerQuery;
+import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.WsResponse;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
+import static util.ItUtils.newWsClient;
/**
* This class start a new orchestrator on each test case
@@ -77,8 +79,9 @@ public class ServerSystemRestartingOrchestrator {
.build();
orchestrator.start();
- Server.Status status = orchestrator.getServer().getAdminWsClient().find(new ServerQuery()).getStatus();
- assertThat(status).isEqualTo(Server.Status.UP);
+ WsResponse statusResponse = newWsClient(orchestrator).wsConnector().call(new GetRequest("api/system/status"));
+ Map<String, Object> json = ItUtils.jsonToMap(statusResponse.content());
+ assertThat(json.get("status")).isEqualTo("UP");
}
// SONAR-4748
diff --git a/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java b/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java
index 1cd6ca181a4..e4f08d62afc 100644
--- a/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java
+++ b/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java
@@ -28,13 +28,10 @@ import java.util.Map;
import okhttp3.Response;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
import org.json.simple.JSONValue;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
-import org.sonar.wsclient.services.Server;
-import org.sonar.wsclient.services.ServerQuery;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.ServerId.ShowWsResponse;
import org.sonarqube.ws.client.GetRequest;
@@ -44,10 +41,12 @@ import pageobjects.Navigation;
import pageobjects.ServerIdPage;
import util.ItUtils;
+import static org.apache.commons.lang.StringUtils.startsWithAny;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
import static util.ItUtils.call;
import static util.ItUtils.newAdminWsClient;
+import static util.ItUtils.newWsClient;
import static util.selenium.Selenese.runSelenese;
public class ServerSystemTest {
@@ -62,15 +61,18 @@ public class ServerSystemTest {
@Test
public void get_sonarqube_version() {
- String version = orchestrator.getServer().getWsClient().find(new ServerQuery()).getVersion();
- if (!StringUtils.startsWithAny(version, new String[] {"5.", "6."})) {
+ Map<String, Object> json = callStatus();
+
+ String version = (String)json.get("version");
+ if (!startsWithAny(version, new String[] {"6."})) {
fail("Bad version: " + version);
}
}
@Test
public void get_server_status() {
- assertThat(orchestrator.getServer().getWsClient().find(new ServerQuery()).getStatus()).isEqualTo(Server.Status.UP);
+ Map<String, Object> json = callStatus();
+ assertThat(json.get("status")).isEqualTo("UP");
}
@Test
@@ -99,6 +101,11 @@ public class ServerSystemTest {
assertThat(serverId).isNotEmpty();
}
+ private Map<String, Object> callStatus() {
+ WsResponse statusResponse = newWsClient(orchestrator).wsConnector().call(new GetRequest("api/system/status"));
+ return ItUtils.jsonToMap(statusResponse.content());
+ }
+
@Test
public void display_system_info() {
runSelenese(orchestrator, "/serverSystem/ServerSystemTest/system_info.html");