@Test public void execute_command_with_task_old_syntax() { SonarRunner build = SonarRunner.create() .setProjectDir(new File(".")) .setProjectKey("SAMPLE") .setTimeoutSeconds(30) .setRunnerVersion("2.0") .setTask("my-task"); Map<String, String> props = new TreeMap<>(); props.put("sonar.jdbc.dialect", "h2"); props.put("sonar.projectKey", "SAMPLE"); SonarScannerInstaller installer = mock(SonarScannerInstaller.class); when(installer.install(eq(Version.create("2.0")), eq(null), any(File.class), eq(true))).thenReturn(new File("sonar-runner.sh")); CommandExecutor executor = mock(CommandExecutor.class); when(executor.execute(any(Command.class), any(StreamConsumer.class), anyLong())).thenReturn(2); new SonarScannerExecutor().execute(build, Configuration.create(), props, installer, executor); verify(executor).execute(argThat(c -> c.getDirectory().equals(new File(".")) && c.toCommandLine().contains("sonar-runner") && c.toCommandLine().contains("-Dsonar.jdbc.dialect") && c.toCommandLine().contains("-Dsonar.projectKey") && c.toCommandLine().contains("-Dsonar.task")), any(), eq(30000L)); }
@Override BuildResult execute(SonarRunner build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new SonarScannerInstaller(config.locators()), create); }
SonarScannerExecutor extends AbstractBuildExecutor<SonarRunner> { @Override BuildResult execute(SonarRunner build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new SonarScannerInstaller(config.locators()), create); } }
SonarScannerExecutor extends AbstractBuildExecutor<SonarRunner> { @Override BuildResult execute(SonarRunner build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new SonarScannerInstaller(config.locators()), create); }  }
SonarScannerExecutor extends AbstractBuildExecutor<SonarRunner> { @Override BuildResult execute(SonarRunner build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new SonarScannerInstaller(config.locators()), create); }   }
SonarScannerExecutor extends AbstractBuildExecutor<SonarRunner> { @Override BuildResult execute(SonarRunner build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor create) { return execute(build, config, adjustedProperties, new SonarScannerInstaller(config.locators()), create); }    }