Search in sources :

Example 1 with FormValidation

use of org.jenkinsci.test.acceptance.po.FormValidation 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 FormValidation

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

Example 3 with FormValidation

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

the class ForemanNodeSharingPluginTest method testConnection.

/**
 * Test the connection and check version.
 * @throws IOException if occurs.
 */
@Test
public void testConnection() throws IOException {
    FormValidation validation = cloud.testConnection();
    assertThat(validation, FormValidation.reports(OK, startsWith("Foreman version is")));
}
Also used : FormValidation(org.jenkinsci.test.acceptance.po.FormValidation) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Example 4 with FormValidation

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

the class OpenstackCloudPluginTest method testConnection.

@Test
public void testConnection() {
    JenkinsConfig config = jenkins.getConfigPage();
    config.configure();
    OpenstackCloud cloud = addCloud(config);
    FormValidation val = cloud.testConnection();
    assertThat(val, FormValidation.reports(OK, "Connection succeeded!"));
}
Also used : OpenstackCloud(org.jenkinsci.test.acceptance.plugins.openstack.OpenstackCloud) FormValidation(org.jenkinsci.test.acceptance.po.FormValidation) JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

FormValidation (org.jenkinsci.test.acceptance.po.FormValidation)4 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)3 JenkinsConfig (org.jenkinsci.test.acceptance.po.JenkinsConfig)3 Test (org.junit.Test)3 VersionNumber (hudson.util.VersionNumber)2 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)1 OpenstackCloud (org.jenkinsci.test.acceptance.plugins.openstack.OpenstackCloud)1