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

1 package hudson.matrix;
2
3 import java.util.List;
4
5 import org.jvnet.hudson.test.HudsonTestCase;
6
7 import hudson.model.AbstractProject;
8 import hudson.model.FreeStyleBuild;
9 import hudson.model.FreeStyleProject;
10 import hudson.model.Result;
11 import hudson.tasks.BuildTrigger;
12 import hudson.util.RunList;
13
14 /**
15 * @author Stefan Wolf
16 */
17 public class MatrixProjectDependencyTest extends HudsonTestCase {
18
19 /**
20 * Checks if the MatrixProject adds and Triggers downstream Projects via
21 * the DependencyGraph
22 */
23 public void testMatrixProjectTriggersDependencies() throws Exception {
24 MatrixProject matrixProject = createMatrixProject();
25 FreeStyleProject freestyleProject = createFreeStyleProject();
26 matrixProject.getPublishersList().add(new BuildTrigger(freestyleProject.getName(), false));
27
28 jenkins.rebuildDependencyGraph();
29
30 buildAndAssertSuccess(matrixProject);
31 waitUntilNoActivity();
32
33 RunList<FreeStyleBuild> builds = freestyleProject.getBuilds();
34 assertEquals("There should only be one FreestyleBuild", 1, builds.size());
35 FreeStyleBuild build = builds.iterator().next();
36 assertEquals(Result.SUCCESS, build.getResult());
37 List<AbstractProject> downstream = jenkins.getDependencyGraph().getDownstream(matrixProject);
38 assertTrue(downstream.contains(freestyleProject));
39 }
40
41 }
42