[CONTINUUM-2563] better define behaviour for when to add a project-level
build definition when a group was not created
git-svn-id: https://svn.apache.org/repos/asf/continuum/branches/CONTINUUM-2563@1391317 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java b/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
index 3847ff8..8042c5e 100644
--- a/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
+++ b/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuilder.java
@@ -45,6 +45,13 @@
boolean checkoutInSingleDirectory )
throws ContinuumProjectBuilderException;
+ ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
+ boolean recursiveProjects,
+ BuildDefinitionTemplate buildDefinitionTemplate,
+ boolean checkoutInSingleDirectory,
+ int projectGroupId )
+ throws ContinuumProjectBuilderException;
+
BuildDefinitionTemplate getDefaultBuildDefinitionTemplate()
throws ContinuumProjectBuilderException;
}
diff --git a/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java b/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
index 9b4d702..10b6f7d 100644
--- a/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
+++ b/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
@@ -1614,6 +1614,13 @@
// Create the projects from the URL
// ----------------------------------------------------------------------
+ ProjectGroup projectGroup;
+
+ if ( projectGroupId != -1 )
+ {
+ CreateProjectsFromMetadataAction.setProjectGroupId( context, projectGroupId );
+ }
+
executeAction( "create-projects-from-metadata", context );
ContinuumProjectBuildingResult result = CreateProjectsFromMetadataAction.getProjectBuildingResult( context );
@@ -1652,14 +1659,14 @@
throw new ContinuumException( "The project building result has to contain exactly one project group." );
}
- ProjectGroup projectGroup = result.getProjectGroups().iterator().next();
-
boolean projectGroupCreation = false;
try
{
if ( projectGroupId == -1 )
{
+ projectGroup = result.getProjectGroups().iterator().next();
+
try
{
projectGroup = projectGroupDao.getProjectGroupByGroupId( projectGroup.getGroupId() );
diff --git a/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java b/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
index 28280e5..ed07758 100644
--- a/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
+++ b/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
@@ -98,6 +98,8 @@
boolean checkoutProjectsInSingleDirectory = getBoolean( context, KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY );
+ int projectGroupId = getProjectGroupId( context );
+
String curl = getUrl( context );
URL url;
@@ -119,7 +121,7 @@
result = projectBuilder.buildProjectsFromMetadata( url, null, null, loadRecursiveProjects,
buildDefinitionTemplate,
- checkoutProjectsInSingleDirectory );
+ checkoutProjectsInSingleDirectory, projectGroupId );
}
else
diff --git a/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java b/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
index eec7cac..9a03a98 100644
--- a/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
+++ b/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
@@ -19,6 +19,7 @@
* under the License.
*/
+import org.apache.continuum.dao.ProjectGroupDao;
import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
import org.apache.maven.continuum.execution.maven.m1.MavenOneBuildExecutor;
@@ -32,6 +33,7 @@
import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
import org.apache.maven.continuum.project.builder.ContinuumProjectBuilderException;
import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.maven.continuum.store.ContinuumStoreException;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
@@ -60,6 +62,11 @@
*/
private MavenOneMetadataHelper metadataHelper;
+ /**
+ * @plexus.requirement
+ */
+ private ProjectGroupDao projectGroupDao;
+
// ----------------------------------------------------------------------
// ProjectCreator Implementation
// ----------------------------------------------------------------------
@@ -93,6 +100,36 @@
boolean checkoutInSingleDirectory )
throws ContinuumProjectBuilderException
{
+ return buildProjectsFromMetadata( url, username, password, buildDefinitionTemplate, null );
+ }
+
+ public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
+ boolean recursiveProjects,
+ BuildDefinitionTemplate buildDefinitionTemplate,
+ boolean checkoutInSingleDirectory,
+ int projectGroupId )
+ throws ContinuumProjectBuilderException
+ {
+ ProjectGroup projectGroup = null;
+ if ( projectGroupId > 0 )
+ {
+ try
+ {
+ projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( projectGroupId );
+ }
+ catch ( ContinuumStoreException e )
+ {
+ throw new ContinuumProjectBuilderException( e.getMessage(), e );
+ }
+ }
+
+ return buildProjectsFromMetadata( url, username, password, buildDefinitionTemplate, projectGroup );
+ }
+
+ private ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
+ BuildDefinitionTemplate buildDefinitionTemplate,
+ ProjectGroup projectGroup )
+ {
ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();
File pomFile;
@@ -136,38 +173,41 @@
}
}
- ProjectGroup projectGroup = new ProjectGroup();
-
- // ----------------------------------------------------------------------
- // Group id
- // ----------------------------------------------------------------------
-
- if ( StringUtils.isEmpty( project.getGroupId() ) )
+ if ( projectGroup != null )
{
- result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_GROUPID );
+ projectGroup = new ProjectGroup();
+
+ // ----------------------------------------------------------------------
+ // Group id
+ // ----------------------------------------------------------------------
+
+ if ( StringUtils.isEmpty( project.getGroupId() ) )
+ {
+ result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_GROUPID );
+ }
+
+ projectGroup.setGroupId( project.getGroupId() );
+
+ // ----------------------------------------------------------------------
+ // Name
+ // ----------------------------------------------------------------------
+
+ String name = project.getName();
+
+ if ( StringUtils.isEmpty( name ) )
+ {
+ name = project.getGroupId();
+ }
+
+ projectGroup.setName( name );
+
+ // ----------------------------------------------------------------------
+ // Description
+ // ----------------------------------------------------------------------
+
+ projectGroup.setDescription( project.getDescription() );
}
- projectGroup.setGroupId( project.getGroupId() );
-
- // ----------------------------------------------------------------------
- // Name
- // ----------------------------------------------------------------------
-
- String name = project.getName();
-
- if ( StringUtils.isEmpty( name ) )
- {
- name = project.getGroupId();
- }
-
- projectGroup.setName( name );
-
- // ----------------------------------------------------------------------
- // Description
- // ----------------------------------------------------------------------
-
- projectGroup.setDescription( project.getDescription() );
-
result.addProjectGroup( projectGroup );
return result;
diff --git a/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java b/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
index 2a7607a..2aed974 100644
--- a/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
+++ b/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
@@ -20,6 +20,7 @@
*/
import org.apache.continuum.dao.LocalRepositoryDao;
+import org.apache.continuum.dao.ProjectGroupDao;
import org.apache.continuum.dao.ScheduleDao;
import org.apache.continuum.model.repository.LocalRepository;
import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
@@ -86,6 +87,11 @@
private Project rootProject;
+ /**
+ * @plexus.requirement
+ */
+ private ProjectGroupDao projectGroupDao;
+
// ----------------------------------------------------------------------
// AbstractContinuumProjectBuilder Implementation
// ----------------------------------------------------------------------
@@ -118,6 +124,16 @@
boolean checkoutInSingleDirectory )
throws ContinuumProjectBuilderException
{
+ return buildProjectsFromMetadata( url, username, password, loadRecursiveProjects, buildDefinitionTemplate, checkoutInSingleDirectory, -1 );
+ }
+
+ public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
+ boolean loadRecursiveProjects,
+ BuildDefinitionTemplate buildDefinitionTemplate,
+ boolean checkoutInSingleDirectory,
+ int projectGroupId )
+ throws ContinuumProjectBuilderException
+ {
// ----------------------------------------------------------------------
// We need to roll the project data into a file so that we can use it
// ----------------------------------------------------------------------
@@ -126,13 +142,23 @@
try
{
- readModules( url, result, true, username, password, null, loadRecursiveProjects, buildDefinitionTemplate,
+ ProjectGroup projectGroup = null;
+ if ( projectGroupId > 0 )
+ {
+ projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( projectGroupId );
+ }
+
+ readModules( url, result, projectGroup, username, password, null, loadRecursiveProjects, buildDefinitionTemplate,
checkoutInSingleDirectory );
}
catch ( BuildDefinitionServiceException e )
{
throw new ContinuumProjectBuilderException( e.getMessage(), e );
}
+ catch ( ContinuumStoreException e )
+ {
+ throw new ContinuumProjectBuilderException( e.getMessage(), e );
+ }
return result;
}
@@ -140,7 +166,7 @@
//
// ----------------------------------------------------------------------
- private void readModules( URL url, ContinuumProjectBuildingResult result, boolean groupPom, String username,
+ private void readModules( URL url, ContinuumProjectBuildingResult result, ProjectGroup projectGroup, String username,
String password, String scmUrl, boolean loadRecursiveProjects,
BuildDefinitionTemplate buildDefinitionTemplate, boolean checkoutInSingleDirectory )
throws ContinuumProjectBuilderException, BuildDefinitionServiceException
@@ -173,10 +199,9 @@
pomFile.delete();
}
}
- log.debug( "groupPom " + groupPom );
+ log.debug( "projectGroup " + projectGroup );
- ProjectGroup projectGroup = null;
- if ( groupPom )
+ if ( projectGroup == null )
{
projectGroup = buildProjectGroup( mavenProject, result );
@@ -186,48 +211,20 @@
if ( projectGroup != null )
{
List<BuildDefinition> buildDefinitions = getBuildDefinitions( buildDefinitionTemplate,
- loadRecursiveProjects );
- boolean defaultSetted = false;
+ loadRecursiveProjects,
+ mavenProject.getBuild().getDefaultGoal() );
for ( BuildDefinition buildDefinition : buildDefinitions )
{
- if ( !defaultSetted && buildDefinition.isDefaultForProject() )
- {
- buildDefinition.setDefaultForProject( true );
- defaultSetted = true;
- }
- buildDefinition = buildDefinitionService.addBuildDefinition(
- buildDefinitionService.cloneBuildDefinition( buildDefinition ) );
- //CONTINUUM-1296
- String defaultGoal = mavenProject.getBuild().getDefaultGoal();
- if ( StringUtils.isNotEmpty( defaultGoal ) )
- {
- buildDefinition.setGoals( defaultGoal );
- }
- if ( buildDefinition.getSchedule() == null )
- {
- try
- {
- Schedule schedule = scheduleDao.getScheduleByName(
- ConfigurationService.DEFAULT_SCHEDULE_NAME );
-
- buildDefinition.setSchedule( schedule );
- }
- catch ( ContinuumStoreException e )
- {
- log.warn( "Can't get default schedule.", e );
- }
- }
- // jdo complains that Collections.singletonList(bd) is a second class object and fails.
- //ArrayList arrayList = new ArrayList();
-
- //arrayList.add( buildDefinition );
+ buildDefinition = persistBuildDefinition( buildDefinition );
projectGroup.addBuildDefinition( buildDefinition );
- // .setBuildDefinitions( arrayList );
}
- result.addProjectGroup( projectGroup );
}
}
+ if ( result.getProjectGroups().isEmpty() )
+ {
+ result.addProjectGroup( projectGroup );
+ }
if ( !excludedPackagingTypes.contains( mavenProject.getPackaging() ) )
{
@@ -276,33 +273,33 @@
}
// CONTINUUM-2563
- if ( !loadRecursiveProjects )
+ // Don't create if the project has a build definition template assigned to it already
+ if ( !loadRecursiveProjects && buildDefinitionTemplate.equals( getDefaultBuildDefinitionTemplate() ) )
{
- // should only contain 1 project group
- ProjectGroup pg = result.getProjectGroups().iterator().next();
- if ( pg.equals( projectGroup ) )
+ List<BuildDefinition> buildDefinitions = projectGroup.getBuildDefinitions();
+ for ( BuildDefinition buildDefinition : buildDefinitions )
{
- List<BuildDefinition> pgBuildDefs = pg.getBuildDefinitions();
- for ( BuildDefinition bD : pgBuildDefs )
+ if ( buildDefinition.isDefaultForProject() )
{
- if ( bD.isDefaultForProject() )
+ // create a default build definition at the project level
+ BuildDefinition projectBuildDef = buildDefinitionService.cloneBuildDefinition( buildDefinition );
+ projectBuildDef.setDefaultForProject( true );
+
+ String arguments = projectBuildDef.getArguments().replace( "--non-recursive", "" );
+ arguments = arguments.replace( "-N", "" );
+ arguments = arguments.trim();
+
+ // add build definition only if it differs
+ if ( !projectBuildDef.getArguments().equals( arguments ) )
{
- // create a default build definition at the project
- // level
- BuildDefinition projectBuildDef = buildDefinitionService.cloneBuildDefinition( bD );
- projectBuildDef.setDefaultForProject( true );
-
- String arguments = projectBuildDef.getArguments().replace( "--non-recursive", "" );
- arguments = arguments.replace( "-N", "" );
- projectBuildDef.setArguments( arguments );
-
log.info( "Adding default build definition for project '" + continuumProject.getName() +
"' without '--non-recursive' flag." );
+ projectBuildDef.setArguments( arguments );
continuumProject.addBuildDefinition( projectBuildDef );
-
- break;
}
+
+ break;
}
}
}
@@ -386,19 +383,59 @@
moduleScmUrl = scmUrl + "/" + modulePath;
}
// we are in recursive loading mode
- readModules( moduleUrl, result, false, username, password, moduleScmUrl, true,
+ readModules( moduleUrl, result, projectGroup, username, password, moduleScmUrl, true,
buildDefinitionTemplate, checkoutInSingleDirectory );
}
}
}
}
- private List<BuildDefinition> getBuildDefinitions( BuildDefinitionTemplate template, boolean loadRecursiveProjects )
+ private BuildDefinition persistBuildDefinition( BuildDefinition buildDefinition )
+ throws BuildDefinitionServiceException
+ {
+ buildDefinition = buildDefinitionService.addBuildDefinition( buildDefinition );
+ if ( buildDefinition.getSchedule() == null )
+ {
+ try
+ {
+ Schedule schedule = scheduleDao.getScheduleByName(
+ ConfigurationService.DEFAULT_SCHEDULE_NAME );
+
+ buildDefinition.setSchedule( schedule );
+ }
+ catch ( ContinuumStoreException e )
+ {
+ log.warn( "Can't get default schedule.", e );
+ }
+ }
+ return buildDefinition;
+ }
+
+ private List<BuildDefinition> getBuildDefinitions( BuildDefinitionTemplate template, boolean loadRecursiveProjects,
+ String defaultGoal )
throws ContinuumProjectBuilderException, BuildDefinitionServiceException
{
List<BuildDefinition> buildDefinitions = new ArrayList<BuildDefinition>();
- for ( BuildDefinition buildDefinition : (List<BuildDefinition>) template.getBuildDefinitions() )
+ boolean defaultSet = false;
+ for ( BuildDefinition buildDefinition : template.getBuildDefinitions() )
{
+ buildDefinition = buildDefinitionService.cloneBuildDefinition( buildDefinition );
+
+ if ( !defaultSet && buildDefinition.isDefaultForProject() )
+ {
+ defaultSet = true;
+
+ //CONTINUUM-1296
+ if ( StringUtils.isNotEmpty( defaultGoal ) )
+ {
+ buildDefinition.setGoals( defaultGoal );
+ }
+ }
+ else
+ {
+ buildDefinition.setDefaultForProject( false );
+ }
+
// due to CONTINUUM-1207 CONTINUUM-1436 user can do what they want with arguments
// we must remove if exists --non-recursive or -N
if ( !loadRecursiveProjects )
@@ -412,6 +449,7 @@
{
String arguments = buildDefinition.getArguments().replace( "--non-recursive", "" );
arguments = arguments.replace( "-N", "" );
+ arguments = arguments.trim();
buildDefinition.setArguments( arguments );
}
}
diff --git a/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java b/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java
index f7647be..aaa591d 100755
--- a/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java
+++ b/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java
@@ -45,6 +45,8 @@
protected BuildDefinition bd;
+ protected BuildDefinitionService bds;
+
@Override
protected void setUp()
throws Exception
@@ -55,7 +57,7 @@
bd.setBuildFile( "pom.xml" );
bd.setDescription( "my foo" );
bd.setTemplate( true );
- BuildDefinitionService bds = (BuildDefinitionService) lookup( BuildDefinitionService.class.getName(),
+ bds = (BuildDefinitionService) lookup( BuildDefinitionService.class.getName(),
"default" );
bd = bds.addBuildDefinition( bd );
@@ -84,6 +86,7 @@
pg = getContinuum().getProjectGroupWithBuildDetails( pg.getId() );
// group created with the m2 default build def
assertEquals( 1, pg.getBuildDefinitions().size() );
+ assertEquals( "clean install", pg.getBuildDefinitions().get( 0 ).getGoals() );
File rootPom = getTestFile( "src/test/resources/projects/continuum/continuum-core/pom.xml" );
@@ -100,11 +103,10 @@
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() );
+ // project with the build def coming from template
+ assertEquals( "clean deploy", project.getBuildDefinitions().get( 0 ).getGoals() );
}
public void testAddProjectWithGroupCreationWithBuildDefTemplate()
@@ -177,24 +179,26 @@
pg = getContinuum().getProjectGroupWithBuildDetails( pg.getId() );
- log.info( " pg groupId " + pg.getGroupId() );
//@ group level the db from template must be used
- log.info( " mg builddefs size " + pg.getBuildDefinitions().size() );
- log.info( "pg bd goals " + ( (BuildDefinition) pg.getBuildDefinitions().get( 0 ) ).getGoals() );
- assertEquals( "clean install", ( (BuildDefinition) pg.getBuildDefinitions().get( 0 ) ).getGoals() );
+ assertEquals( "clean install", pg.getBuildDefinitions().get( 0 ).getGoals() );
}
public void testAddProjectToExistingGroupDefaultBuildDef()
throws Exception
{
-
ProjectGroup pg = new ProjectGroup();
- pg.setName( "foo" );
+ String groupId = "foo";
+ pg.setName( groupId );
+ pg.setGroupId( groupId );
pg.setDescription( "foo pg" );
getContinuum().addProjectGroup( pg );
- pg = getContinuum().getAllProjectGroups().get( 1 );
- assertEquals( 2, getContinuum().getAllProjectGroups().size() );
+ pg = getContinuum().getProjectGroupByGroupIdWithBuildDetails( groupId );
+
+ assertEquals( 1, pg.getBuildDefinitions().size() );
+ BuildDefinition buildDefinition = pg.getBuildDefinitions().get( 0 );
+ assertEquals( "clean install", buildDefinition.getGoals() );
+ assertEquals( "--batch-mode --non-recursive", buildDefinition.getArguments() );
File rootPom = getTestFile( "src/test/resources/projects/continuum/continuum-core/pom.xml" );
@@ -211,16 +215,51 @@
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() );
assertEquals( 1, project.getBuildDefinitions().size() );
- pg = result.getProjectGroups().get( 0 );
- pg = getContinuum().getProjectGroupWithBuildDetails( pg.getId() );
-
- assertEquals( "clean install", pg.getBuildDefinitions().get( 0 ).getGoals() );
+ buildDefinition = project.getBuildDefinitions().get( 0 );
+ assertEquals( "clean install", buildDefinition.getGoals() );
+ assertEquals( "--batch-mode", buildDefinition.getArguments() );
}
+ public void testAddProjectToExistingGroupMatchingBuildDef()
+ throws Exception
+ {
+ ProjectGroup pg = new ProjectGroup();
+ String groupId = "testAddProjectToExistingGroupMatchingBuildDef";
+ pg.setName( groupId );
+ pg.setGroupId( groupId );
+ pg.setDescription( "foo pg" );
+ getContinuum().addProjectGroup( pg );
+ pg = getContinuum().getProjectGroupByGroupIdWithBuildDetails( groupId );
+
+ assertEquals( 1, pg.getBuildDefinitions().size() );
+ BuildDefinition buildDefinition = pg.getBuildDefinitions().get( 0 );
+ buildDefinition.setArguments( "--batch-mode" );
+ bds.updateBuildDefinition( buildDefinition );
+
+ pg = getContinuum().getProjectGroupByGroupIdWithBuildDetails( groupId );
+ buildDefinition = pg.getBuildDefinitions().get( 0 );
+ assertEquals( "clean install", buildDefinition.getGoals() );
+ assertEquals( "--batch-mode", buildDefinition.getArguments() );
+
+ 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, -1, false );
+ assertNotNull( result );
+
+ assertEquals( Collections.emptyList(), result.getErrors() );
+
+ assertEquals( 1, result.getProjects().size() );
+
+ Project project = result.getProjects().get( 0 );
+ project = getContinuum().getProjectWithBuildDetails( project.getId() );
+ assertNotNull( project );
+ assertEquals( 0, project.getBuildDefinitions().size() );
+ }
private Continuum getContinuum()
throws Exception
diff --git a/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java b/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
index ae71256..8dcfc4b 100644
--- a/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
+++ b/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
@@ -346,11 +346,6 @@
assertTrue( "project group build definition is not default", pgbd.isDefaultForProject() );
- // project was added as a single project (loadRecursiveProjects == false) so project should not
- // get the PG's build def which has '--non-recursive' flag set in its argument
- assertTrue( "project group build definition should not be the default for project",
- continuum.getDefaultBuildDefinition( project.getId() ).getId() != pgbd.getId() );
-
BuildDefinition nbd = new BuildDefinition();
nbd.setGoals( "clean" );
nbd.setArguments( "" );
diff --git a/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java b/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java
index 60dc958..2c815f5 100644
--- a/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java
+++ b/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java
@@ -84,6 +84,16 @@
return null;
}
+ public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
+ boolean recursiveProjects,
+ BuildDefinitionTemplate buildDefinitionTemplate,
+ boolean checkoutInSingleDirectory,
+ int projectGroupId )
+ throws ContinuumProjectBuilderException
+ {
+ return null;
+ }
+
public BuildDefinitionTemplate getDefaultBuildDefinitionTemplate()
throws ContinuumProjectBuilderException
{