You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by oc...@apache.org on 2010/05/06 11:23:34 UTC

svn commit: r941625 [11/24] - in /continuum/branches/continuum-flat-multi-module: ./ continuum-api/ continuum-api/src/main/java/org/apache/continuum/builder/distributed/ continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/ cont...

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=941625&r1=941624&r2=941625&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 Thu May  6 09:23:13 2010
@@ -28,13 +28,16 @@ import java.util.Set;
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
-import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.continuum.dao.ProjectScmRootDao;
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.taskqueue.PrepareBuildProjectsTask;
 import org.apache.continuum.utils.ContinuumUtils;
 import org.apache.continuum.utils.ProjectSorter;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
+import org.apache.maven.continuum.core.action.CheckWorkingDirectoryAction;
+import org.apache.maven.continuum.core.action.CheckoutProjectContinuumAction;
+import org.apache.maven.continuum.core.action.UpdateWorkingDirectoryFromScmContinuumAction;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
@@ -99,11 +102,6 @@ public class PrepareBuildProjectsTaskExe
      * @plexus.requirement
      */
     private ContinuumNotificationDispatcher notifierDispatcher;
-    
-    /**
-     * @plexus.requirement
-     */
-    private ProjectGroupDao projectGroupDao;
 
     public void executeTask( Task task )
         throws TaskExecutionException
@@ -111,7 +109,7 @@ public class PrepareBuildProjectsTaskExe
         PrepareBuildProjectsTask prepareTask = (PrepareBuildProjectsTask) task;
 
         Map<Integer, Integer> projectsBuildDefinitionsMap = prepareTask.getProjectsBuildDefinitionsMap();
-        int trigger = prepareTask.getTrigger();
+        BuildTrigger buildTrigger = prepareTask.getBuildTrigger();
         Set<Integer> projectsId = projectsBuildDefinitionsMap.keySet();
         Map<String, Object> context = new HashMap<String, Object>();
         Map<Integer, ScmResult> scmResultMap = new HashMap<Integer, ScmResult>();
@@ -123,7 +121,7 @@ public class PrepareBuildProjectsTaskExe
                 int buildDefinitionId = projectsBuildDefinitionsMap.get( projectId );
 
                 log.info( "Initializing prepare build" );
-                context = initializeContext( projectId, buildDefinitionId );
+                context = initializeContext( projectId, buildDefinitionId, prepareTask.getBuildTrigger() );
 
                 log.info(
                     "Starting prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
@@ -162,7 +160,7 @@ public class PrepareBuildProjectsTaskExe
                     log.info(
                         "Ending prepare build of project: " + AbstractContinuumAction.getProject( context ).getName() );
                     scmResultMap.put( AbstractContinuumAction.getProjectId( context ),
-                                      AbstractContinuumAction.getScmResult( context, null ) );
+                                      AbstractContinuumAction.getScmResult( context, new ScmResult() ) );
                     endProjectPrepareBuild( context );
                 }
             }
@@ -176,11 +174,11 @@ public class PrepareBuildProjectsTaskExe
         if ( checkProjectScmRoot( context ) )
         {
             int projectGroupId = AbstractContinuumAction.getProjectGroupId( context );
-            buildProjects( projectGroupId, projectsBuildDefinitionsMap, trigger, scmResultMap );
+            buildProjects( projectGroupId, projectsBuildDefinitionsMap, buildTrigger, scmResultMap );
         }
     }
 
-    private Map<String, Object> initializeContext( int projectId, int buildDefinitionId )
+    private Map<String, Object> initializeContext( int projectId, int buildDefinitionId, BuildTrigger buildTrigger )
         throws TaskExecutionException
     {
         Map<String, Object> context = new HashMap<String, Object>();
@@ -192,54 +190,37 @@ public class PrepareBuildProjectsTaskExe
 
             List<ProjectScmRoot> scmRoots = projectScmRootDao.getProjectScmRootByProjectGroup( projectGroup.getId() );
             String projectScmUrl = project.getScmUrl();
-            String projectScmRootAddress = "";
-            
+
             for ( ProjectScmRoot projectScmRoot : scmRoots )
             {
-                projectScmRootAddress = projectScmRoot.getScmRootAddress();
                 if ( projectScmUrl.startsWith( projectScmRoot.getScmRootAddress() ) )
-                {                    
-                    context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, projectScmRoot );
-                    context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL, projectScmRootAddress );
+                {
+                    AbstractContinuumAction.setProjectScmRoot( context, projectScmRoot );
                     break;
                 }
             }
 
-            context.put( AbstractContinuumAction.KEY_PROJECT_GROUP_ID, projectGroup.getId() );
-            context.put( AbstractContinuumAction.KEY_PROJECT_ID, projectId );
-            context.put( AbstractContinuumAction.KEY_PROJECT, project );
-
-            context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION_ID, buildDefinitionId );
-            context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION,
-                         buildDefinitionDao.getBuildDefinition( buildDefinitionId ) );
-
-            if( project.isCheckedOutInSingleDirectory() )
-            {
-                List<Project> projectsInGroup =
-                    projectGroupDao.getProjectGroupWithProjects( projectGroup.getId() ).getProjects(); 
-                List<Project> projectsWithCommonScmRoot = new ArrayList<Project>();            
-                for( Project projectInGroup : projectsInGroup )
-                {
-                    if( projectInGroup.getScmUrl().startsWith( projectScmRootAddress ) )
-                    {
-                        projectsWithCommonScmRoot.add( projectInGroup );
-                    }
-                }            
-                context.put( AbstractContinuumAction.KEY_PROJECTS_IN_GROUP_WITH_COMMON_SCM_ROOT, projectsWithCommonScmRoot );
-            }
-            
+            AbstractContinuumAction.setProjectGroupId( context, projectGroup.getId() );
+            AbstractContinuumAction.setProjectId( context, projectId );
+            AbstractContinuumAction.setProject( context, project );
+            AbstractContinuumAction.setBuildTrigger( context, buildTrigger );
+
+            AbstractContinuumAction.setBuildDefinitionId( context, buildDefinitionId );
+            AbstractContinuumAction.setBuildDefinition( context,
+                                                        buildDefinitionDao.getBuildDefinition( buildDefinitionId ) );
+
             BuildResult oldBuildResult =
                 buildResultDao.getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId );
 
             if ( oldBuildResult != null )
             {
-                context.put( AbstractContinuumAction.KEY_OLD_SCM_RESULT,
-                             getOldScmResults( projectId, oldBuildResult.getBuildNumber(),
-                                               oldBuildResult.getEndTime() ) );
+                AbstractContinuumAction.setOldScmResult( context,
+                                                         getOldScmResults( projectId, oldBuildResult.getBuildNumber(),
+                                                                           oldBuildResult.getEndTime() ) );
             }
             else
             {
-                context.put( AbstractContinuumAction.KEY_OLD_SCM_RESULT, null );
+                AbstractContinuumAction.setOldScmResult( context, null );
             }
         }
         catch ( ContinuumStoreException e )
@@ -261,8 +242,7 @@ public class PrepareBuildProjectsTaskExe
     {
         performAction( "check-working-directory", context );
 
-        boolean workingDirectoryExists =
-            AbstractContinuumAction.getBoolean( context, AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS );
+        boolean workingDirectoryExists = CheckWorkingDirectoryAction.isWorkingDirectoryExist( context );
 
         ScmResult scmResult;
 
@@ -270,21 +250,28 @@ public class PrepareBuildProjectsTaskExe
         {
             performAction( "update-working-directory-from-scm", context );
 
-            scmResult = AbstractContinuumAction.getUpdateScmResult( context );
+            scmResult = UpdateWorkingDirectoryFromScmContinuumAction.getUpdateScmResult( context );
         }
         else
         {
             Project project = AbstractContinuumAction.getProject( context );
 
-            context.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY,
-                         workingDirectoryService.getWorkingDirectory( project ).getAbsolutePath() );
-            
+            AbstractContinuumAction.setWorkingDirectory( context, workingDirectoryService.getWorkingDirectory(
+                project ).getAbsolutePath() );
+
             performAction( "checkout-project", context );
 
-            scmResult = AbstractContinuumAction.getCheckoutResult( context, null );
+            scmResult = CheckoutProjectContinuumAction.getCheckoutResult( context, null );
         }
 
