continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r943159 [3/3] - in /continuum/branches/continuum-flat-multi-module: ./ 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/maven/c...
Date Tue, 11 May 2010 16:15:32 GMT
Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddMaven2ProjectTest.java Tue May 11 16:15:28 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/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java Tue May 11 16:15:28 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/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java Tue May 11 16:15:28 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/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java Tue May 11 16:15:28 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/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/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java Tue May 11 16:15:28 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/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/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java Tue May 11 16:15:28 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/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/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java Tue May 11 16:15:28 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/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/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java Tue May 11 16:15:28 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 )
     {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java Tue May 11 16:15:28 2010
@@ -96,11 +96,12 @@ public class PrepareBuildProjectsTaskExe
 
         List<Project> projects = getProjectDao().getProjectsInGroup( task.getProjectGroupId() );
 
-        assertEquals( "failed to add all projects", 3, projects.size() );
+        assertEquals( "failed to add all projects", 4, projects.size() );
 
         Project rootProject = getProjectDao().getProjectByName( "multi-module-parent" );
         Project moduleA = getProjectDao().getProjectByName( "module-A" );
         Project moduleB = getProjectDao().getProjectByName( "module-B" );
+        Project moduleD = getProjectDao().getProjectByName( "module-D" );
 
         // wait while task finishes prepare build
         while( !prepareBuildQueue.getQueueSnapshot().isEmpty() || 
@@ -120,6 +121,16 @@ public class PrepareBuildProjectsTaskExe
 
         assertTrue( "checkout directory of project 'module-B' does not exist.", new File( workingDir, Integer.toString( moduleB.getId() ) ).exists() );
 
+        assertTrue( "checkout directory of project 'module-D' does not exist.", new File( workingDir, Integer.toString( moduleD.getId() ) ).exists() );
+ 
+        assertTrue( "failed to checkout project 'multi-module-parent'", new File( workingDir, Integer.toString( rootProject.getId() ) ).list().length > 0 );
+
+        assertTrue( "failed to checkout project 'module-A'", new File( workingDir, Integer.toString( moduleA.getId() ) ).list().length > 0 );
+
+        assertTrue( "failed to checkout project 'module-B'", new File( workingDir, Integer.toString( moduleB.getId() ) ).list().length > 0 );
+
+        assertTrue( "failed to checkout project 'module-D'", new File( workingDir, Integer.toString( moduleD.getId() ) ).list().length > 0 );
+
         while( !buildsManager.getCurrentBuilds().isEmpty() ||
                         isAnyProjectInBuildQueue() )
         {
@@ -136,11 +147,12 @@ public class PrepareBuildProjectsTaskExe
 
         List<Project> projects = getProjectDao().getProjectsInGroup( task.getProjectGroupId() );
 
-        assertEquals( "failed to add all projects", 3, projects.size() );
+        assertEquals( "failed to add all projects", 4, projects.size() );
 
         Project rootProject = getProjectDao().getProjectByName( "multi-module-parent" );
         Project moduleA = getProjectDao().getProjectByName( "module-A" );
         Project moduleB = getProjectDao().getProjectByName( "module-B" );
+        Project moduleD = getProjectDao().getProjectByName( "module-D" );
 
         // wait while task finishes prepare build
         while( !prepareBuildQueue.getQueueSnapshot().isEmpty() || 
@@ -159,14 +171,24 @@ public class PrepareBuildProjectsTaskExe
         assertTrue( "checkout directory of project 'module-A' does not exist.", new File( workingDir, Integer.toString( moduleA.getId() ) ).exists() );
 
         assertTrue( "checkout directory of project 'module-B' does not exist.", new File( workingDir, Integer.toString( moduleB.getId() ) ).exists() );
+        
+        assertTrue( "checkout directory of project 'module-D' does not exist.", new File( workingDir, Integer.toString( moduleD.getId() ) ).exists() );
+ 
+        assertTrue( "failed to checkout project 'multi-module-parent'", new File( workingDir, Integer.toString( rootProject.getId() ) ).list().length > 0 );
+
+        assertTrue( "failed to checkout project 'module-A'", new File( workingDir, Integer.toString( moduleA.getId() ) ).list().length > 0 );
 
+        assertTrue( "failed to checkout project 'module-B'", new File( workingDir, Integer.toString( moduleB.getId() ) ).list().length > 0 );
+
+        assertTrue( "failed to checkout project 'module-D'", new File( workingDir, Integer.toString( moduleD.getId() ) ).list().length > 0 );
+ 
         while( !buildsManager.getCurrentBuilds().isEmpty() ||
                         isAnyProjectInBuildQueue() )
         {
             Thread.sleep( 10 );
         }
     }
-/*
+
     public void testCheckoutPrepareBuildSingleCheckedoutMultiModuleProject()
         throws Exception
     {
@@ -176,7 +198,7 @@ public class PrepareBuildProjectsTaskExe
 
         List<Project> projects = getProjectDao().getProjectsInGroup( task.getProjectGroupId() );
 
-        assertEquals( "failed to add all projects", 3, projects.size() );
+        assertEquals( "failed to add all projects", 4, projects.size() );
 
         Project rootProject = getProjectDao().getProjectByName( "multi-module-parent" );
 
@@ -197,6 +219,22 @@ public class PrepareBuildProjectsTaskExe
         assertTrue( "module-A was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-A" ).exists() );
 
         assertTrue( "module-B was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-B" ).exists() );
+       
+        assertTrue( "module-D was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-C/module-D" ).exists() );
+
+        assertTrue( "failed to checkout project 'multi-module-parent'", checkedOutDir.list().length > 0 );
+   
+            assertTrue( "failed to checkout project 'module-A'", new File( checkedOutDir, "module-A" ).list().length > 0 );
+
+        assertTrue( "failed to checkout project 'module-B'", new File( checkedOutDir, "module-B" ).list().length > 0 );
+
+        assertTrue( "failed to checkout project 'module-D'", new File( checkedOutDir, "module-C/module-D" ).list().length > 0 );
+
+        while( !buildsManager.getCurrentBuilds().isEmpty() ||
+                        isAnyProjectInBuildQueue() )
+        {
+            Thread.sleep( 10 );
+        }
     }
 
     public void testCheckoutPrepareBuildSingleCheckedoutMultiModuleProjectFreshBuild()
@@ -208,7 +246,7 @@ public class PrepareBuildProjectsTaskExe
 
         List<Project> projects = getProjectDao().getProjectsInGroup( task.getProjectGroupId() );
 
-        assertEquals( "failed to add all projects", 3, projects.size() );
+        assertEquals( "failed to add all projects", 4, projects.size() );
 
         Project rootProject = getProjectDao().getProjectByName( "multi-module-parent" );
 
@@ -229,6 +267,22 @@ public class PrepareBuildProjectsTaskExe
         assertTrue( "module-A was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-A" ).exists() );
 
         assertTrue( "module-B was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-B" ).exists() );
+        
+        assertTrue( "module-D was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-C/module-D" ).exists() );
+
+        assertTrue( "failed to checkout project 'multi-module-parent'", checkedOutDir.list().length > 0 );
+
+        assertTrue( "failed to checkout project 'module-A'", new File( checkedOutDir, "module-A" ).list().length > 0 );
+
+        assertTrue( "failed to checkout project 'module-B'", new File( checkedOutDir, "module-B" ).list().length > 0 );
+
+        assertTrue( "failed to checkout project 'module-D'", new File( checkedOutDir, "module-C/module-D" ).list().length > 0 );
+
+        while( !buildsManager.getCurrentBuilds().isEmpty() ||
+                        isAnyProjectInBuildQueue() )
+        {
+            Thread.sleep( 10 );
+        }
     }
 
     public void testCheckoutPrepareBuildSingleCheckoutFlatMultiModuleProject()
@@ -240,8 +294,8 @@ public class PrepareBuildProjectsTaskExe
 
         List<Project> projects = getProjectDao().getProjectsInGroup( task.getProjectGroupId() );
 
-        assertEquals( "failed to add all projects", 3, projects.size() );
-
+        assertEquals( "failed to add all projects", 4, projects.size() );
+        
         Project rootProject = getProjectDao().getProjectByName( "parent-project" );
 
         // wait while task finishes prepare build
@@ -261,6 +315,22 @@ public class PrepareBuildProjectsTaskExe
         assertTrue( "module-a was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-a" ).exists() );
 
         assertTrue( "module-b was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-b" ).exists() );
+
+        assertTrue( "module-d was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-c/module-d" ).exists() );
+
+        assertTrue( "failed to checkout parent-project", new File( checkedOutDir, "parent-project" ).list().length > 0 );
+
+        assertTrue( "failed to checkout module-a", new File( checkedOutDir, "module-a" ).list().length > 0 );
+        
+        assertTrue( "failed to checkout module-b", new File( checkedOutDir, "module-b" ).list().length > 0 );
+        
+        assertTrue( "failed to checkout module-d", new File( checkedOutDir, "module-c/module-d" ).list().length > 0 );
+
+        while( !buildsManager.getCurrentBuilds().isEmpty() ||
+                        isAnyProjectInBuildQueue() )
+        {
+            Thread.sleep( 10 );
+        }
     }
 
     public void testCheckoutPrepareBuildSingleCheckoutFlatMultiModuleProjectBuildFresh()
@@ -272,7 +342,7 @@ public class PrepareBuildProjectsTaskExe
 
         List<Project> projects = getProjectDao().getProjectsInGroup( task.getProjectGroupId() );
 
-        assertEquals( "failed to add all projects", 3, projects.size() );
+        assertEquals( "failed to add all projects", 4, projects.size() );
 
         Project rootProject = getProjectDao().getProjectByName( "parent-project" );
 
@@ -296,8 +366,82 @@ public class PrepareBuildProjectsTaskExe
         assertTrue( "module-a was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-a" ).exists() );
 
         assertTrue( "module-b was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-b" ).exists() );
+
+        assertTrue( "module-d was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-c/module-d" ).exists() );
+
+        assertTrue( "failed to checkout parent-project", new File( checkedOutDir, "parent-project" ).list().length > 0 );
+
+        assertTrue( "failed to checkout module-a", new File( checkedOutDir, "module-a" ).list().length > 0 );
+        
+        assertTrue( "failed to checkout module-b", new File( checkedOutDir, "module-b" ).list().length > 0 );
+       
+        assertTrue( "failed to checkout module-d", new File( checkedOutDir, "module-c/module-d" ).list().length > 0 );
+
+        while( !buildsManager.getCurrentBuilds().isEmpty() ||
+                        isAnyProjectInBuildQueue() )
+        {
+            Thread.sleep( 10 );
+        }
+    }
+    
+    public void testCheckoutPrepareBuildSingleCheckoutFlatMultiModuleProjectBuildFreshAfterRemovingWorkingCopy()
+        throws Exception
+    {
+        PrepareBuildProjectsTask task = createTask( "src/test-projects/flat-multi-module/parent-project/pom.xml", true, true );
+     
+        List<Project> projects = getProjectDao().getProjectsInGroup( task.getProjectGroupId() );
+     
+        assertEquals( "failed to add all projects", 4, projects.size() );
+    
+        Project rootProject = getProjectDao().getProjectByName( "parent-project" );
+    
+        File rootProjectDir = new File( configurationService.getWorkingDirectory(), Integer.toString( rootProject.getId() ) );
+        rootProjectDir = new File( rootProjectDir, "parent-project" );
+    
+       rootProject.setWorkingDirectory( rootProjectDir.getAbsolutePath() );
+    
+        getProjectDao().updateProject( rootProject );
+   
+        this.prepareBuildQueue.put( task );
+    
+        ProjectScmRoot scmRoot = projectScmRootDao.getProjectScmRoot( task.getProjectScmRootId() );
+        // wait while task finishes prepare build
+        while( !prepareBuildQueue.getQueueSnapshot().isEmpty() || 
+                        prepareBuildTaskQueueExecutor.getCurrentTask() != null || scmRoot.getState() == ContinuumProjectState.UPDATING )
+        {
+            Thread.sleep( 10 );
+
+            scmRoot = projectScmRootDao.getProjectScmRoot( task.getProjectScmRootId() );
+        }
+    
+        scmRoot = projectScmRootDao.getProjectScmRoot( task.getProjectScmRootId() );
+        assertEquals( "Failed to update multi-module project", ContinuumProjectState.UPDATED, scmRoot.getState() );
+    
+        File checkedOutDir = new File( configurationService.getWorkingDirectory(), Integer.toString( rootProject.getId() ) );
+    
+        assertTrue( "checkout directory of project 'parent-project' does not exist.", new File( checkedOutDir, "parent-project" ).exists() );
+    
+        assertTrue( "module-a was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-a" ).exists() );
+    
+        assertTrue( "module-b was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-b" ).exists() );
+
+        assertTrue( "module-d was not checked out in the same directory as it's parent.", new File( checkedOutDir, "module-c/module-d" ).exists() );
+
+        assertTrue( "failed to checkout parent-project", new File( checkedOutDir, "parent-project" ).list().length > 0 );
+
+        assertTrue( "failed to checkout module-a", new File( checkedOutDir, "module-a" ).list().length > 0 );
+        
+        assertTrue( "failed to checkout module-b", new File( checkedOutDir, "module-b" ).list().length > 0 );
+        
+        assertTrue( "failed to checkout module-d", new File( checkedOutDir, "module-c/module-d" ).list().length > 0 );
+
+        while( !buildsManager.getCurrentBuilds().isEmpty() ||
+                        isAnyProjectInBuildQueue() )
+        {
+            Thread.sleep( 10 );
+        }
     }
-*/
+
     private PrepareBuildProjectsTask createTask( String pomResource, boolean singleCheckout, boolean buildFresh )
         throws Exception
     {
@@ -352,10 +496,10 @@ public class PrepareBuildProjectsTaskExe
             }
         }
 
-        assertEquals( 3, map.size() );
-        PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( map, new BuildTrigger( 1, "test-user" ), 
-                                                                      projectGroupId, projectGroup.getName(), 
-                                                                      scmRoot.getScmRootAddress(), scmRoot.getId() );
+        assertEquals( 4, map.size() );
+        PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( map, new org.apache.continuum.utils.build.BuildTrigger( 1, "user" ),
+                                                                               projectGroupId, projectGroup.getName(), 
+                                                                               scmRoot.getScmRootAddress(), scmRoot.getId() );
 
         return task;
     }
@@ -367,8 +511,8 @@ public class PrepareBuildProjectsTaskExe
     
         assertNotNull( "Can't find project " + pomResource, pom );
 
-        //ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata( pom.toURL(), null, null, true, singleCheckout );
-        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata( pom.toURL(), null, null, true );
+        //ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata( pom.toURL(), null, null, true );
+        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata( pom.toURL(), null, null, true, singleCheckout );
 
         // some assertions to make sure our expectations match. This is NOT
         // meant as a unit test for the projectbuilder!
@@ -412,7 +556,7 @@ public class PrepareBuildProjectsTaskExe
 
         projectScmRoot.setScmRootAddress( url );
 
-        projectScmRoot.setState( ContinuumProjectState.ERROR );
+        //projectScmRoot.setState( ContinuumProjectState.ERROR );
 
         return projectScmRootDao.addProjectScmRoot( projectScmRoot );
     }

