Search in sources :

Example 1 with JenkinsConfig

use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.

the class FormValidationTest method validate.

@Test
public void validate() throws Exception {
    JenkinsConfig c = jenkins.getConfigPage();
    c.configure();
    c.numExecutors.set(16);
    FormValidation formValidation = c.numExecutors.getFormValidation();
    assertThat(formValidation, silent());
    c.numExecutors.set(-16);
    formValidation = c.numExecutors.getFormValidation();
    // support older jenkins versions
    String errorMessage = jenkins.getVersion().isNewerThan(new VersionNumber("2.104")) ? "Not a non-negative number" : "Not an integer";
    assertThat(formValidation, reports(Kind.ERROR, errorMessage));
}
Also used : FormValidation(org.jenkinsci.test.acceptance.po.FormValidation) JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig) VersionNumber(hudson.util.VersionNumber) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 2 with JenkinsConfig

use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.

the class MissionControlTest method testBuildQueue.

/**
 * Test the existence and number of builds in the queue.
 */
@Test
public void testBuildQueue() {
    MissionControlView view = jenkins.views.create(MissionControlView.class, "mission-control-sample-view");
    view.configure(() -> view.setHideBuildQueue(true));
    view.open();
    assertThat(driver, not(hasContent("Build queue")));
    view.configure(() -> view.setHideBuildQueue(false));
    JenkinsConfig master = jenkins.getConfigPage();
    master.configure(() -> master.labels.set("notQueued"));
    FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "queuedJob");
    job.configure(() -> job.setLabelExpression("queued"));
    job.scheduleBuild();
    view.open();
    assertThat(view.getBuildQueueArea().getBuildQueueSize(), is(1));
    job.configure(() -> job.setLabelExpression("notQueued"));
    job.getLastBuild().waitUntilFinished();
    view.open();
    assertThat(view.getBuildQueueArea().getBuildQueueSize(), is(0));
}
Also used : MissionControlView(org.jenkinsci.test.acceptance.plugins.mission_control.MissionControlView) JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 3 with JenkinsConfig

use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.

the class ArtifactoryPluginTest method configureArtifactory.

ArtifactoryGlobalConfig.Server configureArtifactory(ArtifactoryContainer artifactory) {
    JenkinsConfig config = jenkins.getConfigPage();
    config.configure();
    ArtifactoryGlobalConfig global = new ArtifactoryGlobalConfig(config);
    Server server = global.addServer();
    server.id.set("artifactoryId");
    server.url.set(artifactory.getURL());
    server.username.set("admin");
    server.password.set("password");
    config.save();
    return server;
}
Also used : Server(org.jenkinsci.test.acceptance.plugins.artifactory.ArtifactoryGlobalConfig.Server) ArtifactoryGlobalConfig(org.jenkinsci.test.acceptance.plugins.artifactory.ArtifactoryGlobalConfig) JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig)

Example 4 with JenkinsConfig

use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.

the class DockerBuildStepTest method configureTcpEndpoint.

@Before
public void configureTcpEndpoint() {
    assumeNotNull(DOCKER_DAEMON_TCP);
    final JenkinsConfig global = jenkins.getConfigPage();
    global.configure();
    GlobalDockerConfig pluginConfig = new GlobalDockerConfig(global);
    pluginConfig.restApiUrl(DOCKER_DAEMON_TCP);
    pluginConfig.testConnection();
    global.save();
}
Also used : JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig) GlobalDockerConfig(org.jenkinsci.test.acceptance.plugins.docker_build_step.GlobalDockerConfig) Before(org.junit.Before)

Example 5 with JenkinsConfig

use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.

the class FormValidationTest method jsValidation.

private void jsValidation() {
    JenkinsConfig c = jenkins.getConfigPage();
    c.configure();
    c.numExecutors.set(16);
    FormValidation formValidation = c.numExecutors.getFormValidation();
    assertThat(formValidation, silent());
    c.numExecutors.set(-16);
    formValidation = c.numExecutors.getFormValidation();
    // support older jenkins versions
    String errorMessage = jenkins.getVersion().isNewerThan(new VersionNumber("2.295")) ? "Not a non-negative integer" : "Not a non-negative number";
    assertThat(formValidation, reports(Kind.ERROR, errorMessage));
}
Also used : FormValidation(org.jenkinsci.test.acceptance.po.FormValidation) JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig) VersionNumber(hudson.util.VersionNumber)

Aggregations

JenkinsConfig (org.jenkinsci.test.acceptance.po.JenkinsConfig)12 Test (org.junit.Test)7 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)6 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)4 FormValidation (org.jenkinsci.test.acceptance.po.FormValidation)3 VersionNumber (hudson.util.VersionNumber)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 SvnContainer (org.jenkinsci.test.acceptance.docker.fixtures.SvnContainer)1 Tomcat7Container (org.jenkinsci.test.acceptance.docker.fixtures.Tomcat7Container)1 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)1 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 ArtifactoryGlobalConfig (org.jenkinsci.test.acceptance.plugins.artifactory.ArtifactoryGlobalConfig)1 Server (org.jenkinsci.test.acceptance.plugins.artifactory.ArtifactoryGlobalConfig.Server)1 JcascManage (org.jenkinsci.test.acceptance.plugins.configuration_as_code.JcascManage)1 DeployPublisher (org.jenkinsci.test.acceptance.plugins.deploy.DeployPublisher)1 GlobalDockerConfig (org.jenkinsci.test.acceptance.plugins.docker_build_step.GlobalDockerConfig)1 JobConfigHistory (org.jenkinsci.test.acceptance.plugins.job_config_history.JobConfigHistory)1 MissionControlView (org.jenkinsci.test.acceptance.plugins.mission_control.MissionControlView)1 OpenstackCloud (org.jenkinsci.test.acceptance.plugins.openstack.OpenstackCloud)1 SubversionScm (org.jenkinsci.test.acceptance.plugins.subversion.SubversionScm)1