continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r927733 - in /continuum/trunk: continuum-api/ continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/ continuum-api/src/main/java/org/apache/maven/continuum/ continuum-buildagent/continuum-buildagent-api/src/main/java/...
Date Fri, 26 Mar 2010 08:49:32 GMT
Author: ctan
Date: Fri Mar 26 08:49:31 2010
New Revision: 927733

URL: http://svn.apache.org/viewvc?rev=927733&view=rev
Log:
[CONTINUUM-2349] only build project in agents that are in the build agent group assigned to it and display a message if there is no build agent configured.


Added:
    continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentException.java   (with props)
    continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentInGroupException.java   (with props)
Modified:
    continuum/trunk/continuum-api/pom.xml
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/trunk/continuum-core/pom.xml
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
    continuum/trunk/continuum-docs/src/site/apt/user_guides/building_project/forced_build.apt
    continuum/trunk/continuum-docs/src/site/apt/user_guides/building_project/schedule_build.apt
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildEnvironmentTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildEnvironmentTest.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
    continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/trunk/continuum-webapp/src/main/resources/struts.xml
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java

Modified: continuum/trunk/continuum-api/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/pom.xml?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-api/pom.xml (original)
+++ continuum/trunk/continuum-api/pom.xml Fri Mar 26 08:49:31 2010
@@ -32,6 +32,10 @@ under the License.
       <artifactId>continuum-model</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-buildagent-api</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
     </dependency>

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java (original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java Fri Mar 26 08:49:31 2010
@@ -22,6 +22,8 @@ package org.apache.continuum.builder.dis
 import java.util.List;
 import java.util.Map;
 
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
 import org.apache.continuum.taskqueue.BuildProjectTask;
 import org.apache.continuum.taskqueue.PrepareBuildProjectsTask;
 import org.apache.continuum.utils.build.BuildTrigger;
@@ -63,7 +65,7 @@ public interface DistributedBuildManager
 
     void prepareBuildProjects( Map<Integer, Integer> projectsBuildDefinitionsMap, BuildTrigger buildTrigger, int projectGroupId,  
                                String projectGroupName, String scmRootAddress, int scmRootId )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     Map<String, PrepareBuildProjectsTask> getProjectsCurrentlyPreparingBuild()
         throws ContinuumException;

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java (original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java Fri Mar 26 08:49:31 2010
@@ -24,6 +24,8 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.model.project.ProjectGroupSummary;
@@ -149,40 +151,40 @@ public interface Continuum
     List<Project> getProjectsInBuildOrder( Collection<Project> projects );
 
     void buildProjects( String username )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     void buildProjectsWithBuildDefinition( List<Project> projects, List<BuildDefinition> bds )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     void buildProjectsWithBuildDefinition( List<Project> projects, int buildDefinitionId )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     void buildProjects( BuildTrigger buildTrigger )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     void buildProjects( BuildTrigger buildTrigger, int buildDefinitionId )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     void buildProjects( Schedule schedule )
         throws ContinuumException;
 
     void buildProject( int projectId, String username )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     void buildProject( int projectId, BuildTrigger buildTrigger )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     void buildProjectWithBuildDefinition( int projectId, int buildDefinitionId, BuildTrigger buildTrigger )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     void buildProject( int projectId, int buildDefinitionId, BuildTrigger buildTrigger )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     public void buildProjectGroup( int projectGroupId, BuildTrigger buildTrigger )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     public void buildProjectGroupWithBuildDefinition( int projectGroupId, int buildDefinitionId, BuildTrigger buildTrigger )
-        throws ContinuumException;
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException;
 
     // ----------------------------------------------------------------------
     // Build information

Added: continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentException.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentException.java?rev=927733&view=auto
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentException.java (added)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentException.java Fri Mar 26 08:49:31 2010
@@ -0,0 +1,39 @@
+package org.apache.continuum.buildagent;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class NoBuildAgentException
+    extends Exception
+{
+    public NoBuildAgentException( String message )
+    {
+        super( message );
+    }
+
+    public NoBuildAgentException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public NoBuildAgentException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Propchange: continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentInGroupException.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentInGroupException.java?rev=927733&view=auto
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentInGroupException.java (added)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentInGroupException.java Fri Mar 26 08:49:31 2010
@@ -0,0 +1,20 @@
+package org.apache.continuum.buildagent;
+
+public class NoBuildAgentInGroupException
+    extends Exception
+{
+    public NoBuildAgentInGroupException( String message )
+    {
+        super( message );
+    }
+
+    public NoBuildAgentInGroupException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public NoBuildAgentInGroupException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Propchange: continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentInGroupException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/NoBuildAgentInGroupException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: continuum/trunk/continuum-core/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/pom.xml?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-core/pom.xml (original)
+++ continuum/trunk/continuum-core/pom.xml Fri Mar 26 08:49:31 2010
@@ -171,7 +171,7 @@ under the License.
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-beans</artifactId>
-    </dependency>    
+    </dependency>
     <dependency>
       <groupId>org.apache.continuum</groupId>
       <artifactId>continuum-builder</artifactId>

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java Fri Mar 26 08:49:31 2010
@@ -27,12 +27,13 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
 import org.apache.continuum.builder.distributed.executor.ThreadedDistributedBuildTaskQueueExecutor;
 import org.apache.continuum.builder.distributed.util.DistributedBuildUtil;
 import org.apache.continuum.builder.utils.ContinuumBuildConstant;
 import org.apache.continuum.configuration.BuildAgentConfiguration;
 import org.apache.continuum.configuration.BuildAgentGroupConfiguration;
-import org.apache.continuum.configuration.ContinuumConfigurationException;
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
@@ -45,7 +46,6 @@ import org.apache.continuum.utils.Projec
 import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.configuration.ConfigurationService;
-import org.apache.maven.continuum.configuration.ConfigurationStoringException;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
@@ -216,22 +216,31 @@ public class DefaultDistributedBuildMana
 
     public void prepareBuildProjects( Map<Integer, Integer>projectsBuildDefinitionsMap, BuildTrigger buildTrigger, int projectGroupId, 
                                       String projectGroupName, String scmRootAddress, int scmRootId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
     	PrepareBuildProjectsTask task = new PrepareBuildProjectsTask( projectsBuildDefinitionsMap, buildTrigger,
                                                                       projectGroupId, projectGroupName, 
                                                                       scmRootAddress, scmRootId );
 
         OverallDistributedBuildQueue overallDistributedBuildQueue = getOverallDistributedBuildQueueByGroup( projectGroupId );
-
-        if ( overallDistributedBuildQueue == null )
+        
+        if ( hasBuildagentGroup( projectsBuildDefinitionsMap ) && overallDistributedBuildQueue == null )
         {
-            // get overall distributed build queue from build agent group
-            overallDistributedBuildQueue = getOverallDistributedBuildQueueByAgentGroup( projectsBuildDefinitionsMap );
-        }
+            if ( !hasBuildagentInGroup( projectsBuildDefinitionsMap ) )
+            {
+                log.warn( "No build agent configured in build agent group. Not building projects." );
 
-        if ( overallDistributedBuildQueue == null )
+                throw new NoBuildAgentInGroupException( "No build agent configured in build agent group" );
+            }
+            else
+            {
+                // get overall distributed build queue from build agent group
+                overallDistributedBuildQueue = getOverallDistributedBuildQueueByAgentGroup( projectsBuildDefinitionsMap );
+            }
+        }
+        else if ( overallDistributedBuildQueue == null )
         {
+            // project does not have build agent group
             overallDistributedBuildQueue = getOverallDistributedBuildQueue();
         }
 
@@ -250,6 +259,8 @@ public class DefaultDistributedBuildMana
         else
         {
             log.warn( "No build agent configured. Not building projects." );
+
+            throw new NoBuildAgentException( "No build agent configured" );
         }
     }
 
@@ -968,7 +979,7 @@ public class DefaultDistributedBuildMana
                     
                     for ( String buildAgentUrl : overallDistributedBuildQueues.keySet() )
                     {
-                        if ( ( !buildAgentUrls.isEmpty() && buildAgentUrls.contains( buildAgentUrl ) ) || buildAgentUrls.isEmpty() )
+                        if ( !buildAgentUrls.isEmpty() && buildAgentUrls.contains( buildAgentUrl ) )
                         {
                             OverallDistributedBuildQueue distributedBuildQueue = overallDistributedBuildQueues.get( buildAgentUrl );
 
@@ -1004,6 +1015,7 @@ public class DefaultDistributedBuildMana
                                 }
                             }
                         }
+                        idx++;
                     }
                 }
             }
