continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r772129 - in /continuum/branches/continuum-flat-multi-module: continuum-commons/src/main/java/org/apache/maven/continuum/utils/ continuum-commons/src/test/java/org/apache/maven/continuum/utils/ continuum-core/src/main/java/org/apache/maven/...
Date Wed, 06 May 2009 10:12:34 GMT
Author: oching
Date: Wed May  6 10:12:33 2009
New Revision: 772129

URL: http://svn.apache.org/viewvc?rev=772129&view=rev
Log:
[CONTINUUM-2193]
o fix more bugs related to building multi-module projects

Modified:
    continuum/branches/continuum-flat-multi-module/continuum-commons/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java
    continuum/branches/continuum-flat-multi-module/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
    continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataTest.java

Modified: continuum/branches/continuum-flat-multi-module/continuum-commons/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-commons/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-commons/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-commons/src/main/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryService.java
Wed May  6 10:12:33 2009
@@ -81,7 +81,7 @@
         if ( project.getWorkingDirectory() == null || "".equals( project.getWorkingDirectory()
) )
         {   
             if ( project.isCheckedOutInSingleDirectory() && projectScmRoot != null
&& !"".equals( projectScmRoot ) )
-            {
+            {                
                 Project rootProject = project;
                 if( projects != null )
                 {
@@ -98,8 +98,13 @@
              // determine the path
                 String projectScmUrl = project.getScmUrl();
                 int indexDiff = StringUtils.differenceAt( projectScmUrl, projectScmRoot );
+                                
+                String pathToProject = "";
+                if( indexDiff != -1 )
+                {
+                    pathToProject = projectScmUrl.substring( indexDiff );
+                }
                 
-                String pathToProject = projectScmUrl.substring( indexDiff );      
                 if( pathToProject.startsWith( "\\" ) || pathToProject.startsWith( "/" ) )
                 {
                     project.setWorkingDirectory( Integer.toString( rootProject.getId() )
+ pathToProject );
@@ -117,6 +122,7 @@
 
         File workDir;
         File projectWorkingDirectory = new File( project.getWorkingDirectory() );
+        
         if ( projectWorkingDirectory.isAbsolute() )
         {
             // clean the project working directory path if it's a subdirectory of the global
working directory

Modified: continuum/branches/continuum-flat-multi-module/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
Wed May  6 10:12:33 2009
@@ -58,43 +58,35 @@
         workingDirectoryService.setConfigurationService( configurationService );
     }
     
-    public void testGetWorkingDirectoryOfSingleCheckoutMultiModules()
-        throws Exception
+    private Project createProject( int id, String groupId, String artifactId, String version,
String scmUrl,
+                                   boolean checkedOutInSingleDirectory )
     {
-        ProjectGroup pGroup = new ProjectGroup();
-        pGroup.setId( 1 );
+        Project project = new Project();        
+        project.setId( id );
+        project.setGroupId( groupId );
+        project.setArtifactId( artifactId );
+        project.setVersion( version );
+        project.setScmUrl( scmUrl );
+        project.setCheckedOutInSingleDirectory( checkedOutInSingleDirectory );
         
+        return project;
+    }
+    
+    public void testGetWorkingDirectoryOfSingleCheckoutFlatMultiModules()
+        throws Exception
+    {        
         List<Project> projects = new ArrayList<Project>();
         
-        Project project = new Project();        
-        project.setId( 7 );
-        project.setGroupId( "org.apache.continuum" );
-        project.setArtifactId( "module-a" );
-        project.setVersion( "1.0-SNAPSHOT" );
-        project.setScmUrl( "scm:local:src/test-projects:flat-multi-module/module-a" );
-        project.setCheckedOutInSingleDirectory( true );
+        Project project = createProject( 7, "org.apache.continuum", "module-a", "1.0-SNAPSHOT",
+                                         "scm:local:src/test-projects:flat-multi-module/module-a",
true );
         
         projects.add( project );
         
-        Project otherProject = new Project();        
-        otherProject.setId( 8 );
-        otherProject.setGroupId( "org.apache.continuum" );
-        otherProject.setArtifactId( "module-b" );
-        otherProject.setVersion( "1.0-SNAPSHOT" );
-        otherProject.setScmUrl( "scm:local:src/test-projects:flat-multi-module/module-b"
);
-        otherProject.setCheckedOutInSingleDirectory( true );
-        
-        projects.add( otherProject );
-        
-        otherProject = new Project();        
-        otherProject.setId( 6 );
-        otherProject.setGroupId( "org.apache.continuum" );
-        otherProject.setArtifactId( "parent-project" );
-        otherProject.setVersion( "1.0-SNAPSHOT" );
-        otherProject.setScmUrl( "scm:local:src/test-projects:flat-multi-module/parent-project"
);
-        otherProject.setCheckedOutInSingleDirectory( true );
-        
-        projects.add( otherProject );
+        projects.add( createProject( 8, "org.apache.continuum", "module-b", "1.0-SNAPSHOT",
+                                     "scm:local:src/test-projects:flat-multi-module/module-b",
true ) );
+                
+        projects.add( createProject( 6, "org.apache.continuum", "parent-project", "1.0-SNAPSHOT",
+                                     "scm:local:src/test-projects:flat-multi-module/parent-project",
true ) );
                 
         final File unixBaseWorkingDirectory = new File( "/target/working-directory" );  
     
      
@@ -115,7 +107,7 @@
             workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:flat-multi-module",
                                                          projects );
         
-        assertEquals( "Incorrect working directory for multi-module project", "/target/working-directory/6/module-a",
+        assertEquals( "Incorrect working directory for flat multi-module project", "/target/working-directory/6/module-a",
                       projectWorkingDirectory.getPath() );
         
         // test if separator is appended at the end of the scm root url
@@ -123,7 +115,7 @@
             workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:flat-multi-module/",
                                                          projects );
         
-        assertEquals( "Incorrect working directory for multi-module project", "/target/working-directory/6/module-a",
+        assertEquals( "Incorrect working directory for flat multi-module project", "/target/working-directory/6/module-a",
                       projectWorkingDirectory.getPath() );
         
             
@@ -134,10 +126,85 @@
             workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:flat-multi-module",
                                                          projects );
         
-        assertEquals( "Incorrect working directory for multi-module project", "c:\\target\\working-directory\\6\\module-a",
+        assertEquals( "Incorrect working directory for flat multi-module project", "c:\\target\\working-directory\\6\\module-a",
                       projectWorkingDirectory.getPath() );        
-
     }
-    
-    
+
+    public void testGetWorkingDirectoryOfSingleCheckoutRegularMultiModules()
+        throws Exception
+    {       
+        List<Project> projects = new ArrayList<Project>();
+        
+        Project project = createProject( 10, "org.apache.continuum", "module-a", "1.0-SNAPSHOT",
+                                         "scm:local:src/test-projects:regular-multi-module/module-a",
true );
+        
+        projects.add( project );
+        
+        projects.add( createProject( 11, "org.apache.continuum", "module-b", "1.0-SNAPSHOT",
+                                     "scm:local:src/test-projects:regular-multi-module/module-b",
true ) );
+                
+        projects.add( createProject( 9, "org.apache.continuum", "parent-project", "1.0-SNAPSHOT",
+                                     "scm:local:src/test-projects:regular-multi-module/",
true ) );
+                
+        final File unixBaseWorkingDirectory = new File( "/target/working-directory" );  
     
+     
+        final File windowsBaseWorkingDirectory = new File( "c:\\target\\working-directory"
);
+        
+        context.checking( new Expectations()
+        {
+            {
+                exactly( 2 ).of( configurationService ).getWorkingDirectory();
+                will( returnValue( unixBaseWorkingDirectory ) );
+                
+                one( configurationService ).getWorkingDirectory();
+                will( returnValue( windowsBaseWorkingDirectory ) );
+            }} );
+        
+     // test if unix path
+        File projectWorkingDirectory =
+            workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:regular-multi-module",
+                                                         projects );
+        
+        assertEquals( "Incorrect working directory for regular multi-module project", "/target/working-directory/9/module-a",
+                      projectWorkingDirectory.getPath() );
+        
+        // test if separator is appended at the end of the scm root url
+        projectWorkingDirectory =
+            workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:regular-multi-module/",
+                                                         projects );
+        
+        assertEquals( "Incorrect working directory for regular multi-module project", "/target/working-directory/9/module-a",
+                      projectWorkingDirectory.getPath() );
+        
+            
+        project.setWorkingDirectory( null );
+        
+     // test if windows path
+        projectWorkingDirectory =
+            workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:regular-multi-module",
+                                                         projects );
+        
+        assertEquals( "Incorrect working directory for regular multi-module project", "c:\\target\\working-directory\\9\\module-a",
+                      projectWorkingDirectory.getPath() );
+        
+        project.setWorkingDirectory( null );
+        
+     // test generated path of parent project
+        project = createProject( 9, "org.apache.continuum", "parent-project", "1.0-SNAPSHOT",
+                       "scm:local:src/test-projects:regular-multi-module", true );
+        
+        context.checking( new Expectations()
+        {
+            {
+                one( configurationService ).getWorkingDirectory();
+                will( returnValue( unixBaseWorkingDirectory ) );                
+            }} );
+        
+        projectWorkingDirectory =
+            workingDirectoryService.getWorkingDirectory( project, "scm:local:src/test-projects:regular-multi-module",
+                                                         projects );
+        
+        assertEquals( "Incorrect working directory for regular multi-module project", "/target/working-directory/9",
+                      projectWorkingDirectory.getPath() );
+    }    
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Wed May  6 10:12:33 2009
@@ -1555,7 +1555,7 @@
 
             projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId(
projectGroupId );
 
-            String url = AbstractContinuumAction.getString( context, AbstractContinuumAction.KEY_PROJECT_SCM_ROOT,
null );
+            String url = AbstractContinuumAction.getString( context, AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL,
null );
 
             projectScmRoot = getProjectScmRootByProjectGroupAndScmRootAddress( projectGroup.getId(),
url );
             
@@ -1620,11 +1620,11 @@
              
                 if( project != null )
                 {
-                    String scmRootUrl = AbstractContinuumAction.getString( context, AbstractContinuumAction.KEY_PROJECT_SCM_ROOT
);
+                    String scmRootUrl = AbstractContinuumAction.getString( context, AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL,
null );
                     
                     context = new HashMap<String, Object>();
 
-                    context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, scmRootUrl
);
+                    context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL, scmRootUrl
);
                     
                     Project rootProject = result.getRootProject();
                     

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Wed May  6 10:12:33 2009
@@ -369,7 +369,7 @@
                 projectScmRootAddress = projectScmRoot.getScmRootAddress();
                 if ( projectScmUrl.contains( projectScmRoot.getScmRootAddress() ) )
                 {                    
-                    actionContext.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, projectScmRoot
);
+                    actionContext.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL,
projectScmRoot.getScmRootAddress() );
                     break;
                 }
             }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