Modified: continuum/branches/continuum-flat-multi-module/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-model/src/main/mdo/continuum.xml?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-model/src/main/mdo/continuum.xml (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-model/src/main/mdo/continuum.xml Tue May 11 16:15:28 2010
@@ -317,6 +317,12 @@
           <version>1.1.0+</version>
           <type>String</type>
         </field>
+        <field>
+          <name>checkedOutInSingleDirectory</name>
+          <version>1.4.0+</version>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+        </field>
         <field jpox.mapped-by="project" jpox.fetch-groups="project-with-builds">
           <name>buildResults</name>
           <version>1.0.9+</version>

Modified: continuum/branches/continuum-flat-multi-module/continuum-model/src/main/resources/package-default.orm
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-model/src/main/resources/package-default.orm?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-model/src/main/resources/package-default.orm (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-model/src/main/resources/package-default.orm Tue May 11 16:15:28 2010
@@ -17,4 +17,11 @@
       </field>
     </class>
   </package>
+  <package name="org.apache.maven.continuum.model.project">
+    <class name="Project">
+      <field name="checkedOutInSingleDirectory" null-value="default">
+        <column jdbc-type="CHAR" default-value="N" />
+      </field>
+    </class>
+  </package>
 </orm>

Modified: continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java Tue May 11 16:15:28 2010
@@ -75,7 +75,7 @@ public abstract class AbstractContinuumR
                     executable = ( (ContinuumReleaseDescriptor) releaseDescriptor).getExecutable();
                 }
                 shellCommandHelper.executeGoals( determineWorkingDirectory( workingDirectory,
-                                                                            releaseDescriptor.getScmRelativePathProjectDirectory() ),
+                								 releaseDescriptor.getScmRelativePathProjectDirectory() ),
                                                  executable, goals, releaseDescriptor.isInteractive(), additionalArguments, result, 
                                                  environments );
             }

