continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r899514 - /continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java
Date Fri, 15 Jan 2010 01:41:05 GMT
Author: ctan
Date: Fri Jan 15 01:41:04 2010
New Revision: 899514

URL: http://svn.apache.org/viewvc?rev=899514&view=rev
Log:
fixed test
merge -r 899511:899512 of 1.3.x branch

Modified:
    continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java?rev=899514&r1=899513&r2=899514&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java
(original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java
Fri Jan 15 01:41:04 2010
@@ -25,8 +25,11 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.continuum.buildmanager.BuildsManager;
+import org.apache.continuum.buildmanager.ParallelBuildsManager;
 import org.apache.continuum.dao.ProjectScmRootDao;
 import org.apache.continuum.model.project.ProjectScmRoot;
+import org.apache.continuum.taskqueue.BuildProjectTask;
 import org.apache.continuum.taskqueue.PrepareBuildProjectsTask;
 import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.AbstractContinuumTest;
@@ -60,6 +63,8 @@
 
     private ConfigurationService configurationService;
 
+    private BuildsManager buildsManager;
+
     @Override
     protected void setUp()
         throws Exception
@@ -78,6 +83,8 @@
         actionManager = (ActionManager) lookup( ActionManager.ROLE );
 
         configurationService =  (ConfigurationService ) lookup( "configurationService" );
+
+        buildsManager = (ParallelBuildsManager) lookup( BuildsManager.class, "parallel" );
     }
 
     public void testCheckoutPrepareBuildMultiModuleProject()
@@ -112,6 +119,12 @@
         assertTrue( "checkout directory of project 'module-A' does not exist.", new File(
workingDir, Integer.toString( moduleA.getId() ) ).exists() );
 
         assertTrue( "checkout directory of project 'module-B' does not exist.", new File(
workingDir, Integer.toString( moduleB.getId() ) ).exists() );
+
+        while( !buildsManager.getCurrentBuilds().isEmpty() ||
+                        isAnyProjectInBuildQueue() )
+        {
+            Thread.sleep( 10 );
+        }
     }
 
     public void testCheckoutPrepareBuildMultiModuleProjectFreshBuild()
@@ -146,6 +159,12 @@
         assertTrue( "checkout directory of project 'module-A' does not exist.", new File(
workingDir, Integer.toString( moduleA.getId() ) ).exists() );
 
         assertTrue( "checkout directory of project 'module-B' does not exist.", new File(
workingDir, Integer.toString( moduleB.getId() ) ).exists() );
+
+        while( !buildsManager.getCurrentBuilds().isEmpty() ||
+                        isAnyProjectInBuildQueue() )
+        {
+            Thread.sleep( 10 );
+        }
     }
 /*
     public void testCheckoutPrepareBuildSingleCheckedoutMultiModuleProject()
@@ -424,4 +443,20 @@
             return path1.substring( 0, indexDiff );
         }
     }
+
+    private boolean isAnyProjectInBuildQueue()
+        throws Exception
+    {
+        Map<String, List<BuildProjectTask>> buildTasks = buildsManager.getProjectsInBuildQueues();
+
+        for ( String queue : buildTasks.keySet() )
+        {
+            if ( !buildTasks.get( queue ).isEmpty() )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
 }



Mime
View raw message