private Project<?, ?> createParentProject(String parentJobName, String... childJobNames) throws IOException {
//create ProjectA
Project<?,?> project = createFreeStyleProject(parentJobName);
List<AbstractBuildParameters> buildParameters = new ArrayList<AbstractBuildParameters>();
buildParameters.add(new CurrentBuildParameters());
StringBuilder childJobNamesString = new StringBuilder();
for(String childJobName : childJobNames){
childJobNamesString.append(childJobName);
childJobNamesString.append(",");
}
//setup build step trigger
project.getBuildersList().add(new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters)));
// setup triggers for conditional buildsteps
// test conditional builder (multi)
List<BuildStep> blist = new ArrayList<BuildStep>();
TriggerBuilder tb = new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters));
blist.add(tb);
project.getBuildersList().add(new ConditionalBuilder(new AlwaysRun(), new BuildStepRunner.Run(), blist));
// test conditional builder (single)
TriggerBuilder tb2 = new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters));
project.getBuildersList().add(new SingleConditionalBuilder(tb2, new AlwaysRun(), new BuildStepRunner.Run()));
//setup post build trigger
project.getPublishersList().add(new BuildTrigger(new BuildTriggerConfig(childJobNamesString.toString(), ResultCondition.SUCCESS, new CurrentBuildParameters())));
return project;
}