int all = buildDefinitionDao.getAllBuildDefinitions().size();
BuildDefinition buildDefinition = new BuildDefinition();
buildDefinition.setBuildFile( "pom.xml" );
buildDefinition.setGoals( "clean" );
buildDefinition.setTemplate( true );
BuildDefinitionTemplate template = new BuildDefinitionTemplate();
template.setName( "test" );
template.setContinuumDefault( true );
template.setType( ContinuumBuildExecutorConstants.MAVEN_TWO_BUILD_EXECUTOR );
template = buildDefinitionTemplateDao.addBuildDefinitionTemplate( template );
buildDefinition = buildDefinitionDao.addBuildDefinition( buildDefinition );
template.addBuildDefinition( buildDefinition );
template = buildDefinitionTemplateDao.updateBuildDefinitionTemplate( template );
assertEquals( "test", template.getName() );
assertTrue( template.isContinuumDefault() );
assertEquals( 1, template.getBuildDefinitions().size() );
assertEquals( all + 1, buildDefinitionDao.getAllBuildDefinitions().size() );
assertEquals( 2, buildDefinitionTemplateDao.getAllBuildDefinitionTemplate().size() );
template = buildDefinitionTemplateDao
.getContinuumBuildDefinitionTemplateWithType( ContinuumBuildExecutorConstants.MAVEN_TWO_BUILD_EXECUTOR );
assertNotNull( template );
assertEquals( 1, template.getBuildDefinitions().size() );
assertEquals( 2, buildDefinitionTemplateDao.getAllBuildDefinitionTemplate().size() );
}