@Test public void execute_command() { final FileLocation buildFile = FileLocation.of("src/test/resources/com/sonar/orchestrator/build/AntBuildTest/build.xml"); AntBuild build = AntBuild.create() .setBuildLocation(buildFile) .setTimeoutSeconds(30) .setTargets("sonar"); Map<String, String> props = new TreeMap<>(); props.put("sonar.jdbc.dialect", "h2"); CommandExecutor executor = mock(CommandExecutor.class); when(executor.execute(any(Command.class), any(StreamConsumer.class), anyLong())).thenReturn(2); new AntBuildExecutor().execute(build, Configuration.create(), props, executor); verify(executor).execute(argThat(c -> c.toCommandLine().contains("ant") && c.toCommandLine().contains("-f") && c.toCommandLine().contains("-Dsonar.jdbc.dialect=")), any(), eq(30000L)); }
@Override BuildResult execute(AntBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor commandExecutor) { BuildResult result = new BuildResult(); for (String target : build.getTargets()) { executeTarget(build, config, adjustedProperties, target, result, commandExecutor); } return result; }
AntBuildExecutor extends AbstractBuildExecutor<AntBuild> { @Override BuildResult execute(AntBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor commandExecutor) { BuildResult result = new BuildResult(); for (String target : build.getTargets()) { executeTarget(build, config, adjustedProperties, target, result, commandExecutor); } return result; } }
AntBuildExecutor extends AbstractBuildExecutor<AntBuild> { @Override BuildResult execute(AntBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor commandExecutor) { BuildResult result = new BuildResult(); for (String target : build.getTargets()) { executeTarget(build, config, adjustedProperties, target, result, commandExecutor); } return result; }  }
AntBuildExecutor extends AbstractBuildExecutor<AntBuild> { @Override BuildResult execute(AntBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor commandExecutor) { BuildResult result = new BuildResult(); for (String target : build.getTargets()) { executeTarget(build, config, adjustedProperties, target, result, commandExecutor); } return result; }   }
AntBuildExecutor extends AbstractBuildExecutor<AntBuild> { @Override BuildResult execute(AntBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor commandExecutor) { BuildResult result = new BuildResult(); for (String target : build.getTargets()) { executeTarget(build, config, adjustedProperties, target, result, commandExecutor); } return result; }    }