-        context.put( AbstractContinuumAction.KEY_SCM_RESULT, scmResult );
+        // [CONTINUUM-2207] when returned scmResult is null, this causes a problem when building the project 
+        if ( scmResult == null )
+        {
+            log.debug( "Returned ScmResult is null when updating the working directory" );
+            scmResult = new ScmResult();
+        }
+
+        AbstractContinuumAction.setScmResult( context, scmResult );
     }
 
     private boolean checkProjectScmRoot( Map<String, Object> context )
@@ -294,6 +281,7 @@ public class PrepareBuildProjectsTaskExe
 
         // check state of scm root
         return projectScmRoot.getState() != ContinuumProjectState.ERROR;
+
     }
 
     private void startPrepareBuild( Map<String, Object> context )
@@ -407,7 +395,7 @@ public class PrepareBuildProjectsTaskExe
         {
             if ( newScmResult == null )
             {
-                context.put( AbstractContinuumAction.KEY_SCM_RESULT, oldScmResult );
+                AbstractContinuumAction.setScmResult( context, oldScmResult );
             }
             else
             {
@@ -454,7 +442,7 @@ public class PrepareBuildProjectsTaskExe
 
         result.setException( ContinuumUtils.throwableToString( exception ) );
 
-        context.put( AbstractContinuumAction.KEY_SCM_RESULT, result );
+        AbstractContinuumAction.setScmResult( context, result );
 
         throw exception;
     }
@@ -513,7 +501,7 @@ public class PrepareBuildProjectsTaskExe
 
             projectScmRootDao.updateProjectScmRoot( projectScmRoot );
 
-            context.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, projectScmRoot );
+            AbstractContinuumAction.setProjectScmRoot( context, projectScmRoot );
         }
         catch ( ContinuumStoreException e )
         {
@@ -521,8 +509,8 @@ public class PrepareBuildProjectsTaskExe
         }
     }
 