@@ -1074,12 +1086,11 @@ public class DefaultDistributedBuildMana
     private BuildAgentGroupConfiguration getBuildAgentGroup( Map<Integer, Integer> projectsAndBuildDefinitions )
         throws ContinuumException
     {
-
         if ( projectsAndBuildDefinitions == null )
         {
             return null;
         }
-
+        
         try
         {
             List<Project> projects = new ArrayList<Project>();
@@ -1187,6 +1198,20 @@ public class DefaultDistributedBuildMana
             }
         }
     }
+    
+    private boolean hasBuildagentGroup( Map<Integer, Integer> projectsAndBuildDefinitionsMap )
+        throws ContinuumException
+    {
+        return getBuildAgentGroup( projectsAndBuildDefinitionsMap ) != null &&
+               getBuildAgentGroup( projectsAndBuildDefinitionsMap ).getName().length() > 0 ? true : false;
+    }
+    
+    private boolean hasBuildagentInGroup( Map<Integer, Integer> projectsAndBuildDefinitionsMap )
+        throws ContinuumException
+    {
+        return getBuildAgentGroup( projectsAndBuildDefinitionsMap ).getBuildAgents() != null &&
+               getBuildAgentGroup( projectsAndBuildDefinitionsMap ).getBuildAgents().size() > 0 ? true : false;
+    }
 
     // for unit testing
 

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Fri Mar 26 08:49:31 2010
@@ -19,6 +19,8 @@ package org.apache.maven.continuum;
  * under the License.
  */
 
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.continuum.buildmanager.BuildsManager;
@@ -759,19 +761,19 @@ public class DefaultContinuum
     // ----------------------------------------------------------------------
 
     public void buildProjects( String username )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
     	buildProjects( new BuildTrigger( ContinuumProjectState.TRIGGER_FORCED, username ) );
     }
 
     public void buildProjectsWithBuildDefinition( int buildDefinitionId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
     	buildProjects( new BuildTrigger( ContinuumProjectState.TRIGGER_FORCED, "" ), buildDefinitionId );
     }
 
     public void buildProjectsWithBuildDefinition( List<Project> projects, List<BuildDefinition> bds )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         Collection<Project> filteredProjectsList = getProjectsNotInReleaseStage( projects );
 