Modified: continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java Tue May 11 16:15:28 2010
@@ -83,37 +83,16 @@ public class PerformReleaseTaskExecutor
 
         repository = performTask.getLocalRepository();
 
-        List<MavenProject> reactorProjects = getReactorProjects( performTask );
-
-        ReleaseResult result = releaseManager.performWithResult( descriptor, settings, reactorProjects, listener );
-
-        //override to show the actual start time
-        result.setStartTime( getStartTime() );
-
-        if ( result.getResultCode() == ReleaseResult.SUCCESS )
-        {
-            continuumReleaseManager.getPreparedReleases().remove( performTask.getReleaseId() );
-        }
-
-        continuumReleaseManager.getReleaseResults().put( performTask.getReleaseId(), result );
-    }
-
-    protected List<MavenProject> getReactorProjects( PerformReleaseProjectTask releaseTask )
-        throws TaskExecutionException
-    {
-        List<MavenProject> reactorProjects;
-        ReleaseDescriptor descriptor = releaseTask.getDescriptor();
-
-        if ( StringUtils.isEmpty( descriptor.getWorkingDirectory() ) )
-        {
-            //Perform with provided release parameters (CONTINUUM-1541)
-            descriptor.setCheckoutDirectory( releaseTask.getBuildDirectory().getAbsolutePath() );
-            return null;
-        }
-
+        List reactorProjects = null;
+        MavenProject mavenProject = null;
+        
         try
         {
-            reactorProjects = getReactorProjects( descriptor );
+        	mavenProject = getMavenProject( performTask );
+            if( mavenProject != null )
+            {
+                reactorProjects = getReactorProjects( descriptor, mavenProject ); 
+            }
         }
         catch ( ContinuumReleaseException e )
         {
@@ -121,38 +100,37 @@ public class PerformReleaseTaskExecutor
 
             result.appendError( e );
 
-            continuumReleaseManager.getReleaseResults().put( releaseTask.getReleaseId(), result );
+            continuumReleaseManager.getReleaseResults().put( performTask.getReleaseId(), result );
 
-            releaseTask.getListener().error( e.getMessage() );
+            performTask.getListener().error( e.getMessage() );
 
             throw new TaskExecutionException( "Failed to build reactor projects.", e );
         }
 
-        return reactorProjects;
+        ReleaseResult result = releaseManager.performWithResult( descriptor, settings, reactorProjects, listener );
+        
+        //override to show the actual start time
+        result.setStartTime( getStartTime() );
+
+        if ( result.getResultCode() == ReleaseResult.SUCCESS )
+        {
+            continuumReleaseManager.getPreparedReleases().remove( performTask.getReleaseId() );
+        }
+
+        continuumReleaseManager.getReleaseResults().put( performTask.getReleaseId(), result );
     }
 
     /**
      * @todo remove and use generate-reactor-projects phase
      */