Wed May  6 10:12:33 2009
@@ -93,6 +93,13 @@
     public static final String KEY_OLD_SCM_RESULT = "old-scmResult";
 
     public static final String KEY_PROJECT_SCM_ROOT = "projectScmRoot";
+    
+    /**
+     * SCM root url. Used in these actions add-project-to-checkout-queue, checkout-project,
clean-working-directory,
+     *      create-projects-from-metadata, update-project-from-working-directory, 
+     *      update-working-directory-from-scm
+     */
+    public static final String KEY_PROJECT_SCM_ROOT_URL = "projectScmRootUrl";
 
     public static final String KEY_OLD_BUILD_ID = "old-buildResult-id";
 
@@ -100,8 +107,14 @@
 
     public static final String KEY_SCM_RESULT_MAP = "scm-result-map";
     
+    /**
+     * Metadata url for adding projects.
+     */
     public static final String KEY_URL = "url";
     
+    /**
+     * List of projects in a project group with a common scm root url.
+     */
     public static final String KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT = "projects-in-group-with-common-scm-root";
 
     // ----------------------------------------------------------------------

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
Wed May  6 10:12:33 2009
@@ -61,7 +61,7 @@
             project = projectDao.getProject( getProjectId( context ) );
         }
 
-        String scmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT, null );
+        String scmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, null );
         
         BuildDefinition defaultBuildDefinition = getBuildDefinition( context );
         parallelBuildsManager.checkoutProject( project.getId(), project.getName(),

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
Wed May  6 10:12:33 2009
@@ -24,7 +24,6 @@
 import java.util.Map;
 
 import org.apache.continuum.dao.ProjectDao;
-import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
 
@@ -36,7 +35,7 @@
  */
 public class CheckWorkingDirectoryAction
     extends AbstractContinuumAction
-{
+{   
     /**
      * @plexus.requirement
      */
@@ -51,13 +50,13 @@
         throws Exception
     {
         Project project = projectDao.getProject( getProjectId( context ) );
-        List<Project> projectsWithSimilarScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
-        ProjectScmRoot projectScmRoot = getProjectScmRoot( context );
+        List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
+        String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl()
);
        
         File workingDirectory =
-            workingDirectoryService.getWorkingDirectory( project, projectScmRoot.getScmRootAddress(),
-                                                         projectsWithSimilarScmRoot );
-
+            workingDirectoryService.getWorkingDirectory( project, projectScmRootUrl,
+                                                         projectsWithCommonScmRoot );
+        
         if ( !workingDirectory.exists() )
         {
             context.put( KEY_WORKING_DIRECTORY_EXISTS, Boolean.FALSE );

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
Wed May  6 10:12:33 2009
@@ -99,7 +99,7 @@
         {
             String scmUserName = getString( context, KEY_SCM_USERNAME, project.getScmUsername()
);
             String scmPassword = getString( context, KEY_SCM_PASSWORD, project.getScmPassword()
);
-            String scmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT, project.getScmUrl()
);            
+            String scmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl()
);            
             
             ContinuumScmConfiguration config =
                 createScmConfiguration( project, workingDirectory, scmUserName, scmPassword,
scmRootUrl );

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CleanWorkingDirectoryAction.java
Wed May  6 10:12:33 2009
@@ -20,7 +20,6 @@
  */
 
 import org.apache.continuum.dao.ProjectDao;
-import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
 import org.apache.maven.shared.model.fileset.FileSet;
@@ -53,12 +52,11 @@
         throws Exception
     {
         Project project = projectDao.getProject( getProjectId( context ) );
-        List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
-        ProjectScmRoot projectScmRoot = getProjectScmRoot( context ); 
+        List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );        
+        String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, null );
 
-        //File workingDirectory = workingDirectoryService.getWorkingDirectory( project );
         File workingDirectory =
-            workingDirectoryService.getWorkingDirectory( project, projectScmRoot.getScmRootAddress(),
+            workingDirectoryService.getWorkingDirectory( project, projectScmRootUrl,
                                                          projectsWithCommonScmRoot );
 
         if ( workingDirectory.exists() )

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
Wed May  6 10:12:33 2009
@@ -180,7 +180,7 @@
                     }
                 }
                 
-                context.put( KEY_PROJECT_SCM_ROOT, scmRootUrl );
+                context.put( KEY_PROJECT_SCM_ROOT_URL, scmRootUrl );
             }
         }
         catch ( MalformedURLException e )

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
Wed May  6 10:12:33 2009
@@ -21,7 +21,6 @@
 
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.ProjectDao;
-import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorException;
@@ -31,7 +30,6 @@
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
 
