Search in sources :

Example 1 with ArtifactArchiver

use of org.jenkinsci.test.acceptance.po.ArtifactArchiver in project acceptance-test-harness by jenkinsci.

the class FreestyleJobTest method archiveArtifacts.

@Test
@Category(SmokeTest.class)
public void archiveArtifacts() {
    FreeStyleJob j = jenkins.jobs.create(FreeStyleJob.class);
    j.configure();
    j.addShellStep("echo 'yes' > include; echo 'no' > exclude;");
    ArtifactArchiver archiver = j.addPublisher(ArtifactArchiver.class);
    archiver.includes("**/*include*");
    archiver.excludes("exclude");
    j.save();
    Build build = j.scheduleBuild().waitUntilFinished();
    assertThat(build.getArtifact("exclude"), pageObjectDoesNotExist());
    Artifact include = build.getArtifact("include");
    assertThat(include, pageObjectExists());
    assertThat(include.getTextContent(), equalTo("yes"));
}
Also used : ArtifactArchiver(org.jenkinsci.test.acceptance.po.ArtifactArchiver) Build(org.jenkinsci.test.acceptance.po.Build) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Artifact(org.jenkinsci.test.acceptance.po.Artifact) Category(org.junit.experimental.categories.Category) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) SmokeTest(org.jenkinsci.test.acceptance.junit.SmokeTest) Test(org.junit.Test)

Example 2 with ArtifactArchiver

use of org.jenkinsci.test.acceptance.po.ArtifactArchiver in project acceptance-test-harness by jenkinsci.

the class ParameterizedTriggerTest method triggerWithNonStandardArchiver.

@Test
@WithPlugins({ "compress-artifacts", "matrix-project" /*JENKINS-33910*/
})
@Issue("JENKINS-28980")
public void triggerWithNonStandardArchiver() {
    CompressingArtifactManager.setup(jenkins);
    FreeStyleJob target = jenkins.jobs.create();
    target.configure();
    target.addParameter(StringParameter.class).setName("PARAM");
    target.addShellStep("test 'value' = $PARAM");
    target.save();
    FreeStyleJob trigger = jenkins.jobs.create();
    trigger.configure();
    trigger.addShellStep("echo 'PARAM=value' > my.properties");
    ArtifactArchiver archiver = trigger.addPublisher(ArtifactArchiver.class);
    archiver.includes("my.properties");
    ParameterizedTrigger step = trigger.addPublisher(ParameterizedTrigger.class);
    TriggerConfig config = step.getTriggerConfig(0);
    config.projects.set(target.name);
    FileBuildParameters params = config.addParameter(FileBuildParameters.class);
    params.file.set("my.properties");
    params.failIfMissing.check();
    trigger.save();
    trigger.startBuild().shouldSucceed();
    Build downstream = target.build(1);
    downstream.shouldSucceed();
}
Also used : StringParameter(org.jenkinsci.test.acceptance.po.StringParameter) ParameterizedTrigger(org.jenkinsci.test.acceptance.plugins.parameterized_trigger.ParameterizedTrigger) ArtifactArchiver(org.jenkinsci.test.acceptance.po.ArtifactArchiver) Build(org.jenkinsci.test.acceptance.po.Build) TriggerConfig(org.jenkinsci.test.acceptance.plugins.parameterized_trigger.TriggerConfig) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) FileBuildParameters(org.jenkinsci.test.acceptance.plugins.parameterized_trigger.FileBuildParameters) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 3 with ArtifactArchiver

use of org.jenkinsci.test.acceptance.po.ArtifactArchiver in project acceptance-test-harness by jenkinsci.

the class PublisherOrderTest method testOrdered.