-    protected List<MavenProject> getReactorProjects( ReleaseDescriptor descriptor )
+    protected List<MavenProject> getReactorProjects( ReleaseDescriptor descriptor, MavenProject project )
         throws ContinuumReleaseException
     {
         List<MavenProject> reactorProjects = new ArrayList<MavenProject>();
 
-        MavenProject project;
-        try
-        {
-            project = projectBuilder.build( getProjectDescriptorFile( descriptor ), getLocalRepository(),
-                                            getProfileManager( settings ) );
-
-            reactorProjects.add( project );
-
-            addModules( reactorProjects, project );
-        }
-        catch ( ProjectBuildingException e )
-        {
-            throw new ContinuumReleaseException( "Failed to build project.", e );
-        }
+        reactorProjects.add( project );
+       
+        addModules( reactorProjects, project );
 
         try
         {
@@ -238,4 +216,30 @@ public class PerformReleaseTaskExecutor
     {
         container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
     }
+    
+    protected MavenProject getMavenProject( PerformReleaseProjectTask releaseTask )
+	    throws ContinuumReleaseException
+	{
+	    ReleaseDescriptor descriptor = releaseTask.getDescriptor();
+	
+	    if ( StringUtils.isEmpty( descriptor.getWorkingDirectory() ) )
+	    {
+	        //Perform with provided release parameters (CONTINUUM-1541)
+	        descriptor.setCheckoutDirectory( releaseTask.getBuildDirectory().getAbsolutePath() );
+	        return null;
+	    }
+	
+	    MavenProject project;
+	    try
+	    {
+	        project = projectBuilder.build( getProjectDescriptorFile( descriptor ), getLocalRepository(),
+	                                        getProfileManager( settings ) );
+	    }
+	    catch ( ProjectBuildingException e )
+	    {
+	        throw new ContinuumReleaseException( "Failed to build project.", e );
+	    }
+	    
+	    return project;
+	}   
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java Tue May 11 16:15:28 2010
@@ -48,6 +48,7 @@ import org.codehaus.plexus.PlexusContain
 import org.codehaus.plexus.context.Context;
 import org.codehaus.plexus.context.ContextException;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.dag.CycleDetectedException;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
@@ -150,7 +151,7 @@ public class GenerateReactorProjectsPhas
     {
         for ( Object o : project.getModules() )
         {
-            String moduleDir = o.toString();
+        	String moduleDir = StringUtils.replace( o.toString(), '\\', '/' );
 
             File pomFile = new File( project.getBasedir(), moduleDir + "/pom.xml" );
 

Modified: continuum/branches/continuum-flat-multi-module/continuum-release/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-release/src/main/resources/META-INF/plexus/components.xml?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-release/src/main/resources/META-INF/plexus/components.xml (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-release/src/main/resources/META-INF/plexus/components.xml Tue May 11 16:15:28 2010
@@ -279,6 +279,21 @@
           <phase>scm-commit-rollback</phase>
           <phase>remove-scm-tag</phase>
         </rollbackPhases>
+        <!-- Set <branchPhases> even though it is not used in Continuum. Having this empty causes an NPE when cleaning up the release
+             in maven-release 2.0! -->
+        <branchPhases>
+          <phase>create-backup-poms</phase>
+          <phase>check-poms</phase>
+          <phase>scm-check-modifications</phase>
+          <phase>map-branch-versions</phase>
+          <phase>map-development-versions</phase>
+          <phase>rewrite-poms-for-branch</phase>
+          <phase>scm-commit-branch</phase>
+          <phase>scm-branch</phase>
+          <phase>rewrite-poms-for-development</phase>
+          <phase>scm-commit-release</phase>
+          <phase>end-release</phase>
+        </branchPhases>
       </configuration>
     </component>
     <component>

Modified: continuum/branches/continuum-flat-multi-module/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java Tue May 11 16:15:28 2010
@@ -32,6 +32,7 @@ import javax.jdo.PersistenceManagerFacto
 import org.apache.continuum.dao.DaoUtils;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.dao.ProjectGroupDao;
+import org.apache.continuum.dao.ProjectScmRootDao;
 import org.apache.continuum.dao.ScheduleDao;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
@@ -63,6 +64,8 @@ public abstract class AbstractContinuumT
     private ProjectGroupDao projectGroupDao;
 
     private ScheduleDao scheduleDao;
+    
+    private ProjectScmRootDao projectScmRootDao;
 
     // ----------------------------------------------------------------------
     //
@@ -81,6 +84,8 @@ public abstract class AbstractContinuumT
         getProjectGroupDao();
 
         getScheduleDao();
+        
+        getProjectScmRootDao();
 
         setUpConfigurationService( (ConfigurationService) lookup( "configurationService" ) );
 
@@ -246,6 +251,15 @@ public abstract class AbstractContinuumT
         }
         return scheduleDao;
     }
+    
+    protected ProjectScmRootDao getProjectScmRootDao()
+    {
+        if ( projectScmRootDao == null )
+        {
+            projectScmRootDao = (ProjectScmRootDao) lookup( ProjectScmRootDao.class.getName() );
+        }
+        return projectScmRootDao;
+    }
 
     // ----------------------------------------------------------------------
     // Build Executor

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java Tue May 11 16:15:28 2010
@@ -53,6 +53,8 @@ public class AddMavenTwoProjectAction
     public static final String FILE_SCHEME = "file:/";
 
     private boolean nonRecursiveProject;
+    
+    private boolean checkoutInSingleDirectory;
 
     protected ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup, boolean checkProtocol,
                                                         boolean scmUseCache )
@@ -104,11 +106,18 @@ public class AddMavenTwoProjectAction
             }
         }
 
