continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r570267 - in /maven/continuum/trunk: ./ continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/test/java/org/apache/maven/continuum/
Date Mon, 27 Aug 2007 23:03:28 GMT
Author: oching
Date: Mon Aug 27 16:03:27 2007
New Revision: 570267

URL: http://svn.apache.org/viewvc?rev=570267&view=rev
Log:
[CONTINUUM-1387]
Submitted by Teody Cue

- added removeProjectFromCheckoutQueue(int projectId) in DefaultContinuum (remove from checkout
queue if Build button is clicked 
while the project is still being checked out)
- added test for new method
- updated version of plexus-task-queue from 1.0-alpha-6 to 1.0-alpha-7-SNAPSHOT to get the
applied patch submitted for removing 
projects in the task queue


Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
    maven/continuum/trunk/pom.xml

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=570267&r1=570266&r2=570267&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Mon Aug 27 16:03:27 2007
@@ -141,6 +141,9 @@
     boolean isInCheckoutQueue( int projectId )
         throws ContinuumException;
 
+    boolean removeProjectFromCheckoutQueue( int projectId )
+        throws ContinuumException;
+
     // ----------------------------------------------------------------------
     // Building
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=570267&r1=570266&r2=570267&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Mon Aug 27 16:03:27 2007
@@ -531,6 +531,33 @@
         return false;
     }
 
+    public boolean removeProjectFromCheckoutQueue( int projectId )
+        throws ContinuumException
+    {
+        List queue;
+
+        try
+        {
+            queue = checkoutQueue.getQueueSnapshot();
+        }
+        catch ( TaskQueueException e )
+        {
+            throw new ContinuumException( "Error while getting the checkout queue.", e );
+        }
+
+        for ( Iterator it = queue.iterator(); it.hasNext(); )
+        {
+            CheckOutTask task = (CheckOutTask) it.next();
+
+            if ( task != null && task.getProjectId() == projectId )
+            {
+                return checkoutQueue.remove( task );
+            }
+        }
+
+        return false;
+    }
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -956,9 +983,13 @@
     {
         if ( checkQueues )
         {
-            if ( isInBuildingQueue( project.getId(), buildDefinitionId ) || isInCheckoutQueue(
project.getId() ) )
+            if ( isInBuildingQueue( project.getId(), buildDefinitionId ) )
             {
                 return;
+            }
+            if ( isInCheckoutQueue( project.getId() ) )
+            {
+                removeProjectFromCheckoutQueue( project.getId() );
             }
         }
 

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=570267&r1=570266&r2=570267&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
Mon Aug 27 16:03:27 2007
@@ -336,4 +336,28 @@
             }
         }
     }
+
+    public void testRemoveProjectFromCheckoutQueue()
+        throws Exception
+    {
+        Continuum continuum = (Continuum) lookup( Continuum.ROLE );
+
+        String url = getTestFile( "src/test-projects/project1/pom.xml" ).toURL().toExternalForm();
+
+        ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url );
+
+        assertNotNull( result );
+
+        List projects = result.getProjects();
+
+        assertEquals( 1, projects.size() );
+
+        assertEquals( Project.class, projects.get( 0 ).getClass() );
+
+        Project project = (Project) projects.get( 0 );
+
+        assertTrue( "project missing from the checkout queue", continuum.removeProjectFromCheckoutQueue(
project.getId() ) );
+
+        assertFalse( "project still exist on the checkout queue", continuum.removeProjectFromCheckoutQueue(
project.getId() ) );
+    }
 }

Modified: maven/continuum/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/pom.xml?rev=570267&r1=570266&r2=570267&view=diff
==============================================================================
--- maven/continuum/trunk/pom.xml (original)
+++ maven/continuum/trunk/pom.xml Mon Aug 27 16:03:27 2007
@@ -544,7 +544,7 @@
       <dependency>
         <groupId>org.codehaus.plexus</groupId>
         <artifactId>plexus-taskqueue</artifactId>
-        <version>1.0-alpha-6</version>
+        <version>1.0-alpha-7-SNAPSHOT</version>
       </dependency>
       <dependency>
         <groupId>org.apache.derby</groupId>



Mime
View raw message