Search in sources :

Example 6 with GradleStep

use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.

the class ArtifactoryPluginTest method gradle_integration.

@Test
@WithPlugins("gradle")
@Ignore
@Issue("JENKINS-39323")
public void gradle_integration() {
    final ArtifactoryContainer artifactory = artifactoryContainer.get();
    waitForArtifactory(artifactory);
    configureArtifactory(artifactory);
    GradleInstallation.installGradle(jenkins, "gradle 2.0", "2.0");
    FreeStyleJob job = jenkins.jobs.create();
    job.copyDir(resource("/artifactory_plugin/quickstart"));
    ArtifactoryGradleConfiguratior gradleConfig = new ArtifactoryGradleConfiguratior(job);
    gradleConfig.refresh();
    GradleStep gradle = job.addBuildStep(GradleStep.class);
    gradle.setVersion("gradle 2.0");
    // gradle.tasks.set("build --stacktrace --debug");
    gradle.setTasks("build");
    job.save();
    Build build = job.startBuild().shouldSucceed();
    String log = build.getConsole();
    assertThat(log, containsString("build artifactoryPublish"));
    assertThat(log, containsString("[buildinfo]"));
    assertThat(log, containsString("Deploying artifact"));
    assertThat(log, containsRegexp("Deploying build (info|descriptor) to: " + artifactory.getURL() + "/api/build"));
}
Also used : ArtifactoryContainer(org.jenkinsci.test.acceptance.docker.fixtures.ArtifactoryContainer) Build(org.jenkinsci.test.acceptance.po.Build) GradleStep(org.jenkinsci.test.acceptance.plugins.gradle.GradleStep) ArtifactoryGradleConfiguratior(org.jenkinsci.test.acceptance.plugins.artifactory.ArtifactoryGradleConfiguratior) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Matchers.containsString(org.hamcrest.Matchers.containsString) Ignore(org.junit.Ignore) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 7 with GradleStep

use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.

the class GradlePluginTest method run_gradle_job_parameters_as_project_properties.

@Test
public void run_gradle_job_parameters_as_project_properties() {
    GradleInstallation.installGradle(jenkins);
    final FreeStyleJob job = jenkins.jobs.create();
    job.copyResource(resource(GRADLE_SCRIPT), "build.gradle");
    job.addParameter(StringParameter.class).setName("PROJ_PARAM_1").setDefault("hello");
    job.addParameter(StringParameter.class).setName("SYS_PARAM_1").setDefault("hello");
    final GradleStep step = job.addBuildStep(GradleStep.class);
    step.setVersion(GradleInstallation.DEFAULT);
    step.setTasks("jobParametersAsProjectProperties jobParametersAsSystemProperties");
    step.setProjectProperties("PROJ_PARAM_2=world");
    step.setSystemProperties("SYS_PARAM_2=world");
    step.setPassAllAsProjectProperties();
    step.setPassAllAsSystemProperties();
    step.setSwitches("--no-daemon");
    job.save();
    final Build build = job.startBuild().shouldSucceed();
    assertThat(build.getConsole(), containsString("Project Properties: hello world"));
    assertThat(build.getConsole(), containsString("System Properties: hello world"));
}
Also used : GradleStep(org.jenkinsci.test.acceptance.plugins.gradle.GradleStep) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 8 with GradleStep

use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.

the class GradlePluginTest method run_gradle_script.

@Test
public void run_gradle_script() {
    GradleInstallation.installGradle(jenkins);
    FreeStyleJob job = jenkins.jobs.create();
    job.copyResource(resource(GRADLE_SCRIPT), "gradle/hello.gradle");
    GradleStep step = job.addBuildStep(GradleStep.class);
    step.setFile("hello.gradle");
    step.setVersion(GradleInstallation.DEFAULT);
    step.setTasks("environmentVariables");
    step.setDir("gradle");
    step.setSwitches("--quiet --no-daemon");
    job.save();
    final Build build = job.startBuild();
    build.shouldSucceed();
    assertThat(build.getConsole(), containsRegexp("gradle.* --quiet"));
    assertThat(build.getConsole(), containsString("Build Number: " + build.getNumber()));
    assertThat(build.getConsole(), containsString("Build Name: " + build.getName()));
}
Also used : GradleStep(org.jenkinsci.test.acceptance.plugins.gradle.GradleStep) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 9 with GradleStep

use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.

the class GradlePluginTest method run_gradle_with_switches.

/**
 * Verify the execution of gradle build script with switch parameter.
 */
@Test
public void run_gradle_with_switches() {
    GradleInstallation.installGradle(jenkins);
    final FreeStyleJob job = jenkins.jobs.create();
    job.copyResource(resource(GRADLE_SCRIPT), "build.gradle");
    final GradleStep step = job.addBuildStep(GradleStep.class);
    step.setVersion(GradleInstallation.DEFAULT);
    step.setSwitches("--quiet");
    step.setTasks(FIRST.getName() + " " + SECOND.getName());
    job.save();
    final Build build = job.startBuild().shouldSucceed();
    assertThat(build.getConsole(), containsRegexp("gradle.* --quiet"));
    assertThat(build.getConsole(), containsString(SUCCESSFUL_BUILD));
}
Also used : GradleStep(org.jenkinsci.test.acceptance.plugins.gradle.GradleStep) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 10 with GradleStep

use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.

the class GradlePluginTest method run_gradle_add_project_properties.

/**
 * Verify the execution of gradle build script with committed gradle project properties.
 */
@Test
public void run_gradle_add_project_properties() {
    GradleInstallation.installGradle(jenkins);
    final FreeStyleJob job = jenkins.jobs.create();
    job.copyResource(resource(GRADLE_SCRIPT), "build.gradle");
    final GradleStep step = job.addBuildStep(GradleStep.class);
    step.setVersion(GradleInstallation.DEFAULT);
    step.setProjectProperties("TEST_PARAM_1=hello\nTEST_PARAM_2=world");
    step.setTasks(JOB_PARAM_AS_PROJECT_PROPERTIES.getName());
    job.save();
    final Build build = job.startBuild().shouldSucceed();
    assertThat(build.getConsole(), containsString("Gradle Properties: hello world"));
}
Also used : GradleStep(org.jenkinsci.test.acceptance.plugins.gradle.GradleStep) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)12 GradleStep (org.jenkinsci.test.acceptance.plugins.gradle.GradleStep)12 Test (org.junit.Test)12 WebElement (org.openqa.selenium.WebElement)2 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Matchers.containsString (org.jenkinsci.test.acceptance.Matchers.containsString)1 ArtifactoryContainer (org.jenkinsci.test.acceptance.docker.fixtures.ArtifactoryContainer)1 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)1 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 ArtifactoryGradleConfiguratior (org.jenkinsci.test.acceptance.plugins.artifactory.ArtifactoryGradleConfiguratior)1 Build (org.jenkinsci.test.acceptance.po.Build)1 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)1 Ignore (org.junit.Ignore)1 Issue (org.jvnet.hudson.test.Issue)1