continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r943391 [2/3] - in /continuum/branches/continuum-flat-multi-module-updated: ./ continuum-api/src/main/java/org/apache/continuum/buildmanager/ continuum-api/src/main/java/org/apache/continuum/taskqueue/ continuum-api/src/main/java/org/apache...
Date Wed, 12 May 2010 06:41:28 GMT
Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java Wed May 12 06:41:26 2010
@@ -61,13 +61,20 @@ import org.codehaus.plexus.util.xml.pull
 public class CreateProjectsFromMetadataAction
     extends AbstractContinuumAction
 {
-    private static final String KEY_URL = "url";
+    // TODO: Review and fix access of constant variables used for build context!
+    
+    //private static final String KEY_URL = "url";
+    
+	public static final String KEY_PROJECT_BUILDER_ID = "builderId";
 
-    private static final String KEY_PROJECT_BUILDER_ID = "builderId";
+    //private static final String KEY_PROJECT_BUILDER_ID = "builderId";
+	public static final String KEY_PROJECT_BUILDING_RESULT = "projectBuildingResult";
 
-    private static final String KEY_PROJECT_BUILDING_RESULT = "projectBuildingResult";
+    //private static final String KEY_PROJECT_BUILDING_RESULT = "projectBuildingResult";
+	public static final String KEY_LOAD_RECURSIVE_PROJECTS = "loadRecursiveProjects";
 
-    private static final String KEY_LOAD_RECURSIVE_PROJECTS = "loadRecursiveProjects";
+    //private static final String KEY_LOAD_RECURSIVE_PROJECTS = "loadRecursiveProjects";
+	public static final String KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY = "checkoutProjectsInSingleDirectory";
 
     /**
      * @plexus.requirement
@@ -87,11 +94,16 @@ public class CreateProjectsFromMetadataA
     public void execute( Map context )
         throws ContinuumException, ContinuumProjectBuilderManagerException, ContinuumProjectBuilderException
     {
-        String projectBuilderId = getProjectBuilderId( context );
+        //String projectBuilderId = getProjectBuilderId( context );
+    	String projectBuilderId = getString( context, KEY_PROJECT_BUILDER_ID );
 
-        boolean loadRecursiveProjects = isLoadRecursiveProject( context );
+        //boolean loadRecursiveProjects = isLoadRecursiveProject( context );
+    	boolean loadRecursiveProjects = getBoolean( context, KEY_LOAD_RECURSIVE_PROJECTS );
+    	        
+        boolean checkoutProjectsInSingleDirectory = getBoolean( context, KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY );
 
-        String curl = getUrl( context );
+        //String curl = getUrl( context );
+        String curl = getString( context, KEY_URL );
 
         URL url;
 
@@ -111,7 +123,7 @@ public class CreateProjectsFromMetadataA
                 url = new URL( curl );
 
                 result = projectBuilder.buildProjectsFromMetadata( url, null, null, loadRecursiveProjects,
-                                                                   buildDefinitionTemplate );
+                		 						buildDefinitionTemplate, checkoutProjectsInSingleDirectory );
 
             }
             else
@@ -150,7 +162,7 @@ public class CreateProjectsFromMetadataA
                 {
 
                     result = projectBuilder.buildProjectsFromMetadata( url, username, password, loadRecursiveProjects,
-                                                                       buildDefinitionTemplate );
+                    											buildDefinitionTemplate, checkoutProjectsInSingleDirectory );
 
                 }
                 else
@@ -177,7 +189,8 @@ public class CreateProjectsFromMetadataA
                     }
                 }
 
-                setUrl( context, scmRootUrl );
+                //setUrl( context, scmRootUrl );
+                context.put( KEY_PROJECT_SCM_ROOT_URL, scmRootUrl );
             }
         }
         catch ( MalformedURLException e )
@@ -193,7 +206,8 @@ public class CreateProjectsFromMetadataA
             result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
         }
 
-        setProjectBuildingResult( context, result );
+        //setProjectBuildingResult( context, result );
+        context.put( KEY_PROJECT_BUILDING_RESULT, result );
     }
 
     private String hidePasswordInUrl( String url )
@@ -299,7 +313,7 @@ public class CreateProjectsFromMetadataA
         this.urlValidator = urlValidator;
     }
 
-    public static ContinuumProjectBuildingResult getProjectBuildingResult( Map<String, Object> context )
+    /*public static ContinuumProjectBuildingResult getProjectBuildingResult( Map<String, Object> context )
     {
         return (ContinuumProjectBuildingResult) getObject( context, KEY_PROJECT_BUILDING_RESULT );
     }
@@ -337,5 +351,5 @@ public class CreateProjectsFromMetadataA
     public static void setLoadRecursiveProject( Map<String, Object> context, boolean loadRecursiveProject )
     {
         context.put( KEY_LOAD_RECURSIVE_PROJECTS, loadRecursiveProject );
-    }
+    }*/
 }

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/DeployArtifactContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/DeployArtifactContinuumAction.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/DeployArtifactContinuumAction.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/DeployArtifactContinuumAction.java Wed May 12 06:41:26 2010
@@ -101,10 +101,14 @@ public class DeployArtifactContinuumActi
             if ( project.getState() == ContinuumProjectState.OK )
             {
                 BuildDefinition buildDefinition = getBuildDefinition( context );
+                
+                String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl() );
+                
+                List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot( context );
 
                 List<Artifact> artifacts = buildExecutor.getDeployableArtifacts( project,
-                                                                                 workingDirectoryService.getWorkingDirectory(
-                                                                                     project ), buildDefinition );
+                									workingDirectoryService.getWorkingDirectory( 
+                									project, projectScmRootUrl, projectsWithCommonScmRoot ), buildDefinition );
 
                 LocalRepository repository = project.getProjectGroup().getLocalRepository();
 

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java Wed May 12 06:41:26 2010
@@ -204,12 +204,15 @@ public class ExecuteBuilderContinuumActi
             AbstractContinuumAction.setProject( context, project );
 
             projectDao.updateProject( project );
+            
+            String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl() );
+            List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot( context );
 
             // ----------------------------------------------------------------------
             // Backup test result files
             // ----------------------------------------------------------------------
             //TODO: Move as a plugin
-            buildExecutor.backupTestFiles( project, buildResult.getId() );
+            buildExecutor.backupTestFiles( project, buildResult.getId(), projectScmRootUrl, projectsWithCommonScmRoot );
         }
     }
 

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java Wed May 12 06:41:26 2010
@@ -19,6 +19,7 @@ package org.apache.maven.continuum.core.
  * under the License.
  */
 
+import java.util.List;
 import java.util.Map;
 
 import org.apache.continuum.dao.BuildDefinitionDao;
@@ -80,9 +81,11 @@ public class UpdateProjectFromWorkingDir
         ContinuumBuildExecutor builder = buildExecutorManager.getBuildExecutor( project.getExecutorId() );
 
         ScmResult scmResult = (ScmResult) context.get( "scmResult" );
-        builder.updateProjectFromCheckOut( workingDirectoryService.getWorkingDirectory( project ), project,
-                                           buildDefinition, scmResult );
-
+        List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot( context );
+        String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl() );
+        
+        builder.updateProjectFromCheckOut( workingDirectoryService.getWorkingDirectory( project, 
+                        projectScmRootUrl, projectsWithCommonScmRoot ), project, buildDefinition, scmResult );
         // ----------------------------------------------------------------------
         // Store the new descriptor
         // ----------------------------------------------------------------------

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java Wed May 12 06:41:26 2010
@@ -116,9 +116,15 @@ public class UpdateWorkingDirectoryFromS
         {
             notifier.checkoutStarted( project, buildDefinition );
 
-            // TODO: not sure why this is different to the context, but it all needs to change
-            File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
-            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory );
+            List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot( context );           
+            String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl() );
+            
+         // TODO: not sure why this is different to the context, but it all needs to change            
+            File workingDirectory =
+                workingDirectoryService.getWorkingDirectory( project, projectScmRootUrl,
+                                                             projectsWithCommonScmRoot );    
+            
+            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory, projectScmRootUrl );
             config.setLatestUpdateDate( latestUpdateDate );
             String tag = config.getTag();
             String msg =
