aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-10-30 12:01:15 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-10-30 12:03:13 +0100
commitef3dfef25ecba3a84e18a614bdecd88352ea1585 (patch)
tree8db67b0cca9412f50e1f253275561eb1eb4c8383
parent5d9040a4ede3d3a47a8d55d9b331c3a72bb10125 (diff)
downloadsonarqube-ef3dfef25ecba3a84e18a614bdecd88352ea1585.tar.gz
sonarqube-ef3dfef25ecba3a84e18a614bdecd88352ea1585.zip
SONAR-5347 Preview mode should use the new WS /api/sources/raw
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/LastSnapshots.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/LastSnapshotsTest.java6
2 files changed, 4 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/LastSnapshots.java b/sonar-batch/src/main/java/org/sonar/batch/scan/LastSnapshots.java
index 9f04b206fb3..8a5d2bf2ee7 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/LastSnapshots.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/LastSnapshots.java
@@ -63,7 +63,7 @@ public class LastSnapshots implements BatchComponent {
TimeProfiler profiler = new TimeProfiler(LOG).start("Load previous source code of: " + resource.getEffectiveKey()).setLevelToDebug();
try {
return server
- .request("/api/sources?resource=" + ServerClient.encodeForUrl(resource.getEffectiveKey()) + "&format=txt", "GET", false, analysisMode.getPreviewReadTimeoutSec() * 1000);
+ .request("/api/sources/raw?key=" + ServerClient.encodeForUrl(resource.getEffectiveKey()), "GET", false, analysisMode.getPreviewReadTimeoutSec() * 1000);
} catch (HttpDownloader.HttpException he) {
if (he.getResponseCode() == 404) {
return "";
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/LastSnapshotsTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/LastSnapshotsTest.java
index 66acae88fa3..719ae5c1775 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/LastSnapshotsTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/LastSnapshotsTest.java
@@ -91,7 +91,7 @@ public class LastSnapshotsTest {
String source = lastSnapshots.getSource(newFile());
assertThat(source).isEqualTo("downloaded source of Bar.c");
- verify(server).request("/api/sources?resource=myproject%3Aorg%2Ffoo%2FBar.c&format=txt", "GET", false, 30 * 1000);
+ verify(server).request("/api/sources/raw?key=myproject%3Aorg%2Ffoo%2FBar.c", "GET", false, 30 * 1000);
}
@Test
@@ -105,7 +105,7 @@ public class LastSnapshotsTest {
String source = lastSnapshots.getSource(newFile());
assertThat(source).isEqualTo("downloaded source of Foo Bar.c");
- verify(server).request("/api/sources?resource=myproject%3Aorg%2Ffoo%2FBar.c&format=txt", "GET", false, 30 * 1000);
+ verify(server).request("/api/sources/raw?key=myproject%3Aorg%2Ffoo%2FBar.c", "GET", false, 30 * 1000);
}
@Test
@@ -132,7 +132,7 @@ public class LastSnapshotsTest {
String source = lastSnapshots.getSource(newFileWithSpace());
assertThat(source).isEqualTo("");
- verify(server).request("/api/sources?resource=myproject%3Aorg%2Ffoo%2FFoo+Bar.c&format=txt", "GET", false, 30 * 1000);
+ verify(server).request("/api/sources/raw?key=myproject%3Aorg%2Ffoo%2FFoo+Bar.c", "GET", false, 30 * 1000);
}
@Test