Search in sources :

Example 16 with PublishGlobalPublisher

use of org.jenkinsci.test.acceptance.plugins.publish_over.PublishGlobalPublisher in project acceptance-test-harness by jenkinsci.

the class GlobalPublishPluginTest method publish_with_clean_remote.

@Test
public void publish_with_clean_remote() {
    DockerContainer dock = container.get();
    Resource cpTxt = resource("/ftp_plugin/odes.txt");
    FreeStyleJob j = jenkins.jobs.create();
    configurePublisher("asd", dock);
    j.configure();
    {
        j.copyResource(cpTxt);
        PublishGlobalPublisher fp = addGlobalPublisher(j);
        PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
        fps.getDefaultTransfer().cleanRemote.check();
        fps.getDefaultTransfer().sourceFile.set("odes.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/odes.txt", "/tmp/"), is(true));
    assertThat(!dock.cp("/tmp/old.txt", "/tmp/"), is(true));
}
Also used : DockerContainer(org.jenkinsci.test.acceptance.docker.DockerContainer) Resource(org.jenkinsci.test.acceptance.junit.Resource) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) PublishGlobalPublisher(org.jenkinsci.test.acceptance.plugins.publish_over.PublishGlobalPublisher) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Example 17 with PublishGlobalPublisher

use of org.jenkinsci.test.acceptance.plugins.publish_over.PublishGlobalPublisher in project acceptance-test-harness by jenkinsci.

the class GlobalPublishPluginTest method publish_resources_and_remove_prefix.

@Test
public void publish_resources_and_remove_prefix() throws IOException {
    DockerContainer dock = container.get();
    Resource cpDir = resource("/ftp_plugin/");
    Resource test = resource("/ftp_plugin/prefix_/test.txt");
    FreeStyleJob j = jenkins.jobs.create();
    configurePublisher("asd", dock);
    j.configure();
    {
        j.copyDir(cpDir);
        PublishGlobalPublisher fp = addGlobalPublisher(j);
        PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
        fps.getDefaultTransfer().sourceFile.set("prefix_/test.txt");
        fps.getDefaultTransfer().removePrefix.set("prefix_");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/test.txt", "/tmp"), is(true));
    assertThat(FileUtils.readFileToString(new File("/tmp/test.txt")), CoreMatchers.is(test.asText()));
}
Also used : DockerContainer(org.jenkinsci.test.acceptance.docker.DockerContainer) Resource(org.jenkinsci.test.acceptance.junit.Resource) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) PublishGlobalPublisher(org.jenkinsci.test.acceptance.plugins.publish_over.PublishGlobalPublisher) File(java.io.File) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Aggregations

DockerContainer (org.jenkinsci.test.acceptance.docker.DockerContainer)17 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)17 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)17 Resource (org.jenkinsci.test.acceptance.junit.Resource)17 PublishGlobalPublisher (org.jenkinsci.test.acceptance.plugins.publish_over.PublishGlobalPublisher)17 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)17 Test (org.junit.Test)17 File (java.io.File)9 Ignore (org.junit.Ignore)2 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 DockerContainerHolder (org.jenkinsci.test.acceptance.docker.DockerContainerHolder)1 Slave (org.jenkinsci.test.acceptance.po.Slave)1