@@ -198,10 +204,19 @@ public class UpdateWorkingDirectoryFromS
         AbstractContinuumAction.setProject( context, project );
     }
 
-    private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory )
+    private ContinuumScmConfiguration createScmConfiguration( Project project, File workingDirectory, String scmRootUrl )
     {
         ContinuumScmConfiguration config = new ContinuumScmConfiguration();
-        config.setUrl( project.getScmUrl() );
+        
+        if( project.isCheckedOutInSingleDirectory() && scmRootUrl!= null && !"".equals( scmRootUrl ) )
+        {
+            config.setUrl( scmRootUrl );
+        }
+        else
+        {
+            config.setUrl( project.getScmUrl() );
+        }
+        
         config.setUsername( project.getScmUsername() );
         config.setPassword( project.getScmPassword() );
         config.setUseCredentialsCache( project.isScmUseCache() );

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java Wed May 12 06:41:26 2010
@@ -248,7 +248,7 @@ public abstract class AbstractBuildExecu
         throws ContinuumBuildExecutorException
     {
 
-        File workingDirectory = getWorkingDirectory( project );
+    	File workingDirectory = getWorkingDirectory( project, null, null );
 
         String actualExecutable = findExecutable( executable, defaultExecutable, resolveExecutable, workingDirectory );
 
@@ -340,7 +340,7 @@ public abstract class AbstractBuildExecu
         return jdk.getVarValue();
     }
 
-    public void backupTestFiles( Project project, int buildId )
+    public void backupTestFiles( Project project, int buildId, String projectScmRootUrl, List<Project> projectsWithCommonScmRoot )
     {
         //Nothing to do, by default
     }
@@ -456,7 +456,7 @@ public abstract class AbstractBuildExecu
         return Collections.EMPTY_LIST;
     }
 
-    public File getWorkingDirectory( Project project )
+    public File getWorkingDirectory( Project project, String projectScmRootUrl, List<Project> projectsWithCommonScmRoot )
     {
         return getWorkingDirectoryService().getWorkingDirectory( project );
     }

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java Wed May 12 06:41:26 2010
@@ -338,7 +338,7 @@ public class MavenTwoBuildExecutor
     }
 
     @Override
-    public void backupTestFiles( Project project, int buildId )
+    public void backupTestFiles( Project project, int buildId, String projectScmRootUrl, List<Project> projectsWithCommonScmRoot )
     {
         File backupDirectory = null;
         try
@@ -353,7 +353,7 @@ public class MavenTwoBuildExecutor
         {
             log.info( "error on surefire backup directory creation skip backup " + e.getMessage(), e );
         }
-        backupTestFiles( getWorkingDirectory( project ), backupDirectory );
+        backupTestFiles( getWorkingDirectory( project, projectScmRootUrl, projectsWithCommonScmRoot ), backupDirectory );
     }
 
     private void backupTestFiles( File workingDir, File backupDirectory )

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java Wed May 12 06:41:26 2010
@@ -67,17 +67,17 @@ public class MavenOneContinuumProjectBui
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password )
         throws ContinuumProjectBuilderException
     {
-        return buildProjectsFromMetadata( url, username, password, true );
+    	return buildProjectsFromMetadata( url, username, password, true, false );
     }
 
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
-                                                                     boolean recursiveProjects )
+    						boolean recursiveProjects, boolean checkoutInSingleDirectory )
         throws ContinuumProjectBuilderException
     {
         try
         {
             return buildProjectsFromMetadata( url, username, password, recursiveProjects,
-                                              buildDefinitionService.getDefaultMavenOneBuildDefinitionTemplate() );
+            				buildDefinitionService.getDefaultMavenOneBuildDefinitionTemplate(), false );
         }
         catch ( BuildDefinitionServiceException e )
         {
@@ -87,7 +87,7 @@ public class MavenOneContinuumProjectBui
 
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
                                                                      boolean recursiveProjects,
-                                                                     BuildDefinitionTemplate buildDefinitionTemplate )
+                                                                     BuildDefinitionTemplate buildDefinitionTemplate, boolean checkoutInSingleDirectory )
         throws ContinuumProjectBuilderException
     {
         ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java Wed May 12 06:41:26 2010
@@ -83,6 +83,8 @@ public class MavenTwoContinuumProjectBui
      * @plexus.configuration
      */
     private List<String> excludedPackagingTypes = new ArrayList<String>();
+        
+    private Project rootProject;
 
     // ----------------------------------------------------------------------
     // AbstractContinuumProjectBuilder Implementation
@@ -90,17 +92,18 @@ public class MavenTwoContinuumProjectBui
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password )
         throws ContinuumProjectBuilderException
     {
-        return buildProjectsFromMetadata( url, username, password, true );
+    	return buildProjectsFromMetadata( url, username, password, true, false );
     }
 
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
-                                                                     boolean loadRecursiveProjects )
+    				boolean loadRecursiveProjects, boolean checkoutInSingleDirectory )
         throws ContinuumProjectBuilderException
     {
         try
         {
             return buildProjectsFromMetadata( url, username, password, loadRecursiveProjects,
-                                              buildDefinitionService.getDefaultMavenTwoBuildDefinitionTemplate() );
+            						buildDefinitionService.getDefaultMavenTwoBuildDefinitionTemplate(),
+                                    checkoutInSingleDirectory );
         }
         catch ( BuildDefinitionServiceException e )
         {
@@ -110,7 +113,7 @@ public class MavenTwoContinuumProjectBui
 
     public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
                                                                      boolean loadRecursiveProjects,
-                                                                     BuildDefinitionTemplate buildDefinitionTemplate )
+                                                                     BuildDefinitionTemplate buildDefinitionTemplate, boolean checkoutInSingleDirectory )
         throws ContinuumProjectBuilderException
     {
         // ----------------------------------------------------------------------
@@ -121,7 +124,7 @@ public class MavenTwoContinuumProjectBui
 
         try
         {
-            readModules( url, result, true, username, password, null, loadRecursiveProjects, buildDefinitionTemplate );
+        	readModules( url, result, true, username, password, null, loadRecursiveProjects, buildDefinitionTemplate, checkoutInSingleDirectory );
         }
         catch ( BuildDefinitionServiceException e )
         {
@@ -136,7 +139,7 @@ public class MavenTwoContinuumProjectBui
 
     private void readModules( URL url, ContinuumProjectBuildingResult result, boolean groupPom, String username,
                               String password, String scmUrl, boolean loadRecursiveProjects,
-                              BuildDefinitionTemplate buildDefinitionTemplate )
+                              BuildDefinitionTemplate buildDefinitionTemplate, boolean checkoutInSingleDirectory )
         throws ContinuumProjectBuilderException, BuildDefinitionServiceException
     {
 
@@ -238,6 +241,9 @@ public class MavenTwoContinuumProjectBui
                     continuumProject.setScmPassword( password );
                 }
             }
+            
+            continuumProject.setCheckedOutInSingleDirectory( checkoutInSingleDirectory );
+            
             // New project
             builderHelper.mapMavenProjectToContinuumProject( result, mavenProject, continuumProject, true);
 
@@ -264,6 +270,13 @@ public class MavenTwoContinuumProjectBui
                 continuumProject.setScmTag( mavenProject.getScm().getTag() );
             }
             result.addProject( continuumProject, MavenTwoBuildExecutor.ID );