-import java.io.File;
 import java.util.List;
 import java.util.Map;
 
@@ -82,10 +80,10 @@
         ContinuumBuildExecutor builder = buildExecutorManager.getBuildExecutor( project.getExecutorId()
);
 
         List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
-        ProjectScmRoot projectScmRoot = getProjectScmRoot( context );
+        String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl()
);
         
         builder.updateProjectFromCheckOut( workingDirectoryService.getWorkingDirectory( project,

-                        projectScmRoot.getScmRootAddress(), projectsWithCommonScmRoot ),
project, buildDefinition );
+                        projectScmRootUrl, projectsWithCommonScmRoot ), project, buildDefinition
);
 
         // ----------------------------------------------------------------------
         // Store the new descriptor

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
Wed May  6 10:12:33 2009
@@ -21,7 +21,6 @@
 
 import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
-import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.scm.ContinuumScm;
 import org.apache.continuum.scm.ContinuumScmConfiguration;
 import org.apache.continuum.utils.ContinuumUtils;
@@ -54,7 +53,7 @@
  */
 public class UpdateWorkingDirectoryFromScmContinuumAction
     extends AbstractContinuumAction
-{
+{                                                                  
     /**
      * @plexus.requirement
      */
@@ -112,16 +111,15 @@
         {
             notifier.checkoutStarted( project, buildDefinition );
 
-            List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );
-            ProjectScmRoot projectScmRoot = getProjectScmRoot( context );
+            List<Project> projectsWithCommonScmRoot = getListOfProjectsInGroupWithCommonScmRoot(
context );           
+            String projectScmRootUrl = getString( context, KEY_PROJECT_SCM_ROOT_URL, project.getScmUrl()
);
 
-            // TODO: not sure why this is different to the context, but it all needs to change
-            //File workingDirectory = workingDirectoryService.getWorkingDirectory( project
);
+            // TODO: not sure why this is different to the context, but it all needs to change
           
             File workingDirectory =
-                workingDirectoryService.getWorkingDirectory( project, projectScmRoot.getScmRootAddress(),
+                workingDirectoryService.getWorkingDirectory( project, projectScmRootUrl,
                                                              projectsWithCommonScmRoot );
             
-            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory,
projectScmRoot.getScmRootAddress() );
+            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory,
projectScmRootUrl );
             config.setLatestUpdateDate( latestUpdateDate );
             String tag = config.getTag();
             String msg = project.getName() + "', id: '" + project.getId() + "' to '" +

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
Wed May  6 10:12:33 2009
@@ -93,7 +93,7 @@
 
         context.put( AbstractContinuumAction.KEY_SCM_USERNAME, task.getScmUserName() );
 
-        context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, task.getScmRootUrl() );
+        context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL, task.getScmRootUrl()
);
 
         context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT,
task.getProjectsWithSimilarScmRoot() );
         

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=772129&r1=772128&r2=772129&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
(original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
Wed May  6 10:12:33 2009
@@ -51,7 +51,6 @@
 import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
 import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -201,6 +200,7 @@
                 if ( projectScmUrl.contains( projectScmRoot.getScmRootAddress() ) )
                 {                    
                     context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, projectScmRoot
);
+                    context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL, projectScmRootAddress
);
                     break;
                 }
             }

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=772129&r1=772128&r2=772129&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
Wed May  6 10:12:33 2009
@@ -200,6 +200,6 @@
             "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
) );
+                      "scm:local:src/test-projects:flat-multi-module/", context.get( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL
) );
     }
 }



Mime
View raw message