Search in sources :

Example 16 with Resource

use of org.jenkinsci.test.acceptance.junit.Resource 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 17 with Resource

use of org.jenkinsci.test.acceptance.junit.Resource 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 18 with Resource

use of org.jenkinsci.test.acceptance.junit.Resource 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 19 with Resource

use of org.jenkinsci.test.acceptance.junit.Resource 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)

Example 20 with Resource

use of org.jenkinsci.test.acceptance.junit.Resource 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)

Aggregations

Resource (org.jenkinsci.test.acceptance.junit.Resource)23 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)20 Test (org.junit.Test)20 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)19 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)19 DockerContainer (org.jenkinsci.test.acceptance.docker.DockerContainer)17 PublishGlobalPublisher (org.jenkinsci.test.acceptance.plugins.publish_over.PublishGlobalPublisher)17 File (java.io.File)11 SshdContainer (org.jenkinsci.test.acceptance.docker.fixtures.SshdContainer)2 ScpGlobalConfig (org.jenkinsci.test.acceptance.plugins.scp.ScpGlobalConfig)2 Site (org.jenkinsci.test.acceptance.plugins.scp.ScpGlobalConfig.Site)2 ScpPublisher (org.jenkinsci.test.acceptance.plugins.scp.ScpPublisher)2 Ignore (org.junit.Ignore)2 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Properties (java.util.Properties)1 DockerContainerHolder (org.jenkinsci.test.acceptance.docker.DockerContainerHolder)1 LogParserPublisher (org.jenkinsci.test.acceptance.plugins.logparser.LogParserPublisher)1 Plot (org.jenkinsci.test.acceptance.plugins.plot.Plot)1