-    private void buildProjects( int projectGroupId, Map<Integer, Integer> projectsAndBuildDefinitionsMap, int trigger,
-                                Map<Integer, ScmResult> scmResultMap )
+    private void buildProjects( int projectGroupId, Map<Integer, Integer> projectsAndBuildDefinitionsMap,
+    		                    BuildTrigger buildTrigger, Map<Integer, ScmResult> scmResultMap )
         throws TaskExecutionException
     {
         List<Project> projects = projectDao.getProjectsWithDependenciesByGroupId( projectGroupId );
@@ -536,7 +524,7 @@ public class PrepareBuildProjectsTaskExe
         for ( Project project : projectList )
         {
             int buildDefinitionId;
-            
+
             if ( projectsAndBuildDefinitionsMap.get( project.getId() ) != null )
             {
                 buildDefinitionId = projectsAndBuildDefinitionsMap.get( project.getId() );
@@ -553,36 +541,16 @@ public class PrepareBuildProjectsTaskExe
                     throw new TaskExecutionException( "Error while creating build object", e );
                 }
             }
-            else if ( project.getState() == ContinuumProjectState.CHECKEDOUT ||
-                project.getState() == ContinuumProjectState.NEW || project.isCheckedOutInSingleDirectory() ) //check if no build result yet for project
-            {
-                try
-                {
-                    //get default build definition for project
-                    BuildDefinition buildDefinition = buildDefinitionDao.getDefaultBuildDefinition( project.getId() );
-                    projectsBuildDefinitionsMap.put( project.getId(), buildDefinition );
-                    projectsToBeBuilt.add( project );
-                }
-                catch ( ContinuumStoreException e )
-                {
-                    log.error( "Error while creating build object", e );
-                    throw new TaskExecutionException( "Error while creating build object", e );
-                }
-                catch ( Exception e )
-                {
-                    log.error( e.getMessage(), e );
-                    throw new TaskExecutionException( "Error executing action 'build-project'", e );
-                }
-            }            
         }
 
         try
         {
             Map<String, Object> context = new HashMap<String, Object>();
-            context.put( AbstractContinuumAction.KEY_PROJECTS, projectsToBeBuilt );
-            context.put( AbstractContinuumAction.KEY_PROJECTS_BUILD_DEFINITIONS_MAP, projectsBuildDefinitionsMap );
-            context.put( AbstractContinuumAction.KEY_TRIGGER, trigger );
-            context.put( AbstractContinuumAction.KEY_SCM_RESULT_MAP, scmResultMap );
+            AbstractContinuumAction.setListOfProjects( context, projectsToBeBuilt );
+            AbstractContinuumAction.setProjectsBuildDefinitionsMap( context, projectsBuildDefinitionsMap );
+            AbstractContinuumAction.setBuildTrigger( context, buildTrigger );
+            AbstractContinuumAction.setScmResultMap( context, scmResultMap );
+            AbstractContinuumAction.setProjectGroupId( context, projectGroupId );
 
             log.info( "Performing action create-build-project-task" );
             actionManager.lookup( "create-build-project-task" ).execute( context );

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/PrepareBuildComplete.vm
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/PrepareBuildComplete.vm?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/PrepareBuildComplete.vm (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/main/resources/org/apache/maven/continuum/notification/mail/templates/PrepareBuildComplete.vm Thu May  6 09:23:13 2010
@@ -15,7 +15,7 @@
  *#
 Online report : $reportUrl
 
-  Project Group: $projectGroup.name
+  Project Group: $projectScmRoot.projectGroup.name
   SCM Root URL: $projectScmRoot.scmRootAddress
   
 #if ($projectScmRoot.state == 4)

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java Thu May  6 09:23:13 2010
@@ -28,14 +28,18 @@ import java.util.Map;
 
 import org.apache.continuum.buildqueue.BuildQueueService;
 import org.apache.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.taskqueue.BuildProjectTask;
 import org.apache.continuum.taskqueue.CheckOutTask;
 import org.apache.continuum.taskqueue.OverallBuildQueue;
 import org.apache.continuum.taskqueueexecutor.ParallelBuildsThreadedTaskQueueExecutor;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildQueue;
+import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.Schedule;
+import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.TaskQueue;
@@ -60,6 +64,8 @@ public class ParallelBuildsManagerTest
 
     private BuildDefinitionDao buildDefinitionDao;
 
+    private ProjectDao projectDao;
+
     private ConfigurationService configurationService;
 
     private OverallBuildQueue overallBuildQueue;
@@ -68,6 +74,12 @@ public class ParallelBuildsManagerTest
 
     private TaskQueue checkoutQueue;
 
+    private List<Project> projects;
+
+    private TaskQueueExecutor buildTaskQueueExecutor;
+
+    private TaskQueueExecutor checkoutTaskQueueExecutor;
+
     @Override
     public void setUp()
         throws Exception
@@ -98,6 +110,14 @@ public class ParallelBuildsManagerTest
         buildQueue = context.mock( TaskQueue.class, "build-queue" );
 
         checkoutQueue = context.mock( TaskQueue.class, "checkout-queue" );
+
+        projectDao = context.mock( ProjectDao.class );
+
+        buildsManager.setProjectDao( projectDao );
+
+        buildTaskQueueExecutor = context.mock( TaskQueueExecutor.class, "build-task-queue" );
+
+        checkoutTaskQueueExecutor = context.mock( TaskQueueExecutor.class, "checkout-task-queue" );
     }
 
     @Override
@@ -159,7 +179,7 @@ public class ParallelBuildsManagerTest
 
     // build project recordings
     private void recordStartOfBuildProjectSequence()
-        throws TaskQueueException
+        throws TaskQueueException, ContinuumStoreException
     {
         context.checking( new Expectations()
         {
@@ -167,16 +187,25 @@ public class ParallelBuildsManagerTest
                 exactly( 5 ).of( overallBuildQueue ).isInBuildQueue( with( any( int.class ) ) );
                 will( returnValue( false ) );
 
+                exactly( 5 ).of( buildTaskQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+
+                one( projectDao ).getProjectsInGroup( with( any( int.class ) ) );
+                will( returnValue( projects ) );
+
                 one( configurationService ).getNumberOfBuildsInParallel();
                 will( returnValue( 2 ) );
 
                 exactly( 2 ).of( overallBuildQueue ).getBuildQueue();
                 will( returnValue( buildQueue ) );
+
+                exactly( 7 ).of( overallBuildQueue ).getBuildTaskQueueExecutor();
+                will( returnValue( buildTaskQueueExecutor ) );
             }} );
     }
 
     private void recordBuildProjectBuildQueuesAreEmpty()
-        throws TaskQueueException
+        throws TaskQueueException, ContinuumStoreException
     {
         // shouldn't only the build queues attached to the schedule be checked?
         recordStartOfBuildProjectSequence();
@@ -185,8 +214,11 @@ public class ParallelBuildsManagerTest
         context.checking( new Expectations()
         {
             {
-                exactly( 3 ).of( buildQueue ).getQueueSnapshot();
+                exactly( 2 ).of( buildQueue ).getQueueSnapshot();
                 will( returnValue( tasks ) );
+                
+                exactly( 2 ).of( buildTaskQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
 
                 one( overallBuildQueue ).getName();
                 will( returnValue( "BUILD_QUEUE_2" ) );
@@ -220,6 +252,9 @@ public class ParallelBuildsManagerTest
 
                 exactly( 2 ).of( overallBuildQueue ).getCheckoutQueue();
                 will( returnValue( checkoutQueue ) );
+
+                exactly( 2 ).of( overallBuildQueue ).getCheckoutTaskQueueExecutor();
+                will( returnValue( checkoutTaskQueueExecutor ) );
             }} );
 
     }
@@ -233,9 +268,12 @@ public class ParallelBuildsManagerTest
         context.checking( new Expectations()
         {
             {
-                exactly( 3 ).of( checkoutQueue ).getQueueSnapshot();
+                exactly( 2 ).of( checkoutQueue ).getQueueSnapshot();
                 will( returnValue( tasks ) );
 
+                exactly( 2 ).of( checkoutTaskQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+
                 one( overallBuildQueue ).getName();
                 will( returnValue( "BUILD_QUEUE_2" ) );
             }} );
@@ -276,7 +314,7 @@ public class ParallelBuildsManagerTest
 
         recordBuildProjectBuildQueuesAreEmpty();
 
-        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", 1, null );
+        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", new BuildTrigger( 1, "test-user" ), null, 1 );
 
         context.assertIsSatisfied();
     }
@@ -292,7 +330,7 @@ public class ParallelBuildsManagerTest
 
         recordBuildProjectBuildQueuesAreEmpty();
 
-        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", 1, null );
+        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", new BuildTrigger( 1, "test-user" ), null, 1 );
         context.assertIsSatisfied();
 
         //queue second project - 1st queue is not empty, 2nd queue is empty 
@@ -302,24 +340,27 @@ public class ParallelBuildsManagerTest
         final List<Task> tasks = new ArrayList<Task>();
         final List<Task> tasksOfFirstBuildQueue = new ArrayList<Task>();
         tasksOfFirstBuildQueue.add(
-            new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", buildDef.getDescription(), null ) );
+        		new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", buildDef.getDescription(), null, 2 ) );
         context.checking( new Expectations()
         {
             {
-                exactly( 2 ).of( buildQueue ).getQueueSnapshot();
+                one( buildQueue ).getQueueSnapshot();
                 will( returnValue( tasksOfFirstBuildQueue ) );
 
                 // the second build queue has no tasks queued, so it should return 0
-                exactly( 2 ).of( buildQueue ).getQueueSnapshot();
+                one( buildQueue ).getQueueSnapshot();
                 will( returnValue( tasks ) );
 
+                exactly( 2 ).of( buildTaskQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+
                 one( overallBuildQueue ).getName();
                 will( returnValue( "BUILD_QUEUE_3" ) );
             }} );
 
         recordAddToBuildQueue();
 
-        buildsManager.buildProject( 2, buildDef, "continuum-project-test-2", 1, null );
+        buildsManager.buildProject( 2, buildDef, "continuum-project-test-2", new BuildTrigger( 1, "test-user" ), null, 2 );
         context.assertIsSatisfied();
 
         // queue third project - both queues have 1 task queued each
@@ -329,16 +370,19 @@ public class ParallelBuildsManagerTest
         context.checking( new Expectations()
         {
             {
-                exactly( 3 ).of( buildQueue ).getQueueSnapshot();
+                exactly( 2 ).of( buildQueue ).getQueueSnapshot();
                 will( returnValue( tasksOfFirstBuildQueue ) );
 
+                exactly( 2 ).of( buildTaskQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+                
                 one( overallBuildQueue ).getName();
                 will( returnValue( "BUILD_QUEUE_2" ) );
             }} );
 
         recordAddToBuildQueue();
 
-        buildsManager.buildProject( 3, buildDef, "continuum-project-test-3", 1, null );
+        buildsManager.buildProject( 3, buildDef, "continuum-project-test-3", new BuildTrigger( 1, "test-user" ), null, 3 );
         context.assertIsSatisfied();
     }
 
@@ -391,8 +435,8 @@ public class ParallelBuildsManagerTest
         recordCheckoutProjectBuildQueuesAreEmpty();
 
         buildsManager.checkoutProject( 1, "continuum-project-test-1",
-                                       new File( getBasedir(), "/target/test-working-dir/1" ), null, "dummy",
-                                       "dummypass", buildDef, null );
+                                       new File( getBasedir(), "/target/test-working-dir/1" ), "dummy", "dummypass",
+                                       buildDef );
         context.assertIsSatisfied();
     }
 
@@ -408,8 +452,8 @@ public class ParallelBuildsManagerTest
         recordCheckoutProjectBuildQueuesAreEmpty();
 
         buildsManager.checkoutProject( 1, "continuum-project-test-1",
-                                       new File( getBasedir(), "/target/test-working-dir/1" ), null, "dummy",
-                                       "dummypass", buildDef, null );
+                                       new File( getBasedir(), "/target/test-working-dir/1" ), "dummy", "dummypass",
+                                       buildDef );
         context.assertIsSatisfied();
 
         // queue second project - 1st queue has 1 task while 2nd queue is empty; project should be queued in
@@ -421,17 +465,20 @@ public class ParallelBuildsManagerTest
         final List<Task> tasksInFirstCheckoutQueue = new ArrayList<Task>();
         tasksInFirstCheckoutQueue.add(
             new CheckOutTask( 1, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-1",
-                              "dummy", "dummypass", null, null ) );
+                              "dummy", "dummypass" ) );
 
         context.checking( new Expectations()
         {
             {
-                exactly( 2 ).of( checkoutQueue ).getQueueSnapshot();
+                one( checkoutQueue ).getQueueSnapshot();
                 will( returnValue( tasksInFirstCheckoutQueue ) );
 
-                exactly( 2 ).of( checkoutQueue ).getQueueSnapshot();
+                one( checkoutQueue ).getQueueSnapshot();
                 will( returnValue( tasks ) );
 
+                exactly( 2 ).of( checkoutTaskQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+                
                 one( overallBuildQueue ).getName();
                 will( returnValue( "BUILD_QUEUE_3" ) );
             }} );
@@ -439,8 +486,8 @@ public class ParallelBuildsManagerTest
         recordAddToCheckoutQueue();
 
         buildsManager.checkoutProject( 2, "continuum-project-test-2",
-                                       new File( getBasedir(), "/target/test-working-dir/1" ), null, "dummy",
-                                       "dummypass", buildDef, null );
+                                       new File( getBasedir(), "/target/test-working-dir/1" ), "dummy", "dummypass",
+                                       buildDef );
         context.assertIsSatisfied();
 
         // queue third project - both queues have 1 task queued each; third project should be queued in 1st queue
