Search in sources :

Example 11 with DockerContainer

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

the class GlobalPublishPluginTest method publish_resources_with_excludes.

@Test
public void publish_resources_with_excludes() {
    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_/");
        fps.getDefaultTransfer().excludes.set("**/*.exclude");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/prefix_/", "/tmp"), is(true));
    assertThat(!dock.cp("/tmp/prefix_/.exclude", "/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 12 with DockerContainer

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

the class GlobalPublishPluginTest method publish_with_own_pattern.

@Test
public void publish_with_own_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().patternSeparator.set("[;]+");
        fps.getDefaultTransfer().sourceFile.set("te,st.txt;odes.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/te,st.txt", "/tmp"), is(true));
    assertThat(dock.cp("/tmp/odes.txt", "/tmp"), is(true));
    assertThat(new File("/tmp/te,st.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)

Example 13 with DockerContainer

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

the class GlobalPublishPluginTest method publish_without_flatten_files.

@Test
@Ignore
public void publish_without_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().sourceFile.set("flat/odes.txt,odes.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/flat/odes.txt", "/tmp/flat"), is(true));
    assertThat(dock.cp("/tmp/odes.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) Ignore(org.junit.Ignore) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Example 14 with DockerContainer

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

the class GlobalPublishPluginTest method publish_with_empty_directory.

@Test
public void publish_with_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");
        fps.getDefaultTransfer().makeEmptyDirs.check();
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/odes.txt", "/tmp/"), is(true));
    assertThat(dock.cp("/tmp/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 15 with DockerContainer

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

the class GlobalPublishPluginTest method publish_multiple_servers.

@Test
@Ignore
public void publish_multiple_servers() {
    DockerContainer dock = container.get();
    DockerContainer dock2 = injector.getInstance(DockerContainerHolder.class).get();
    Resource cpTxt = resource("/ftp_plugin/odes.txt");
    FreeStyleJob j = jenkins.jobs.create();
    configurePublisher("docker1", dock);
    configurePublisher("docker2", dock2);
    j.configure();
    {
        j.copyResource(cpTxt);
        PublishGlobalPublisher fp = addGlobalPublisher(j);
        PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
        fps.configName.select("docker1");
        fps.getDefaultTransfer().sourceFile.set("odes.txt");
        PublishGlobalPublisher.GlobalPublishSite fps2 = fp.addServer();
        fps2.configName.select("docker2");
        fps2.getDefaultTransfer().sourceFile.set("odes.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/odes.txt", "/tmp/dockertmp"), is(true));
    assertThat(dock.cp("/tmp/odes.txt", "/tmp/dockertmp2"), is(true));
}
Also used : DockerContainer(org.jenkinsci.test.acceptance.docker.DockerContainer) DockerContainerHolder(org.jenkinsci.test.acceptance.docker.DockerContainerHolder) Resource(org.jenkinsci.test.acceptance.junit.Resource) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) PublishGlobalPublisher(org.jenkinsci.test.acceptance.plugins.publish_over.PublishGlobalPublisher) Ignore(org.junit.Ignore) 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