@@ -779,7 +781,7 @@ public class DefaultContinuum
     }
 
     public void buildProjectsWithBuildDefinition( List<Project> projects, int buildDefinitionId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         Collection<Project> filteredProjectsList = getProjectsNotInReleaseStage( projects );
 
@@ -794,7 +796,7 @@ public class DefaultContinuum
      * @throws ContinuumException
      */
     public void buildProjects( BuildTrigger buildTrigger )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         Collection<Project> projectsList = getProjectsInBuildOrder();
 
@@ -811,7 +813,7 @@ public class DefaultContinuum
      * @throws ContinuumException
      */
     public void buildProjects( BuildTrigger buildTrigger, int buildDefinitionId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         Collection<Project> projectsList = getProjectsInBuildOrder();
 
@@ -828,7 +830,7 @@ public class DefaultContinuum
      * @throws ContinuumException
      */
     public void buildProjectGroup( int projectGroupId, BuildTrigger buildTrigger )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         List<BuildDefinition> groupDefaultBDs;
 
@@ -849,7 +851,7 @@ public class DefaultContinuum
      * @throws ContinuumException
      */
     public void buildProjectGroupWithBuildDefinition( int projectGroupId, int buildDefinitionId, BuildTrigger buildTrigger )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         if ( !isAnyProjectInGroupInReleaseStage( projectGroupId ) )
         {
@@ -874,7 +876,7 @@ public class DefaultContinuum
      */
     private void buildProjectGroupWithBuildDefinition( int projectGroupId, List<BuildDefinition> bds,
     		                                   boolean checkDefaultBuildDefinitionForProject, BuildTrigger buildTrigger )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         if ( !isAnyProjectInGroupInReleaseStage( projectGroupId ) )
         {
@@ -978,24 +980,43 @@ public class DefaultContinuum
             }
         }
 
-        prepareBuildProjects( map, new BuildTrigger( ContinuumProjectState.TRIGGER_SCHEDULED, "" ), sortedScmRoot );
+        BuildTrigger buildTrigger = new BuildTrigger( ContinuumProjectState.TRIGGER_SCHEDULED, "" );
+
+        for ( ProjectScmRoot scmRoot : sortedScmRoot )
+        {
+            try
+            {
+                prepareBuildProjects( map.get( scmRoot ), buildTrigger, scmRoot.getScmRootAddress(),
+                                      scmRoot.getProjectGroup().getId(), scmRoot.getId() );
+            }
+            catch ( NoBuildAgentException e )
+            {
+                log.error( "Unable to build projects in project group " + scmRoot.getProjectGroup().getName() 
+                           + " because there is no build agent configured" );
+            }
+            catch ( NoBuildAgentInGroupException e )
+            {
+                log.error( "Unable to build projects in project group " + scmRoot.getProjectGroup().getName() 
+                           + " because there is no build agent configured in build agent group" );
+            }
+        }
     }
 
     public void buildProject( int projectId, String username )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
     	buildProject( projectId, new BuildTrigger( ContinuumProjectState.TRIGGER_FORCED, username ) );
     }
 
     public void buildProjectWithBuildDefinition( int projectId, int buildDefinitionId, BuildTrigger buildTrigger )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
     	buildTrigger.setTrigger( ContinuumProjectState.TRIGGER_FORCED );
     	buildProject( projectId, buildDefinitionId, buildTrigger );
     }
 
     public void buildProject( int projectId, BuildTrigger buildTrigger )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         Project project = getProject( projectId );
         if ( isProjectInReleaseStage( project ) )
