Skip to content
Permalink
Browse files
JENKINS-40707
tidying
  • Loading branch information
prospero238 committed Dec 30, 2016
1 parent ae1ff90 commit 085707e93f720473ec7a01ffce2d234cd8da68cd
Showing 1 changed file with 13 additions and 9 deletions.
@@ -4,7 +4,6 @@

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.ExecutionException;

import org.apache.commons.io.IOUtils;
@@ -39,14 +38,9 @@ public class LiquibaseUpdateBuildStepTest {
@Before
public void setup() throws IOException {
File workspace = temporaryFolder.newFolder("workspace");
InputStream resourceAsStream = getClass().getResourceAsStream("/pipeline-with-ws-token.groovy");
String template = IOUtils.toString(resourceAsStream);
pipelineScript = template.replaceAll("@WORKSPACE@", workspace.getAbsolutePath());

String projectName = RandomStringUtils.randomAlphabetic(8);
job = jenkinsRule.jenkins.createProject(WorkflowJob.class, projectName);

LiquibaseTestUtil.createFileFromResource(workspace, "/example-changesets/sunny-day-changeset.xml");
pipelineScript = generatePipelineScript(workspace);
copyChangeLogFileToWorkspace(workspace);
job = jenkinsRule.jenkins.createProject(WorkflowJob.class, RandomStringUtils.randomAlphabetic(8));
}

@Test
@@ -55,4 +49,14 @@ public void should_allow_friendly_update_name() throws ExecutionException, Inter
WorkflowRun workflowRun = job.scheduleBuild2(0).get();
assertThat(workflowRun.getResult(), is(Result.SUCCESS));
}

private static void copyChangeLogFileToWorkspace(File workspace) throws IOException {
LiquibaseTestUtil.createFileFromResource(workspace, "/example-changesets/sunny-day-changeset.xml");
}

private String generatePipelineScript(File workspace) throws IOException {
String template = IOUtils.toString(getClass().getResourceAsStream("/pipeline-with-ws-token.groovy"));
return template.replaceAll("@WORKSPACE@", workspace.getAbsolutePath());

}
}

0 comments on commit 085707e

Please sign in to comment.