continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r388290 - in /maven/continuum/branches/continuum-1.0.x: continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/buildqueu...
Date Thu, 23 Mar 2006 23:06:41 GMT
Author: evenisse
Date: Thu Mar 23 15:06:39 2006
New Revision: 388290

URL: http://svn.apache.org/viewcvs?rev=388290&view=rev
Log:
Fix execution of two build definitions of a project attached to the same schedule

Modified:
    maven/continuum/branches/continuum-1.0.x/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/buildqueue/evaluator/BuildProjectTaskViabilityEvaluator.java
    maven/continuum/branches/continuum-1.0.x/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java

Modified: maven/continuum/branches/continuum-1.0.x/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/continuum-1.0.x/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=388290&r1=388289&r2=388290&view=diff
==============================================================================
--- maven/continuum/branches/continuum-1.0.x/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
(original)
+++ maven/continuum/branches/continuum-1.0.x/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
Thu Mar 23 15:06:39 2006
@@ -101,7 +101,7 @@
     Project getProject( int projectId )
         throws ContinuumStoreException, ContinuumObjectNotFoundException;
 
-    Map getProjectIdsAndBuildDefinitionIdsBySchedule( int scheduleId )
+    Map getProjectIdsAndBuildDefinitionsIdsBySchedule( int scheduleId )
         throws ContinuumStoreException;
 
     void updateProject( Project project )

Modified: maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=388290&r1=388289&r2=388290&view=diff
==============================================================================
--- maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Thu Mar 23 15:06:39 2006
@@ -395,7 +395,7 @@
 
         try
         {
-            projectsMap = store.getProjectIdsAndBuildDefinitionIdsBySchedule( schedule.getId()
);
+            projectsMap = store.getProjectIdsAndBuildDefinitionsIdsBySchedule( schedule.getId()
);
 
             if ( projectsMap == null )
             {
@@ -420,12 +420,17 @@
         {
             Project project = (Project) projectIterator.next();
 
-            Integer buildDefId = ( (Integer) projectsMap.get( new Integer( project.getId()
) ) );
+            List buildDefIds = (List) projectsMap.get( new Integer( project.getId() ) );
 
-            if ( buildDefId != null && !isInBuildingQueue( project.getId(), buildDefId.intValue()
) &&
-                !isInCheckoutQueue( project.getId() ) )
+            for ( Iterator buildDefinitionIterator = buildDefIds.iterator(); buildDefinitionIterator.hasNext();
)
             {
-                buildProject( project, buildDefId.intValue(), ContinuumProjectState.TRIGGER_SCHEDULED,
false );
+                Integer buildDefId = (Integer) buildDefinitionIterator.next();
+
+                if ( buildDefId != null && !isInBuildingQueue( project.getId(), buildDefId.intValue()
) &&
+                    !isInCheckoutQueue( project.getId() ) )
+                {
+                    buildProject( project, buildDefId.intValue(), ContinuumProjectState.TRIGGER_SCHEDULED,
false );
+                }
             }
         }
     }

Modified: maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/buildqueue/evaluator/BuildProjectTaskViabilityEvaluator.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/buildqueue/evaluator/BuildProjectTaskViabilityEvaluator.java?rev=388290&r1=388289&r2=388290&view=diff
==============================================================================
--- maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/buildqueue/evaluator/BuildProjectTaskViabilityEvaluator.java
(original)
+++ maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/buildqueue/evaluator/BuildProjectTaskViabilityEvaluator.java
Thu Mar 23 15:06:39 2006
@@ -62,6 +62,7 @@
             BuildProjectTask task = (BuildProjectTask) it.next();
 
             Integer key = new Integer( task.getProjectId() );
+
             List projectTasks = (List) projects.get( key );
 
             if ( projectTasks == null )
@@ -90,39 +91,42 @@
 
     private List checkTasks( List list )
     {
-        BuildProjectTask okTask = null;
-
         List toBeRemoved = new ArrayList();
 
         for ( Iterator it = list.iterator(); it.hasNext(); )
         {
             BuildProjectTask buildProjectTask = (BuildProjectTask) it.next();
 
-            if ( okTask == null )
+            for ( Iterator it2 = list.iterator(); it2.hasNext(); )
             {
-                okTask = buildProjectTask;
-
-                continue;
-            }
-
-            // ----------------------------------------------------------------------
-            // If this build is forces, don't remove it
-            // ----------------------------------------------------------------------
+                BuildProjectTask task = (BuildProjectTask) it2.next();
 
-            if ( buildProjectTask.getTrigger() == ContinuumProjectState.TRIGGER_FORCED )
-            {
-                continue;
-            }
-
-            // ----------------------------------------------------------------------
-            //
-            // ----------------------------------------------------------------------
-
-            long interval = buildProjectTask.getTimestamp() - okTask.getTimestamp();
-
-            if ( interval < requiredBuildInterval )
-            {
-                toBeRemoved.add( buildProjectTask );
+                // check if it's the same task
+                if ( buildProjectTask == task ||
+                    buildProjectTask.getBuildDefinitionId() != task.getBuildDefinitionId()
)
+                {
+                    continue;
+                }
+
+                // ----------------------------------------------------------------------
+                // If this build is forces, don't remove it
+                // ----------------------------------------------------------------------
+
+                if ( task.getTrigger() == ContinuumProjectState.TRIGGER_FORCED )
+                {
+                    continue;
+                }
+
+                // ----------------------------------------------------------------------
+                //
+                // ----------------------------------------------------------------------
+
+                long interval = task.getTimestamp() - buildProjectTask.getTimestamp();
+
+                if ( interval < requiredBuildInterval )
+                {
+                    toBeRemoved.add( buildProjectTask );
+                }
             }
         }
 

Modified: maven/continuum/branches/continuum-1.0.x/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/continuum-1.0.x/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=388290&r1=388289&r2=388290&view=diff
==============================================================================
--- maven/continuum/branches/continuum-1.0.x/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/branches/continuum-1.0.x/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Thu Mar 23 15:06:39 2006
@@ -41,6 +41,7 @@
 import javax.jdo.PersistenceManagerFactory;
 import javax.jdo.Query;
 import javax.jdo.Transaction;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -139,7 +140,7 @@
         }
     }
 
-    public Map getProjectIdsAndBuildDefinitionIdsBySchedule( int scheduleId )
+    public Map getProjectIdsAndBuildDefinitionsIdsBySchedule( int scheduleId )
         throws ContinuumStoreException
     {
         PersistenceManager pm = getPersistenceManager();
@@ -175,7 +176,20 @@
                 {
                     Object[] obj = (Object[]) i.next();
 
-                    projects.put( (Integer) obj[0], (Integer) obj[1] );
+                    List buildDefinitions;
+
+                    if ( projects.get( obj[0] ) != null )
+                    {
+                        buildDefinitions = (List) projects.get( obj[0] );
+                    }
+                    else
+                    {
+                        buildDefinitions = new ArrayList();
+                    }
+
+                    buildDefinitions.add( obj[1] );
+
+                    projects.put( obj[0], buildDefinitions );
                 }
 
                 return projects;



Mime
View raw message