@@ -1033,7 +1054,7 @@ public class DefaultContinuum
     }
 
     public void buildProject( int projectId, int buildDefinitionId, BuildTrigger buildTrigger )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         Project project = getProject( projectId );
         if ( isProjectInReleaseStage( project ) )
@@ -3404,7 +3425,7 @@ public class DefaultContinuum
 
     private void prepareBuildProjects( Collection<Project> projects, List<BuildDefinition> bds,
     		                           boolean checkDefaultBuildDefinitionForProject, BuildTrigger buildTrigger )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         Map<ProjectScmRoot, Map<Integer, Integer>> map = new HashMap<ProjectScmRoot, Map<Integer, Integer>>();
         List<ProjectScmRoot> sortedScmRoot = new ArrayList<ProjectScmRoot>();
@@ -3503,7 +3524,7 @@ public class DefaultContinuum
     }
 
     private void prepareBuildProjects( Collection<Project> projects, int buildDefinitionId, BuildTrigger buildTrigger )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         Map<ProjectScmRoot, Map<Integer, Integer>> map = new HashMap<ProjectScmRoot, Map<Integer, Integer>>();
         List<ProjectScmRoot> sortedScmRoot = new ArrayList<ProjectScmRoot>();
@@ -3558,7 +3579,7 @@ public class DefaultContinuum
 
     private void prepareBuildProjects( Map<ProjectScmRoot, Map<Integer, Integer>> map, BuildTrigger buildTrigger,
                                        List<ProjectScmRoot> scmRoots )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         for ( ProjectScmRoot scmRoot : scmRoots )
         {
@@ -3569,7 +3590,7 @@ public class DefaultContinuum
 
     private void prepareBuildProjects( Map<Integer, Integer> projectsBuildDefinitionsMap, BuildTrigger buildTrigger,
                                        String scmRootAddress, int projectGroupId, int scmRootId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         ProjectGroup group = getProjectGroup( projectGroupId );
 

Modified: continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java (original)
+++ continuum/trunk/continuum-core/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java Fri Mar 26 08:49:31 2010
@@ -136,6 +136,16 @@ public class DefaultDistributedBuildMana
         context.assertIsSatisfied();
     }
 
+    public void testBuildProjectWithoutBuildAgent()
+    {
+        
+    }
+
+    public void testBuildProjectWithBuildAgentGroupButWithoutBuildAgent()
+    {
+        
+    }
+
     private void setUpMockOverallDistributedBuildQueues()
     {
         Map<String, OverallDistributedBuildQueue> overallDistributedBuildQueues =

Modified: continuum/trunk/continuum-docs/src/site/apt/user_guides/building_project/forced_build.apt
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-docs/src/site/apt/user_guides/building_project/forced_build.apt?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-docs/src/site/apt/user_guides/building_project/forced_build.apt (original)
+++ continuum/trunk/continuum-docs/src/site/apt/user_guides/building_project/forced_build.apt Fri Mar 26 08:49:31 2010
@@ -18,13 +18,6 @@ Force Project Build
 
     []
 
-    If there are duplicates of a project in <<another project group>> (duplicates would mean
-    another instance of a project with the same groupId, artifactId, and version),
-    all the projects are built.
-
-    However, if there are duplicates of a project in the <<same project group>>, only one (1) of the duplicated
-    projects is built.
-
     To manually build a project perform the following steps:
 
     [[1]] Click <<Show Project Groups>>.
@@ -50,5 +43,8 @@ Force Project Build
     Click on the build icon to the right of the specific build goal you want to execute.
 
     []
+    
+    *Note* In a distributed build setup, the project builds are not executed if no build agent is
+    configured in the build environment that is attached to the project's build definition.
 
     To view the results of the build, refer to {{{./build_results.html}Build Results Management}}.

Modified: continuum/trunk/continuum-docs/src/site/apt/user_guides/building_project/schedule_build.apt
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-docs/src/site/apt/user_guides/building_project/schedule_build.apt?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-docs/src/site/apt/user_guides/building_project/schedule_build.apt (original)
+++ continuum/trunk/continuum-docs/src/site/apt/user_guides/building_project/schedule_build.apt Fri Mar 26 08:49:31 2010
@@ -20,13 +20,6 @@ Scheduling Project Build
 
     []
 
-    If there are duplicates of a project in <<another project group>> (duplicates would mean
-    another instance of a project with the same groupId, artifactId, and version),
-    both projects are built.
-
-    However, if there are duplicates of a project in the <<same project group>>, only one (1)
-    of the projects is built.
-
     To configure a scheduled build:
 
     [[1]] Create a schedule. You can refer to {{{../../administrator_guides/schedules.html} Managing Schedules}} section.
@@ -37,5 +30,8 @@ Scheduling Project Build
 [../../images/schedule_build.png] Scheduling build
 
     []
+    
+    *Note* In a distributed build setup, the project builds are not executed if no build agent is
+    configured in the build environment that is attached to the project's build definition.
 
     To view the results of the build, refer to {{{./build_results.html}Build Results Management}}.

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java Fri Mar 26 08:49:31 2010
@@ -127,7 +127,7 @@ public class BuildAgentsTest
     	}
     }
 