+            
+                        
+	        if( checkoutInSingleDirectory && rootProject == null )
+	        {
+	            rootProject = continuumProject;
+	            result.setRootProject( rootProject );
+	        }
         }
 
         List<String> modules = mavenProject.getModules();
@@ -300,6 +313,7 @@ public class MavenTwoContinuumProjectBui
 
                     try
                     {
+                    	urlString = StringUtils.replace( urlString, '\\', '/' );
                         moduleUrl = new URL( urlString );
                     }
                     catch ( MalformedURLException e )
@@ -308,19 +322,34 @@ public class MavenTwoContinuumProjectBui
                         result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL, urlString );
                         continue;
                     }
-
-                    String moduleScmUrl;
-                    if ( scmUrl.endsWith( "/" ) )
-                    {
-                        moduleScmUrl = scmUrl + module;
+                    
+                    String moduleScmUrl = "";                    
+                 
+                    String modulePath = StringUtils.replace( new String( module ), '\\', '/' );
+                    
+                    // check if module is relative
+                    if( modulePath.indexOf( "../" ) != -1 )
+                    {   
+                        int depth =
+                            StringUtils.countMatches( StringUtils.substring( modulePath, 0,
+                                                                             modulePath.lastIndexOf( '/' ) + 1 ), "/" );
+                        
+                        String baseUrl = "";
+                        for( int j = 1; j <= depth; j++ )
+                        {
+                            scmUrl = StringUtils.chompLast( new String( scmUrl ), "/" );
+                            baseUrl = StringUtils.substring( scmUrl, 0, scmUrl.lastIndexOf( '/' ) );                            
+                        }
+                        moduleScmUrl = baseUrl + "/" + StringUtils.substring( modulePath, modulePath.lastIndexOf( "../" ) + 3 );
                     }
                     else
                     {
-                        moduleScmUrl = scmUrl + "/" + module;
+                    	scmUrl = StringUtils.chompLast( scmUrl, "/" );
+                    	moduleScmUrl = scmUrl + "/" + modulePath;
                     }
                     // we are in recursive loading mode
                     readModules( moduleUrl, result, false, username, password, moduleScmUrl, true,
-                                 buildDefinitionTemplate );
+                    		buildDefinitionTemplate, checkoutInSingleDirectory );
                 }
             }
         }

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java Wed May 12 06:41:26 2010
@@ -95,6 +95,11 @@ public class CheckOutTaskExecutor
         CheckoutProjectContinuumAction.setScmUsername( context, task.getScmUserName() );
 
         CheckoutProjectContinuumAction.setScmPassword( context, task.getScmPassword() );
