diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2017-08-24 17:27:14 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk@users.noreply.github.com> | 2017-08-30 16:24:53 +0200 |
commit | db428b662317a7c21b6dd9bde30aa69e58eb406b (patch) | |
tree | 743e7e802995fb455a52b032d82b6c57c1c5cd75 /tests | |
parent | 3a4c0545eec0a3cfe04bdd6466052d3a2a5f012a (diff) | |
download | sonarqube-db428b662317a7c21b6dd9bde30aa69e58eb406b.tar.gz sonarqube-db428b662317a7c21b6dd9bde30aa69e58eb406b.zip |
SONAR-9721 Send project measures statistics
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryTest.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryTest.java b/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryTest.java index 0521010d90a..87662e11ca6 100644 --- a/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryTest.java +++ b/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryTest.java @@ -20,6 +20,7 @@ package org.sonarqube.tests.telemetry; import com.sonar.orchestrator.Orchestrator; +import java.util.Map; import java.util.concurrent.TimeUnit; import javax.ws.rs.core.HttpHeaders; import okhttp3.mockwebserver.MockWebServer; @@ -30,6 +31,7 @@ import org.junit.Test; import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; import static org.assertj.core.api.Assertions.assertThat; +import static util.ItUtils.jsonToMap; import static util.ItUtils.xooPlugin; public class TelemetryTest { @@ -65,8 +67,14 @@ public class TelemetryTest { RecordedRequest request = server.takeRequest(1, TimeUnit.SECONDS); assertThat(request.getMethod()).isEqualTo("POST"); - assertThat(request.getBody().readUtf8()).contains(serverId); assertThat(request.getHeader(HttpHeaders.USER_AGENT)).contains("SonarQube"); + String body = request.getBody().readUtf8(); + System.out.println(body); + Map<String, Object> json = jsonToMap(body); + assertThat(json.get("id")).isEqualTo(serverId); + assertThat(json.get("ncloc")).isEqualTo(0.0d); + assertThat(json.get("lines")).isEqualTo(0.0d); + assertThat(((Map)json.get("plugins")).keySet()).contains("xoo"); orchestrator.stop(); } |