]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
SONARUNNER-152 Scanner does not log Server version 3/head 4/head
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Tue, 8 Mar 2016 17:42:05 +0000 (18:42 +0100)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Tue, 8 Mar 2016 17:42:05 +0000 (18:42 +0100)
src/main/java/org/sonarsource/scanner/cli/Main.java
src/test/java/org/sonarsource/scanner/cli/MainTest.java

index 548caa3dc7ec0b84928696f66b3c8c66c134a7c9..7ea4f30ef9792bcfa717789566537b5dc8b6ee0e 100644 (file)
@@ -74,6 +74,7 @@ public class Main {
       configureLogging(p);
       init(p);
       runner.start();
+      logger.info("SonarQube server " + runner.serverVersion());
 
       if (cli.isInteractive()) {
         interactiveLoop(p);
index e2fd69ca83c0205ec5b6cd17374caf11d0156092..1936ca84263e124b309030e74673224b2e2d17eb 100644 (file)
@@ -150,6 +150,18 @@ public class MainTest {
     inOrder.verify(shutdown, times(1)).exit(Exit.SUCCESS);
   }
 
+  @Test
+  public void shouldLogServerVersion() throws IOException {
+    when(runner.serverVersion()).thenReturn("5.5");
+    Properties p = new Properties();
+    when(cli.isDisplayVersionOnly()).thenReturn(true);
+    when(conf.properties()).thenReturn(p);
+
+    Main main = new Main(shutdown, cli, conf, runnerFactory, logs);
+    main.execute();
+    verify(logs).info("SonarQube server 5.5");
+  }
+
   @Test
   public void should_configure_logging() throws IOException {
     Properties p = new Properties();