// Downstream project is triggered with parameters of each child.
{
upstream.getBuildersList().clear();
upstream.getBuildersList().add(wfb);
upstream.getBuildersList().add(new TriggerBuilder(
new BlockableBuildTriggerConfig(downstream.getFullName(), null, Arrays.<AbstractBuildParameters>asList(
new FileBuildParameters("properties.txt", null, false, false, null, false)
))
));
upstream.getPublishersList().clear();
jenkins.rebuildDependencyGraph();
assertEquals(0, downstream.getBuilds().size());
upstream.scheduleBuild2(0).get();
waitUntilNoActivity();
assertEquals(2, downstream.getBuilds().size());
FreeStyleBuild build1 = downstream.getLastBuild();
FreeStyleBuild build2 = build1.getPreviousBuild();
if (build1.getCause(Cause.UpstreamCause.class).getUpstreamProject().contains("child1")) {
assertEquals("true", getStringParameterValue(build1, "triggered_child1"));
assertNull(getStringParameterValue(build1, "triggered_child2"));
assertNull(getStringParameterValue(build2, "triggered_child1"));
assertEquals("true", getStringParameterValue(build2, "triggered_child2"));
} else {
assertEquals("true", getStringParameterValue(build2, "triggered_child1"));
assertNull(getStringParameterValue(build2, "triggered_child2"));
assertNull(getStringParameterValue(build1, "triggered_child1"));
assertEquals("true", getStringParameterValue(build1, "triggered_child2"));
}
build2.delete();
build1.delete();
}
// With useMatrixBuild, publisher
// Downstream project is triggered with parameters of each child.
// (useMatrixBuild is ignored)
{
upstream.getBuildersList().clear();
upstream.getBuildersList().add(wfb);
upstream.getBuildersList().add(new TriggerBuilder(
new BlockableBuildTriggerConfig(downstream.getFullName(), null, Arrays.<AbstractBuildParameters>asList(
new FileBuildParameters("properties.txt", null, false, true, null, false)
))
));
upstream.getPublishersList().clear();