Return-Path: Delivered-To: apmail-continuum-commits-archive@www.apache.org Received: (qmail 91585 invoked from network); 15 Jan 2010 01:38:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Jan 2010 01:38:30 -0000 Received: (qmail 4890 invoked by uid 500); 15 Jan 2010 01:38:30 -0000 Delivered-To: apmail-continuum-commits-archive@continuum.apache.org Received: (qmail 4845 invoked by uid 500); 15 Jan 2010 01:38:29 -0000 Mailing-List: contact commits-help@continuum.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@continuum.apache.org Delivered-To: mailing list commits@continuum.apache.org Received: (qmail 4836 invoked by uid 99); 15 Jan 2010 01:38:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jan 2010 01:38:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jan 2010 01:38:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 14ECC23889CB; Fri, 15 Jan 2010 01:38:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r899512 - /continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java Date: Fri, 15 Jan 2010 01:38:05 -0000 To: commits@continuum.apache.org From: ctan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100115013806.14ECC23889CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ctan Date: Fri Jan 15 01:38:05 2010 New Revision: 899512 URL: http://svn.apache.org/viewvc?rev=899512&view=rev Log: fixed test Modified: continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java Modified: continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java?rev=899512&r1=899511&r2=899512&view=diff ============================================================================== --- continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java (original) +++ continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutorTest.java Fri Jan 15 01:38:05 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.maven.continuum.AbstractContinuumTest; import org.apache.maven.continuum.configuration.ConfigurationService; @@ -59,6 +62,8 @@ private ConfigurationService configurationService; + private BuildsManager buildsManager; + @Override protected void setUp() throws Exception @@ -77,6 +82,8 @@ actionManager = (ActionManager) lookup( ActionManager.ROLE ); configurationService = (ConfigurationService ) lookup( "configurationService" ); + + buildsManager = (ParallelBuildsManager) lookup( BuildsManager.class, "parallel" ); } public void testCheckoutPrepareBuildMultiModuleProject() @@ -111,6 +118,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() @@ -145,6 +158,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> buildTasks = buildsManager.getProjectsInBuildQueues(); + + for ( String queue : buildTasks.keySet() ) + { + if ( !buildTasks.get( queue ).isEmpty() ) + { + return true; + } + } + + return false; + } }