Search in sources :

Example 1 with ExecuteDslScripts

use of javaposse.jobdsl.plugin.ExecuteDslScripts in project promoted-builds-plugin by jenkinsci.

the class PromotionsDslContextExtensionTest method testShouldGenerateTheDefindedComplexJob.

@Test
public void testShouldGenerateTheDefindedComplexJob() throws Exception {
    // Given
    String dsl = FileUtils.readFileToString(new File("src/test/resources/complex-example-dsl.groovy"));
    FreeStyleProject seedJob = createFreeStyleProject();
    seedJob.getBuildersList().add(new ExecuteDslScripts(new ExecuteDslScripts.ScriptLocation(Boolean.TRUE.toString(), null, dsl), false, RemovedJobAction.DELETE));
    // When        
    QueueTaskFuture<FreeStyleBuild> scheduleBuild2 = seedJob.scheduleBuild2(0);
    // Then
    assertBuildStatusSuccess(scheduleBuild2);
}
Also used : ExecuteDslScripts(javaposse.jobdsl.plugin.ExecuteDslScripts) FreeStyleBuild(hudson.model.FreeStyleBuild) FreeStyleProject(hudson.model.FreeStyleProject) File(java.io.File) Test(org.junit.Test)

Example 2 with ExecuteDslScripts

use of javaposse.jobdsl.plugin.ExecuteDslScripts in project promoted-builds-plugin by jenkinsci.

the class PromotionsDslContextExtensionTest method testShouldGenerateTheDefindedJob.

@Test
public void testShouldGenerateTheDefindedJob() throws Exception {
    // Given
    String dsl = FileUtils.readFileToString(new File("src/test/resources/example-dsl.groovy"));
    FreeStyleProject seedJob = createFreeStyleProject();
    seedJob.getBuildersList().add(new ExecuteDslScripts(new ExecuteDslScripts.ScriptLocation(Boolean.TRUE.toString(), null, dsl), false, RemovedJobAction.DELETE));
    // When        
    QueueTaskFuture<FreeStyleBuild> scheduleBuild2 = seedJob.scheduleBuild2(0);
    // Then
    assertBuildStatusSuccess(scheduleBuild2);
}
Also used : ExecuteDslScripts(javaposse.jobdsl.plugin.ExecuteDslScripts) FreeStyleBuild(hudson.model.FreeStyleBuild) FreeStyleProject(hudson.model.FreeStyleProject) File(java.io.File) Test(org.junit.Test)

Example 3 with ExecuteDslScripts

use of javaposse.jobdsl.plugin.ExecuteDslScripts in project promoted-builds-plugin by jenkinsci.

the class PromotionsDslContextExtensionTest method testShouldGenerateTheCopyArtifactsJob.

@Test
public void testShouldGenerateTheCopyArtifactsJob() throws Exception {
    // Given
    String dsl = FileUtils.readFileToString(new File("src/test/resources/copyartifacts-example-dsl.groovy"));
    FreeStyleProject seedJob = createFreeStyleProject();
    seedJob.getBuildersList().add(new ExecuteDslScripts(new ExecuteDslScripts.ScriptLocation(Boolean.TRUE.toString(), null, dsl), false, RemovedJobAction.DELETE));
    // When
    QueueTaskFuture<FreeStyleBuild> scheduleBuild2 = seedJob.scheduleBuild2(0);
    // Then (unstable b/c we aren't including the CopyArtifacts dependency)
    assertBuildStatus(Result.UNSTABLE, scheduleBuild2.get());
    TopLevelItem item = jenkins.getItem("copy-artifacts-test");
    File config = new File(item.getRootDir(), "promotions/Development/config.xml");
    String content = Files.toString(config, Charset.forName("UTF-8"));
    assert content.contains("<selector class=\"hudson.plugins.copyartifact.SpecificBuildSelector\">");
}
Also used : ExecuteDslScripts(javaposse.jobdsl.plugin.ExecuteDslScripts) TopLevelItem(hudson.model.TopLevelItem) FreeStyleBuild(hudson.model.FreeStyleBuild) FreeStyleProject(hudson.model.FreeStyleProject) File(java.io.File) Test(org.junit.Test)

Aggregations

FreeStyleBuild (hudson.model.FreeStyleBuild)3 FreeStyleProject (hudson.model.FreeStyleProject)3 File (java.io.File)3 ExecuteDslScripts (javaposse.jobdsl.plugin.ExecuteDslScripts)3 Test (org.junit.Test)3 TopLevelItem (hudson.model.TopLevelItem)1