-    @Test( dependsOnMethods = { "testProjectGroupAllBuildSuccessWithDistributedBuilds" } )
+    @Test( dependsOnMethods = { "testDeleteBuildAgent" }, enabled=false )
     public void testBuildSuccessWithDistributedBuildsAfterDisableEnableOfBuildAgent()
         throws Exception
     {
@@ -159,6 +159,9 @@ public class BuildAgentsTest
             enableDisableBuildAgent( BUILD_AGENT_NAME, true );
 
             buildProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "", M2_PROJ_GRP_NAME );
+
+            removeProjectGroup( M2_PROJ_GRP_NAME );
+            assertLinkNotPresent( M2_PROJ_GRP_NAME );
         }
         finally
         {
@@ -266,4 +269,22 @@ public class BuildAgentsTest
             disableDistributedBuilds();
         }
     }
+
+    @Test( dependsOnMethods = { "testDeleteBuildAgentGroup" } )
+    public void testAddBuildAgentGroupWithEmptyBuildAgent()
+        throws Exception
+    {
+        String BUILD_AGENT_GROUPNAME = getProperty( "BUILD_AGENT_GROUPNAME" );
+
+        try
+        {
+            enableDistributedBuilds();
+            goToAddBuildAgentGroup();
+            addEditBuildAgentGroup( BUILD_AGENT_GROUPNAME, new String[] {}, new String[] {}, true );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
+    }
 }

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildEnvironmentTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildEnvironmentTest.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildEnvironmentTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildEnvironmentTest.java Fri Mar 26 08:49:31 2010
@@ -81,4 +81,22 @@ public class BuildEnvironmentTest
         String BUIL_ENV_NAME = getProperty( "BUIL_ENV_NAME" );
         removeBuildEnvironment( BUIL_ENV_NAME );
     }
+
+    @Test( dependsOnMethods = { "testDeleteBuildEnvironment", "testAddBuildAgentGroupWithEmptyBuildAgent" } )
+    public void testAddBuildEnvironmentWithBuildAgentGroup()
+    {
+        try
+        {
+            enableDistributedBuilds();
+
+            String BUILD_ENV_NAME = getProperty( "BUIL_ENV_NAME" );
+            String BUILD_AGENT_GROUPNAME = getProperty( "BUILD_AGENT_GROUPNAME" );
+            goToAddBuildEnvironment();
+            addBuildEnvironmentWithBuildAgentGroup( BUILD_ENV_NAME, new String[] {}, BUILD_AGENT_GROUPNAME, true );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
+    }
 }

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/MavenTwoProjectTest.java Fri Mar 26 08:49:31 2010
@@ -275,32 +275,95 @@ public class MavenTwoProjectTest
         assertLinkNotPresent( M2_PROJ_GRP_NAME );
     }
 
+    public void testBuildProjectGroupNoBuildAgentConfigured()
+        throws Exception
+    {
+        String M2_PROJ_GRP_NAME = getProperty( "M2_DELETE_PROJ_GRP_NAME" );
+        String M2_PROJ_GRP_ID = getProperty( "M2_DELETE_PROJ_GRP_ID" );
+    
+        try
+        {
+            enableDistributedBuilds();
+            addMaven2Project( M2_PROJ_GRP_NAME );
+            clickLinkWithText( M2_PROJ_GRP_NAME );
+    
+            assertPage( "Continuum - Project Group" );
+    
+            showProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "" );
+            clickButtonWithValue( "Build all projects" );
+
+            assertTextPresent( "Unable to build projects because no build agent is configured" );
+
+            removeProjectGroup( M2_PROJ_GRP_NAME );
+            assertLinkNotPresent( M2_PROJ_GRP_NAME );
+        }
+        finally
+        {
+            disableDistributedBuilds();
+        }
+    }
+
     @Test( dependsOnMethods = { "testDeleteMavenTwoProject", "testAddBuildAgent" } )
     public void testProjectGroupAllBuildSuccessWithDistributedBuilds()
         throws Exception
     {
         String M2_PROJ_GRP_NAME = getProperty( "M2_DELETE_PROJ_GRP_NAME" );
         String M2_PROJ_GRP_ID = getProperty( "M2_DELETE_PROJ_GRP_ID" );
-        String BUILD_AGENT_URL = getProperty( "BUILD_AGENT_NAME2" );
 
         try
         {
             enableDistributedBuilds();
+
             addMaven2Project( M2_PROJ_GRP_NAME );
             clickLinkWithText( M2_PROJ_GRP_NAME );
-
+    
             assertPage( "Continuum - Project Group" );
-            //wait for project to finish checkout
-            waitForProjectCheckout();
+    
+            showProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "" );
+            clickButtonWithValue( "Build all projects" );
 
             buildProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "", M2_PROJ_GRP_NAME );
