public void testAddBuildDefinitionTemplate()
throws Exception
{
BuildDefinitionTemplate template = new BuildDefinitionTemplate();
template.setName( "test" );
template = getBuildDefinitionService().addBuildDefinitionTemplate( template );
template = getBuildDefinitionService().getBuildDefinitionTemplate( template.getId() );
assertNotNull( template );
assertEquals( "test", template.getName() );
List<BuildDefinition> all = getBuildDefinitionService().getAllBuildDefinitions();
assertEquals( 5, all.size() );
BuildDefinition bd = (BuildDefinition) getBuildDefinitionService().getDefaultMavenTwoBuildDefinitionTemplate()
.getBuildDefinitions().get( 0 );
template = getBuildDefinitionService().addBuildDefinitionInTemplate( template, bd, false );
assertEquals( 1, template.getBuildDefinitions().size() );
all = getBuildDefinitionService().getAllBuildDefinitions();
assertEquals( 5, all.size() );
template = getBuildDefinitionService().getBuildDefinitionTemplate( template.getId() );
template = getBuildDefinitionService().updateBuildDefinitionTemplate( template );
template = getBuildDefinitionService().removeBuildDefinitionFromTemplate( template, bd );
assertEquals( 0, template.getBuildDefinitions().size() );
all = getBuildDefinitionService().getAllBuildDefinitions();
assertEquals( 5, all.size() );
}