From 181170cd55d3f0bd930e895cc0871c20643ac91a Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Thu, 7 Dec 2017 11:54:37 +0100 Subject: [PATCH] SONAR-10168 Log downloading of plugins in debug --- .../sonar/scanner/bootstrap/ScannerPluginInstaller.java | 9 ++++----- .../java/org/sonarqube/tests/analysis/ScannerTest.java | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java index a37a98d3a79..046acc54cd0 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java @@ -67,7 +67,7 @@ public class ScannerPluginInstaller implements PluginInstaller { private Map loadPlugins(InstalledPlugin[] remotePlugins) { Map infosByKey = new HashMap<>(remotePlugins.length); - Profiler profiler = Profiler.create(LOG).startDebug("Load plugins"); + Profiler profiler = Profiler.create(LOG).startInfo("Load/download plugins"); for (InstalledPlugin installedPlugin : remotePlugins) { if (pluginPredicate.apply(installedPlugin.key)) { @@ -76,8 +76,7 @@ public class ScannerPluginInstaller implements PluginInstaller { infosByKey.put(info.getKey(), new ScannerPlugin(installedPlugin.key, installedPlugin.updatedAt, info)); } } - - profiler.stopDebug(); + profiler.stopInfo(); return infosByKey; } @@ -139,9 +138,9 @@ public class ScannerPluginInstaller implements PluginInstaller { public void download(String filename, File toFile) throws IOException { String url = format("/deploy/plugins/%s/%s", key, filename); if (LOG.isDebugEnabled()) { - LOG.debug("Download plugin {} to {}", filename, toFile); + LOG.debug("Download plugin '{}' to '{}'", filename, toFile); } else { - LOG.info("Download {}", filename); + LOG.debug("Download '{}'", filename); } WsResponse response = wsClient.call(new GetRequest(url)); diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java index 15b20555741..cd47342301b 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java @@ -254,13 +254,12 @@ public class ScannerTest { int cachedFiles = FileUtils.listFiles(cache, new String[]{"jar"}, true).size(); assertThat(cachedFiles).isGreaterThan(5); assertThat(result.getLogs()).contains("User cache: " + cache.getAbsolutePath()); - assertThat(result.getLogs()).contains("Download sonar-xoo-plugin-"); result = scan("shared/xoo-sample", "sonar.userHome", userHome.getAbsolutePath()); - assertThat(cachedFiles).isEqualTo(cachedFiles); + int cachedFiles2 = FileUtils.listFiles(cache, new String[]{"jar"}, true).size(); + assertThat(cachedFiles).isEqualTo(cachedFiles2); assertThat(result.getLogs()).contains("User cache: " + cache.getAbsolutePath()); - assertThat(result.getLogs()).doesNotContain("Download sonar-xoo-plugin-"); } @Test -- 2.39.5