File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\test\src\test\java\hudson\maven\AbortedMavenBuildTest.java.html

1 package hudson.maven;
2
3 import hudson.Launcher;
4 import hudson.model.BuildListener;
5 import hudson.model.Result;
6 import org.jvnet.hudson.test.Bug;
7 import org.jvnet.hudson.test.ExtractResourceSCM;
8 import org.jvnet.hudson.test.HudsonTestCase;
9
10 import java.io.IOException;
11
12 public class AbortedMavenBuildTest extends HudsonTestCase {
13 @Bug(8054)
14 public void testBuildWrapperSeesAbortedStatus() throws Exception {
15 configureDefaultMaven();
16 MavenModuleSet project = createMavenProject();
17 TestBuildWrapper wrapper = new TestBuildWrapper();
18 project.getBuildWrappersList().add(wrapper);
19 project.getReporters().add(new AbortingReporter());
20 project.setGoals("clean");
21 project.setScm(new ExtractResourceSCM(getClass().getResource("maven-empty-mod.zip")));
22 MavenModuleSetBuild build = project.scheduleBuild2(0).get();
23 assertEquals(Result.ABORTED, build.getResult());
24 assertEquals(Result.ABORTED, wrapper.buildResultInTearDown);
25 }
26
27 private static class AbortingReporter extends MavenReporter {
28 private static final long serialVersionUID = 1L;
29
30 @Override
31 public boolean end(MavenBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
32 throw new InterruptedException();
33 }
34 }
35 }
36