use of org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet in project acceptance-test-harness by jenkinsci.
the class AbstractAnalysisTest method createMavenJob.
/**
* Creates a new maven job (an instance of {@link MavenModuleSet}) and initializes it with the specified configurator.
*
* @param resources File or folder in resources which will be copied to the working directory before the maven
* goals are invoked. Should contain the pom.xml.
* @param goal The maven goals to set.
* @param settings The code analyzer to use or null if you do not want one.
* @param configurator A configurator to customize the code analyzer settings you want to use.
* @param <T> The type of the Analyzer.
* @return the configured job.
*/
public <T extends AnalysisSettings> MavenModuleSet createMavenJob(final String resources, final String goal, Class<T> settings, final AnalysisConfigurator<T> configurator) {
MavenInstallation.ensureThatMavenIsInstalled(jenkins);
MavenModuleSet job = jenkins.jobs.create(MavenModuleSet.class);
job.copyResource(resources);
job.setGoals(goal);
job.addBuildSettings(settings, configurator);
job.save();
return job;
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet in project acceptance-test-harness by jenkinsci.
the class CheckStylePluginTest method should_retrieve_results_from_maven_job.
/**
* Builds a maven project and checks if new warning are displayed.
*/
@Test
public void should_retrieve_results_from_maven_job() {
MavenModuleSet job = createMavenJob();
Build build = buildSuccessfulJob(job);
assertThatCheckStyleResultExists(job, build);
build.open();
CheckStyleAction checkstyle = new CheckStyleAction(build);
checkstyle.open();
assertThat(checkstyle.getNumberOfNewWarnings(), is(12));
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet in project acceptance-test-harness by jenkinsci.
the class CheckStylePluginTest method should_set_result_to_unstable_if_warning_found.
/**
* Builds a maven project and checks if it is unstable.
*/
@Test
public void should_set_result_to_unstable_if_warning_found() {
MavenModuleSet job = createMavenJob(settings -> settings.setBuildUnstableTotalAll("0"));
buildJobAndWait(job).shouldBeUnstable();
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet in project acceptance-test-harness by jenkinsci.
the class CheckStylePluginTest method should_set_result_to_failed_if_warning_found.
/**
* Builds a maven project and checks if it failed.
*/
@Test
public void should_set_result_to_failed_if_warning_found() {
MavenModuleSet job = createMavenJob(settings -> settings.setBuildFailedTotalAll("0"));
buildJobAndWait(job).shouldFail();
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet in project acceptance-test-harness by jenkinsci.
the class PmdPluginTest method should_set_result_to_unstable_if_warning_found.
/**
* Builds a maven project and checks if it is unstable.
*/
@Test
public void should_set_result_to_unstable_if_warning_found() {
MavenModuleSet job = createMavenJob(settings -> settings.setBuildUnstableTotalAll("0"));
buildJobAndWait(job).shouldBeUnstable();
}
Aggregations