+        
+        context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL, task.getScmRootUrl() );
+        
+        context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT,
+                             task.getProjectsWithCommonScmRoot() );
 
         try
         {

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java Wed May 12 06:41:26 2010
@@ -24,10 +24,12 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.io.File;
 
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.continuum.dao.ProjectScmRootDao;
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.taskqueue.PrepareBuildProjectsTask;
@@ -103,6 +105,11 @@ public class PrepareBuildProjectsTaskExe
      */
     private ContinuumNotificationDispatcher notifierDispatcher;
 
+    /**
+     * @plexus.requirement
+     */
+    private ProjectGroupDao projectGroupDao;
+
     public void executeTask( Task task )
         throws TaskExecutionException
     {
@@ -113,58 +120,89 @@ public class PrepareBuildProjectsTaskExe
         Set<Integer> projectsId = projectsBuildDefinitionsMap.keySet();
         Map<String, Object> context = new HashMap<String, Object>();
         Map<Integer, ScmResult> scmResultMap = new HashMap<Integer, ScmResult>();
+        List<Project> projectList = new ArrayList<Project>();
+        int projectGroupId = 0;
 
         try
         {
-            for ( Integer projectId : projectsId )
+        	if ( !projectsId.isEmpty() )
             {
-                int buildDefinitionId = projectsBuildDefinitionsMap.get( projectId );
+        	    int projectId = projectsId.iterator().next();
+                Project project = projectDao.getProject( projectId );
+                ProjectGroup projectGroup = project.getProjectGroup();
+                projectGroupId = projectGroup.getId();
 
-                log.info( "Initializing prepare build" );
-                context = initializeContext( projectId, buildDefinitionId, prepareTask.getBuildTrigger() );
+                List<Project> projects = projectDao.getProjectsWithDependenciesByGroupId( projectGroupId );
+                                projectList = ProjectSorter.getSortedProjects( projects, log );
+            }
 
-                log.info(
-                    "Starting prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
-                startPrepareBuild( context );
+            Project rootProject = null;
 
-                if ( !checkProjectScmRoot( context ) )
+            for ( Project project : projectList )
+            {
+	            if ( rootProject == null )
                 {
-                    break;
+                    // first project is the root project.
+                    rootProject = project;
                 }
 
-                try
+                int projectId = project.getId();
+                int buildDefinitionId;
+
+                if ( projectsBuildDefinitionsMap.get( projectId ) != null )
                 {
-                    if ( AbstractContinuumAction.getBuildDefinition( context ).isBuildFresh() )
+                    buildDefinitionId = projectsBuildDefinitionsMap.get( projectId );
+
+                    log.info( "Initializing prepare build" );
+                    context = initializeContext( project, buildDefinitionId, prepareTask.getBuildTrigger() );
+    
+                    log.info(
+                        "Starting prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
+                    startPrepareBuild( context );
+    
+                    if ( !checkProjectScmRoot( context ) )
                     {
-                        log.info( "Purging existing working copy" );
-                        cleanWorkingDirectory( context );
+                    	break;
                     }
 
-                    // ----------------------------------------------------------------------
-                    // TODO: Centralize the error handling from the SCM related actions.
-                    // ContinuumScmResult should return a ContinuumScmResult from all
-                    // methods, even in a case of failure.
-                    // ----------------------------------------------------------------------
-                    log.info( "Updating working dir" );
-                    updateWorkingDirectory( context );
-
-                    log.info( "Merging SCM results" );
-                    //CONTINUUM-1393
-                    if ( !AbstractContinuumAction.getBuildDefinition( context ).isBuildFresh() )
+                    try
+                    {
+                        if ( AbstractContinuumAction.getBuildDefinition( context ).isBuildFresh() )
+                        {
+                            log.info( "Purging existing working copy" );
+                            cleanWorkingDirectory( context );
+                        }
+    
+                        // ----------------------------------------------------------------------
+                        // TODO: Centralize the error handling from the SCM related actions.
+                        // ContinuumScmResult should return a ContinuumScmResult from all
+                        // methods, even in a case of failure.
+                        // ----------------------------------------------------------------------
+                        log.info( "Updating working dir" );
+                        updateWorkingDirectory( context, rootProject );
+    
+                        log.info( "Merging SCM results" );
+                        //CONTINUUM-1393
+                        if ( !AbstractContinuumAction.getBuildDefinition( context ).isBuildFresh() )
+                        {
+                            mergeScmResults( context );
+                        }
+                    }
+                    finally
                     {
-                        mergeScmResults( context );
+                        log.info(
+                            "Ending prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
+                        scmResultMap.put( AbstractContinuumAction.getProjectId( context ),
+                                          AbstractContinuumAction.getScmResult( context, null ) );
+                        endProjectPrepareBuild( context );
                     }
                 }
-                finally
-                {
-                    log.info(
-                        "Ending prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
-                    scmResultMap.put( AbstractContinuumAction.getProjectId( context ),
-                                      AbstractContinuumAction.getScmResult( context, new ScmResult() ) );
-                    endProjectPrepareBuild( context );
-                }
             }
         }
+        catch ( ContinuumStoreException e )
+        {
+            throw new TaskExecutionException( "Failed to prepare build project group: " + projectGroupId, e );
+        }
         finally
         {
             log.info( "Ending prepare build" );
@@ -173,35 +211,38 @@ public class PrepareBuildProjectsTaskExe
 
         if ( checkProjectScmRoot( context ) )
         {
-            int projectGroupId = AbstractContinuumAction.getProjectGroupId( context );
-            buildProjects( projectGroupId, projectsBuildDefinitionsMap, buildTrigger, scmResultMap );
+            projectGroupId = AbstractContinuumAction.getProjectGroupId( context );
+            buildProjects( projectGroupId, projectList, projectsBuildDefinitionsMap, buildTrigger, scmResultMap );
         }
     }
 
-    private Map<String, Object> initializeContext( int projectId, int buildDefinitionId, BuildTrigger buildTrigger )
+    private Map<String, Object> initializeContext( Project project, int buildDefinitionId, BuildTrigger buildTrigger )
         throws TaskExecutionException
     {
         Map<String, Object> context = new HashMap<String, Object>();
 
         try
         {
-            Project project = projectDao.getProject( projectId );
             ProjectGroup projectGroup = project.getProjectGroup();
 
             List<ProjectScmRoot> scmRoots = projectScmRootDao.getProjectScmRootByProjectGroup( projectGroup.getId() );
             String projectScmUrl = project.getScmUrl();
+            String projectScmRootAddress = "";
 
             for ( ProjectScmRoot projectScmRoot : scmRoots )
             {
+            	projectScmRootAddress = projectScmRoot.getScmRootAddress();
+            	
                 if ( projectScmUrl.startsWith( projectScmRoot.getScmRootAddress() ) )
                 {
                     AbstractContinuumAction.setProjectScmRoot( context, projectScmRoot );
+                    context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL, projectScmRootAddress );
                     break;
                 }
             }
 
             AbstractContinuumAction.setProjectGroupId( context, projectGroup.getId() );
-            AbstractContinuumAction.setProjectId( context, projectId );
+            AbstractContinuumAction.setProjectId( context, project.getId() );
             AbstractContinuumAction.setProject( context, project );
             AbstractContinuumAction.setBuildTrigger( context, buildTrigger );
 
@@ -209,13 +250,28 @@ public class PrepareBuildProjectsTaskExe
             AbstractContinuumAction.setBuildDefinition( context,
                                                         buildDefinitionDao.getBuildDefinition( buildDefinitionId ) );
 
+             if( project.isCheckedOutInSingleDirectory() )
+             {
+                 List<Project> projectsInGroup =
+                     projectGroupDao.getProjectGroupWithProjects( projectGroup.getId() ).getProjects(); 
+                 List<Project> projectsWithCommonScmRoot = new ArrayList<Project>();            
+                 for( Project projectInGroup : projectsInGroup )
+                 {
+                     if( projectInGroup.getScmUrl().startsWith( projectScmRootAddress ) )
+                     {
+                         projectsWithCommonScmRoot.add( projectInGroup );
+                     }
+                 }            
+                 context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT, projectsWithCommonScmRoot );
+             }
+            
             BuildResult oldBuildResult =
-                buildResultDao.getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId );
+            	buildResultDao.getLatestBuildResultForBuildDefinition( project.getId(), buildDefinitionId );
 
             if ( oldBuildResult != null )
             {
                 AbstractContinuumAction.setOldScmResult( context,
-                                                         getOldScmResults( projectId, oldBuildResult.getBuildNumber(),
+                										getOldScmResults( project.getId(), oldBuildResult.getBuildNumber(),
                                                                            oldBuildResult.getEndTime() ) );
             }
             else
@@ -237,7 +293,7 @@ public class PrepareBuildProjectsTaskExe
         performAction( "clean-working-directory", context );
     }
 
-    private void updateWorkingDirectory( Map<String, Object> context )
+    private void updateWorkingDirectory( Map<String, Object> context, Project rootProject )
         throws TaskExecutionException
     {
         performAction( "check-working-directory", context );
@@ -258,6 +314,43 @@ public class PrepareBuildProjectsTaskExe
 
             AbstractContinuumAction.setWorkingDirectory( context, workingDirectoryService.getWorkingDirectory(
                 project ).getAbsolutePath() );
+            
+            List<Project> projectsWithCommonScmRoot = AbstractContinuumAction.getListOfProjectsInGroupWithCommonScmRoot( context );           
+            String projectScmRootUrl = AbstractContinuumAction.getString( context, AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl() );
+            String workingDir = null;
+
+            if ( rootProject.getId() == project.getId() )
+            {
+                workingDir = workingDirectoryService.getWorkingDirectory( project, false ).getAbsolutePath();
+
+                if ( project.isCheckedOutInSingleDirectory() )
+                {
+                    File parentDir = new File( workingDir );
+
+                    while ( !isRootDirectory( parentDir.getAbsolutePath(), project ) )
+                    {
+                        parentDir = parentDir.getParentFile();
+                    }
+
+                    if ( !parentDir.exists() )
+                    {
+                        workingDir = parentDir.getAbsolutePath();
+                    }
+                }
+            }
+
+            if ( workingDir == null || new File( workingDir ).exists() )
+            {
+                workingDir = workingDirectoryService.getWorkingDirectory( 
+                    project, projectScmRootUrl, projectsWithCommonScmRoot ).getAbsolutePath();
+            }
+
+            AbstractContinuumAction.setWorkingDirectory( context, workingDir );
+
+            if ( rootProject.getId() != project.getId() || ( rootProject.getId() == project.getId() && !isRootDirectory( workingDir, rootProject ) ) )
+            {
+                AbstractContinuumAction.setRootDirectory(context, false );
+            }
 
             performAction( "checkout-project", context );
 
@@ -509,15 +602,10 @@ public class PrepareBuildProjectsTaskExe
         }
     }
 
-    private void buildProjects( int projectGroupId, Map<Integer, Integer> projectsAndBuildDefinitionsMap,
-    		                    BuildTrigger buildTrigger, Map<Integer, ScmResult> scmResultMap )
+    private void buildProjects( int projectGroupId, List<Project> projectList, Map<Integer, Integer> projectsAndBuildDefinitionsMap, BuildTrigger buildTrigger,
+    		Map<Integer, ScmResult> scmResultMap )
         throws TaskExecutionException
-    {
-        List<Project> projects = projectDao.getProjectsWithDependenciesByGroupId( projectGroupId );
-        List<Project> projectList;
-
-        projectList = ProjectSorter.getSortedProjects( projects, log );
-
+    {   
         List<Project> projectsToBeBuilt = new ArrayList<Project>();
         Map<Integer, BuildDefinition> projectsBuildDefinitionsMap = new HashMap<Integer, BuildDefinition>();
 
@@ -566,4 +654,10 @@ public class PrepareBuildProjectsTaskExe
             throw new TaskExecutionException( "Error executing action 'build-project'", e );
         }
     }
+    
+    private boolean isRootDirectory( String workingDir, Project rootProject )
+    {
+        return workingDir.endsWith( Integer.toString( rootProject.getId() ) + System.getProperty( "line.separator" ) )
+            || workingDir.endsWith( Integer.toString( rootProject.getId() ) );
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test-projects/multi-module/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test-projects/multi-module/pom.xml?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test-projects/multi-module/pom.xml (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test-projects/multi-module/pom.xml Wed May 12 06:41:26 2010
@@ -41,5 +41,6 @@
   <modules>
     <module>module-A</module>
     <module>module-B</module>
+    <module>module-C/module-D</module>
   </modules>
 </project>

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java Wed May 12 06:41:26 2010
@@ -435,8 +435,8 @@ public class ParallelBuildsManagerTest
         recordCheckoutProjectBuildQueuesAreEmpty();
 
         buildsManager.checkoutProject( 1, "continuum-project-test-1",
-                                       new File( getBasedir(), "/target/test-working-dir/1" ), "dummy", "dummypass",
-                                       buildDef );
+        			new File( getBasedir(), "/target/test-working-dir/1" ), null, "dummy", "dummypass",
+        			buildDef, null );
         context.assertIsSatisfied();
     }
 
@@ -452,8 +452,8 @@ public class ParallelBuildsManagerTest
         recordCheckoutProjectBuildQueuesAreEmpty();
 
         buildsManager.checkoutProject( 1, "continuum-project-test-1",
-                                       new File( getBasedir(), "/target/test-working-dir/1" ), "dummy", "dummypass",
-                                       buildDef );
+	        		new File( getBasedir(), "/target/test-working-dir/1" ), null, "dummy", "dummypass",
+	    			buildDef, null );
         context.assertIsSatisfied();
 
         // queue second project - 1st queue has 1 task while 2nd queue is empty; project should be queued in
@@ -465,7 +465,7 @@ public class ParallelBuildsManagerTest
         final List<Task> tasksInFirstCheckoutQueue = new ArrayList<Task>();
         tasksInFirstCheckoutQueue.add(
             new CheckOutTask( 1, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-1",
-                              "dummy", "dummypass" ) );
+            			"dummy", "dummypass", null, null ) );
 
         context.checking( new Expectations()
         {
@@ -486,8 +486,8 @@ public class ParallelBuildsManagerTest
         recordAddToCheckoutQueue();
 
         buildsManager.checkoutProject( 2, "continuum-project-test-2",
-                                       new File( getBasedir(), "/target/test-working-dir/1" ), "dummy", "dummypass",
-                                       buildDef );
+	        		new File( getBasedir(), "/target/test-working-dir/1" ), null, "dummy", "dummypass",
+	    			buildDef, null );
         context.assertIsSatisfied();
 
         // queue third project - both queues have 1 task queued each; third project should be queued in 1st queue
@@ -509,8 +509,8 @@ public class ParallelBuildsManagerTest
         recordAddToCheckoutQueue();
 
         buildsManager.checkoutProject( 3, "continuum-project-test-3",
-                                       new File( getBasedir(), "/target/test-working-dir/1" ), "dummy", "dummypass",
-                                       buildDef );
+	        		new File( getBasedir(), "/target/test-working-dir/1" ), null, "dummy", "dummypass",
+	    			buildDef, null );
         context.assertIsSatisfied();
     }
 