+        }
+        finally
+        {
+            disableDistributedBuilds();   
+        }
+    }
+
+    @Test( dependsOnMethods = { "testAddBuildAgentGroupWithEmptyBuildAgent", "testAddBuildEnvironmentWithBuildAgentGroup" } )
+    public void testProjectGroupNoBuildAgentConfiguredInBuildAgentGroup()
+        throws Exception
+    {
+        String M2_PROJ_GRP_NAME = getProperty( "M2_DELETE_PROJ_GRP_NAME" );
+        String M2_PROJ_GRP_ID = getProperty( "M2_DELETE_PROJ_GRP_ID" );
+        String BUILD_ENV_NAME = getProperty( "BUIL_ENV_NAME" );
+
+        try
+        {
+            enableDistributedBuilds();
+            addMaven2Project( M2_PROJ_GRP_NAME );
+            clickLinkWithText( M2_PROJ_GRP_NAME );
+
+            assertPage( "Continuum - Project Group" );
+
+            goToGroupBuildDefinitionPage( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "" );
+            clickImgWithAlt( "Edit" );
+            assertAddEditBuildDefinitionPage();
+            selectValue( "profileId", BUILD_ENV_NAME );
+            submit();
+            assertGroupBuildDefinitionPage( M2_PROJ_GRP_NAME );
+
+            clickLinkWithText( "Project Group Summary" );
+            clickButtonWithValue( "Build all projects" );
+
+            assertTextPresent( "Unable to build projects because no build agent is configured in the build agent group" );
 
             removeProjectGroup( M2_PROJ_GRP_NAME );
             assertLinkNotPresent( M2_PROJ_GRP_NAME );
         }
         finally
         {
-            disableDistributedBuilds();   
+            disableDistributedBuilds();
         }
     }
 
@@ -324,7 +387,7 @@ public class MavenTwoProjectTest
         assertLinkNotPresent( M2_PROJ_GRP_NAME );
     }
     
-    @Test( dependsOnMethods = { "testAddBuildAgent", "testBuildMaven2ProjectWithTag" } )
+    @Test( dependsOnMethods = { "testAddBuildAgent" } )
     public void testBuildMaven2ProjectWithTagDistributedBuild()
         throws Exception
     {

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java Fri Mar 26 08:49:31 2010
@@ -83,6 +83,9 @@ public class ReleaseTest
             releasePerformProjectWithProvideParameters( M2_PROJ_USERNAME, M2_PROJ_PASSWORD, M2_PROJ_TAGBASE, M2_PROJ_TAG, 
                                                         M2_PROJ_SCM_URL, false );
             assertPreparedReleasesFileCreated();
+
+            removeProjectGroup( M2_PROJ_GRP_NAME );
+            assertLinkNotPresent( M2_PROJ_GRP_NAME );
         }
         finally
         {

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildEnvironmentTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildEnvironmentTest.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildEnvironmentTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildEnvironmentTest.java Fri Mar 26 08:49:31 2010
@@ -24,7 +24,7 @@ package org.apache.continuum.web.test.pa
  * @version $Id$
  */
 public abstract class AbstractBuildEnvironmentTest
-    extends AbstractSeleniumTest
+    extends AbstractContinuumTest
 {
     public void goToBuildEnvironmentPage()
     {
@@ -71,6 +71,13 @@ public abstract class AbstractBuildEnvir
         editBuildEnvironment( name, installations, success );
     }
 
+    public void addBuildEnvironmentWithBuildAgentGroup( String name, String[] installations, String buildAgentGroupName, boolean success )
+    {
+        setFieldValue( "profile.name", name );
+        submit();
+        editBuildEnvironmentWithBuildAgentGroup( name, installations, buildAgentGroupName, success );
+    }
+
     public void editBuildEnvironment( String name, String[] installations, boolean success )
     {
         setFieldValue( "profile.name", name );
@@ -90,6 +97,26 @@ public abstract class AbstractBuildEnvir
         }
     }
 
+    public void editBuildEnvironmentWithBuildAgentGroup( String name, String[] installations, String buildAgentGroupName, boolean success )
+    {
+        setFieldValue( "profile.name", name );
+        selectValue( "profile.buildAgentGroup", buildAgentGroupName );
+        for ( String i : installations )
+        {
+            selectValue( "installationId", i );
+            clickButtonWithValue( "Add" );
+        }
+        submit();
+        if ( success )
+        {
+            assertBuildEnvironmentPage();
+        }
+        else
+        {
+            assertAddBuildEnvironmentPage();
+        }
+    }
+
     public void goToEditBuildEnvironment( String name )
     {
         goToBuildEnvironmentPage();

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java Fri Mar 26 08:49:31 2010
@@ -20,8 +20,11 @@ package org.apache.maven.continuum.web.a
  */
 
 import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
 import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
@@ -61,31 +64,42 @@ public class BuildProjectAction
         
         BuildTrigger buildTrigger = new BuildTrigger( ContinuumProjectState.TRIGGER_FORCED, getPrincipal() );
 
-        if ( projectId > 0 )
+        try
         {
-            if ( buildDefinitionId > 0 )
+            if ( projectId > 0 )
             {
-            	getContinuum().buildProjectWithBuildDefinition( projectId, buildDefinitionId, buildTrigger );
+                if ( buildDefinitionId > 0 )
+                {
+                	getContinuum().buildProjectWithBuildDefinition( projectId, buildDefinitionId, buildTrigger );
+                }
+                else
+                {
+                	getContinuum().buildProject( projectId, buildTrigger.getUsername() );
+                }
             }
             else
             {
-            	getContinuum().buildProject( projectId, buildTrigger.getUsername() );
+                if ( buildDefinitionId > 0 )
+                {
+                	getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId, buildTrigger );
+                }
+                else
+                {
+                    //TODO: Check if this code is called, I don't think
+                    //If it is, it should used the projectId
+                	getContinuum().buildProjects( buildTrigger.getUsername() );
+                }
             }
         }
-        else
+        catch ( NoBuildAgentException e )
         {
-            if ( buildDefinitionId > 0 )
-            {
-            	getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId, buildTrigger );
-            }
-            else
-            {
-                //TODO: Check if this code is called, I don't think
-                //If it is, it should used the projectId
-            	getContinuum().buildProjects( buildTrigger.getUsername() );
-            }
+            addActionError( getText( "projectGroup.build.error.noBuildAgent" ) );
         }
