use of hudson.plugins.copyartifact.testutils.WrapperBuilder in project copyartifact-plugin by jenkinsci.
the class CopyArtifactTest method testEnvDataWrapped.
@Issue("JENKINS-18762")
@Test
public void testEnvDataWrapped() throws Exception {
FreeStyleProject upstream = rule.createFreeStyleProject("upstream");
upstream.getBuildersList().add(new FileWriteBuilder("artifact.txt", "foobar"));
upstream.getPublishersList().add(new ArtifactArchiver("**/*", "", false, false));
FreeStyleBuild upstreamBuild = upstream.scheduleBuild2(0).get();
rule.assertBuildStatusSuccess(upstreamBuild);
FreeStyleProject downstream = rule.createFreeStyleProject();
downstream.getBuildersList().add(new WrapperBuilder(CopyArtifactUtil.createCopyArtifact("upstream", "", new SpecificBuildSelector(Integer.toString(upstreamBuild.getNumber())), "**/*", "", "", false, false, false)));
CaptureEnvironmentBuilder envStep = new CaptureEnvironmentBuilder();
downstream.getBuildersList().add(envStep);
FreeStyleBuild downstreamBuild = downstream.scheduleBuild2(0).get();
rule.assertBuildStatusSuccess(downstreamBuild);
assertFile(true, "artifact.txt", downstreamBuild);
assertEquals(Integer.toString(upstreamBuild.getNumber()), envStep.getEnvVars().get("COPYARTIFACT_BUILD_NUMBER_UPSTREAM"));
}
Aggregations