use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.
the class CompressingArtifactManager method setup.
public static void setup(Jenkins jenkins) {
JenkinsConfig config = jenkins.getConfigPage();
config.configure();
config.clearArtifactManagers();
config.addArtifactManager(CompressingArtifactManager.class);
config.save();
}
use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.
the class ConfigurationAsCodeTest method loadAndReload.
@Test
public void loadAndReload() {
final String EXPECTED_DESC = "JCasC populated description";
JcascManage jm = new JcascManage(jenkins);
jm.open();
jm.configure(resource("/configuration_as_code/trivial.yaml").asFile().getAbsolutePath());
assertThat(jenkins.open(), hasContent(EXPECTED_DESC));
JenkinsConfig gc = jenkins.getConfigPage();
gc.configure(() -> gc.setDescription("Changed"));
assertThat(jenkins.open(), Matchers.not(hasContent(EXPECTED_DESC)));
jm.open();
jm.reload();
assertThat(jenkins.open(), hasContent(EXPECTED_DESC));
}
use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.
the class SubversionPluginTest method poll_for_changes.
@Test
public void poll_for_changes() throws SubversionPluginTestException {
final SvnContainer svnContainer = svn.get();
JenkinsConfig jc = new JenkinsConfig(jenkins);
jc.configure();
jc.setQuietPeriod(0);
jc.save();
final FreeStyleJob f = jenkins.jobs.create();
final SubversionScm subversionScm = f.useScm(SubversionScm.class);
subversionScm.url.set(svnContainer.getUrlUnauthenticatedRepoAtRevision(1));
f.save();
f.startBuild().shouldSucceed();
f.configure();
subversionScm.url.set(svnContainer.getUrlUnauthenticatedRepoAtRevision(2));
f.pollScm().schedule("* * * * *");
f.addShellStep("test -d .svn");
f.save();
elasticSleep(10000);
f.build(1).waitUntilFinished().shouldSucceed();
}
use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.
the class DeployPluginTest method deploy_sample_webapp_to_tomcat7.
@Test
@Native("bash")
@WithCredentials(credentialType = WithCredentials.USERNAME_PASSWORD, values = { "admin", "tomcat" }, id = "tomcat")
public void deploy_sample_webapp_to_tomcat7() throws IOException, InterruptedException {
if (SystemUtils.IS_OS_WINDOWS) {
// TODO move somewhere else...
String path = new CommandBuilder("where.exe", "bash.exe").popen().asText().trim();
// where will return all matches and we only want the first.
path = path.replaceAll("\r\n.*", "");
JenkinsConfig conf = jenkins.getConfigPage();
JenkinsConfig cp = jenkins.getConfigPage();
cp.configure();
cp.setShell(path);
cp.save();
}
Tomcat7Container f = docker.get();
FreeStyleJob j = jenkins.jobs.create();
j.configure();
ShellBuildStep s;
{
s = j.addShellStep(resource("/deploy_plugin/build-war.sh"));
DeployPublisher d = j.addPublisher(DeployPublisher.class);
d.war.set("my-webapp/target/*.war");
d.contextPath.set("test");
d.useContainer("Tomcat 7.x Remote", "Tomcat 7.x");
d.setCredentials("tomcat");
d.url.set(f.getUrl().toExternalForm());
}
j.save();
Build b = j.startBuild().shouldSucceed();
b.shouldContainsConsoleOutput("to container Tomcat 7.x Remote");
assertThat(readText(f), containsString("Hello World!"));
j.configure();
s.command("cd my-webapp && echo '<html><body>Hello Jenkins</body></html>' > src/main/webapp/index.jsp && mvn install");
j.save();
b = j.startBuild().shouldSucceed();
b.shouldContainsConsoleOutput("Redeploying");
assertThat(readText(f), containsString("Hello Jenkins"));
}
use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.
the class PrioritySorterPluginTest method saving_global_config_should_not_create_job_change.
// Reproduce regression fixed in https://github.com/jenkinsci/priority-sorter-plugin/commit/e46b2b1fbc4396f441c69692eb328fb982325572
@Test
@WithPlugins("jobConfigHistory")
public void saving_global_config_should_not_create_job_change() {
FreeStyleJob job = jenkins.jobs.create();
job.save();
JobConfigHistory action = job.action(JobConfigHistory.class);
final int expected = action.getChanges().size();
final JenkinsConfig global = jenkins.getConfigPage();
global.configure();
global.numExecutors.set(42);
global.save();
assertThat(action.getChanges().size(), equalTo(expected));
}
Aggregations