continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r798361 - in /continuum/branches/continuum-1.3.x/continuum-core/src: main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
Date Tue, 28 Jul 2009 02:18:40 GMT
Author: ctan
Date: Tue Jul 28 02:18:40 2009
New Revision: 798361

URL: http://svn.apache.org/viewvc?rev=798361&view=rev
Log:
[CONTINUUM-2315] prevent project from being added to the build queue if it is currently building

Modified:
    continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
    continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java?rev=798361&r1=798360&r2=798361&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
Tue Jul 28 02:18:40 2009
@@ -109,6 +109,11 @@
                 log.warn( "Project already queued." );
                 return;
             }
+            else if ( isProjectInAnyCurrentBuild( projectId ) )
+            {
+                log.warn( "Project is already building." );
+                return;
+            }
         }
         catch ( TaskQueueException e )
         {
@@ -165,7 +170,7 @@
         {
             try
             {
-                if ( !isInQueue( project.getId(), BUILD_QUEUE, -1 ) )
+                if ( !isInQueue( project.getId(), BUILD_QUEUE, -1 ) && !isProjectInAnyCurrentBuild(
project.getId() ) )
                 {
                     firstProjectId = project.getId();
                     break;
@@ -200,6 +205,12 @@
                                 "' is already in build queue." );
                             continue;
                         }
+                        else if ( isProjectInAnyCurrentBuild( project.getId() ) )
+                        {
+                            log.warn( "Project '" + project.getId() + "' - '" + project.getName()
+
+                                      "' is already building." );
+                            continue;
+                        }
                     }
                     catch ( TaskQueueException e )
                     {
@@ -242,7 +253,6 @@
         else
         {
             log.error( "Projects are already in build queue." );
-            throw new BuildManagerException( "Projects are already in build queue." );
         }
     }
 

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java?rev=798361&r1=798360&r2=798361&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
Tue Jul 28 02:18:40 2009
@@ -186,6 +186,9 @@
                 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 ) );
 
@@ -195,7 +198,7 @@
                 exactly( 2 ).of( overallBuildQueue ).getBuildQueue();
                 will( returnValue( buildQueue ) );
 
-                exactly( 2 ).of( overallBuildQueue ).getBuildTaskQueueExecutor();
+                exactly( 7 ).of( overallBuildQueue ).getBuildTaskQueueExecutor();
                 will( returnValue( buildTaskQueueExecutor ) );
             }} );
     }
@@ -672,6 +675,9 @@
                 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 ) );
 
@@ -681,7 +687,7 @@
                 exactly( 2 ).of( overallBuildQueue ).getBuildQueue();
                 will( returnValue( buildQueue ) );
 
-                exactly( 2 ).of( overallBuildQueue ).getBuildTaskQueueExecutor();
+                exactly( 6 ).of( overallBuildQueue ).getBuildTaskQueueExecutor();
                 will( returnValue( buildQueueExecutor ) );
                 
                 exactly( 2 ).of( buildQueue ).getQueueSnapshot();
@@ -804,6 +810,12 @@
                 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 ) );
 



Mime
View raw message