@@ -613,7 +613,7 @@ public class ParallelBuildsManagerTest
         final List<CheckOutTask> checkoutTasks = new ArrayList<CheckOutTask>();
         checkoutTasks.add(
             new CheckOutTask( 2, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-2",
-                              "dummy", "dummypass" ) );
+            			"dummy", "dummypass", null, null ) );
 
         final ParallelBuildsThreadedTaskQueueExecutor buildTaskQueueExecutor =
             context.mock( ParallelBuildsThreadedTaskQueueExecutor.class, "parallel-build-task-executor" );
@@ -756,7 +756,7 @@ public class ParallelBuildsManagerTest
         final List<CheckOutTask> checkoutTasks = new ArrayList<CheckOutTask>();
         checkoutTasks.add(
             new CheckOutTask( 2, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-2",
-                              "dummy", "dummypass" ) );
+            			"dummy", "dummypass", null, null ) );
 
         try
         {
@@ -863,7 +863,7 @@ public class ParallelBuildsManagerTest
         final List<Task> tasks = new ArrayList<Task>();
         tasks.add(
             new CheckOutTask( 2, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-2",
-                              "dummy", "dummypass" ) );
+            			"dummy", "dummypass", null, null ) );
 
         context.checking( new Expectations()
         {

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java Wed May 12 06:41:26 2010
@@ -85,7 +85,7 @@ public class DefaultOverallBuildQueueTes
     {
         final CheckOutTask checkoutTask =
             new CheckOutTask( 1, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-1",
-                              "dummy", "dummypass" );
+            			"dummy", "dummypass", null, null );
         final TaskQueue checkoutQueue = context.mock( TaskQueue.class, "checkout-queue" );
 
         context.checking( new Expectations()
@@ -108,7 +108,7 @@ public class DefaultOverallBuildQueueTes
         final List<Task> tasks = new ArrayList<Task>();
         tasks.add(
             new CheckOutTask( 1, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-1",
-                              "dummy", "dummypass" ) );
+            			"dummy", "dummypass", null, null ) );
 
         context.checking( new Expectations()
         {
@@ -134,7 +134,7 @@ public class DefaultOverallBuildQueueTes
         final List<Task> tasks = new ArrayList<Task>();
         tasks.add(
             new CheckOutTask( 1, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-1",
-                              "dummy", "dummypass" ) );
+            			"dummy", "dummypass", null, null ) );
 
         context.checking( new Expectations()
         {
@@ -155,7 +155,7 @@ public class DefaultOverallBuildQueueTes
     {
         final Task checkoutTask =
             new CheckOutTask( 1, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-1",
-                              "dummy", "dummypass" );
+            			"dummy", "dummypass", null, null );
         final TaskQueue checkoutQueue = context.mock( TaskQueue.class, "checkout-queue" );
         final List<Task> tasks = new ArrayList<Task>();
         tasks.add( checkoutTask );

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java Wed May 12 06:41:26 2010
@@ -91,7 +91,7 @@ public class AddMaven2ProjectTest
         ContinuumProjectBuildingResult result = getContinuum().addMavenTwoProject(
                                                                                    rootPom.toURI().toURL()
                                                                                        .toExternalForm(), pg.getId(),
-                                                                                   true, false, false, bdt.getId() );
+                                                                                       true, false, false, bdt.getId(), false );
         assertNotNull( result );
 
         assertEquals( 1, result.getProjects().size() );
@@ -118,7 +118,7 @@ public class AddMaven2ProjectTest
         ContinuumProjectBuildingResult result = getContinuum().addMavenTwoProject(
                                                                                    rootPom.toURI().toURL()
                                                                                        .toExternalForm(), -1, true,
-                                                                                   false, true, bdt.getId() );
+                                                                                       false, true, bdt.getId(), false );
         assertNotNull( result );
 
         assertEquals( 1, result.getProjects().size() );
@@ -154,7 +154,7 @@ public class AddMaven2ProjectTest
         ContinuumProjectBuildingResult result = getContinuum().addMavenTwoProject(
                                                                                    rootPom.toURI().toURL()
                                                                                        .toExternalForm(), -1, true,
-                                                                                   false, true, -1 );
+                                                                                       false, true, -1, false );
         assertNotNull( result );
 
         assertEquals( 1, result.getProjects().size() );
@@ -202,7 +202,7 @@ public class AddMaven2ProjectTest
         ContinuumProjectBuildingResult result = getContinuum().addMavenTwoProject(
                                                                                    rootPom.toURI().toURL()
                                                                                        .toExternalForm(), pg.getId(),
-                                                                                   true, false, false, -1 );
+                                                                                       true, false, false, -1, false );
         assertNotNull( result );
 
         assertEquals( 1, result.getProjects().size() );

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java Wed May 12 06:41:26 2010
@@ -44,7 +44,7 @@ public class AddProjectTest
         
         ContinuumProjectBuildingResult result = continuum
             .executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID,
-                                                     getDefaultProjectGroup().getId(), false, true, false, -1, false );
+            						getDefaultProjectGroup().getId(), false, true, false, -1, false, false );
         assertEquals( 1, result.getProjects().size() );
         
         // read the project from store
@@ -62,7 +62,7 @@ public class AddProjectTest
 
         ContinuumProjectBuildingResult result = continuum
             .executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID,