-        
+        catch ( NoBuildAgentInGroupException e )
+        {
+            addActionError( getText( "projectGroup.build.error.noBuildAgentInGroup" ) );
+        }
+
         AuditLog event = new AuditLog( AuditLogConstants.FORCE_BUILD );
         event.setCurrentUser( getPrincipal() );
 
@@ -95,7 +109,7 @@ public class BuildProjectAction
             event.setCategory( AuditLogConstants.PROJECT );
             event.log();
 
-            if ( fromGroupPage )
+            if ( fromGroupPage || hasActionErrors() )
             {
                 return "to_group_page";
             }
@@ -179,7 +193,10 @@ public class BuildProjectAction
             }
             else
             {
-                projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
+                ProjectGroup projectGroup = getContinuum().getProjectGroupByProjectId( projectId );
+
+                projectGroupName = projectGroup.getName();
+                projectGroupId = projectGroup.getId();
             }
         }
 

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java Fri Mar 26 08:49:31 2010
@@ -31,6 +31,8 @@ import java.util.Map;
 
 import org.apache.commons.collections.ComparatorUtils;
 import org.apache.commons.lang.StringUtils;
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
 import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.model.project.ProjectScmRoot;
@@ -563,13 +565,24 @@ public class ProjectGroupAction
         
         BuildTrigger buildTrigger = new BuildTrigger( ContinuumProjectState.TRIGGER_FORCED, getPrincipal() );
 
-        if ( this.getBuildDefinitionId() == -1 )
+        try
+        {
+            if ( this.getBuildDefinitionId() == -1 )
+            {
+            	getContinuum().buildProjectGroup( projectGroupId, buildTrigger );
+            }
+            else
+            {
+            	getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId, buildTrigger );
+            }
+        }
+        catch ( NoBuildAgentException e )
         {
-        	getContinuum().buildProjectGroup( projectGroupId, buildTrigger );
+            addActionError( getText( "projectGroup.build.error.noBuildAgent" ) );
         }
-        else
+        catch ( NoBuildAgentInGroupException e )
         {
-        	getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId, buildTrigger );
+            addActionError( getText( "projectGroup.build.error.noBuildAgentInGroup" ) );
         }
 
         AuditLog event = new AuditLog( "Project Group id=" + projectGroupId, AuditLogConstants.FORCE_BUILD );
@@ -993,7 +1006,6 @@ public class ProjectGroupAction
     public String getProjectGroupName()
         throws ContinuumException
     {
-
         return getProjectGroup( projectGroupId ).getName();
     }
 

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java Fri Mar 26 08:49:31 2010
@@ -22,6 +22,8 @@ package org.apache.maven.continuum.web.a
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
 import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
@@ -164,15 +166,26 @@ public class ProjectsListAction
 
             List<Project> sortedProjects = getContinuum().getProjectsInBuildOrder( projectsList );
 
