Search in sources :

Example 1 with DockerContainer

use of org.jenkinsci.test.acceptance.docker.DockerContainer in project acceptance-test-harness by jenkinsci.

the class GlobalPublishPluginTest method publish_without_empty_directory.

@Test
public void publish_without_empty_directory() throws IOException {
    DockerContainer dock = container.get();
    Resource cpTxt = resource("/ftp_plugin/odes.txt");
    File tmpDir = createTempDirectory();
    File nestedEmptyDir = new File(tmpDir + "/empty");
    nestedEmptyDir.mkdir();
    FreeStyleJob j = jenkins.jobs.create();
    configurePublisher("asd", dock);
    j.configure();
    {
        j.copyResource(cpTxt);
        j.copyFile(tmpDir);
        PublishGlobalPublisher fp = addGlobalPublisher(j);
        PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
        fps.getDefaultTransfer().sourceFile.set("empty/,odes.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/odes.txt", "/tmp/"), is(true));
    assertThat(!dock.cp("/tmp/dockertmp/empty", "/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) File(java.io.File) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Example 2 with DockerContainer

use of org.jenkinsci.test.acceptance.docker.DockerContainer in project acceptance-test-harness by jenkinsci.

the class GlobalPublishPluginTest method publish_with_date_format.

@Test
public void publish_with_date_format() {
    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().remoteDirectorySDF.check();
        fps.getDefaultTransfer().remoteDirectory.set("yyyyMMddHH");
        fps.getDefaultTransfer().sourceFile.set("odes.txt");
    }
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH");
    Date date = new Date();
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/" + dateFormat.format(date) + "/odes.txt", "/tmp/"), is(true));
    assertThat(new File("/tmp/odes.txt").exists(), is(true));
}
Also used : DockerContainer(org.jenkinsci.test.acceptance.docker.DockerContainer) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Resource(org.jenkinsci.test.acceptance.junit.Resource) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) PublishGlobalPublisher(org.jenkinsci.test.acceptance.plugins.publish_over.PublishGlobalPublisher) SimpleDateFormat(java.text.SimpleDateFormat) File(java.io.File) Date(java.util.Date) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Example 3 with DockerContainer

use of org.jenkinsci.test.acceptance.docker.DockerContainer in project acceptance-test-harness by jenkinsci.

the class GlobalPublishPluginTest method publish_with_flatten_files.

@Test
public void publish_with_flatten_files() {
    DockerContainer dock = container.get();
    Resource cpDir = resource("/ftp_plugin/");
    FreeStyleJob j = jenkins.jobs.create();
    configurePublisher("asd", dock);
    j.configure();
    {
        j.copyDir(cpDir);
        PublishGlobalPublisher fp = addGlobalPublisher(j);
        PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
        fps.getDefaultTransfer().flatten.check();
        fps.getDefaultTransfer().sourceFile.set("flat/odes.txt,odes.txt");
    }
    j.save();
    j.startBuild().shouldBeUnstable();
}
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 4 with DockerContainer

use of org.jenkinsci.test.acceptance.docker.DockerContainer in project acceptance-test-harness by jenkinsci.

the class GlobalPublishPluginTest method publish_multiple_sets.

@Test
public void publish_multiple_sets() {
    DockerContainer dock = container.get();
    Resource cpTxt = resource("/ftp_plugin/odes.txt");
    FreeStyleJob j = jenkins.jobs.create();
    configurePublisher("asd", dock);
    j.configure();
    {
        j.copyResource(cpTxt);
        j.copyResource(cpTxt, "odes2.txt");
        j.copyResource(cpTxt, "odes3.txt");
        PublishGlobalPublisher fp = addGlobalPublisher(j);
        PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
        fps.getDefaultTransfer().sourceFile.set("odes.txt");
        fps.addTransferSet().sourceFile.set("odes2.txt");
        fps.addTransferSet().sourceFile.set("odes3.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/odes.txt", "/tmp/"), is(true));
    assertThat(dock.cp("/tmp/odes2.txt", "/tmp/"), is(true));
    assertThat(dock.cp("/tmp/odes3.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 5 with DockerContainer

use of org.jenkinsci.test.acceptance.docker.DockerContainer in project acceptance-test-harness by jenkinsci.

the class GlobalPublishPluginTest method publish_with_default_pattern.

@Test
public void publish_with_default_pattern() {
    DockerContainer dock = container.get();
    Resource cpDir = resource("/ftp_plugin/");
    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,odes.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/prefix_/test.txt", "/tmp"), is(true));
    assertThat(dock.cp("/tmp/odes.txt", "/tmp"), is(true));
    assertThat(new File("/tmp/test.txt").exists(), is(true));
    assertThat(new File("/tmp/odes.txt").exists(), 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) 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