-                                                     getDefaultProjectGroup().getId(), false, false, false, -1, false );
+            						getDefaultProjectGroup().getId(), false, false, false, -1, false, false );
         assertEquals( 1, result.getProjects().size() );
 
         // read the project from store

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java Wed May 12 06:41:26 2010
@@ -29,6 +29,7 @@ import java.util.Map;
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.model.release.ContinuumReleaseResult;
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.continuum.repository.RepositoryService;
@@ -100,7 +101,7 @@ public class DefaultContinuumTest
         assertTrue( rootPom.exists() );
 
         ContinuumProjectBuildingResult result =
-            continuum.addMavenTwoProject( rootPom.toURI().toURL().toExternalForm(), -1, true, false, true, -1 );
+        	continuum.addMavenTwoProject( rootPom.toURI().toURL().toExternalForm(), -1, true, false, true, -1, false );
 
         assertNotNull( result );
 
@@ -134,9 +135,95 @@ public class DefaultContinuumTest
 
         assertTrue( "no jabber notifier", projects.containsKey( "Continuum Jabber Notifier" ) );
 
-
     }
+    
+    // handle flat multi-module projects
+    public void testAddMavenTwoProjectSetInSingleDirectory()
+        throws Exception
+    {   
+        Continuum continuum = (Continuum) lookup( Continuum.ROLE );
+        
+        String url = getTestFile( "src/test-projects/flat-multi-module/parent-project/pom.xml" ).toURL().toExternalForm();
+
+        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url, -1, true, false, true, -1, true );
+ 
+        assertNotNull( result );
+
+        List<Project> projects = result.getProjects();
+
+        assertEquals( 4, projects.size() );     
+        
+        Project rootProject = result.getRootProject();
+        
+        assertNotNull( rootProject );
+        
+        Map<String, Project> projectsMap = new HashMap<String, Project>();
+
+        int projectGroupId = 0;
+
+        for ( Project project : getProjectDao().getAllProjectsByName() )
+        {
+            projectsMap.put( project.getName(), project );
+
+            ProjectGroup projectGroup = getProjectGroupDao().getProjectGroupByProjectId( project.getId() );
+            projectGroupId = projectGroup.getId();
+
+            // validate project in project group
+            assertTrue( "project not in project group", projectGroup != null );
+        }
+
+        // sometimes projects don't get added to checkout queue
+        continuum.buildProjectGroup( projectGroupId, new org.apache.continuum.utils.build.BuildTrigger( 1, "user" ) );
 
+        assertTrue( "no module-a", projectsMap.containsKey( "module-a" ) );
+        
+        assertTrue( "no module-b", projectsMap.containsKey( "module-b" ) );
+
+        assertTrue( "no module-d", projectsMap.containsKey( "module-d" ) );
+
+        // check if the modules were checked out in the same directory as the parent
+        ConfigurationService configurationService = ( ConfigurationService ) lookup( "configurationService" );
+        
+        File workingDir = configurationService.getWorkingDirectory();
+        
+        Project parentProject = getProjectDao().getProjectByName( "parent-project" );
+        
+        File checkoutDir = new File( workingDir, String.valueOf( parentProject.getId() ) );
+
+        for( long delay = 0; delay <= 999999999; delay++ )
+        {
+            // wait while the project has been checked out/build
+        }
+        
+        assertTrue( "checkout directory of project 'parent-project' does not exist." , new File( checkoutDir, "parent-project" ).exists() );
+        
+        assertFalse( "module-a should not have been checked out as a separate project.",
+                    new File( workingDir, String.valueOf( getProjectDao().getProjectByName( "module-a" ).getId() ) ).exists() );
+        
+        assertFalse( "module-b should not have been checked out as a separate project.",
+                    new File( workingDir, String.valueOf( getProjectDao().getProjectByName( "module-b" ).getId() ) ).exists() );
+
+        assertFalse( "module-d should not have been checked out as a separate project.",
+                     new File( workingDir, String.valueOf( getProjectDao().getProjectByName( "module-d" ).getId() ) ).exists() );
+
+        assertTrue( "module-a was not checked out in the same directory as it's parent.", new File( checkoutDir, "module-a" ).exists() );
+        
+        assertTrue( "module-b was not checked out in the same directory as it's parent.", new File( checkoutDir, "module-b" ).exists() );
+
+        assertTrue( "module-d was not checked out in the same directory as it's parent.", new File( checkoutDir, "module-c/module-d" ).exists() );
+
+        // assert project state
+        // commented out this test case as it sometimes fails because the actual checkout hasn't finished yet so
+        //    the state hasn't been updated yet
+        /*assertEquals( "state of 'parent-project' should have been updated.", ContinuumProjectState.CHECKEDOUT, parentProject.getState() );
+        
+        assertEquals( "state of 'module-a' should have been updated.", ContinuumProjectState.CHECKEDOUT,
+                      getProjectDao().getProjectByName( "module-a" ).getState() );
+        
+        assertEquals( "state of 'module-b' should have been updated.", ContinuumProjectState.CHECKEDOUT,
+                      getProjectDao().getProjectByName( "module-b" ).getState() );*/        
+    }
+        
     public void testUpdateMavenTwoProject()
         throws Exception
     {
@@ -432,6 +519,51 @@ public class DefaultContinuumTest
         assertFalse( "project still exist on the checkout queue",
                      parallelBuildsManager.isInAnyCheckoutQueue( project.getId() ) );
     }
+    
+    /*public void testCreationOfProjectScmRootDuringInitialization()
+        throws Exception
+    {
+        DefaultContinuum continuum = (DefaultContinuum) getContinuum();
+
+        ProjectGroup defaultProjectGroup =
+            continuum.getProjectGroupByGroupId( ContinuumInitializer.DEFAULT_PROJECT_GROUP_GROUP_ID );
+
+        ProjectScmRoot scmRoot = new ProjectScmRoot();
+        scmRoot.setProjectGroup( defaultProjectGroup );
+        scmRoot.setScmRootAddress( "http://temp.company.com/svn/trunk" );
+        getProjectScmRootDao().addProjectScmRoot( scmRoot );
+        
+        defaultProjectGroup = continuum.getProjectGroupWithProjects( defaultProjectGroup.getId() );
+        assertEquals( 0, defaultProjectGroup.getProjects().size() );
+        
+        Project project = new Project();
+        project.setGroupId( "project1" );
+        project.setArtifactId( "project1" );
+        project.setVersion( "1.0-SNAPSHOT" );
+        project.setScmUrl( "http://temp.company.com/svn/trunk/project1" );
+        defaultProjectGroup.addProject( project );
+
+        project = new Project();
+        project.setGroupId( "project2" );
+        project.setArtifactId( "project2" );
+        project.setVersion( "1.0-SNAPSHOT" );
+        project.setScmUrl( "http://temp.company.com/svn/trunk/project2" );
+        defaultProjectGroup.addProject( project );
+
+        project = new Project();
+        project.setGroupId( "project3" );
+        project.setArtifactId( "project3" );
+        project.setVersion( "1.0-SNAPSHOT" );
+        project.setScmUrl( "http://temp.company.com/svn/trunk/project3" );
+        defaultProjectGroup.addProject( project );
+
+        getProjectGroupDao().updateProjectGroup( defaultProjectGroup );
+
+        continuum.initialize();
+
+        List<ProjectScmRoot> scmRoots = continuum.getProjectScmRootByProjectGroup( defaultProjectGroup.getId() );
+        assertEquals( "#scmRoots in the group", 1, scmRoots.size() );
+    }    */
 
     public void testAddAntProjectWithdefaultBuildDef()
         throws Exception

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java Wed May 12 06:41:26 2010
@@ -22,7 +22,9 @@ package org.apache.maven.continuum.build
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.utils.build.BuildTrigger;
+import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.maven.continuum.AbstractContinuumTest;
+import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -37,6 +39,7 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.util.Calendar;
 import java.util.List;