@@ -449,9 +496,12 @@ public class ParallelBuildsManagerTest
         context.checking( new Expectations()
         {
             {
-                exactly( 3 ).of( checkoutQueue ).getQueueSnapshot();
+                exactly( 2 ).of( checkoutQueue ).getQueueSnapshot();
                 will( returnValue( tasksInFirstCheckoutQueue ) );
 
+                exactly( 2 ).of( checkoutTaskQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+                
                 one( overallBuildQueue ).getName();
                 will( returnValue( "BUILD_QUEUE_2" ) );
             }} );
@@ -459,8 +509,8 @@ public class ParallelBuildsManagerTest
         recordAddToCheckoutQueue();
 
         buildsManager.checkoutProject( 3, "continuum-project-test-3",
-                                       new File( getBasedir(), "/target/test-working-dir/1" ), null, "dummy",
-                                       "dummypass", buildDef, null );
+                                       new File( getBasedir(), "/target/test-working-dir/1" ), "dummy", "dummypass",
+                                       buildDef );
         context.assertIsSatisfied();
     }
 
@@ -558,12 +608,12 @@ public class ParallelBuildsManagerTest
             context.mock( TaskQueueExecutor.class, "checkout-queue-executor" );
 
         final List<Task> buildTasks = new ArrayList<Task>();
-        buildTasks.add( new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF", null ) );
+        buildTasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, 2 ) );
 
         final List<CheckOutTask> checkoutTasks = new ArrayList<CheckOutTask>();
         checkoutTasks.add(
             new CheckOutTask( 2, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-2",
-                              "dummy", "dummypass", null, null ) );
+                              "dummy", "dummypass" ) );
 
         final ParallelBuildsThreadedTaskQueueExecutor buildTaskQueueExecutor =
             context.mock( ParallelBuildsThreadedTaskQueueExecutor.class, "parallel-build-task-executor" );
@@ -626,15 +676,27 @@ public class ParallelBuildsManagerTest
                 exactly( 4 ).of( overallBuildQueue ).isInBuildQueue( with( any( int.class ) ) );
                 will( returnValue( false ) );
 
+                exactly( 4 ).of( buildQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+
+                one( projectDao ).getProjectsInGroup( with( any( int.class ) ) );
+                will( returnValue( projects ) );
+
                 one( configurationService ).getNumberOfBuildsInParallel();
                 will( returnValue( 2 ) );
 
                 exactly( 2 ).of( overallBuildQueue ).getBuildQueue();
                 will( returnValue( buildQueue ) );
 
-                exactly( 3 ).of( buildQueue ).getQueueSnapshot();
+                exactly( 6 ).of( overallBuildQueue ).getBuildTaskQueueExecutor();
+                will( returnValue( buildQueueExecutor ) );
+                
+                exactly( 2 ).of( buildQueue ).getQueueSnapshot();
                 will( returnValue( tasks ) );
 
+                exactly( 2 ).of( buildQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+                
                 one( overallBuildQueue ).getName();
                 will( returnValue( "BUILD_QUEUE_2" ) );
 
@@ -654,9 +716,15 @@ public class ParallelBuildsManagerTest
                 exactly( 2 ).of( overallBuildQueue ).getCheckoutQueue();
                 will( returnValue( checkoutQueue ) );
 
-                exactly( 3 ).of( checkoutQueue ).getQueueSnapshot();
+                exactly( 2 ).of( overallBuildQueue ).getCheckoutTaskQueueExecutor();
+                will( returnValue( checkoutQueueExecutor ) );
+
+                exactly( 2 ).of( checkoutQueue ).getQueueSnapshot();
                 will( returnValue( tasks ) );
 
+                exactly( 2 ).of( checkoutQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+
                 one( overallBuildQueue ).getName();
                 will( returnValue( "BUILD_QUEUE_2" ) );
 
@@ -680,15 +748,15 @@ public class ParallelBuildsManagerTest
         buildDef.setSchedule( getSchedule( 1, 1, 2 ) );
 
         final TaskQueueExecutor buildQueueExecutor = context.mock( TaskQueueExecutor.class, "build-queue-executor" );
-        final Task buildTask = new BuildProjectTask( 1, 1, 1, "continuum-project-test-1", "BUILD_DEF", null );
+        final Task buildTask = new BuildProjectTask( 1, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-1", "BUILD_DEF", null, 1 );
 
         final List<BuildProjectTask> buildTasks = new ArrayList<BuildProjectTask>();
-        buildTasks.add( new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF", null ) );
+        buildTasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, 2 ) );
 
         final List<CheckOutTask> checkoutTasks = new ArrayList<CheckOutTask>();
         checkoutTasks.add(
             new CheckOutTask( 2, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-2",
-                              "dummy", "dummypass", null, null ) );
+                              "dummy", "dummypass" ) );
 
         try
         {
@@ -743,6 +811,15 @@ public class ParallelBuildsManagerTest
                 one( overallBuildQueue ).isInBuildQueue( with( any( int.class ) ) );
                 will( returnValue( false ) );
 
+                one( overallBuildQueue ).getBuildTaskQueueExecutor();
+                will( returnValue( buildTaskQueueExecutor ) );
+
+                one( buildTaskQueueExecutor ).getCurrentTask();
+                will( returnValue( null ) );
+
+                one( projectDao ).getProjectsInGroup( with( any( int.class ) ) );
+                will( returnValue( projects ) );
+
                 one( configurationService ).getNumberOfBuildsInParallel();
                 will( returnValue( 2 ) );
 
@@ -752,7 +829,7 @@ public class ParallelBuildsManagerTest
                 one( overallBuildQueue ).addToBuildQueue( with( any( BuildProjectTask.class ) ) );
             }} );
 
-        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", 1, null );
+        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", new BuildTrigger( 1, "test-user" ), null, 1 );
         context.assertIsSatisfied();
     }
 
@@ -762,7 +839,7 @@ public class ParallelBuildsManagerTest
         setupMockOverallBuildQueues();
 
         final List<Task> tasks = new ArrayList<Task>();
