Search in sources :

Example 6 with Resource

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

Example 7 with Resource

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

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

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

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

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