+import java.util.Map;
 
 public class DefaultBuildControllerTest
     extends AbstractContinuumTest
@@ -138,7 +141,14 @@ public class DefaultBuildControllerTest
         BuildResult oldBuildResult = new BuildResult();
         oldBuildResult.setEndTime( Calendar.getInstance().getTimeInMillis() + ( hourOfLastExecution * 3600000 ) );
         context.setOldBuildResult( oldBuildResult );
-        context.setScmResult( new ScmResult() );
+        context.setScmResult( new ScmResult() );     
+                      
+        Map<String, Object> actionContext = context.getActionContext();
+        ProjectScmRoot projectScmRoot = new ProjectScmRoot();
+        projectScmRoot.setId( 1 );
+        projectScmRoot.setScmRootAddress( "scm:local:src/test-projects:flat-multi-module" );
+        actionContext.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, projectScmRoot );
+
         return context;
     }
 

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java Wed May 12 06:41:26 2010
@@ -36,6 +36,7 @@ import org.codehaus.plexus.logging.Logge
 import org.codehaus.plexus.logging.console.ConsoleLogger;
 import org.jmock.Mock;
 import org.jmock.MockObjectTestCase;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 
 public class CreateProjectsFromMetadataTest
     extends MockObjectTestCase
@@ -51,24 +52,35 @@ public class CreateProjectsFromMetadataT
         result = new ContinuumProjectBuildingResult();
         action = new CreateProjectsFromMetadataAction();
         action.enableLogging( new ConsoleLogger( Logger.LEVEL_DEBUG, "" ) );
+        
+        recordBuildProjectFromHttp();
+    }
+    
+    private void recordBuildProjectFromHttp()
+            throws Exception
+    {
+        result = new ContinuumProjectBuildingResult();
         Mock projectBuilderManagerMock = mock( ContinuumProjectBuilderManager.class );
-        Mock mavenSettingsBuilderMock = mock( MavenSettingsBuilder.class );
-        action.setProjectBuilderManager( (ContinuumProjectBuilderManager) projectBuilderManagerMock.proxy() );
-        action.setMavenSettingsBuilder( (MavenSettingsBuilder) mavenSettingsBuilderMock.proxy() );
+        
+        action.setProjectBuilderManager( (ContinuumProjectBuilderManager) projectBuilderManagerMock.proxy() );        
         action.setUrlValidator( new ContinuumUrlValidator() );
+        
         Mock projectBuilder = mock( ContinuumProjectBuilder.class );
-
-        projectBuilderManagerMock.expects( once() ).method( "getProjectBuilder" ).will(
-            returnValue( projectBuilder.proxy() ) );
-        projectBuilder.expects( once() ).method( "buildProjectsFromMetadata" ).will(
-            returnValue( result ) );
-
-        projectBuilder.expects( once() ).method( "getDefaultBuildDefinitionTemplate" ).will(
-            returnValue( getDefaultBuildDefinitionTemplate() ) );
-
-        mavenSettingsBuilderMock.expects( once() ).method( "buildSettings" ).will( returnValue( new Settings() ) );
-
+        
+        projectBuilderManagerMock.expects( once() ).method( "getProjectBuilder" )
+            .will( returnValue( projectBuilder.proxy() ) );
+        projectBuilder.expects( once() ).method( "buildProjectsFromMetadata" )
+            .will( returnValue( result ) );
+        projectBuilder.expects( once() ).method( "getDefaultBuildDefinitionTemplate" )
+            .will( returnValue( getDefaultBuildDefinitionTemplate() ) );        
     }
+    
+    private void invokeBuildSettings()
+    {
+        Mock mavenSettingsBuilderMock = mock( MavenSettingsBuilder.class );
+        action.setMavenSettingsBuilder( (MavenSettingsBuilder) mavenSettingsBuilderMock.proxy() );
+        mavenSettingsBuilderMock.expects( once() ).method( "buildSettings" ).will( returnValue( new Settings() ) );
+     }
 
     private BuildDefinitionTemplate getDefaultBuildDefinitionTemplate()
         throws Exception
@@ -94,15 +106,19 @@ public class CreateProjectsFromMetadataT
     public void testExecuteWithNonRecursiveMode()
         throws Exception
     {
+    	invokeBuildSettings();
+    	
         Map<String, Object> context = new HashMap<String, Object>();
-        CreateProjectsFromMetadataAction.setUrl( context,
-                                                 "http://svn.apache.org/repos/asf/maven/continuum/trunk/pom.xml" );
-        CreateProjectsFromMetadataAction.setProjectBuilderId( context, "id" );
-        CreateProjectsFromMetadataAction.setLoadRecursiveProject( context, true );
+        context.put( AbstractContinuumAction.KEY_URL,
+		            "http://svn.apache.org/repos/asf/maven/continuum/trunk/pom.xml" );
+        context.put( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDER_ID, "id" );
+        context.put( CreateProjectsFromMetadataAction.KEY_LOAD_RECURSIVE_PROJECTS, true );
+        context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, false );
 
         action.execute( context );
 
-        ContinuumProjectBuildingResult result = CreateProjectsFromMetadataAction.getProjectBuildingResult( context );
+        ContinuumProjectBuildingResult result =
+	            (ContinuumProjectBuildingResult) context.get( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDING_RESULT );
 
         assertFalse(
             "Should not have errors but had " + result.getErrorsAsString() + " (this test requires internet access)",
@@ -112,24 +128,84 @@ public class CreateProjectsFromMetadataT
     public void testExecuteWithRecursiveMode()
         throws Exception
     {
+    	invokeBuildSettings();
+    	
+        Map<String, Object> context = new HashMap<String, Object>();
+        context.put( AbstractContinuumAction.KEY_URL,
+            "http://svn.apache.org/repos/asf/maven/archiva/trunk/pom.xml" );
+        context.put( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDER_ID, "id" );
+        context.put( CreateProjectsFromMetadataAction.KEY_LOAD_RECURSIVE_PROJECTS, false );
+        context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, false );
+
+        action.execute( context );
+
+        ContinuumProjectBuildingResult result =
+        	            (ContinuumProjectBuildingResult) context.get( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDING_RESULT );
+
+        assertFalse(
+            "Should not have errors but had " + result.getErrorsAsString() + " (this test requires internet access)",
+            result.hasErrors() );
+    }
+    
+            
+    public void testExecuteWithCheckoutProjectsInSingleDirectory()
+        throws Exception
+    {   
+        Project project = new Project();
+        project.setGroupId( "org.apache.continuum" );
+        project.setArtifactId( "parent-project" );
+        project.setVersion( "1.0-SNAPSHOT" );
+        project.setId( 6 );
+        project.setName( "parent-project" );
+        project.setScmUrl( "scm:local:src/test-projects:flat-multi-module/parent-project" );
+        
+        this.result.addProject( project );
+        
+        project = new Project();
+        project.setGroupId( "org.apache.continuum" );
+        project.setArtifactId( "module-a" );
+        project.setVersion( "1.0-SNAPSHOT" );
+        project.setId( 7 );
+        project.setName( "module-a" );
+        project.setScmUrl( "scm:local:src/test-projects:flat-multi-module/module-a" );
+        
+        this.result.addProject( project );
+        
+        project = new Project();
+        project.setGroupId( "org.apache.continuum" );
+        project.setArtifactId( "module-b" );
+        project.setVersion( "1.0-SNAPSHOT" );
+        project.setId( 8 );
+        project.setName( "module-b" );
+        project.setScmUrl( "scm:local:src/test-projects:flat-multi-module/module-b" );
+        
+        this.result.addProject( project );
+                        
+        // assert using scm url set in root!
         Map<String, Object> context = new HashMap<String, Object>();
-        CreateProjectsFromMetadataAction.setUrl( context,
-                                                 "http://svn.apache.org/repos/asf/maven/archiva/trunk/pom.xml" );
-        CreateProjectsFromMetadataAction.setProjectBuilderId( context, "id" );
-        CreateProjectsFromMetadataAction.setLoadRecursiveProject( context, false );
+        context.put( AbstractContinuumAction.KEY_URL,
+                     "file://" + PlexusInSpringTestCase.getBasedir() + "/src/test-projects/flat-multi-module/parent-project/pom.xml" );
+        context.put( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDER_ID, "id" );
+        context.put( CreateProjectsFromMetadataAction.KEY_LOAD_RECURSIVE_PROJECTS, true );
+        context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, true );
 
         action.execute( context );
 
