continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r726606 - in /continuum/branches/continuum-parallel-builds: continuum-api/src/main/java/org/apache/continuum/buildmanager/ continuum-api/src/main/java/org/apache/continuum/taskqueue/ continuum-core/src/main/java/org/apache/continuum/buildma...
Date Mon, 15 Dec 2008 02:21:08 GMT
Author: oching
Date: Sun Dec 14 18:21:08 2008
New Revision: 726606

URL: http://svn.apache.org/viewvc?rev=726606&view=rev
Log:
-added additional methods in builds manager
-added test cases

Modified:
    continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/buildmanager/BuildsManager.java
    continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/taskqueue/OverallBuildQueue.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java

Modified: continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/buildmanager/BuildsManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/buildmanager/BuildsManager.java?rev=726606&r1=726605&r2=726606&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/buildmanager/BuildsManager.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/buildmanager/BuildsManager.java
Sun Dec 14 18:21:08 2008
@@ -24,8 +24,10 @@
 import java.util.Map;
 
 import org.apache.continuum.taskqueue.OverallBuildQueue;
+import org.apache.maven.continuum.buildqueue.BuildProjectTask;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
+import org.codehaus.plexus.taskqueue.Task;
 
 /**
  * BuildsManager. All builds whether forced or triggered will go through (or have to be added
through) 
@@ -40,65 +42,73 @@
     // I think we can move out the prepare build queue from the build manager?
     //      only builds and checkouts should be executed in parallel? :D <-- i don't think
so :)
     
-    public void buildProjects( List<Project> projects, Map<Integer, BuildDefinition>
projectsBuildDefinitionsMap, int trigger ) throws BuildManagerException;
+    void buildProjects( List<Project> projects, Map<Integer, BuildDefinition>
projectsBuildDefinitionsMap, int trigger ) throws BuildManagerException;
     
-    public void buildProject( int projectId, BuildDefinition buildDefinition, String projectName,
int trigger ) throws BuildManagerException;
+    void buildProject( int projectId, BuildDefinition buildDefinition, String projectName,
int trigger ) throws BuildManagerException;
     
     //public void prepareBuildProjects( Collection<Map<Integer, Integer>> projectsBuildDefinitions,
int trigger, int scheduleId );
     
-    public void prepareBuildProject( Map<Integer, Integer> projectsBuildDefinitionsMap,
int trigger ) throws BuildManagerException;
+    void prepareBuildProject( Map<Integer, Integer> projectsBuildDefinitionsMap, int
trigger ) throws BuildManagerException;
     
     // project checkout doesn't require dependency checking
-    public void checkoutProject( int projectId, String projectName, File workingDirectory,
String scmUsername, String scmPassword, BuildDefinition defaultBuildDefinition ) throws BuildManagerException;
+    void checkoutProject( int projectId, String projectName, File workingDirectory, String
scmUsername, String scmPassword, BuildDefinition defaultBuildDefinition ) throws BuildManagerException;
         
-    public boolean cancelBuild( int projectId ) throws BuildManagerException;
+    boolean cancelBuild( int projectId ) throws BuildManagerException;
     
-    public boolean cancelAllBuilds() throws BuildManagerException;
+    boolean cancelAllBuilds() throws BuildManagerException;
     
-    public boolean cancelBuildInQueue( int buildQueueId ) throws BuildManagerException;
+    boolean cancelBuildInQueue( int buildQueueId ) throws BuildManagerException;
     
-    public boolean cancelCheckout(int projectId) throws BuildManagerException;
+    boolean cancelCheckout(int projectId) throws BuildManagerException;
     
-    public boolean cancelAllCheckouts() throws BuildManagerException;
+    boolean cancelAllCheckouts() throws BuildManagerException;
     
     //public boolean cancelPrepareBuild(int projectId) throws BuildManagerException;
     
     //public boolean cancelAllPrepareBuilds() throws BuildManagerException;
     
-    public void removeProjectFromBuildQueue( int projectId ) throws BuildManagerException;
+    void removeProjectFromBuildQueue( int projectId ) throws BuildManagerException;
     
-    public void removeProjectFromBuildQueue( int projectId, int buildDefinitionId, int trigger,
String projectName ) throws BuildManagerException;
+    void removeProjectFromBuildQueue( int projectId, int buildDefinitionId, int trigger,
String projectName ) throws BuildManagerException;
     
     // TODO: should we throw an exception when one of the projects cannot be removed?
-    public void removeProjectsFromBuildQueue( int[] projectIds );
-    
-    //TODO: implement this.. but how????
-    //public void removeProjectsFromBuildQueueWithHashcodes( int[] hashcodes ) throws BuildManagerException;
-    
-    public void removeProjectFromCheckoutQueue( int projectId ) throws BuildManagerException;
+    void removeProjectsFromBuildQueue( int[] projectIds );
+        
+    void removeProjectFromCheckoutQueue( int projectId ) throws BuildManagerException;
     
-    public void removeProjectsFromCheckoutQueue( int[] projectIds );
+ // TODO: implement this.. but how?
+    void removeProjectsFromCheckoutQueue( int[] projectIds );
     
     //TODO: implement this!
     //public void removeProjectFromPrepareBuildQueue( int projectId );
     
-   // public void removeProjectsFromPrepareBuildQueue( int[] projectIds );
+   //  public void removeProjectsFromPrepareBuildQueue( int[] projectIds );
     
-    public void addOverallBuildQueue( OverallBuildQueue overallBuildQueue );
+    void addOverallBuildQueue( OverallBuildQueue overallBuildQueue );
     
-    public void removeOverallBuildQueue( int overallBuildQueueId ) throws BuildManagerException;
+    void removeOverallBuildQueue( int overallBuildQueueId ) throws BuildManagerException;
 
-    public boolean isInAnyBuildQueue( int projectId ) throws BuildManagerException;
+    boolean isInAnyBuildQueue( int projectId ) throws BuildManagerException;
     
-    public boolean isInAnyBuildQueue( int projectId, int buildDefinitionId ) throws BuildManagerException;
+    boolean isInAnyBuildQueue( int projectId, int buildDefinitionId ) throws BuildManagerException;
     
-    public boolean isInAnyCheckoutQueue( int projectId ) throws BuildManagerException;  
+    boolean isInAnyCheckoutQueue( int projectId ) throws BuildManagerException;  
     
-    public boolean isInPrepareBuildQueue( int projectId ) throws BuildManagerException;
+    boolean isInPrepareBuildQueue( int projectId ) throws BuildManagerException;
     
-    public boolean isProjectInAnyCurrentBuild( int projectId ) throws BuildManagerException;
+    boolean isProjectInAnyCurrentBuild( int projectId ) throws BuildManagerException;
     
     // TODO: deng - add the following methods (needed by QueuesAction in webapp)
+    
+    List<Task> getCurrentBuilds() throws BuildManagerException;
+    
+    List<Task> getCurrentCheckouts() throws BuildManagerException;
+    
+    Map<String, List<Task>> getProjectsInBuildQueues() throws BuildManagerException;
+    
+    Map<String, List<Task>> getProjectsInCheckoutQueues() throws BuildManagerException;
+    
+    boolean isBuildInProgress() throws BuildManagerException; 
     // maybe these could return a new object which contains the name of the build queue (overall)
and the current task?
     // - add getCurrentBuilds(..) 
     // - add getCurrentCheckouts(..)

Modified: continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/taskqueue/OverallBuildQueue.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/taskqueue/OverallBuildQueue.java?rev=726606&r1=726605&r2=726606&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/taskqueue/OverallBuildQueue.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/taskqueue/OverallBuildQueue.java
Sun Dec 14 18:21:08 2008
@@ -21,7 +21,6 @@
 
 import java.util.List;
 
-import org.apache.maven.continuum.buildqueue.BuildProjectTask;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import org.codehaus.plexus.taskqueue.Task;
@@ -229,7 +228,7 @@
      * @return
      * @throws TaskQueueException TODO
      */
