@Test public void execute_command() throws Exception { File pom = new File(getClass().getResource("/com/sonar/orchestrator/build/MavenBuildTest/pom.xml").toURI()); MavenBuild build = MavenBuild.create(pom) .addGoal("clean") .addSonarGoal() .setDebugLogs(true) .setTimeoutSeconds(30); Map<String, String> props = new TreeMap<>(); props.put("sonar.jdbc.dialect", "h2"); CommandExecutor executor = mock(CommandExecutor.class); when(executor.execute(any(), any(), anyLong())).thenReturn(2); new MavenBuildExecutor().execute(build, Configuration.create(), props, executor); verify(executor).execute(argThat(mvnMatcher(pom, "clean")), any(), eq(30000L)); verify(executor).execute(argThat(mvnMatcher(pom, "sonar:sonar")), any(), eq(30000L)); }
@Override BuildResult execute(MavenBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor commandExecutor) { BuildResult result = new BuildResult(); for (String goal : build.getGoals()) { appendCoverageArgumentToOpts(build.getEnvironmentVariables(), config, MAVEN_OPTS); executeGoal(build, config, adjustedProperties, goal, result, commandExecutor); } return result; }
MavenBuildExecutor extends AbstractBuildExecutor<MavenBuild> { @Override BuildResult execute(MavenBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor commandExecutor) { BuildResult result = new BuildResult(); for (String goal : build.getGoals()) { appendCoverageArgumentToOpts(build.getEnvironmentVariables(), config, MAVEN_OPTS); executeGoal(build, config, adjustedProperties, goal, result, commandExecutor); } return result; } }
MavenBuildExecutor extends AbstractBuildExecutor<MavenBuild> { @Override BuildResult execute(MavenBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor commandExecutor) { BuildResult result = new BuildResult(); for (String goal : build.getGoals()) { appendCoverageArgumentToOpts(build.getEnvironmentVariables(), config, MAVEN_OPTS); executeGoal(build, config, adjustedProperties, goal, result, commandExecutor); } return result; } MavenBuildExecutor(Os os);  MavenBuildExecutor(); }
MavenBuildExecutor extends AbstractBuildExecutor<MavenBuild> { @Override BuildResult execute(MavenBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor commandExecutor) { BuildResult result = new BuildResult(); for (String goal : build.getGoals()) { appendCoverageArgumentToOpts(build.getEnvironmentVariables(), config, MAVEN_OPTS); executeGoal(build, config, adjustedProperties, goal, result, commandExecutor); } return result; } MavenBuildExecutor(Os os);  MavenBuildExecutor();  }
MavenBuildExecutor extends AbstractBuildExecutor<MavenBuild> { @Override BuildResult execute(MavenBuild build, Configuration config, Map<String, String> adjustedProperties, CommandExecutor commandExecutor) { BuildResult result = new BuildResult(); for (String goal : build.getGoals()) { appendCoverageArgumentToOpts(build.getEnvironmentVariables(), config, MAVEN_OPTS); executeGoal(build, config, adjustedProperties, goal, result, commandExecutor); } return result; } MavenBuildExecutor(Os os);  MavenBuildExecutor();   }