]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-14503: Remove `plugin` word from the installed plugins log message
authorDimitris Kavvathas <dimitris.kavvathas@sonarsource.com>
Fri, 3 Jun 2022 11:20:00 +0000 (13:20 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 3 Jun 2022 20:03:04 +0000 (20:03 +0000)
server/sonar-webserver-api/src/main/java/org/sonar/server/plugins/ServerPluginManager.java
server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/ServerPluginManagerTest.java

index 6f83c5839912dc8504d524f2083ee61549cb7bc3..8e5ed0a01f1136f9201534046cc50417bb09ebb0 100644 (file)
@@ -80,7 +80,7 @@ public class ServerPluginManager implements Startable {
   }
 
   private static void logInstalledPlugins(Collection<ServerPluginInfo> plugins) {
-    plugins.stream().sorted().forEach(plugin -> LOG.info("Deploy plugin {} / {} / {}", plugin.getName(), plugin.getVersion(), plugin.getImplementationBuild()));
+    plugins.stream().sorted().forEach(plugin -> LOG.info("Deploy {} / {} / {}", plugin.getName(), plugin.getVersion(), plugin.getImplementationBuild()));
   }
 
   private Collection<ExplodedPlugin> extractPlugins(Collection<ServerPluginInfo> plugins) {
index d81139264a21744a8a7ae1676ea76e47cef40543..a219caadbca1a71d68943f6475cd6084abb1c0ce 100644 (file)
@@ -33,6 +33,7 @@ import org.sonar.core.platform.ExplodedPlugin;
 import org.sonar.core.platform.PluginClassLoader;
 import org.sonar.core.platform.PluginJarExploder;
 import org.sonar.server.plugins.PluginFilesAndMd5.FileAndMd5;
+import org.sonar.updatecenter.common.Version;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
@@ -44,7 +45,7 @@ import static org.sonar.server.plugins.PluginType.EXTERNAL;
 public class ServerPluginManagerTest {
 
   @Rule
-  public LogTester logs = new LogTester();
+  public LogTester logTester = new LogTester();
 
   private PluginClassLoader pluginClassLoader = mock(PluginClassLoader.class);
   private PluginJarExploder jarExploder = mock(PluginJarExploder.class);
@@ -80,6 +81,9 @@ public class ServerPluginManagerTest {
       .extracting(ServerPlugin::getPluginInfo, ServerPlugin::getCompressed, ServerPlugin::getJar, ServerPlugin::getInstance)
       .containsOnly(tuple(p1, p1Files.getCompressedJar(), p1Files.getLoadedJar(), instances.get("p1")),
         tuple(p2, p2Files.getCompressedJar(), p2Files.getLoadedJar(), instances.get("p2")));
+
+    assertThat(pluginRepository.getPlugins()).extracting(ServerPlugin::getPluginInfo)
+      .allMatch(p -> logTester.logs().contains(String.format("Deploy %s / %s / %s", p.getName(), p.getVersion(), p.getImplementationBuild())));
   }
 
   private static ServerPluginInfo newPluginInfo(String key) {
@@ -87,6 +91,11 @@ public class ServerPluginManagerTest {
     when(pluginInfo.getKey()).thenReturn(key);
     when(pluginInfo.getType()).thenReturn(EXTERNAL);
     when(pluginInfo.getNonNullJarFile()).thenReturn(new File(key + ".jar"));
+    when(pluginInfo.getName()).thenReturn(key + "_name");
+    Version version = mock(Version.class);
+    when(version.getName()).thenReturn(key + "_version");
+    when(pluginInfo.getVersion()).thenReturn(version);
+    when(pluginInfo.getImplementationBuild()).thenReturn(key + "_implementationBuild");
     return pluginInfo;
   }