public void testAddProjectToExistingGroupWithBuildDefTemplate()
throws Exception
{
ProjectGroup pg = new ProjectGroup();
pg.setName( "foo" );
pg.setDescription( "foo pg" );
getContinuum().addProjectGroup( pg );
pg = getContinuum().getAllProjectGroups().get( 1 );
assertEquals( 2, getContinuum().getAllProjectGroups().size() );
pg = getContinuum().getProjectGroupWithBuildDetails( pg.getId() );
// group created with the m2 default build def
assertEquals( 1, pg.getBuildDefinitions().size() );
File rootPom = getTestFile( "src/test/resources/projects/continuum/continuum-core/pom.xml" );
assertTrue( rootPom.exists() );
//String url = getTestFile( "src/test-projects/project1/pom.xml" ).toURL().toExternalForm();
ContinuumProjectBuildingResult result = getContinuum().addMavenTwoProject(
rootPom.toURI().toURL()
.toExternalForm(), pg.getId(),
true, false, false, bdt.getId() );
assertNotNull( result );
assertEquals( 1, result.getProjects().size() );
Project project = result.getProjects().get( 0 );
project = getContinuum().getProjectWithBuildDetails( project.getId() );
assertNotNull( project );
pg = getContinuum().getProjectGroupWithBuildDetails( pg.getId() );
log.info( "project buildDef list size : " + project.getBuildDefinitions().size() );
// project with the build def coming from template
assertEquals( 1, project.getBuildDefinitions().size() );
assertEquals( "clean deploy", ( (BuildDefinition) project.getBuildDefinitions().get( 0 ) ).getGoals() );
}