]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10168 Log downloading of plugins in debug
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Thu, 7 Dec 2017 10:54:37 +0000 (11:54 +0100)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Thu, 7 Dec 2017 14:28:02 +0000 (15:28 +0100)
sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java
tests/src/test/java/org/sonarqube/tests/analysis/ScannerTest.java

index a37a98d3a79b1f0bd35c28e8e9661234e3705885..046acc54cd0cce350a9116e1df15359574d30754 100644 (file)
@@ -67,7 +67,7 @@ public class ScannerPluginInstaller implements PluginInstaller {
   private Map<String, ScannerPlugin> loadPlugins(InstalledPlugin[] remotePlugins) {
     Map<String, ScannerPlugin> 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));
index 15b2055574119524421077f23aee39aaa1724688..cd47342301ba858a1faf04e4d7c5428afad008ba 100644 (file)
@@ -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