continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r946548 [3/3] - in /continuum/trunk: ./ 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/continuum/ continuum-api/src/mai...
Date Thu, 20 May 2010 07:30:46 GMT
Modified: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java (original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java Thu May 20 07:30:43 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" );
+        AbstractContinuumAction.setProjectScmRoot( actionContext, projectScmRoot );
+
         return context;
     }
 

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java (original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java Thu May 20 07:30:43 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,11 +106,13 @@ 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.setUrl( context, "http://svn.apache.org/repos/asf/maven/continuum/trunk/pom.xml" );
         CreateProjectsFromMetadataAction.setProjectBuilderId( context, "id" );
         CreateProjectsFromMetadataAction.setLoadRecursiveProject( context, true );
+        context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, false );
 
         action.execute( context );
 
@@ -112,11 +126,13 @@ public class CreateProjectsFromMetadataT
     public void testExecuteWithRecursiveMode()
         throws Exception
     {
+    	invokeBuildSettings();
+    	
         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.setUrl( context, "http://svn.apache.org/repos/asf/maven/archiva/trunk/pom.xml" );
+        CreateProjectsFromMetadataAction.setProjectBuilderId( context,  "id" );
         CreateProjectsFromMetadataAction.setLoadRecursiveProject( context, false );
+        context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, false );
 
         action.execute( context );
 
@@ -126,10 +142,65 @@ public class CreateProjectsFromMetadataT
             "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, "file://" + PlexusInSpringTestCase.getBasedir()
+            + "/src/test-projects/flat-multi-module/parent-project/pom.xml" );
+        CreateProjectsFromMetadataAction.setProjectBuilderId( context, "id" );
+        CreateProjectsFromMetadataAction.setLoadRecursiveProject( context, true );
+        context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, true );
+
+        action.execute( context );
+
+        ContinuumProjectBuildingResult result = CreateProjectsFromMetadataAction.getProjectBuildingResult( context );
+
+        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/", AbstractContinuumAction.getProjectScmRootUrl( context, "" ) );
+    }
 
     public void testExecuteFlatMultiModuleProjectThatStartsWithTheSameLetter()
         throws Exception
     {
+    	invokeBuildSettings();
+    	
         Project project = new Project();
         project.setGroupId( "com.example.flat" );
         project.setArtifactId( "flat-parent" );
@@ -163,8 +234,9 @@ public class CreateProjectsFromMetadataT
         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.setProjectBuilderId( context,  "id" );
         CreateProjectsFromMetadataAction.setLoadRecursiveProject( context, true );
+	    context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, false );
 
         action.execute( context );
 
@@ -176,6 +248,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 ) );
+            AbstractContinuumAction.getProjectScmRootUrl( context, null ) );
     }
 }

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/ContinuumBuildExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/ContinuumBuildExecutorTest.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/ContinuumBuildExecutorTest.java (original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/ContinuumBuildExecutorTest.java Thu May 20 07:30:43 2010
@@ -21,6 +21,7 @@ package org.apache.maven.continuum.execu
 
 import java.io.File;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.continuum.utils.shell.ExecutionResult;
@@ -110,7 +111,7 @@ public class ContinuumBuildExecutorTest
                 will( returnValue( result ) );
             }} );
 
-        executor.executeShellCommand( project, executable, arguments, output, environments );
+        executor.executeShellCommand( project, executable, arguments, output, environments, null, null );
 
         context.assertIsSatisfied();
     }
@@ -137,7 +138,7 @@ public class ContinuumBuildExecutorTest
             return null;
         }
 
