From ef3dfef25ecba3a84e18a614bdecd88352ea1585 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 30 Oct 2014 12:01:15 +0100 Subject: [PATCH] SONAR-5347 Preview mode should use the new WS /api/sources/raw --- .../src/main/java/org/sonar/batch/scan/LastSnapshots.java | 2 +- .../test/java/org/sonar/batch/scan/LastSnapshotsTest.java | 6 +++--- 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 -- 2.39.5