aboutsummaryrefslogtreecommitdiffstats
path: root/tests/upgrade
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-01-17 12:19:23 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-01-18 15:23:40 +0100
commit5690b112fccf1b3498ed457535cff629609269a2 (patch)
tree227b350c6c042ed72df1183f680237527760e6a8 /tests/upgrade
parent013a9aa964e25e0c70bec60eaa4484d5c7e8683f (diff)
downloadsonarqube-5690b112fccf1b3498ed457535cff629609269a2.tar.gz
sonarqube-5690b112fccf1b3498ed457535cff629609269a2.zip
SONAR-8574 Replace usage of api/resources/index by api/measures/component in ITs
Diffstat (limited to 'tests/upgrade')
-rw-r--r--tests/upgrade/pom.xml6
-rw-r--r--tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java11
2 files changed, 13 insertions, 4 deletions
diff --git a/tests/upgrade/pom.xml b/tests/upgrade/pom.xml
index 59086bf5f6d..eddab9a40ae 100644
--- a/tests/upgrade/pom.xml
+++ b/tests/upgrade/pom.xml
@@ -18,9 +18,9 @@
<dependencies>
<dependency>
- <groupId>org.codehaus.sonar</groupId>
- <artifactId>sonar-ws-client</artifactId>
- <version>5.1</version>
+ <groupId>org.sonarsource.sonarqube</groupId>
+ <artifactId>sonar-ws</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java b/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java
index bad5a01d7f7..480846415f3 100644
--- a/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java
+++ b/tests/upgrade/src/test/java/org/sonarsource/sonarqube/upgrade/UpgradeTest.java
@@ -32,18 +32,22 @@ import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Arrays;
+import java.util.Collections;
import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.Test;
import org.sonar.wsclient.services.ResourceQuery;
+import org.sonarqube.ws.WsMeasures.Measure;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.HttpConnector;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.WsClientFactories;
import org.sonarqube.ws.client.WsResponse;
+import org.sonarqube.ws.client.measure.ComponentWsRequest;
import static com.codeborne.selenide.Condition.hasText;
import static com.codeborne.selenide.Selenide.$;
+import static java.lang.Integer.parseInt;
import static org.assertj.core.api.Assertions.assertThat;
public class UpgradeTest {
@@ -129,7 +133,7 @@ public class UpgradeTest {
checkUrlIsReturningOk("/api/system/db_migration_status");
checkUrlIsReturningOk("/api/webservices/list");
// TODO Reactivate when latest Sonarqube version will be in repox
-// checkUrlIsReturningOkOnlyForDevVersion("/api/l10n/index", sqVersion);
+ // checkUrlIsReturningOkOnlyForDevVersion("/api/l10n/index", sqVersion);
// These urls should not be available when system requires a migration
checkUrlIsReturningNotFound("/api/issues/search?projectKeys=org.apache.struts%3Astruts-core");
@@ -212,6 +216,11 @@ public class UpgradeTest {
}
private int countFiles(String key) {
+ if (orchestrator.getConfiguration().getSonarVersion().isGreaterThanOrEquals("5.4")) {
+ Measure measure = newWsClient(orchestrator).measures().component(new ComponentWsRequest().setComponentKey(key).setMetricKeys(Collections.singletonList("files")))
+ .getComponent().getMeasures(0);
+ return parseInt(measure.getValue());
+ }
return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(key, "files")).getMeasureIntValue("files");
}