Skip to content
Permalink
Browse files

[JENKINS-14653] Added a test to reproduce JENKINS-14653. TriggeredBui…

…ldSelector cannot handle maven modules as upstreams.
  • Loading branch information...
ikedam committed Oct 2, 2014
1 parent a7ce03c commit 0bf22b2a775356f1d0150dc60f15e59fcd1a7304
Showing with 48 additions and 0 deletions.
  1. +48 −0 src/test/java/hudson/plugins/copyartifact/TriggeredBuildSelectorTest.java
@@ -25,7 +25,11 @@
package hudson.plugins.copyartifact;

import static org.junit.Assert.*;

import java.util.Arrays;

import hudson.Util;
import hudson.maven.MavenModuleSet;
import hudson.model.Cause;
import hudson.model.FreeStyleProject;
import hudson.model.ParametersAction;
@@ -38,6 +42,8 @@

import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.JenkinsRule.WebClient;

@@ -611,4 +617,46 @@ public void testIsUseNewest() throws Exception {
d.setGlobalUpstreamFilterStrategy(TriggeredBuildSelector.UpstreamFilterStrategy.UseNewest);
assertFalse(new TriggeredBuildSelector(false, TriggeredBuildSelector.UpstreamFilterStrategy.UseOldest).isUseNewest());
}

@Bug(14653)
@Test
public void testMavenModule() throws Exception {
j.configureDefaultMaven();
MavenModuleSet upstream = j.createMavenProject();
FreeStyleProject downstream = j.createFreeStyleProject();

upstream.setGoals("clean package");
upstream.setScm(new ExtractResourceSCM(getClass().getResource("maven-job.zip")));
upstream.getPublishersList().add(new BuildTrigger(downstream.getName(), Result.SUCCESS));

downstream.getBuildersList().add(new CopyArtifact(
String.format("%s/org.jvnet.hudson.main.test.multimod$moduleB", upstream.getName()),
"",
new TriggeredBuildSelector(false, null),
"**/*",
"",
"",
false,
false,
false
));

upstream.save();
downstream.save();
j.jenkins.rebuildDependencyGraph();

j.assertBuildStatusSuccess(upstream.scheduleBuild2(0));
j.waitUntilNoActivity();

FreeStyleBuild b = downstream.getLastBuild();
j.assertBuildStatusSuccess(b);

assertTrue(
String.format(
"File not found: files are: %s",
Arrays.asList(b.getWorkspace().list("**/*"))
),
b.getWorkspace().child("org.jvnet.hudson.main.test.multimod/moduleB/1.0-SNAPSHOT/moduleB-1.0-SNAPSHOT.jar").exists()
);
}
}

0 comments on commit 0bf22b2

Please sign in to comment.
You can’t perform that action at this time.