-    List<BuildProjectTask> getProjectsInBuildQueue()
+    List<Task> getProjectsInBuildQueue()
         throws TaskQueueException;
 
     /**

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java?rev=726606&r1=726605&r2=726606&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
Sun Dec 14 18:21:08 2008
@@ -20,6 +20,7 @@
  */
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -46,7 +47,6 @@
 import org.codehaus.plexus.taskqueue.Task;
 import org.codehaus.plexus.taskqueue.TaskQueue;
 import org.codehaus.plexus.taskqueue.TaskQueueException;
-import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
 import org.codehaus.plexus.taskqueue.execution.ThreadedTaskQueueExecutor;
 import org.codehaus.plexus.util.StringUtils;
 import org.slf4j.Logger;
@@ -471,7 +471,7 @@
     {
         try
         {
-            List<Object> objects = container.lookupList( TaskQueueExecutor.class );
+            List<Object> objects = container.lookupList( ThreadedTaskQueueExecutor.class
);
             for( Object obj : objects )
             {
                 log.info( "\n object --> " + obj );
@@ -491,23 +491,6 @@
         }
         
         return false;
-        /*try
-        {
-            Task task = getBuildTaskQueueExecutor().getCurrentTask();
-            if ( task != null )
-            {
-                if ( task instanceof BuildProjectTask )
-                {
-                    return ( (BuildProjectTask) task ).getProjectId();
-                }
-            }
-        }
-        catch ( ComponentLookupException e )
-        {
-            throw new TaskQueueException( "Error occurred while looking up the build task
queue executor. " );
-        }
-        
-        return -1;*/
     }
     
     public void prepareBuildProject( Map<Integer, Integer> projectsBuildDefinitionsMap,
int trigger )
@@ -673,7 +656,7 @@
     
     public void removeOverallBuildQueue( int overallBuildQueueId ) throws BuildManagerException
     {
-        List<BuildProjectTask> tasks = null;
+        List<Task> tasks = null;
         List<CheckOutTask> checkoutTasks = null;
         
         /*if( overallBuildQueueId == 1 )
@@ -716,10 +699,11 @@
         
         try
         {
-            for( BuildProjectTask task : tasks )
+            for( Task task : tasks )
             {
-                BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition(
task.getBuildDefinitionId() );
-                buildProject( task.getProjectId(), buildDefinition, task.getProjectName(),
task.getTrigger() );                    
+                BuildProjectTask buildTask = ( BuildProjectTask ) task;
+                BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition(
buildTask.getBuildDefinitionId() );
+                buildProject( buildTask.getProjectId(), buildDefinition, buildTask.getProjectName(),
buildTask.getTrigger() );                    
             }
          
             for( CheckOutTask task : checkoutTasks )
@@ -737,10 +721,109 @@
     }
     
     public Map<Integer, OverallBuildQueue> getOverallBuildQueues()
-    {
+    {   
         return overallBuildQueues;
     }
     
+    public List<Task> getCurrentBuilds() throws BuildManagerException
+    {   
+        List<Task> currentBuilds = new ArrayList<Task>();        
+        try
+        {
+            List<Object> objects = container.lookupList( ThreadedTaskQueueExecutor.class
);
+            for( Object obj : objects )
+            {
+                ThreadedTaskQueueExecutor executor = ( ThreadedTaskQueueExecutor ) obj;
+                Task task = executor.getCurrentTask();
+                if( task instanceof BuildProjectTask )
+                {
+                    currentBuilds.add( task );                    
+                }
+            }            
+        }
+        catch ( ComponentLookupException e )
+        {
+            throw new BuildManagerException( e.getMessage() );
+        }
+        
+        return currentBuilds;
+    }
+    
+    public List<Task> getCurrentCheckouts() throws BuildManagerException
+    {
+        List<Task> currentCheckouts = new ArrayList<Task>();        
+        try
+        {
+            List<Object> objects = container.lookupList( ThreadedTaskQueueExecutor.class
);
+            for( Object obj : objects )
+            {
+                ThreadedTaskQueueExecutor executor = ( ThreadedTaskQueueExecutor ) obj;
+                Task task = executor.getCurrentTask();
+                if( task instanceof CheckOutTask )
+                {
+                    currentCheckouts.add( task );                    
+                }
+            }            
+        }
+        catch ( ComponentLookupException e )
+        {
+            throw new BuildManagerException( e.getMessage() );
+        }
+        
+        return currentCheckouts;
+    }
+    
+    public Map<String, List<Task>> getProjectsInBuildQueues() throws BuildManagerException
+    {   
+        synchronized( overallBuildQueues )
+        {            
+            Map<String, List<Task>> buildsInQueue = new HashMap<String, List<Task>>();
+            Set<Integer> keySet = overallBuildQueues.keySet();
+            for( Integer key : keySet )
+            {
+                OverallBuildQueue overallBuildQueue = overallBuildQueues.get( key );
+                try
+                {                    
+                    buildsInQueue.put( overallBuildQueue.getName(), overallBuildQueue.getProjectsInBuildQueue()
);
+                }
+                catch ( TaskQueueException e )
+                {
+                    throw new BuildManagerException( "Error occurred while getting projects
in build queue '" +
+                        overallBuildQueue.getName() + "'.", e );
+                }
+            }                
+            return buildsInQueue;            
+        }
+    }
+    
+    public Map<String, List<Task>> getProjectsInCheckoutQueues() throws BuildManagerException
+    {
+        synchronized( overallBuildQueues )
+        {            
+            Map<String, List<Task>> checkoutsInQueue = new HashMap<String,
List<Task>>();
+            Set<Integer> keySet = overallBuildQueues.keySet();
+            for( Integer key : keySet )
+            {
+                OverallBuildQueue overallBuildQueue = overallBuildQueues.get( key );
+                try
+                {                    
+                    checkoutsInQueue.put( overallBuildQueue.getName(), overallBuildQueue.getCheckOutTasksInQueue()
);
+                }
+                catch ( TaskQueueException e )
+                {
+                    throw new BuildManagerException( "Error occurred while getting projects
in checkout queue '" +
+                        overallBuildQueue.getName() + "'.", e );
+                }
+            }                
+            return checkoutsInQueue;            
+        }
+    }
+    
+    public boolean isBuildInProgress() throws BuildManagerException
+    {
+        return false;
+    }
+    
     private boolean isInQueue( int projectId, int typeOfQueue, int buildDefinitionId )
         throws TaskQueueException
     {   

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java?rev=726606&r1=726605&r2=726606&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java
Sun Dec 14 18:21:08 2008
@@ -317,7 +317,7 @@
         }
     }
 
-    public List<BuildProjectTask> getProjectsInBuildQueue()
+    public List<Task> getProjectsInBuildQueue()
         throws TaskQueueException
     {   
         return buildQueue.getQueueSnapshot();        
@@ -353,22 +353,23 @@
     public boolean isInBuildQueue( int projectId, int buildDefinitionId )
         throws TaskQueueException
     {
-        List<BuildProjectTask> queue = getProjectsInBuildQueue();
+        List<Task> queue = getProjectsInBuildQueue();
 
-        for ( BuildProjectTask task : queue )
+        for ( Task task : queue )
         {
+            BuildProjectTask buildTask = (BuildProjectTask) task;
             if ( task != null )
             {
                 if ( buildDefinitionId < 0 )
                 {
-                    if ( task.getProjectId() == projectId )
+                    if ( buildTask.getProjectId() == projectId )
                     {
                         return true;
                     }
                 }
                 else
                 {
-                    if ( task.getProjectId() == projectId && task.getBuildDefinitionId()
== buildDefinitionId )
+                    if ( buildTask.getProjectId() == projectId && buildTask.getBuildDefinitionId()
== buildDefinitionId )
                     {
                         return true;
                     }
@@ -510,17 +511,18 @@
         {
             return false;
         }
-        List<BuildProjectTask> queue = getProjectsInBuildQueue();
+        List<Task> queue = getProjectsInBuildQueue();
 
         List<BuildProjectTask> tasks = new ArrayList<BuildProjectTask>();
 
-        for ( BuildProjectTask task : queue )
+        for ( Task task : queue )
         {
+            BuildProjectTask buildTask = (BuildProjectTask) task;
             if ( task != null )
             {
-                if ( ArrayUtils.contains( projectIds, task.getProjectId() ) )
+                if ( ArrayUtils.contains( projectIds, buildTask.getProjectId() ) )
                 {
-                    tasks.add( task );
+                    tasks.add( buildTask );
                 }
             }
         }
@@ -540,11 +542,12 @@
     public boolean removeProjectFromBuildQueue( int projectId )
         throws TaskQueueException
     {
-        List<BuildProjectTask> queue = getProjectsInBuildQueue();
+        List<Task> queue = getProjectsInBuildQueue();
 
-        for ( BuildProjectTask task : queue )
+        for ( Task task : queue )
         {
-            if ( task != null && task.getProjectId() == projectId )
+            BuildProjectTask buildTask = (BuildProjectTask) task;
+            if ( task != null && buildTask.getProjectId() == projectId )
             {
                 return buildQueue.remove( task );
             }
@@ -556,10 +559,9 @@
     public void removeProjectsFromBuildQueueWithHashCodes( int[] hashCodes )
         throws TaskQueueException
     {
-        List<BuildProjectTask> queue = getProjectsInBuildQueue();
-
-        for ( BuildProjectTask task : queue )
-        {
+        List<Task> queue = getProjectsInBuildQueue();
+        for ( Task task : queue )        
+        {            
             if ( ArrayUtils.contains( hashCodes, task.hashCode() ) )
             {
                 buildQueue.remove( task );

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java?rev=726606&r1=726605&r2=726606&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
Sun Dec 14 18:21:08 2008
@@ -33,6 +33,7 @@
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.Schedule;
 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
+import org.codehaus.plexus.taskqueue.Task;
 import org.jmock.Expectations;
 import org.jmock.Mockery;
 import org.jmock.integration.junit3.JUnit3Mockery;
@@ -81,7 +82,14 @@
         {
             BuildQueue buildQueue = new BuildQueue();
             buildQueue.setId( i );
-            buildQueue.setName( "BUILD_QUEUE_" + String.valueOf( i ) );
+            if( i == 1 )
+            {
+                buildQueue.setName( ConfigurationService.DEFAULT_BUILD_QUEUE_NAME );    
           
+            }
+            else
+            {
+                buildQueue.setName( "BUILD_QUEUE_" + String.valueOf( i ) );
+            }
             buildQueues.add( buildQueue );
         }
 
@@ -714,4 +722,58 @@
             assertEquals( "No build queue found.", e.getMessage() );
         }
     }
+    
+    public void testGetProjectsInBuildQueue()
+        throws Exception
+    {
+        setupOverallBuildQueues();
+        
+        BuildDefinition buildDef = new BuildDefinition();
+        buildDef.setId( 1 );
+        buildDef.setSchedule( getSchedule( 1, 1, 2 ) );
+        
+     // populate build queue
+        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", 1 );      
+        buildsManager.buildProject( 2, buildDef, "continuum-project-test-2", 1 );      
+        buildsManager.buildProject( 3, buildDef, "continuum-project-test-3", 1 );
+        
+        Map<String, List<Task>> buildsInQueue = buildsManager.getProjectsInBuildQueues();
+        
+        assertEquals( 5, buildsInQueue.size() );
+        assertTrue( buildsInQueue.containsKey( ConfigurationService.DEFAULT_BUILD_QUEUE_NAME
) );
+        assertTrue( buildsInQueue.containsKey( "BUILD_QUEUE_2" ) );
+        
+        assertEquals( 2, buildsInQueue.get( ConfigurationService.DEFAULT_BUILD_QUEUE_NAME
).size() );
+        assertEquals( 1, buildsInQueue.get( "BUILD_QUEUE_2" ).size() );
+    }
+    
+    public void testGetProjectsInCheckoutQueue()
+        throws Exception
+    {
+        setupOverallBuildQueues();
+        
+        BuildDefinition buildDef = new BuildDefinition();
+        buildDef.setId( 1 );
+        buildDef.setSchedule( getSchedule( 1, 1, 2 ) );
+        
+        buildsManager.checkoutProject( 1, "continuum-test-1", new File( getBasedir(), "/target/test-working-dir/1"
),
+                                       "dummy", "dummypass", buildDef );
+        buildsManager.checkoutProject( 2, "continuum-test-2", new File( getBasedir(), "/target/test-working-dir/1"
), 
+                                       "dummy", "dummypass", buildDef );
+        buildsManager.checkoutProject( 3, "continuum-test-3", new File( getBasedir(), "/target/test-working-dir/1"
), 
+                                       "dummy", "dummypass", buildDef );
+        buildsManager.checkoutProject( 4, "continuum-test-4", new File( getBasedir(), "/target/test-working-dir/1"
), 
+                                       "dummy", "dummypass", buildDef );
+        buildsManager.checkoutProject( 5, "continuum-test-5", new File( getBasedir(), "/target/test-working-dir/1"
), 
+                                       "dummy", "dummypass", buildDef );
+                
+        Map<String, List<Task>> checkoutsInQueue = buildsManager.getProjectsInCheckoutQueues();
+        
+        assertEquals( 5, checkoutsInQueue.size() );
+        assertTrue( checkoutsInQueue.containsKey( ConfigurationService.DEFAULT_BUILD_QUEUE_NAME
) );
+        assertTrue( checkoutsInQueue.containsKey( "BUILD_QUEUE_2" ) );
+        
+        assertEquals( 3, checkoutsInQueue.get( ConfigurationService.DEFAULT_BUILD_QUEUE_NAME
).size() );
+        assertEquals( 2, checkoutsInQueue.get( "BUILD_QUEUE_2" ).size() );
+    }
 }



Mime
View raw message