+     // force set checkoutInCingleDirectory to false if adding the project as non-recursive
+        if( this.isNonRecursiveProject() )
+        {
+            this.setCheckoutInSingleDirectory( false );
+        }
+        
         if ( result == null )
         {
             result = getContinuum().addMavenTwoProject( pomUrl, selectedProjectGroup, checkProtocol, scmUseCache,
                                                         !this.isNonRecursiveProject(),
-                                                        this.getBuildDefinitionTemplateId() );
+                                                        this.getBuildDefinitionTemplateId(),
+                                                        this.isCheckoutInSingleDirectory() );
         }
 
         AuditLog event = new AuditLog( hidePasswordInUrl( pomUrl ), AuditLogConstants.ADD_M2_PROJECT );
@@ -165,4 +174,14 @@ public class AddMavenTwoProjectAction
     {
         this.nonRecursiveProject = nonRecursiveProject;
     }
+    
+    public boolean isCheckoutInSingleDirectory()
+    {
+        return checkoutInSingleDirectory;
+    }
+
+    public void setCheckoutInSingleDirectory( boolean checkoutInSingleDirectory )
+    {
+        this.checkoutInSingleDirectory = checkoutInSingleDirectory;
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java Tue May 11 16:15:28 2010
@@ -520,7 +520,9 @@ public class ReleasePrepareAction
         {
             for ( Iterator modules = model.getModules().iterator(); modules.hasNext(); )
             {
-                processProject( workingDirectory + "/" + modules.next().toString(), "pom.xml" );
+            	String module = StringUtils.replace( modules.next().toString(), '\\', '/' );
+            	
+                processProject( workingDirectory + "/" + module, "pom.xml" );
             }
         }
     }

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/resources/localization/Continuum.properties (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/resources/localization/Continuum.properties Tue May 11 16:15:28 2010
@@ -339,6 +339,7 @@ add.m2.project.upload.modules.error = Ca
 add.m2.project.nonRecursiveProject = For multi-module project, load only root as recursive build
 add.m2.project.buildDefinitionTemplate = Build Definition Template
 add.m2.project.defaultBuildDefinition = Default
+add.m2.project.checkoutInSingleDirectory = Checkout multi-module project in single directory
 
 # ----------------------------------------------------------------------
 # Page: AddProject (ant or shell)

Modified: continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp Tue May 11 16:15:28 2010
@@ -82,6 +82,7 @@
                             </c:otherwise>
                             </c:choose>
                             <s:checkbox label="%{getText('add.m2.project.nonRecursiveProject')}" name="nonRecursiveProject" />
+                            <s:checkbox label="%{getText('add.m2.project.checkoutInSingleDirectory')}" name="checkoutInSingleDirectory" />
                             <s:select label="%{getText('add.m2.project.buildDefinitionTemplate')}" name="buildDefinitionTemplateId"
                                        list="buildDefinitionTemplates" listKey="id" listValue="name" headerKey="-1" 
                                        headerValue="%{getText('add.m2.project.defaultBuildDefinition')}"/> 

Modified: continuum/branches/continuum-flat-multi-module/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/pom.xml?rev=943159&r1=943158&r2=943159&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/pom.xml (original)
+++ continuum/branches/continuum-flat-multi-module/pom.xml Tue May 11 16:15:28 2010
@@ -549,7 +549,7 @@ under the License.
       <dependency>
         <groupId>org.apache.maven.release</groupId>
         <artifactId>maven-release-manager</artifactId>
-        <version>2.0-beta-9</version>
+        <version>2.0</version>
         <exclusions>
           <exclusion>
             <groupId>commons-logging</groupId>



Mime
View raw message