Search in sources :

Example 21 with Resource

use of org.jenkinsci.test.acceptance.junit.Resource in project acceptance-test-harness by jenkinsci.

the class GlobalPublishPluginTest method publish_resources_and_remove_prefix.

@Test
public void publish_resources_and_remove_prefix() throws IOException {
    DockerContainer dock = container.get();
    Resource cpDir = resource("/ftp_plugin/");
    Resource test = resource("/ftp_plugin/prefix_/test.txt");
    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");
        fps.getDefaultTransfer().removePrefix.set("prefix_");
    }
    j.save();
    j.startBuild().shouldSucceed();
    assertThat(dock.cp("/tmp/test.txt", "/tmp"), is(true));
    assertThat(FileUtils.readFileToString(new File("/tmp/test.txt")), CoreMatchers.is(test.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 22 with Resource

use of org.jenkinsci.test.acceptance.junit.Resource in project acceptance-test-harness by jenkinsci.

the class ScpPluginTest method configure_job_with_scp_password_publishing.

@Test
public void configure_job_with_scp_password_publishing() throws Exception {
    SshdContainer sshd = docker.get();
    Resource cp_file = resource("/scp_plugin/lorem-ipsum-scp.txt");
    FreeStyleJob j = jenkins.jobs.create();
    jenkins.configure();
    Site s = new ScpGlobalConfig(jenkins).addSite();
    {
        s.hostname.set(sshd.ipBound(22));
        s.port.set(sshd.port(22));
        s.username.set("test");
        s.password.set("test");
        s.rootRepositoryPath.set("/tmp");
    }
    jenkins.save();
    j.configure();
    {
        j.copyResource(cp_file);
        ScpPublisher sp = j.addPublisher(ScpPublisher.class);
        ScpPublisher.Site sps = sp.add();
        sps.sourceFile.set("lorem-ipsum-scp.txt");
        sps.filePath.set("abc");
    }
    j.save();
    j.startBuild().shouldSucceed();
    sshd.cp("/tmp/abc/lorem-ipsum-scp.txt", "/tmp");
    assertThat(FileUtils.readFileToString(new File("/tmp/lorem-ipsum-scp.txt")), CoreMatchers.is(cp_file.asText()));
}
Also used : Site(org.jenkinsci.test.acceptance.plugins.scp.ScpGlobalConfig.Site) SshdContainer(org.jenkinsci.test.acceptance.docker.fixtures.SshdContainer) Resource(org.jenkinsci.test.acceptance.junit.Resource) ScpGlobalConfig(org.jenkinsci.test.acceptance.plugins.scp.ScpGlobalConfig) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) File(java.io.File) ScpPublisher(org.jenkinsci.test.acceptance.plugins.scp.ScpPublisher) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Example 23 with Resource

use of org.jenkinsci.test.acceptance.junit.Resource in project acceptance-test-harness by jenkinsci.

the class PlotPluginPropertiesTest method test_clickable_data_points.

@Test
public void test_clickable_data_points() throws IOException {
    job.configure();
    job.copyResource(propertiesFilePath);
    PlotPublisher pub = job.addPublisher(PlotPublisher.class);
    final Resource res = resource(propertiesFilePath);
    Properties prop = new Properties();
    prop.load(res.asInputStream());
    Plot plot = pub.getPlot(1);
    plot.setGroup("Group_1");
    plot.setTitle("PropertiesPlot1");
    PropertiesDataSeries pSeries = plot.addDataSeries(PropertiesDataSeries.class, propertiesFileName);
    job.save();
    job.startBuild().shouldSucceed();
    job.visit("plot");
    find(by.xpath("//map/area[contains(@title, '%s')]", prop.getProperty("YVALUE")));
    find(by.xpath("//map/area[contains(@href, '%s')]", prop.getProperty("URL")));
}
Also used : PropertiesDataSeries(org.jenkinsci.test.acceptance.plugins.plot.PropertiesDataSeries) PlotPublisher(org.jenkinsci.test.acceptance.plugins.plot.PlotPublisher) Plot(org.jenkinsci.test.acceptance.plugins.plot.Plot) Resource(org.jenkinsci.test.acceptance.junit.Resource) Properties(java.util.Properties) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

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