Search in sources :

Example 6 with DockerContainer

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

the class GlobalPublishPluginTest method publish_jenkins_variables.

@Test
public void publish_jenkins_variables() throws IOException {
    DockerContainer dock = container.get();
    Resource cpFile = resource("/ftp_plugin/odes.txt");
    String randomName = jenkins.jobs.createRandomName();
    String randomPath = "/tmp/" + randomName + "/";
    FreeStyleJob j = jenkins.jobs.create(FreeStyleJob.class, randomName);
    configurePublisher("asd", dock);
    j.configure();
    {
        j.copyResource(cpFile);
        PublishGlobalPublisher fp = addGlobalPublisher(j);
        PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
        fps.getDefaultTransfer().remoteDirectory.set("${JOB_NAME}/");
        fps.getDefaultTransfer().sourceFile.set("odes.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp(randomPath + "odes.txt", "/tmp/"), is(true));
    assertThat(FileUtils.readFileToString(new File("/tmp/odes.txt")), CoreMatchers.is(cpFile.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)

Example 7 with DockerContainer

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

the class GlobalPublishPluginTest method publish_resources.

@Test
public void publish_resources() throws IOException {
    DockerContainer dock = container.get();
    Resource cpFile = resource("/ftp_plugin/odes.txt");
    FreeStyleJob j = jenkins.jobs.create();
    configurePublisher("asd", dock);
    j.configure();
    {
        j.copyResource(cpFile);
        PublishGlobalPublisher fp = addGlobalPublisher(j);
        PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
        fps.getDefaultTransfer().sourceFile.set("odes.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/odes.txt", "/tmp/"), is(true));
    assertThat(FileUtils.readFileToString(new File("/tmp/odes.txt")), CoreMatchers.is(cpFile.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)

Example 8 with DockerContainer

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

the class GlobalPublishPluginTest method publish_with_default_exclude.

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

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

the class GlobalPublishPluginTest method publish_with_no_default_exclude.

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

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

the class GlobalPublishPluginTest method publish_slave_resourses.

@Test
public void publish_slave_resourses() throws IOException, InterruptedException, ExecutionException {
    DockerContainer dock = container.get();
    Resource cpFile = resource("/ftp_plugin/odes.txt");
    Slave s = slaves.get().install(jenkins).get();
    s.configure();
    s.save();
    FreeStyleJob j = jenkins.jobs.create();
    configurePublisher("asd", dock);
    j.configure();
    {
        j.copyResource(cpFile);
        PublishGlobalPublisher fp = addGlobalPublisher(j);
        PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
        fps.getDefaultTransfer().sourceFile.set("odes.txt");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/odes.txt", "/tmp"), is(true));
    assertThat(FileUtils.readFileToString(new File("/tmp/odes.txt")), CoreMatchers.is(cpFile.asText()));
}
Also used : DockerContainer(org.jenkinsci.test.acceptance.docker.DockerContainer) Slave(org.jenkinsci.test.acceptance.po.Slave) 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