-        tasks.add( new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF", null ) );
+        tasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, 2  ) );
 
         context.checking( new Expectations()
         {
@@ -786,7 +863,7 @@ public class ParallelBuildsManagerTest
         final List<Task> tasks = new ArrayList<Task>();
         tasks.add(
             new CheckOutTask( 2, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-2",
-                              "dummy", "dummypass", null, null ) );
+                              "dummy", "dummypass" ) );
 
         context.checking( new Expectations()
         {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java Thu May  6 09:23:13 2010
@@ -25,6 +25,7 @@ import java.util.List;
 
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.taskqueueexecutor.ParallelBuildsThreadedTaskQueueExecutor;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.codehaus.plexus.taskqueue.Task;
@@ -84,7 +85,7 @@ public class DefaultOverallBuildQueueTes
     {
         final CheckOutTask checkoutTask =
             new CheckOutTask( 1, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-1",
-                              "dummy", "dummypass", null, null );
+                              "dummy", "dummypass" );
         final TaskQueue checkoutQueue = context.mock( TaskQueue.class, "checkout-queue" );
 
         context.checking( new Expectations()
@@ -107,7 +108,7 @@ public class DefaultOverallBuildQueueTes
         final List<Task> tasks = new ArrayList<Task>();
         tasks.add(
             new CheckOutTask( 1, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-1",
-                              "dummy", "dummypass", null, null ) );
+                              "dummy", "dummypass" ) );
 
         context.checking( new Expectations()
         {
@@ -133,7 +134,7 @@ public class DefaultOverallBuildQueueTes
         final List<Task> tasks = new ArrayList<Task>();
         tasks.add(
             new CheckOutTask( 1, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-1",
-                              "dummy", "dummypass", null, null ) );
+                              "dummy", "dummypass" ) );
 
         context.checking( new Expectations()
         {
@@ -154,7 +155,7 @@ public class DefaultOverallBuildQueueTes
     {
         final Task checkoutTask =
             new CheckOutTask( 1, new File( getBasedir(), "/target/test-working-dir/1" ), "continuum-project-test-1",
-                              "dummy", "dummypass", null, null );
+                              "dummy", "dummypass" );
         final TaskQueue checkoutQueue = context.mock( TaskQueue.class, "checkout-queue" );
         final List<Task> tasks = new ArrayList<Task>();
         tasks.add( checkoutTask );
@@ -184,7 +185,7 @@ public class DefaultOverallBuildQueueTes
         throws Exception
     {
         final BuildProjectTask buildTask =
-            new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF", null );
+        	new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, 2 );
         final TaskQueue buildQueue = context.mock( TaskQueue.class, "build-queue" );
 
         context.checking( new Expectations()
@@ -205,7 +206,7 @@ public class DefaultOverallBuildQueueTes
     {
         final TaskQueue buildQueue = context.mock( TaskQueue.class, "build-queue" );
         final List<Task> tasks = new ArrayList<Task>();
-        tasks.add( new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF", null ) );
+        tasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, 2 ) );
 
         context.checking( new Expectations()
         {
@@ -229,7 +230,7 @@ public class DefaultOverallBuildQueueTes
     {
         final TaskQueue buildQueue = context.mock( TaskQueue.class, "build-queue" );
         final List<Task> tasks = new ArrayList<Task>();
-        tasks.add( new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF", null ) );
+        tasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, 2 ) );
 
         context.checking( new Expectations()
         {
@@ -248,7 +249,7 @@ public class DefaultOverallBuildQueueTes
     public void testCancelBuildTask()
         throws Exception
     {
-        final Task buildTask = new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF", null );
+    	final Task buildTask = new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, 2 );
 
         context.checking( new Expectations()
         {
@@ -266,7 +267,7 @@ public class DefaultOverallBuildQueueTes
     public void testCancelCurrentBuild()
         throws Exception
     {
-        final Task buildTask = new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF", null );
+    	final Task buildTask = new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, 2 );
 
         context.checking( new Expectations()
         {
@@ -302,14 +303,14 @@ public class DefaultOverallBuildQueueTes
                 one( buildQueue ).remove( with( any( Task.class ) ) );
             }} );
 
-        overallQueue.removeProjectFromBuildQueue( 1, 1, 1, "continuum-project-test-1" );
+        overallQueue.removeProjectFromBuildQueue( 1, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-1", 1 );
         context.assertIsSatisfied();
     }
 
     public void testRemoveProjectFromBuildQueue()
         throws Exception
     {
-        final Task buildTask = new BuildProjectTask( 1, 1, 1, "continuum-project-test-2", "BUILD_DEF", null );
+    	final Task buildTask = new BuildProjectTask( 1, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2", "BUILD_DEF", null, 1 );
 
         final TaskQueue buildQueue = context.mock( TaskQueue.class, "build-queue" );
         final List<Task> tasks = new ArrayList<Task>();

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

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/AddProjectTest.java Thu May  6 09:23:13 2010
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.continuum;
 
+import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
+import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.continuum.project.builder.maven.MavenTwoContinuumProjectBuilder;
@@ -30,6 +32,10 @@ import org.apache.maven.continuum.projec
 public class AddProjectTest
     extends AbstractContinuumTest
 {
+    static final String SCM_USERNAME = "test";
+    
+    static final String SCM_PASSWORD = ";password";
+    
     public void testScmUserNamePasswordNotStoring()
         throws Exception
     {
@@ -38,7 +44,7 @@ public class AddProjectTest
         
         ContinuumProjectBuildingResult result = continuum
             .executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID,
-                                                     getDefaultProjectGroup().getId(), false, true, false, -1, false, false );
+                                                     getDefaultProjectGroup().getId(), false, true, false, -1, false );
         assertEquals( 1, result.getProjects().size() );
         
         // read the project from store
@@ -56,13 +62,72 @@ public class AddProjectTest
 
         ContinuumProjectBuildingResult result = continuum
             .executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID,
-                                                     getDefaultProjectGroup().getId(), false, false, false, -1, false, false );
+                                                     getDefaultProjectGroup().getId(), false, false, false, -1, false );
         assertEquals( 1, result.getProjects().size() );
 
         // read the project from store
         Project project = continuum.getProject( result.getProjects().get( 0 ).getId() );
-        assertEquals( "test", project.getScmUsername() );
-        assertEquals( ";password", project.getScmPassword() );
+        assertEquals( SCM_USERNAME, project.getScmUsername() );
+        assertEquals( SCM_PASSWORD, project.getScmPassword() );
         assertFalse( project.isScmUseCache() );
     }    
+    
+    public void testAntProjectScmUserNamePasswordNotStoring()
+        throws Exception
+    {
+        // use same url since we're just going to add the project, not build it
+        String scmUrl = "http://test:;password@svn.apache.org/repos/asf/continuum/tags/continuum-1.1/continuum-api/pom.xml";
+        DefaultContinuum continuum = (DefaultContinuum) lookup( Continuum.ROLE );
+        
+        Project project = new Project();
+        project.setName( "Sample Ant Project" );
+        project.setVersion( "1.0" );
+        project.setScmUsername( SCM_USERNAME );
+        project.setScmPassword( SCM_PASSWORD );
+        project.setScmUrl( scmUrl );        
+        project.setScmUseCache( true );
+        
+        BuildDefinitionService bdService = ( BuildDefinitionService )lookup( BuildDefinitionService.class.getName() );
+        
+        int projectId =
+            continuum.addProject( project, ContinuumBuildExecutorConstants.ANT_BUILD_EXECUTOR,
+                                  getDefaultProjectGroup().getId(),
+                                  bdService.getDefaultAntBuildDefinitionTemplate().getId() );
+                
+        // read the project from store
+        Project retrievedProject = continuum.getProject( projectId );
+        assertNull(  retrievedProject.getScmUsername() );
+        assertNull( retrievedProject.getScmPassword() );
+        assertTrue( retrievedProject.isScmUseCache() );
+    }
+    
+    public void testAntProjectScmUserNamePasswordStoring()
+        throws Exception
+    {
+        // use same url since we're just going to add the project, not build it
+        String scmUrl = "http://test:;password@svn.apache.org/repos/asf/continuum/tags/continuum-1.1/continuum-api/pom.xml";
+        DefaultContinuum continuum = (DefaultContinuum) lookup( Continuum.ROLE );
+        
+        Project project = new Project();
+        project.setName( "Sample Ant Project" );
+        project.setVersion( "1.0" );
+        project.setScmUsername( SCM_USERNAME );
+        project.setScmPassword( SCM_PASSWORD );
+        project.setScmUrl( scmUrl );        
+        project.setScmUseCache( false );
+        
+        BuildDefinitionService bdService = ( BuildDefinitionService )lookup( BuildDefinitionService.class.getName() );
+        
+        int projectId =
+            continuum.addProject( project, ContinuumBuildExecutorConstants.ANT_BUILD_EXECUTOR,
+                                  getDefaultProjectGroup().getId(),
+                                  bdService.getDefaultAntBuildDefinitionTemplate().getId() );
+               
+        // read the project from store
+        Project retrievedProject = continuum.getProject( projectId );
+        assertEquals( SCM_USERNAME, retrievedProject.getScmUsername() );
+        assertEquals( SCM_PASSWORD, retrievedProject.getScmPassword() );
+        assertFalse( retrievedProject.isScmUseCache() );
+    }
+    
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java Thu May  6 09:23:13 2010
@@ -27,20 +27,22 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.continuum.buildmanager.BuildsManager;
+import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.model.release.ContinuumReleaseResult;
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.continuum.repository.RepositoryService;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.initialization.ContinuumInitializer;
 import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
-import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.jmock.Expectations;
 import org.jmock.Mockery;
@@ -63,6 +65,8 @@ public class DefaultContinuumTest
 
     private ProjectDao projectDao;
 
+    private BuildResultDao buildResultDao;
+
     @Override
     protected void setUp()
         throws Exception
@@ -96,7 +100,7 @@ public class DefaultContinuumTest
         assertTrue( rootPom.exists() );
 
         ContinuumProjectBuildingResult result =
-            continuum.addMavenTwoProject( rootPom.toURI().toURL().toExternalForm(), -1, true, false, true, -1, false );
+            continuum.addMavenTwoProject( rootPom.toURI().toURL().toExternalForm(), -1, true, false, true, -1 );
 
         assertNotNull( result );
 
@@ -129,79 +133,8 @@ public class DefaultContinuumTest
         assertTrue( "no irc notifier", projects.containsKey( "Continuum IRC Notifier" ) );
 
         assertTrue( "no jabber notifier", projects.containsKey( "Continuum Jabber Notifier" ) );
-    }
-    
-    // handle flat multi-module projects
-    public void testAddMavenTwoProjectSetInSingleDirectory()
-        throws Exception
-    {   
-        Continuum continuum = (Continuum) lookup( Continuum.ROLE );
-        
-        String url = getTestFile( "src/test-projects/flat-multi-module/parent-project/pom.xml" ).toURL().toExternalForm();
-
-        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url, -1, true, false, true, -1, true );
 
-        assertNotNull( result );
-
-        List<Project> projects = result.getProjects();
-
-        assertEquals( 3, projects.size() );     
-        
-        Project rootProject = result.getRootProject();
-        
-        assertNotNull( rootProject );
-        
-        Map<String, Project> projectsMap = new HashMap<String, Project>();
-
-        for ( Project project : getProjectDao().getAllProjectsByName() )
-        {
-            projectsMap.put( project.getName(), project );
 
-            // validate project in project group
-            assertTrue( "project not in project group",
-                        getProjectGroupDao().getProjectGroupByProjectId( project.getId() ) != null );
-        }
-        
-        assertTrue( "no module-a", projectsMap.containsKey( "module-a" ) );
-        
-        assertTrue( "no module-b", projectsMap.containsKey( "module-b" ) );
-        
-        // check if the modules were checked out in the same directory as the parent
-        ConfigurationService configurationService = ( ConfigurationService ) lookup( "configurationService" );
-        
-        File workingDir = configurationService.getWorkingDirectory();
-        
-        Project parentProject = getProjectDao().getProjectByName( "parent-project" );
-        
-        File checkoutDir = new File( workingDir, String.valueOf( parentProject.getId() ) );
-        
-        for( long delay = 0; delay <= 999999999; delay++ )
-        {
-            // wait while the project has been checked out
-        }
-        
-        assertTrue( "checkout directory of project 'parent-project' does not exist." , checkoutDir.exists() );
-        
-        assertFalse( "module-a should not have been checked out as a separate project.",
-                    new File( workingDir, String.valueOf( getProjectDao().getProjectByName( "module-a" ).getId() ) ).exists() );
-        
-        assertFalse( "module-b should not have been checked out as a separate project.",
-                    new File( workingDir, String.valueOf( getProjectDao().getProjectByName( "module-b" ).getId() ) ).exists() );
-        
-        assertTrue( "module-a was not checked out in the same directory as it's parent.", new File( checkoutDir, "module-a" ).exists() );
-        
-        assertTrue( "module-b was not checked out in the same directory as it's parent.", new File( checkoutDir, "module-b" ).exists() );
-                
-        // assert project state
-        // commented out this test case as it sometimes fails because the actual checkout hasn't finished yet so
-        //    the state hasn't been updated yet
-        /*assertEquals( "state of 'parent-project' should have been updated.", ContinuumProjectState.CHECKEDOUT, parentProject.getState() );
-        
-        assertEquals( "state of 'module-a' should have been updated.", ContinuumProjectState.CHECKEDOUT,
-                      getProjectDao().getProjectByName( "module-a" ).getState() );
-        
-        assertEquals( "state of 'module-b' should have been updated.", ContinuumProjectState.CHECKEDOUT,
-                      getProjectDao().getProjectByName( "module-b" ).getState() );*/        
     }
 
     public void testUpdateMavenTwoProject()
@@ -237,6 +170,48 @@ public class DefaultContinuumTest
         project = continuum.getProject( project.getId() );
     }
 
+    public void testRemoveMavenTwoProject()
+        throws Exception
+    {
+        Continuum continuum = (Continuum) lookup( Continuum.ROLE );
+
+        Project project = makeStubProject( "test-project" );
+
+        ProjectGroup defaultGroup = getDefaultProjectGroup();
+
+        defaultGroup.addProject( project );
+
+        getProjectGroupDao().updateProjectGroup( defaultGroup );
+
+        project = getProjectDao().getProjectByName( "test-project" );
+
+        assertNotNull ( project );
+
+        BuildResult buildResult = new BuildResult();
+
+        getBuildResultDao().addBuildResult( project, buildResult );
+
+        Collection<BuildResult> brs = continuum.getBuildResultsForProject( project.getId() );
+
+        assertEquals( "Build result of project was not added", 1, brs.size() );
+
+        // delete project
+        continuum.removeProject( project.getId() );
+
+        try
+        {
+            continuum.getProject( project.getId() );
+
+            fail( "Project was not removed" );
+        }
+        catch ( ContinuumException expected )
+        {
+            brs = continuum.getBuildResultsForProject( project.getId() );
+
+            assertEquals( "Build result of project was not removed", 0, brs.size() );
+        }
+    }
+
     public void testBuildDefinitions()
         throws Exception
     {
@@ -319,7 +294,7 @@ public class DefaultContinuumTest
     {
         Continuum continuum = (Continuum) lookup( Continuum.ROLE );
 
-        Collection projectGroupList = continuum.getAllProjectGroupsWithProjects();
+        Collection projectGroupList = continuum.getAllProjectGroups();
 
         int projectGroupsBefore = projectGroupList.size();
 
@@ -337,7 +312,7 @@ public class DefaultContinuumTest
 
         assertEquals( "plexus", projectGroup.getGroupId() );
 
-        projectGroupList = continuum.getAllProjectGroupsWithProjects();
+        projectGroupList = continuum.getAllProjectGroups();
 
         assertEquals( "Project group missing, should have " + ( projectGroupsBefore + 1 ) + " project groups",
                       projectGroupsBefore + 1, projectGroupList.size() );
@@ -348,7 +323,7 @@ public class DefaultContinuumTest
 
         BuildsManager buildsManager = continuum.getBuildsManager();
 
-        List<Project> projects = projectGroup.getProjects();
+        List<Project> projects = continuum.getProjectGroupWithProjects( projectGroup.getId() ).getProjects();
         int[] projectIds = new int[projects.size()];
 
         int idx = 0;
@@ -364,7 +339,7 @@ public class DefaultContinuumTest
 
         continuum.removeProjectGroup( projectGroup.getId() );
 
-        projectGroupList = continuum.getAllProjectGroupsWithProjects();
+        projectGroupList = continuum.getAllProjectGroups();
 
         assertEquals( "Remove project group failed", projectGroupsBefore, projectGroupList.size() );
     }
@@ -377,7 +352,7 @@ public class DefaultContinuumTest
     {
         Continuum continuum = (Continuum) lookup( Continuum.ROLE );
 
-        Collection projectGroupList = continuum.getAllProjectGroupsWithProjects();
+        Collection projectGroupList = continuum.getAllProjectGroups();
 
         int projectGroupsBefore = projectGroupList.size();
 
@@ -590,7 +565,7 @@ public class DefaultContinuumTest
 
         try
         {
-            continuum.buildProject( 1 );
+        	continuum.buildProject( 1, "test-user" );
             fail( "An exception should have been thrown." );
         }
         catch ( ContinuumException e )
@@ -636,7 +611,7 @@ public class DefaultContinuumTest
 
         try
         {
-            continuum.buildProjectGroup( 1 );
+        	continuum.buildProjectGroup( 1, new BuildTrigger( 1, "test-user" ) );
             fail( "An exception should have been thrown." );
         }
         catch ( ContinuumException e )
@@ -651,4 +626,9 @@ public class DefaultContinuumTest
     {
         return (Continuum) lookup( Continuum.ROLE );
     }
+
+    private BuildResultDao getBuildResultDao()
+    {
+        return (BuildResultDao) lookup( BuildResultDao.class.getName() );
+    }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java Thu May  6 09:23:13 2010
@@ -25,6 +25,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.continuum.taskqueue.BuildProjectTask;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.AbstractContinuumTest;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -227,9 +228,9 @@ public class BuildProjectTaskExecutorTes
 
         Map<String, Object> pgContext = new HashMap<String, Object>();
 
-        pgContext.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, project.getWorkingDirectory() );
+        AbstractContinuumAction.setWorkingDirectory( pgContext, project.getWorkingDirectory() );
 
-        pgContext.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT_GROUP, projectGroup );
+        AbstractContinuumAction.setUnvalidatedProjectGroup( pgContext, projectGroup );
 
         actionManager.lookup( "validate-project-group" ).execute( pgContext );
 
@@ -245,8 +246,8 @@ public class BuildProjectTaskExecutorTes
 
         // projectGroup = continuumStore.addProjectGroup( projectGroup );
 
-        BuildProjectTask task = new BuildProjectTask( project.getId(), buildDefinition.getId(), 0, project.getName(),
-                                                      buildDefinition.getDescription(), null );
+        BuildProjectTask task = new BuildProjectTask( project.getId(), buildDefinition.getId(), new BuildTrigger( 0, "" ),
+        		                                 project.getName(), buildDefinition.getDescription(), null, projectGroupId );
 
         task.setMaxExecutionTime( maxRunTime );
 

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java Thu May  6 09:23:13 2010
@@ -21,9 +21,8 @@ package org.apache.maven.continuum.build
 
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildResultDao;
-import org.apache.continuum.model.project.ProjectScmRoot;
+import org.apache.continuum.utils.build.BuildTrigger;
 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;
@@ -38,7 +37,6 @@ 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
@@ -130,7 +128,7 @@ public class DefaultBuildControllerTest
         throws Exception
     {
         return controller.initializeBuildContext( projectId2, buildDefinitionId2,
-                                                  ContinuumProjectState.TRIGGER_SCHEDULED, new ScmResult() );
+                          new BuildTrigger( ContinuumProjectState.TRIGGER_SCHEDULED, "" ), new ScmResult() );
     }
 
     private BuildContext getContext( int hourOfLastExecution )
@@ -141,13 +139,6 @@ public class DefaultBuildControllerTest
         oldBuildResult.setEndTime( Calendar.getInstance().getTimeInMillis() + ( hourOfLastExecution * 3600000 ) );
         context.setOldBuildResult( oldBuildResult );
         context.setScmResult( new ScmResult() );
-        
-        Map<String, Object> actionContext = context.getActionContext();
-        ProjectScmRoot projectScmRoot = new ProjectScmRoot();
-        projectScmRoot.setId( 1 );
-        projectScmRoot.setScmRootAddress( "scm:local:src/test-projects:flat-multi-module" );
-        actionContext.put( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT, projectScmRoot );
-        
         return context;
     }
 
@@ -194,6 +185,16 @@ public class DefaultBuildControllerTest
         assertTrue( controller.shouldBuild( context ) );
     }
 
+    public void testWithNullScmResult()
+        throws Exception
+    {
+        BuildContext context = getContext( +1 );
+        context.setScmResult( null );
+        controller.checkProjectDependencies( context );
+        assertEquals( 0, context.getModifiedDependencies().size() );
+        assertFalse( controller.shouldBuild( context ) );
+    }
+
     private File getWorkingDirectory()
         throws Exception
     {

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/builddefinition/DefaultBuildDefinitionServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/builddefinition/DefaultBuildDefinitionServiceTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/builddefinition/DefaultBuildDefinitionServiceTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/builddefinition/DefaultBuildDefinitionServiceTest.java Thu May  6 09:23:13 2010
@@ -144,12 +144,12 @@ public class DefaultBuildDefinitionServi
         throws Exception
     {
         BuildDefinitionTemplate template = new BuildDefinitionTemplate();
-        template.setName( "test" );
+        template.setName( "testTemplate" );
 
         template = getBuildDefinitionService().addBuildDefinitionTemplate( template );
         template = getBuildDefinitionService().getBuildDefinitionTemplate( template.getId() );
         assertNotNull( template );
-        assertEquals( "test", template.getName() );
+        assertEquals( "testTemplate", template.getName() );
         List<BuildDefinition> all = getBuildDefinitionService().getAllBuildDefinitions();
         assertEquals( 5, all.size() );
         BuildDefinition bd =
@@ -168,4 +168,14 @@ public class DefaultBuildDefinitionServi
         assertEquals( 5, all.size() );
 
     }
+    
+    public void testAddDuplicateBuildDefinitionTemplate()
+	      throws Exception
+	  {
+	      BuildDefinitionTemplate template = new BuildDefinitionTemplate();
+	      template.setName( "test" );
+	      
+	      template = getBuildDefinitionService().addBuildDefinitionTemplate( template );
+	      assertNull( template );
+	  }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java Thu May  6 09:23:13 2010
@@ -20,8 +20,10 @@ package org.apache.maven.continuum.build
  */
 
 import org.apache.continuum.taskqueue.BuildProjectTask;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.AbstractContinuumTest;
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.TaskQueue;
@@ -131,7 +133,8 @@ public class BuildQueueTest
     private void buildProject( int projectId, int trigger )
         throws Exception
     {
-        buildQueue.put( new BuildProjectTask( projectId, 0, trigger, null, null, null ) );
+        ProjectGroup group = getDefaultProjectGroup();
+        buildQueue.put( new BuildProjectTask( projectId, 0, new BuildTrigger( trigger, "" ), null, null, null, group.getId() ) );
     }
 
     private void assertNextBuildIs( int expectedProjectId )

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=941625&r1=941624&r2=941625&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 Thu May  6 09:23:13 2010
@@ -34,35 +34,27 @@ import org.apache.maven.settings.MavenSe
 import org.apache.maven.settings.Settings;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.jmock.Mock;
 import org.jmock.MockObjectTestCase;
 
 public class CreateProjectsFromMetadataTest
     extends MockObjectTestCase
 {
+
     private CreateProjectsFromMetadataAction action;
-    
+
     private ContinuumProjectBuildingResult result;
 
     protected void setUp()
         throws Exception
     {
+        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.setUrlValidator( new ContinuumUrlValidator() );
         Mock projectBuilder = mock( ContinuumProjectBuilder.class );
 
@@ -73,13 +65,9 @@ public class CreateProjectsFromMetadataT
 
         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()
@@ -106,20 +94,15 @@ public class CreateProjectsFromMetadataT
     public void testExecuteWithNonRecursiveMode()
         throws Exception
     {
-        invokeBuildSettings();
-        
         Map<String, Object> context = new HashMap<String, Object>();
-        context.put( AbstractContinuumAction.KEY_URL,
-                     "http://svn.apache.org/repos/asf/maven/continuum/trunk/pom.xml" );
-        context.put( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDER_ID, "id" );
-        context.put( CreateProjectsFromMetadataAction.KEY_LOAD_RECURSIVE_PROJECTS, true );
-        context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, false );
+        CreateProjectsFromMetadataAction.setUrl( context,
+                                                 "http://svn.apache.org/repos/asf/maven/continuum/trunk/pom.xml" );
+        CreateProjectsFromMetadataAction.setProjectBuilderId( context, "id" );
+        CreateProjectsFromMetadataAction.setLoadRecursiveProject( context, true );
 
         action.execute( context );
 
-        ContinuumProjectBuildingResult result =
-            (ContinuumProjectBuildingResult) context.get( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDING_RESULT )
-            ;
+        ContinuumProjectBuildingResult result = CreateProjectsFromMetadataAction.getProjectBuildingResult( context );
 
         assertFalse(
             "Should not have errors but had " + result.getErrorsAsString() + " (this test requires internet access)",
@@ -128,78 +111,71 @@ public class CreateProjectsFromMetadataT
 
     public void testExecuteWithRecursiveMode()
         throws Exception
-    {        
-        invokeBuildSettings();
-        
+    {
         Map<String, Object> context = new HashMap<String, Object>();
-        context.put( AbstractContinuumAction.KEY_URL,
-                     "http://svn.apache.org/repos/asf/maven/archiva/trunk/pom.xml" );
-        context.put( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDER_ID, "id" );
-        context.put( CreateProjectsFromMetadataAction.KEY_LOAD_RECURSIVE_PROJECTS, false );
-        context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, false );
+        CreateProjectsFromMetadataAction.setUrl( context,
+                                                 "http://svn.apache.org/repos/asf/maven/archiva/trunk/pom.xml" );
+        CreateProjectsFromMetadataAction.setProjectBuilderId( context, "id" );
+        CreateProjectsFromMetadataAction.setLoadRecursiveProject( context, false );
 
         action.execute( context );
 
-        ContinuumProjectBuildingResult result =
-            (ContinuumProjectBuildingResult) context.get( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDING_RESULT )
-            ;
+        ContinuumProjectBuildingResult result = CreateProjectsFromMetadataAction.getProjectBuildingResult( context );
 
         assertFalse(
             "Should not have errors but had " + result.getErrorsAsString() + " (this test requires internet access)",
             result.hasErrors() );
     }
-    
-    public void testExecuteWithCheckoutProjectsInSingleDirectory()
+
+    public void testExecuteFlatMultiModuleProjectThatStartsWithTheSameLetter()
         throws Exception
-    {   
+    {
         Project project = new Project();
-        project.setGroupId( "org.apache.continuum" );
-        project.setArtifactId( "parent-project" );
+        project.setGroupId( "com.example.flat" );
+        project.setArtifactId( "flat-parent" );
         project.setVersion( "1.0-SNAPSHOT" );
         project.setId( 6 );
-        project.setName( "parent-project" );
-        project.setScmUrl( "scm:local:src/test-projects:flat-multi-module/parent-project" );
-        
+        project.setName( "Flat Example" );
+        project.setScmUrl( "scm:svn:http://svn.apache.org/repos/asf/continuum/sandbox/flat-example/flat-parent" );
+
         this.result.addProject( project );
-        
+
         project = new Project();
-        project.setGroupId( "org.apache.continuum" );
-        project.setArtifactId( "module-a" );
+        project.setGroupId( "com.example.flat" );
+        project.setArtifactId( "flat-core" );
         project.setVersion( "1.0-SNAPSHOT" );
         project.setId( 7 );
-        project.setName( "module-a" );
-        project.setScmUrl( "scm:local:src/test-projects:flat-multi-module/module-a" );
-        
+        project.setName( "flat-core" );
+        project.setScmUrl( "scm:svn:http://svn.apache.org/repos/asf/continuum/sandbox/flat-example/flat-core" );
+
         this.result.addProject( project );
-        
+
         project = new Project();
-        project.setGroupId( "org.apache.continuum" );
-        project.setArtifactId( "module-b" );
+        project.setGroupId( "com.example.flat" );
+        project.setArtifactId( "flat-webapp" );
         project.setVersion( "1.0-SNAPSHOT" );
         project.setId( 8 );
-        project.setName( "module-b" );
-        project.setScmUrl( "scm:local:src/test-projects:flat-multi-module/module-b" );
-        
+        project.setName( "flat-webapp Maven Webapp" );
+        project.setScmUrl( "scm:svn:http://svn.apache.org/repos/asf/continuum/sandbox/flat-example/flat-webapp" );
+
         this.result.addProject( project );
-                        
-        // assert using scm url set in root!
+
         Map<String, Object> context = new HashMap<String, Object>();
-        context.put( AbstractContinuumAction.KEY_URL,
-                     "file://" + PlexusInSpringTestCase.getBasedir() + "/src/test-projects/flat-multi-module/parent-project/pom.xml" );
-        context.put( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDER_ID, "id" );
-        context.put( CreateProjectsFromMetadataAction.KEY_LOAD_RECURSIVE_PROJECTS, true );
-        context.put( CreateProjectsFromMetadataAction.KEY_CHECKOUT_PROJECTS_IN_SINGLE_DIRECTORY, true );
+        CreateProjectsFromMetadataAction.setUrl( context,
+                                                 "http://svn.apache.org/repos/asf/continuum/sandbox/flat-example/flat-parent/pom.xml" );
+        CreateProjectsFromMetadataAction.setProjectBuilderId( context, "id" );
+        CreateProjectsFromMetadataAction.setLoadRecursiveProject( context, true );
 
         action.execute( context );
 
-        ContinuumProjectBuildingResult result =
-            (ContinuumProjectBuildingResult) context.get( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDING_RESULT )
-            ;
+        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/", context.get( AbstractContinuumAction.KEY_PROJECT_SCM_ROOT_URL ) );
+
+        assertEquals(
+            "Wrong scm root url created", "scm:svn:http://svn.apache.org/repos/asf/continuum/sandbox/flat-example/",
+            CreateProjectsFromMetadataAction.getUrl( context ) );
     }
 }

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/execution/ContinuumBuildExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/execution/ContinuumBuildExecutorTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/execution/ContinuumBuildExecutorTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/execution/ContinuumBuildExecutorTest.java Thu May  6 09:23:13 2010
@@ -30,6 +30,7 @@ import org.apache.maven.continuum.config
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
+import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.utils.ChrootJailWorkingDirectoryService;
 import org.jmock.Expectations;
 import org.jmock.Mockery;
@@ -143,7 +144,8 @@ public class ContinuumBuildExecutorTest
             return null;
         }
 
-        public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition buildDefinition )
+        public void updateProjectFromCheckOut( File workingDirectory, Project project, BuildDefinition buildDefinition,
+                                               ScmResult scmResult )
             throws ContinuumBuildExecutorException
         {
             // TODO Auto-generated method stub

Modified: continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutorTest.java?rev=941625&r1=941624&r2=941625&view=diff
==============================================================================
--- continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutorTest.java (original)
+++ continuum/branches/continuum-flat-multi-module/continuum-core/src/test/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutorTest.java Thu May  6 09:23:13 2010
@@ -106,7 +106,7 @@ public class MavenOneBuildExecutorTest
         //
         // ----------------------------------------------------------------------
 
-        executor.updateProjectFromCheckOut( checkOut, project, null );
+        executor.updateProjectFromCheckOut( checkOut, project, null, null );
 
         // ----------------------------------------------------------------------
         //
@@ -151,7 +151,7 @@ public class MavenOneBuildExecutorTest
         //
         // ----------------------------------------------------------------------
 
-        executor.updateProjectFromCheckOut( checkOut, project, null );
+        executor.updateProjectFromCheckOut( checkOut, project, null, null );
 
         // ----------------------------------------------------------------------
         //
@@ -171,7 +171,7 @@ public class MavenOneBuildExecutorTest
         // Updating a new time to prevent duplicated notifiers
         // ----------------------------------------------------------------------
 
-        executor.updateProjectFromCheckOut( checkOut, project, null );
+        executor.updateProjectFromCheckOut( checkOut, project, null, null );
 
         // ----------------------------------------------------------------------
         //
@@ -226,7 +226,7 @@ public class MavenOneBuildExecutorTest
         //
         // ----------------------------------------------------------------------
 
-        executor.updateProjectFromCheckOut( checkOut, project, null );
+        executor.updateProjectFromCheckOut( checkOut, project, null, null );
 
         // ----------------------------------------------------------------------
         //
@@ -250,7 +250,7 @@ public class MavenOneBuildExecutorTest
         // Updating a new time to prevent duplicated notifiers
         // ----------------------------------------------------------------------
 
-        executor.updateProjectFromCheckOut( checkOut, project, null );
+        executor.updateProjectFromCheckOut( checkOut, project, null, null );
 
         // ----------------------------------------------------------------------
         //
@@ -308,7 +308,7 @@ public class MavenOneBuildExecutorTest
         //
         // ----------------------------------------------------------------------
 
-        executor.updateProjectFromCheckOut( checkOut, project, null );
+        executor.updateProjectFromCheckOut( checkOut, project, null, null );
 
         // ----------------------------------------------------------------------
         //
@@ -328,7 +328,7 @@ public class MavenOneBuildExecutorTest
         // Updating a new time to prevent duplicated notifiers
         // ----------------------------------------------------------------------
 
-        executor.updateProjectFromCheckOut( checkOut, project, null );
+        executor.updateProjectFromCheckOut( checkOut, project, null, null );
 
         // ----------------------------------------------------------------------
         //