Search in sources :

Example 1 with JdkInstallation

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

the class JdkTest method autoinstallJdk.

@Test
@TestActivation({ "ORACLE_LOGIN", "ORACLE_PASSWORD" })
public void autoinstallJdk() {
    final String login = System.getProperty("JdkTest.ORACLE_LOGIN");
    final String passwd = System.getProperty("JdkTest.ORACLE_PASSWORD");
    ToolInstallation.waitForUpdates(jenkins, JdkInstallation.class);
    JdkInstallation jdk = ToolInstallation.addTool(jenkins, JdkInstallation.class);
    jdk.name.set("jdk_1.8.0");
    jdk.installVersion("jdk-8u141-oth-JPR");
    jdk.getPage().save();
    jdk.setCredentials(login, passwd);
    FreeStyleJob job = jenkins.jobs.create();
    job.configure();
    job.addShellStep("java -version");
    job.save();
    int tenMinutes = 600000;
    job.startBuild().waitUntilFinished(tenMinutes).shouldSucceed().shouldContainsConsoleOutput("Installing JDK jdk-8u141-oth-JPR").shouldContainsConsoleOutput("Downloading JDK from http://download.oracle.com");
}
Also used : JdkInstallation(org.jenkinsci.test.acceptance.po.JdkInstallation) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) TestActivation(org.jenkinsci.test.acceptance.junit.TestActivation)

Example 2 with JdkInstallation

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

the class JdkTest method usePreinstalledJdk.

// This actually tests any installed JDK, not necessarily oracle.
@Test
@Native("java")
public void usePreinstalledJdk() {
    String expectedVersion = localJavaVersion();
    JdkInstallation jdk = ToolInstallation.addTool(jenkins, JdkInstallation.class);
    jdk.name.set("preinstalled");
    jdk.useNative();
    jdk.getPage().save();
    FreeStyleJob job = jenkins.jobs.create();
    job.configure();
    job.addShellStep("java -version");
    job.save();
    job.startBuild().shouldSucceed().shouldContainsConsoleOutput(expectedVersion);
}
Also used : JdkInstallation(org.jenkinsci.test.acceptance.po.JdkInstallation) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Native(org.jenkinsci.test.acceptance.junit.Native) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)2 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)2 JdkInstallation (org.jenkinsci.test.acceptance.po.JdkInstallation)2 Test (org.junit.Test)2 Native (org.jenkinsci.test.acceptance.junit.Native)1 TestActivation (org.jenkinsci.test.acceptance.junit.TestActivation)1