-            if ( this.getBuildDefinitionId() <= 0 )
+            try
             {
-                List<BuildDefinition> groupDefaultBDs =
-                    getContinuum().getDefaultBuildDefinitionsForProjectGroup( projectGroupId );
-                getContinuum().buildProjectsWithBuildDefinition( sortedProjects, groupDefaultBDs );
+                if ( this.getBuildDefinitionId() <= 0 )
+                {
+                    List<BuildDefinition> groupDefaultBDs =
+                        getContinuum().getDefaultBuildDefinitionsForProjectGroup( projectGroupId );
+                    getContinuum().buildProjectsWithBuildDefinition( sortedProjects, groupDefaultBDs );
+                }
+                else
+                {
+                    getContinuum().buildProjectsWithBuildDefinition( sortedProjects, buildDefinitionId );
+                }
+            }
+            catch ( NoBuildAgentException e )
+            {
+                addActionError( getText( "projectGroup.build.error.noBuildAgent" ) );
             }
-            else
+            catch ( NoBuildAgentInGroupException e )
             {
-                getContinuum().buildProjectsWithBuildDefinition( sortedProjects, buildDefinitionId );
+                addActionError( getText( "projectGroup.build.error.noBuildAgentInGroup" ) );
             }
         }
 

Modified: continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties (original)
+++ continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties Fri Mar 26 08:49:31 2010
@@ -198,6 +198,8 @@ projectGroup.scmRoot.title = Project Gro
 projectGroup.scmRoot.label = Scm Root URL
 projectGroup.cancelGroupBuild = Cancel Group Build
 projectGroup.invalid.id = Invalid Project Group Id: {0}
+projectGroup.build.error.noBuildAgent = Unable to build projects because no build agent is configured
+projectGroup.build.error.noBuildAgentInGroup = Unable to build projects because no build agent is configured in the build agent group
 
 # ----------------------------------------------------------------------
 # Page: Project Group - Members

Modified: continuum/trunk/continuum-webapp/src/main/resources/struts.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/struts.xml?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/struts.xml (original)
+++ continuum/trunk/continuum-webapp/src/main/resources/struts.xml Fri Mar 26 08:49:31 2010
@@ -260,6 +260,7 @@
     </action>
 
     <action name="buildProject" class="buildProject">
+      <interceptor-ref name="storeStack"/>
       <result name="success" type="chain">groupSummary</result>
       <result name="to_group_page" type="redirect-action">
         <param name="actionName">projectGroupSummary</param>
@@ -341,6 +342,7 @@
     </action>
 
     <action name="buildProjectGroup" class="projectGroup" method="build">
+      <interceptor-ref name="storeStack"/>
       <result name="success" type="redirect-action">
         <param name="actionName">projectGroupSummary</param>
         <param name="projectGroupId">${projectGroupId}</param>

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml (original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml Fri Mar 26 08:49:31 2010
@@ -49,6 +49,10 @@ under the License.
       <artifactId>continuum-model</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-buildagent-api</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.codehaus.redback</groupId>
       <artifactId>redback-rbac-role-manager</artifactId>
     </dependency>

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?rev=927733&r1=927732&r2=927733&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java (original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java Fri Mar 26 08:49:31 2010
@@ -29,6 +29,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.continuum.buildagent.NoBuildAgentException;
+import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
 import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.dao.SystemConfigurationDao;
@@ -590,7 +592,7 @@ public class ContinuumServiceImpl
     // ----------------------------------------------------------------------
 
     public int addProjectToBuildQueue( int projectId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         ProjectSummary ps = getProjectSummary( projectId );
         checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
@@ -600,7 +602,7 @@ public class ContinuumServiceImpl
     }
 
     public int addProjectToBuildQueue( int projectId, int buildDefinitionId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         ProjectSummary ps = getProjectSummary( projectId );
         checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
@@ -610,7 +612,7 @@ public class ContinuumServiceImpl
     }
 
     public int buildProject( int projectId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         ProjectSummary ps = getProjectSummary( projectId );
         checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
@@ -620,7 +622,7 @@ public class ContinuumServiceImpl
     }
 
     public int buildProject( int projectId, int buildDefintionId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         ProjectSummary ps = getProjectSummary( projectId );
         checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
@@ -630,7 +632,7 @@ public class ContinuumServiceImpl
     }
 
     public int buildGroup( int projectGroupId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         ProjectGroupSummary pg = getProjectGroupSummary( projectGroupId );
         checkBuildProjectInGroupAuthorization( pg.getName() );
@@ -641,7 +643,7 @@ public class ContinuumServiceImpl
     }
 
     public int buildGroup( int projectGroupId, int buildDefintionId )
-        throws ContinuumException
+        throws ContinuumException, NoBuildAgentException, NoBuildAgentInGroupException
     {
         ProjectGroupSummary pg = getProjectGroupSummary( projectGroupId );
         checkBuildProjectInGroupAuthorization( pg.getName() );



Mime
View raw message