@Test
public void testOrdered() {
    FreeStyleJob upstream = jenkins.jobs.create(FreeStyleJob.class);
    upstream.configure();
    String command = "echo 'hello' > aggregate.txt";
    if (SystemUtils.IS_OS_UNIX) {
        upstream.addShellStep(command);
    } else {
        upstream.addBatchStep(command);
    }
    AggregateDownstreamTestResults aggregate = upstream.addPublisher(AggregateDownstreamTestResults.class);
    aggregate.specify.check();
    ArtifactArchiver archiver = upstream.addPublisher(ArtifactArchiver.class);
    archiver.includes("aggregate.txt");
    BuildTrigger trigger = upstream.addPublisher(BuildTrigger.class);
    trigger.childProjects.set("projectName");
    Fingerprint fingerprint = upstream.addPublisher(Fingerprint.class);
    fingerprint.targets.set("aggregate.txt");
    upstream.save();
}
Also used : AggregateDownstreamTestResults(org.jenkinsci.test.acceptance.po.AggregateDownstreamTestResults) Fingerprint(org.jenkinsci.test.acceptance.po.Fingerprint) ArtifactArchiver(org.jenkinsci.test.acceptance.po.ArtifactArchiver) BuildTrigger(org.jenkinsci.test.acceptance.po.BuildTrigger) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 4 with ArtifactArchiver

use of org.jenkinsci.test.acceptance.po.ArtifactArchiver in project acceptance-test-harness by jenkinsci.

the class PublisherOrderTest method testUnordered.

@Test
public void testUnordered() {
    FreeStyleJob upstream = jenkins.jobs.create(FreeStyleJob.class);
    upstream.configure();
    String command = "echo 'hello' > aggregate.txt";
    if (SystemUtils.IS_OS_UNIX) {
        upstream.addShellStep(command);
    } else {
        upstream.addBatchStep(command);
    }
    ArtifactArchiver archiver = upstream.addPublisher(ArtifactArchiver.class);
    archiver.includes("aggregate.txt");
    BuildTrigger trigger = upstream.addPublisher(BuildTrigger.class);
    trigger.childProjects.set("projectName");
    Fingerprint fingerprint = upstream.addPublisher(Fingerprint.class);
    fingerprint.targets.set("aggregate.txt");
    AggregateDownstreamTestResults aggregate = upstream.addPublisher(AggregateDownstreamTestResults.class);
    aggregate.specify.check();
    fingerprint.targets.set("another.txt");
    upstream.save();
    upstream.configure();
    archiver.includes("another.txt");
    JUnitPublisher junit = upstream.addPublisher(JUnitPublisher.class);
    fingerprint.targets.set("yetanother");
}
Also used : AggregateDownstreamTestResults(org.jenkinsci.test.acceptance.po.AggregateDownstreamTestResults) JUnitPublisher(org.jenkinsci.test.acceptance.po.JUnitPublisher) Fingerprint(org.jenkinsci.test.acceptance.po.Fingerprint) ArtifactArchiver(org.jenkinsci.test.acceptance.po.ArtifactArchiver) BuildTrigger(org.jenkinsci.test.acceptance.po.BuildTrigger) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)4 ArtifactArchiver (org.jenkinsci.test.acceptance.po.ArtifactArchiver)4 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)4 Test (org.junit.Test)4 AggregateDownstreamTestResults (org.jenkinsci.test.acceptance.po.AggregateDownstreamTestResults)2 Build (org.jenkinsci.test.acceptance.po.Build)2 BuildTrigger (org.jenkinsci.test.acceptance.po.BuildTrigger)2 Fingerprint (org.jenkinsci.test.acceptance.po.Fingerprint)2 SmokeTest (org.jenkinsci.test.acceptance.junit.SmokeTest)1 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 FileBuildParameters (org.jenkinsci.test.acceptance.plugins.parameterized_trigger.FileBuildParameters)1 ParameterizedTrigger (org.jenkinsci.test.acceptance.plugins.parameterized_trigger.ParameterizedTrigger)1 TriggerConfig (org.jenkinsci.test.acceptance.plugins.parameterized_trigger.TriggerConfig)1 Artifact (org.jenkinsci.test.acceptance.po.Artifact)1 JUnitPublisher (org.jenkinsci.test.acceptance.po.JUnitPublisher)1 StringParameter (org.jenkinsci.test.acceptance.po.StringParameter)1 Category (org.junit.experimental.categories.Category)1 Issue (org.jvnet.hudson.test.Issue)1