use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class ScpPluginTest method configure_job_with_scp_key_publishing.
@Test
public void configure_job_with_scp_key_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.keyfile.set(sshd.getPrivateKey().getAbsolutePath());
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()));
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class SubversionPluginTest method poll_for_changes_excluded.
@Test
public void poll_for_changes_excluded() throws SubversionPluginTestException {
final SvnContainer svnContainer = svn.get();
final FreeStyleJob f = jenkins.jobs.create();
final SubversionScm subversionScm = f.useScm(SubversionScm.class);
subversionScm.url.set(svnContainer.getUrlUnsaveRepoAtRevision(1));
// EXCLUDE THE CHANGES TO REV 2
final SubversionSvmAdvanced scmAdvanced = subversionScm.advanced();
scmAdvanced.excludedRegions.set(".*\\.txt");
f.save();
f.startBuild().shouldSucceed();
f.configure();
subversionScm.url.set(svnContainer.getUrlUnsaveRepoAtRevision(2));
f.pollScm().schedule("* * * * *");
f.save();
elasticSleep(70000);
// We should not have a second build after 70 seconds
assertThat(f.getNextBuildNumber(), CoreMatchers.is(2));
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class Subversion_Version154_PluginTest method run_basic_subversion_build_svn_userPwd.
@Test
public void run_basic_subversion_build_svn_userPwd() throws SubversionPluginTestException {
final SvnContainer svnContainer = svn.get();
final FreeStyleJob f = jenkins.jobs.create();
f.addShellStep("test -d .svn");
final SubversionScm subversionScm = f.useScm(SubversionScm.class);
subversionScm.url.set(svnContainer.getSvnUrl());
final SubversionCredentialUserPwd credentialPage = subversionScm.getCredentialPage(SubversionCredentialUserPwd.class);
credentialPage.setUsername(SvnContainer.USER);
credentialPage.setPassword(SvnContainer.PWD);
credentialPage.confirmDialog();
f.save();
f.startBuild().shouldSucceed().shouldContainsConsoleOutput("test -d .svn");
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class Subversion_Version154_PluginTest method always_checkout_fresh_copy.
@Test
public void always_checkout_fresh_copy() throws SubversionPluginTestException {
final SvnContainer svnContainer = svn.get();
final FreeStyleJob f = jenkins.jobs.create();
final SubversionScm subversionScm = f.useScm(SubversionScm.class);
subversionScm.url.set(svnContainer.getUrlUnsaveRepo());
subversionScm.checkoutStrategy.select(SubversionScm.ALWAYS_FRESH_COPY);
f.save();
f.startBuild().shouldSucceed();
f.startBuild().shouldSucceed().shouldContainsConsoleOutput("Checking out " + svnContainer.getUrlUnsaveRepo());
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class TaskScannerPluginTest method should_report_closed_tasks.
/**
* Verifies the detection of closed tasks. Therefore two runs of the same job with the same task scanner setup are
* conducted but the fileset in the workspace will be replaced by the same files containing less warnings for the
* second run. The tasks that have been removed shall be correctly listed as closed tasks.
*/
@Test
public void should_report_closed_tasks() throws Exception {
FreeStyleJob job = createFreeStyleJob(settings -> {
settings.setPattern("**/*.java");
settings.setExcludePattern("**/*Test.java");
settings.setHighPriorityTags("FIXME");
settings.setNormalPriorityTags("TODO");
settings.setLowPriorityTags("@Deprecated");
settings.setIgnoreCase(false);
});
buildSuccessfulJob(job);
// this time we do not check the task scanner output as the result is the same
// as for single_task_tags_and_exclusion_pattern
// So we proceed directly with the preparation of build #2
editJob("/tasks_plugin/fileset1_less", false, job, TasksFreestyleSettings.class);
Build build = buildSuccessfulJob(job);
build.open();
TaskScannerAction action = new TaskScannerAction(build);
// In the first build the task priorities were
// - 1x high
// - 4x medium
// - 1x low
//
// For the second build (reduced warnings) the expected priorities are
// - 3x medium
//
// --> we expect 3 closed tasks (1x high, 1x normal, 1x low)
assertThatOpenTaskCountLinkIs(action, 3, 7);
assertThatClosedTaskCountLinkIs(action, 3);
action.open();
assertThat(action.getNumberOfWarnings(), is(3));
assertThat(action.getNumberOfFixedWarnings(), is(3));
assertThat(action.getNumberOfWarningsWithHighPriority(), is(0));
assertThat(action.getNumberOfWarningsWithNormalPriority(), is(3));
assertThat(action.getNumberOfWarningsWithLowPriority(), is(0));
assertFixedTab(action);
}
Aggregations