-        ContinuumProjectBuildingResult result = CreateProjectsFromMetadataAction.getProjectBuildingResult( context );
+        ContinuumProjectBuildingResult result =
+            (ContinuumProjectBuildingResult) context.get( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDING_RESULT );
 
         assertFalse(
             "Should not have errors but had " + result.getErrorsAsString() + " (this test requires internet access)",
             result.hasErrors() );
+        assertEquals( "Incorrect SCM Root Url for flat multi-module project.",
+                      "scm:local:src/test-projects:flat-multi-module/", context.get( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL ) );
     }
 
     public void testExecuteFlatMultiModuleProjectThatStartsWithTheSameLetter()
         throws Exception
     {
+    	invokeBuildSettings();
+    	
         Project project = new Project();
         project.setGroupId( "com.example.flat" );
         project.setArtifactId( "flat-parent" );
@@ -161,14 +237,16 @@ public class CreateProjectsFromMetadataT
         this.result.addProject( project );
 
         Map<String, Object> context = new HashMap<String, Object>();
-        CreateProjectsFromMetadataAction.setUrl( context,
-                                                 "http://svn.apache.org/repos/asf/continuum/sandbox/flat-example/flat-parent/pom.xml" );
-        CreateProjectsFromMetadataAction.setProjectBuilderId( context, "id" );
-        CreateProjectsFromMetadataAction.setLoadRecursiveProject( context, true );
+        context.put( AbstractContinuumAction.KEY_URL,
+	                 "http://svn.apache.org/repos/asf/continuum/sandbox/flat-example/flat-parent/pom.xml" );
+	    context.put( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDER_ID, "id" );
+	    context.put( CreateProjectsFromMetadataAction.KEY_LOAD_RECURSIVE_PROJECTS, true );
+	    context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, false );
 
         action.execute( context );
 
-        ContinuumProjectBuildingResult result = CreateProjectsFromMetadataAction.getProjectBuildingResult( context );
+        ContinuumProjectBuildingResult result =
+        	            (ContinuumProjectBuildingResult) context.get( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDING_RESULT );
 
         assertFalse(
             "Should not have errors but had " + result.getErrorsAsString() + " (this test requires internet access)",
@@ -176,6 +254,6 @@ public class CreateProjectsFromMetadataT
 
         assertEquals(
             "Wrong scm root url created", "scm:svn:http://svn.apache.org/repos/asf/continuum/sandbox/flat-example/",
-            CreateProjectsFromMetadataAction.getUrl( context ) );
+            context.get( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL ) );
     }
 }

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java Wed May 12 06:41:26 2010
@@ -69,7 +69,7 @@ public abstract class AbstractContinuumP
         }
 
         public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
-                                                                         boolean recursiveProjects )
+        					boolean recursiveProjects, boolean checkoutInSingleDirectory )
             throws ContinuumProjectBuilderException
         {
             return null;
@@ -77,7 +77,7 @@ public abstract class AbstractContinuumP
 
         public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url, String username, String password,
                                                                          boolean recursiveProjects,
-                                                                         BuildDefinitionTemplate buildDefinitionTemplate )
+                                                                         BuildDefinitionTemplate buildDefinitionTemplate, boolean checkoutInSingleDirectory )
             throws ContinuumProjectBuilderException
         {
             return null;

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java Wed May 12 06:41:26 2010
@@ -63,7 +63,7 @@ public class MavenOneContinuumProjectBui
         bdt = service.addBuildDefinitionInTemplate( bdt, bd, false );
 
         ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
-            getTestFile( "src/test/resources/projects/maven-1.pom.xml" ).toURL(), null, null, false, bdt );
+        		getTestFile( "src/test/resources/projects/maven-1.pom.xml" ).toURL(), null, null, false, bdt, false );
 
         assertOnResult( result );
 
@@ -79,7 +79,7 @@ public class MavenOneContinuumProjectBui
 
         ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
             getTestFile( "src/test/resources/projects/maven-1.pom.xml" ).toURL(), null, null, false,
-            service.getDefaultMavenOneBuildDefinitionTemplate() );
+            service.getDefaultMavenOneBuildDefinitionTemplate(), false );
 
         assertOnResult( result );
 

Modified: continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java?rev=943391&r1=943390&r2=943391&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java (original)
+++ continuum/branches/continuum-flat-multi-module-updated/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java Wed May 12 06:41:26 2010
@@ -39,6 +39,7 @@ import org.apache.maven.continuum.projec
 import org.codehaus.plexus.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -359,7 +360,7 @@ public class MavenTwoContinuumProjectBui
 
         ContinuumProjectBuildingResult result;
 
-        result = projectBuilder.buildProjectsFromMetadata( url, null, null, false, bdt );
+        result = projectBuilder.buildProjectsFromMetadata( url, null, null, false, bdt, false );
         assertFalse( result.hasErrors() );
 
         assertEquals( 5, service.getAllBuildDefinitionTemplate().size() );
@@ -390,6 +391,49 @@ public class MavenTwoContinuumProjectBui
 
         assertEquals( 0, projectGroup.getProjects().size() );
     }
+    
+	public void testCreateProjectWithFlatStructure()
+	    throws Exception
+	{
+	    ContinuumProjectBuilder projectBuilder =
+	        (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE, MavenTwoContinuumProjectBuilder.ID );
+	
+	    URL url = getTestFile( "/src/test-projects/flat-multi-module/parent-project/pom.xml" ).toURL();
+	
+	    ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata( url, null, null, true, true );
+	    
+	    Project rootProject = result.getRootProject();
+	    assertEquals( "Incorrect root project", "parent-project", rootProject.getArtifactId() );
+	    
+	    List<Project> projects = result.getProjects();
+	    for( Project project : projects )
+	    {
+	        if( project.getName().equals( "parent-project" ) )
+	        {
+	            assertEquals( "Incorrect scm url for parent-project",
+	                          "scm:local:src/test-projects:flat-multi-module/parent-project", project.getScmUrl() );
+	        }
+	        else if( project.getName().equals( "module-a" ) )
+	        {
+	            assertEquals( "Incorrect scm url for parent-project",
+	                          "scm:local:src/test-projects:flat-multi-module/module-a", project.getScmUrl() );
+	        }
+	        else if ( project.getName().equals( "module-b" ) )
+	        {
+	            assertEquals( "Incorrect scm url for parent-project",
+	                          "scm:local:src/test-projects:flat-multi-module/module-b", project.getScmUrl() );
+	        }
+	        else if ( project.getName().equals( "module-d" ) )
+	        {
+	            assertEquals( "Incorrect scm url for module-d",
+	                          "scm:local:src/test-projects:flat-multi-module/module-c/module-d", project.getScmUrl() );
+	        }
+	        else
+	        {
+	            fail( "Unknown project: " + project.getName() );
+	        }
+	    }
+	}
 
     private void assertDependency( String dep, String proj, Map<String, Project> projects )
     {



Mime
View raw message