mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
add a simple test case with a maven 3 build
This commit is contained in:
1 parent
53b991a46e
commit
c8fbc67672
4 files changed
+44
-1
No files matched your search
@@ -362,6 +362,7 @@ public class Maven extends Builder {
|
||||
*/
|
||||
public static final int MAVEN_20 = 0;
|
||||
public static final int MAVEN_21 = 1;
|
||||
public static final int MAVEN_30 = 2;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -394,9 +394,13 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
|
||||
* Returns the older default Maven, while still allowing specification of other bundled Mavens.
|
||||
*/
|
||||
protected MavenInstallation configureDefaultMaven() throws Exception {
|
||||
return configureDefaultMaven("apache-maven-2.2.1", MavenInstallation.MAVEN_20);
|
||||
return configureDefaultMaven("apache-maven-2.2.1", MavenInstallation.MAVEN_20);
|
||||
}
|
||||
|
||||
protected MavenInstallation configureMaven3() throws Exception {
|
||||
return configureDefaultMaven("apache-maven-3.0.1", MavenInstallation.MAVEN_30);
|
||||
}
|
||||
|
||||
/**
|
||||
* Locates Maven2 and configure that as the only Maven in the system.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package hudson.maven;
|
||||
|
||||
import hudson.Launcher;
|
||||
import hudson.model.BuildListener;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jvnet.hudson.test.ExtractResourceSCM;
|
||||
import org.jvnet.hudson.test.HudsonTestCase;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
*/
|
||||
public class Maven3BuildTest extends HudsonTestCase {
|
||||
|
||||
/**
|
||||
* NPE in {@code build.getProject().getWorkspace()} for {@link MavenBuild}.
|
||||
*/
|
||||
public void testSimpleMaven3Build() throws Exception {
|
||||
configureMaven3();
|
||||
MavenModuleSet m = createMavenProject();
|
||||
m.getReporters().add(new TestReporter());
|
||||
m.setScm(new ExtractResourceSCM(getClass().getResource("maven3-project.zip")));
|
||||
buildAndAssertSuccess(m);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class TestReporter extends MavenReporter {
|
||||
@Override
|
||||
public boolean end(MavenBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
|
||||
assertNotNull(build.getProject().getWorkspace());
|
||||
assertNotNull(build.getWorkspace());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
Reference in new issue
Block a user