-        public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput )
+        public ContinuumBuildExecutionResult build( Project project, BuildDefinition buildDefinition, File buildOutput, List<Project> projectsWithCommonScmRoot, String projectScmRootUrl )
             throws ContinuumBuildExecutorException
         {
             // TODO Auto-generated method stub

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java (original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilderTest.java Thu May 20 07:30:43 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/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java (original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java Thu May 20 07:30:43 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/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java (original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java Thu May 20 07:30:43 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/trunk/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java (original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java Thu May 20 07:30:43 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/trunk/continuum-docs/src/site/apt/user_guides/managing_project/addProject.apt
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-docs/src/site/apt/user_guides/managing_project/addProject.apt?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-docs/src/site/apt/user_guides/managing_project/addProject.apt (original)
+++ continuum/trunk/continuum-docs/src/site/apt/user_guides/managing_project/addProject.apt Thu May 20 07:30:43 2010
@@ -39,7 +39,105 @@ Add a Project
 
   You cannot add a duplicate project (duplicates would mean another instance of a project with the same groupId, artifactId, and version) in the same Project Group.
 
-  By default, Continuum adds each sub-module POM as an individual Continuum Project. If you want to add only the root POM without sub-modules, check the <<load only root as recursive build>> field.
+  If <<Checkout multi-module project in separate directories>> radio box is selected when a project is added to Continuum, each sub-module POM would be added as an individual Continuum Project.
+  Each of these Continuum projects having it's own working directory. For example, you have a multi-module project with the following structure:
+
++----------------------------+
+simple-multi-module-project
+|-- module-a
+|   |-- pom.xml
+|   `-- src
+|       |-- main
+|       |   `-- java
+|       |       `-- ...
+|       `-- test
+|           `-- java
+|               `-- ...
+|-- module-b
+|   |-- pom.xml
+|   `-- src
+|       |-- main
+|       |   `-- java
+|       |       `-- ...
+|       `-- test
+|           `-- java
+|               `-- ...
+`-- pom.xml
++----------------------------+
+
+  This project tree means that there will be three Continuum Projects added in Continuum. Let's say, the top level project was assigned
+  a <<<project id>>> of '1' when it was added in Continuum and module-a got a <<<project id>>> of '2' and module-b got a <<<project id>>> of '3'. Now in
+  Continuum's working directory, you will see these projects checked out as below. Note that their <<<project ids>>> correspond to their own
+  working directories.
+
++----------------------------+
+|-- 1
+|   |-- module-a
+|   |   |-- pom.xml
+|   |   `-- src
+|   |       |-- main
+|   |       |   `-- java
+|   |       |       `-- ...
+|   |       `-- test
+|   |           `-- java
+|   |               `-- ...
+|   |-- module-b
+|   |   |-- pom.xml
+|   |   `-- src
+|   |       |-- main
+|   |       |   `-- java
+|   |       |       `-- ...
+|   |       `-- test
+|   |           `-- java
+|   |               `-- ...
+|   `-- pom.xml
+|-- 2
+|   |-- pom.xml
+|   `-- src
+|       |-- main
+|       |   `-- java
+|       |       `-- ...
+|       `-- test
+|           `-- java
+|               `-- ...
+`-- 3
+    |-- pom.xml
+    `-- src
+        |-- main
+        |   `-- java
+        |       `-- ...
+        `-- test
+            `-- java
+                `-- ...
++----------------------------+
+
+  You can force Continuum to check out the entire project into a single directory by selecting the <<Checkout multi-module project
+  in single directory>> radio box.
+
+  <<Note:>> If your project has a flat structure similar to the one below, you might want to check out
+  your project into a single directory to be able to release it in Continuum.
+
++----------------------------+
+simple-flat-multi-module
+|-- root-project
+|   `-- pom.xml
+|-- module-a
+|   |-- pom.xml
+|   `-- src
+|       |-- main
+|       |   `-- java
+|       |       `-- ...
+|       `-- test
+|           `-- java
+|               `-- ...
+`-- module-b
+   |-- pom.xml
+   `-- src
+       `-- main
+           `-- ...
++----------------------------+
+
+  If you want to add only the root POM without sub-modules, select the <<load only root as recursive build>> radio box. 
 
   You can choose a <<Build Definition Template>> which will be applied to your project.  If you choose a <<Build Definition
   Template>>, the build definitions from the template will be added in addition to any build definitions that are defined

Modified: continuum/trunk/continuum-docs/src/site/apt/user_guides/release/index.apt
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-docs/src/site/apt/user_guides/release/index.apt?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-docs/src/site/apt/user_guides/release/index.apt (original)
+++ continuum/trunk/continuum-docs/src/site/apt/user_guides/release/index.apt Thu May 20 07:30:43 2010
@@ -67,8 +67,18 @@ Releasing Projects
 
     []
 
+
+* Releasing Projects with Flat Structure
+
+    In order to release projects with flat structure in Continuum, the project must be checked out in a single directory.
+    You can do this by checking the "Checkout multi-module project in single directory" field when you add your Maven Two
+    project in Continuum. See {{{../managing_project/addProject.html}Add a Project}} for more details.
+
+    Projects with flat structures are released in the same process described above.
+
 * Releasing projects in a distributed build
 
     Release will happen in the Build Agent where the last build of project occurred.
 
     To view on-going releases from different build agents, click the <<Releases>> button under the <<Distributed Builds>> menu.
+

Modified: continuum/trunk/continuum-docs/src/site/resources/images/add-m2-project.png
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-docs/src/site/resources/images/add-m2-project.png?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
Binary files - no diff available.

Modified: continuum/trunk/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-model/src/main/mdo/continuum.xml?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-model/src/main/mdo/continuum.xml (original)
+++ continuum/trunk/continuum-model/src/main/mdo/continuum.xml Thu May 20 07:30:43 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/trunk/continuum-model/src/main/resources/package-default.orm
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-model/src/main/resources/package-default.orm?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-model/src/main/resources/package-default.orm (original)
+++ continuum/trunk/continuum-model/src/main/resources/package-default.orm Thu May 20 07:30:43 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/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java Thu May 20 07:30:43 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/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/RunPerformGoalsPhase.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/RunPerformGoalsPhase.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/RunPerformGoalsPhase.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/RunPerformGoalsPhase.java Thu May 20 07:30:43 2010
@@ -27,6 +27,7 @@ import org.apache.maven.shared.release.R
 import org.apache.maven.shared.release.ReleaseFailureException;
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
+import org.apache.maven.shared.release.env.ReleaseEnvironment;
 import org.codehaus.plexus.util.StringUtils;
 
 /**
@@ -42,10 +43,11 @@ public class RunPerformGoalsPhase
         return releaseDescriptor.getPerformGoals();
     }
 
-    public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, Settings settings, List reactorProjects )
-        throws ReleaseExecutionException, ReleaseFailureException
-    {
-        String additionalArguments = releaseDescriptor.getAdditionalArguments();
+    public ReleaseResult execute(ReleaseDescriptor releaseDescriptor,
+			ReleaseEnvironment releaseEnvironment, List reactorProjects)
+			throws ReleaseExecutionException, ReleaseFailureException {
+		
+    	String additionalArguments = releaseDescriptor.getAdditionalArguments();
 
         if ( releaseDescriptor.isUseReleaseProfile() )
         {
@@ -58,10 +60,10 @@ public class RunPerformGoalsPhase
                 additionalArguments = "-DperformRelease=true";
             }
         }
-
+        
         return execute( releaseDescriptor, new File( releaseDescriptor.getCheckoutDirectory() ), additionalArguments );
-    }
-
+	}
+    
     public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, Settings settings, List reactorProjects )
         throws ReleaseExecutionException, ReleaseFailureException
     {

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/RunPrepareGoalsPhase.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/RunPrepareGoalsPhase.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/RunPrepareGoalsPhase.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/RunPrepareGoalsPhase.java Thu May 20 07:30:43 2010
@@ -27,6 +27,7 @@ import org.apache.maven.shared.release.R
 import org.apache.maven.shared.release.ReleaseFailureException;
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
+import org.apache.maven.shared.release.env.ReleaseEnvironment;
 
 /**
  * Run Release Preparation Goals
@@ -41,12 +42,13 @@ public class RunPrepareGoalsPhase
         return releaseDescriptor.getPreparationGoals();
     }
 
-    public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, Settings settings, List reactorProjects )
-        throws ReleaseExecutionException, ReleaseFailureException
-    {
-        return execute( releaseDescriptor, new File( releaseDescriptor.getWorkingDirectory() ), 
-                        releaseDescriptor.getAdditionalArguments() );
-    }
+    public ReleaseResult execute(ReleaseDescriptor releaseDescriptor,
+			ReleaseEnvironment releaseEnvironment, List reactorProjects)
+			throws ReleaseExecutionException, ReleaseFailureException {
+		
+    	return execute( releaseDescriptor, new File( releaseDescriptor.getWorkingDirectory() ), 
+                releaseDescriptor.getAdditionalArguments() );
+	}
 
     public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, Settings settings, List reactorProjects )
         throws ReleaseExecutionException, ReleaseFailureException

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java Thu May 20 07:30:43 2010
@@ -41,6 +41,7 @@ import org.apache.maven.settings.Setting
 import org.apache.maven.shared.release.ReleaseManagerListener;
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
+import org.apache.maven.shared.release.env.DefaultReleaseEnvironment;
 import org.codehaus.plexus.PlexusConstants;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.context.Context;
@@ -80,40 +81,19 @@ public class PerformReleaseTaskExecutor
         descriptor.setUseReleaseProfile( performTask.isUseReleaseProfile() );
         descriptor.setPerformGoals( performTask.getGoals() );
         descriptor.setCheckoutDirectory( performTask.getBuildDirectory().getAbsolutePath() );
-
+        
         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 +101,39 @@ 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 );
         }
+        
+        ReleaseResult result =
+            releaseManager.performWithResult( descriptor, new DefaultReleaseEnvironment().setSettings( settings ),
+                                              reactorProjects, listener );
+        
+        //override to show the actual start time
+        result.setStartTime( getStartTime() );
 
-        return reactorProjects;
+        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
         {
@@ -178,7 +159,6 @@ public class PerformReleaseTaskExecutor
             String moduleDir = o.toString();
 
             File pomFile = new File( project.getBasedir(), moduleDir + "/pom.xml" );
-            System.out.println( pomFile.getAbsolutePath() );
 
             try
             {
@@ -238,4 +218,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/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java (original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/phase/GenerateReactorProjectsPhase.java Thu May 20 07:30:43 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/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml (original)
+++ continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml Thu May 20 07:30:43 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/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java (original)
+++ continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java Thu May 20 07:30:43 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/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java Thu May 20 07:30:43 2010
@@ -51,8 +51,8 @@ public class AddMavenTwoProjectAction
     public static final String ERROR_READING_POM_EXCEPTION_MESSAGE = "Error reading POM";
 
     public static final String FILE_SCHEME = "file:/";
-
-    private boolean nonRecursiveProject;
+    
+    private String checkoutOption;
 
     protected ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup, boolean checkProtocol,
                                                         boolean scmUseCache )
@@ -103,12 +103,32 @@ public class AddMavenTwoProjectAction
                 throw new ContinuumException( ERROR_READING_POM_EXCEPTION_MESSAGE, e );
             }
         }
+        
+        boolean nonRecursiveProject;
+        boolean checkoutInSingleDirectory;
+        
+        if( "checkoutInSingleDirectory".equals( checkoutOption ) )
+        {
+            checkoutInSingleDirectory = true;
+            nonRecursiveProject = false;
+        }
+        else if( "nonRecursiveProject".equals( checkoutOption ) )
+        {
+            checkoutInSingleDirectory = false;
+            nonRecursiveProject = true;
+        }
+        else
+        {
+            checkoutInSingleDirectory = false;
+            nonRecursiveProject = false;
+        }
 
         if ( result == null )
         {
             result = getContinuum().addMavenTwoProject( pomUrl, selectedProjectGroup, checkProtocol, scmUseCache,
-                                                        !this.isNonRecursiveProject(),
-                                                        this.getBuildDefinitionTemplateId() );
+                                                        !nonRecursiveProject,
+                                                        this.getBuildDefinitionTemplateId(),
+                                                        checkoutInSingleDirectory );
         }
 
         AuditLog event = new AuditLog( hidePasswordInUrl( pomUrl ), AuditLogConstants.ADD_M2_PROJECT );
@@ -123,7 +143,7 @@ public class AddMavenTwoProjectAction
         event.log();
         return result;
     }
-
+    
     /**
      * @deprecated Use {@link #getPomFile()} instead
      */
@@ -155,14 +175,14 @@ public class AddMavenTwoProjectAction
     {
         setPomUrl( pomUrl );
     }
-
-    public boolean isNonRecursiveProject()
+    
+    public String getCheckoutOption()
     {
-        return nonRecursiveProject;
+        return checkoutOption;
     }
 
-    public void setNonRecursiveProject( boolean nonRecursiveProject )
+    public void setCheckoutOption( String checkoutOption )
     {
-        this.nonRecursiveProject = nonRecursiveProject;
+        this.checkoutOption = checkoutOption;
     }
 }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java Thu May 20 07:30:43 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/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties (original)
+++ continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties Thu May 20 07:30:43 2010
@@ -339,6 +339,8 @@ 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
+add.m2.project.checkoutInSeparateDirectories = Checkout multi-module project in separate directories 
 
 # ----------------------------------------------------------------------
 # Page: AddProject (ant or shell)

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp Thu May 20 07:30:43 2010
@@ -81,7 +81,28 @@
                                          list="projectGroups" listKey="id" listValue="name"/>
                             </c:otherwise>
                             </c:choose>
-                            <s:checkbox label="%{getText('add.m2.project.nonRecursiveProject')}" name="nonRecursiveProject" />
+                            
+                            <s:label>
+                              <s:param name="desc">
+                                <table cellspacing="0" cellpadding="0">
+	                              <tbody>
+	                                <tr>
+	                                  <td><input name="checkoutOption" type="radio" value="checkoutInSeparateDirectories" checked /></td>
+                                      <td><s:text name="add.m2.project.checkoutInSeparateDirectories"/></td>
+	                                </tr>
+	                                <tr>
+	                                  <td><input name="checkoutOption" type="radio" value="checkoutInSingleDirectory"/></td>
+                                      <td><s:text name="add.m2.project.checkoutInSingleDirectory"/></td>
+	                                </tr>
+	                                <tr>
+	                                  <td><input name="checkoutOption" type="radio" value="nonRecursiveProject"/></td>
+                                      <td><s:text name="add.m2.project.nonRecursiveProject"/></td>
+	                                </tr>
+	                              </tbody>
+	                            </table>
+                              </s:param>
+                            </s:label>	 
+                            
                             <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/trunk/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/pom.xml?rev=946548&r1=946547&r2=946548&view=diff
==============================================================================
--- continuum/trunk/pom.xml (original)
+++ continuum/trunk/pom.xml Thu May 20 07:30:43 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