continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r798364 - in /continuum/trunk/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:28:34 GMT
Author: ctan
Date: Tue Jul 28 02:28:34 2009
New Revision: 798364

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

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

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java?rev=798364&r1=798363&r2=798364&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
Tue Jul 28 02:28:34 2009
@@ -110,6 +110,11 @@
                 log.warn( "Project already queued." );
                 return;
             }
+            else if ( isProjectInAnyCurrentBuild( projectId ) )
+            {
+                log.warn( "Project is already building." );
+                return;
+            }
         }
         catch ( TaskQueueException e )
         {
@@ -166,7 +171,7 @@
         {
             try
             {
-                if ( !isInQueue( project.getId(), BUILD_QUEUE, -1 ) )
+                if ( !isInQueue( project.getId(), BUILD_QUEUE, -1 ) && !isProjectInAnyCurrentBuild(
project.getId() ) )
                 {
                     firstProjectId = project.getId();
                     break;
@@ -201,6 +206,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 )
                     {
@@ -243,7 +254,6 @@
         else
         {
             log.error( "Projects are already in build queue." );
-            throw new BuildManagerException( "Projects are already in build queue." );
         }
     }
 

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java?rev=798364&r1=798363&r2=798364&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
(original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
Tue Jul 28 02:28:34 2009
@@ -187,6 +187,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 ) );
 
@@ -196,7 +199,7 @@
                 exactly( 2 ).of( overallBuildQueue ).getBuildQueue();
                 will( returnValue( buildQueue ) );
 
-                exactly( 2 ).of( overallBuildQueue ).getBuildTaskQueueExecutor();
+                exactly( 7 ).of( overallBuildQueue ).getBuildTaskQueueExecutor();
                 will( returnValue( buildTaskQueueExecutor ) );
             }} );
     }
@@ -673,6 +676,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 ) );
 
@@ -682,7 +688,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();
@@ -805,6 +811,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