Search in sources :

Example 1 with MavenModuleSet

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;
}
Also used : MavenModuleSet(org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet)

Example 2 with MavenModuleSet

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));
}
Also used : CheckStyleAction(org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleAction) Build(org.jenkinsci.test.acceptance.po.Build) MavenModuleSet(org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet) Test(org.junit.Test)

Example 3 with MavenModuleSet

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();
}
Also used : MavenModuleSet(org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet) Test(org.junit.Test)

Example 4 with MavenModuleSet

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();
}
Also used : MavenModuleSet(org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet) Test(org.junit.Test)

Example 5 with MavenModuleSet

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();
}
Also used : MavenModuleSet(org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet) Test(org.junit.Test)

Aggregations

MavenModuleSet (org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet)22 Test (org.junit.Test)21 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)9 Build (org.jenkinsci.test.acceptance.po.Build)7 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)5 Issue (org.jvnet.hudson.test.Issue)5 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)4 CheckStyleAction (org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleAction)2 MavenBuild (org.jenkinsci.test.acceptance.plugins.maven.MavenBuild)2 Matchers.containsString (org.hamcrest.Matchers.containsString)1 ArtifactoryContainer (org.jenkinsci.test.acceptance.docker.fixtures.ArtifactoryContainer)1 MailhogContainer (org.jenkinsci.test.acceptance.docker.fixtures.MailhogContainer)1 ArtifactoryPublisher (org.jenkinsci.test.acceptance.plugins.artifactory.ArtifactoryPublisher)1 FindBugsAction (org.jenkinsci.test.acceptance.plugins.findbugs.FindBugsAction)1 JobConfigHistory (org.jenkinsci.test.acceptance.plugins.job_config_history.JobConfigHistory)1 Change (org.jenkinsci.test.acceptance.plugins.job_config_history.JobConfigHistory.Change)1 Mailer (org.jenkinsci.test.acceptance.plugins.mailer.Mailer)1 MavenModule (org.jenkinsci.test.acceptance.plugins.maven.MavenModule)1 MavenModuleBuild (org.jenkinsci.test.acceptance.plugins.maven.MavenModuleBuild)1 MavenProjectConfig (org.jenkinsci.test.acceptance.plugins.maven.MavenProjectConfig)1