continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r751864 [2/4] - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/dao/ continuum-api/src/main/java/org/apache/continuum/taskqueue/ continuum-api/src/main/java/org/apache/continuum/taskqueue/manager/ continuum-api/src/mai...
Date Mon, 09 Mar 2009 22:02:36 GMT
Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java?rev=751864&r1=751863&r2=751864&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java (original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/utils/ContinuumBuildAgentUtil.java Mon Mar  9 22:02:34 2009
@@ -541,25 +541,25 @@
 
     public static boolean getBoolean( Map context, String key )
     {
-        return ( (Boolean) getObject( context, key ) ).booleanValue();
+        return (Boolean) getObject( context, key );
     }
-    
+
     public static boolean getBoolean( Map context, String key, boolean defaultValue )
     {
-        return ( (Boolean) getObject( context, key, Boolean.valueOf( defaultValue ) ) ).booleanValue();
-    }    
+        return (Boolean) getObject( context, key, defaultValue );
+    }
 
     public static int getInteger( Map context, String key )
     {
         Object obj = getObject( context, key, null );
-        
+
         if ( obj == null )
         {
             return 0;
         }
         else
         {
-            return ( (Integer) obj ).intValue();
+            return (Integer) obj;
         }
     }
 
@@ -578,7 +578,7 @@
             if ( obj instanceof Object[] )
             {
                 Object[] objA = (Object[]) obj;
-    
+
                 for ( Object o : objA )
                 {
                     if ( o instanceof Map )
@@ -705,7 +705,7 @@
         Map<String, Object> result = new HashMap<String, Object>();
         ScmResult scmResult = buildContext.getScmResult();
 
-        result.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, new Integer( buildContext.getProjectId() ) );
+        result.put( ContinuumBuildAgentUtil.KEY_PROJECT_ID, buildContext.getProjectId() );
         if ( StringUtils.isEmpty( scmResult.getCommandLine() ) )
         {
             result.put( ContinuumBuildAgentUtil.KEY_SCM_COMMAND_LINE, "" );
@@ -738,7 +738,7 @@
         {
             result.put( ContinuumBuildAgentUtil.KEY_SCM_EXCEPTION, scmResult.getException() );
         }
-        result.put( ContinuumBuildAgentUtil.KEY_SCM_SUCCESS, new Boolean( scmResult.isSuccess() ) );
+        result.put( ContinuumBuildAgentUtil.KEY_SCM_SUCCESS, scmResult.isSuccess() );
         result.put( ContinuumBuildAgentUtil.KEY_SCM_CHANGES, getScmChanges( scmResult ) );
 
         return result;
@@ -764,7 +764,7 @@
                 {
                     changeSet.put( ContinuumBuildAgentUtil.KEY_CHANGESET_AUTHOR, "" );
                 }
-                if ( StringUtils.isNotEmpty( cs.getComment() ) ) 
+                if ( StringUtils.isNotEmpty( cs.getComment() ) )
                 {
                     changeSet.put( ContinuumBuildAgentUtil.KEY_CHANGESET_COMMENT, cs.getComment() );
                 }

Modified: continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java?rev=751864&r1=751863&r2=751864&view=diff
==============================================================================
--- continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java (original)
+++ continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java Mon Mar  9 22:02:34 2009
@@ -105,8 +105,8 @@
             SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
 
             log.info( "initializing buildContext" );
-            List buildContext = initializeBuildContext( prepareBuildTask.getProjectsBuildDefinitionsMap(), 
-                                                        prepareBuildTask.getTrigger(), 
+            List buildContext = initializeBuildContext( prepareBuildTask.getProjectsBuildDefinitionsMap(),
+                                                        prepareBuildTask.getTrigger(),
                                                         prepareBuildTask.getScmRootAddress() );
 
             startTime = System.currentTimeMillis();
@@ -126,8 +126,8 @@
         }
     }
 
-    private List initializeBuildContext( Map<Integer, Integer> projectsAndBuildDefinitions, 
-                                         int trigger, String scmRootAddress )
+    private List initializeBuildContext( Map<Integer, Integer> projectsAndBuildDefinitions, int trigger,
+                                         String scmRootAddress )
         throws ContinuumException
     {
         List buildContext = new ArrayList();
@@ -151,26 +151,27 @@
             }
 
             for ( Project project : projects )
-            {                
+            {
                 int buildDefinitionId = projectsAndBuildDefinitions.get( project.getId() );
                 BuildDefinition buildDef = buildDefinitionDao.getBuildDefinition( buildDefinitionId );
                 BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( project.getId() );
 
                 Map context = new HashMap();
-                
-                context.put( ContinuumBuildConstant.KEY_PROJECT_GROUP_ID, new Integer( project.getProjectGroup().getId() ) );
+
+                context.put( ContinuumBuildConstant.KEY_PROJECT_GROUP_ID, project.getProjectGroup().getId() );
                 context.put( ContinuumBuildConstant.KEY_PROJECT_GROUP_NAME, project.getProjectGroup().getName() );
                 context.put( ContinuumBuildConstant.KEY_SCM_ROOT_ADDRESS, scmRootAddress );
-                context.put( ContinuumBuildConstant.KEY_PROJECT_ID, new Integer( project.getId() ) );
+                context.put( ContinuumBuildConstant.KEY_PROJECT_ID, project.getId() );
                 context.put( ContinuumBuildConstant.KEY_PROJECT_NAME, project.getName() );
                 context.put( ContinuumBuildConstant.KEY_PROJECT_VERSION, project.getVersion() );
                 context.put( ContinuumBuildConstant.KEY_EXECUTOR_ID, project.getExecutorId() );
-                context.put( ContinuumBuildConstant.KEY_PROJECT_BUILD_NUMBER, new Integer( project.getBuildNumber() ) );
+                context.put( ContinuumBuildConstant.KEY_PROJECT_BUILD_NUMBER, project.getBuildNumber() );
                 context.put( ContinuumBuildConstant.KEY_SCM_URL, project.getScmUrl() );
-                context.put( ContinuumBuildConstant.KEY_PROJECT_STATE, new Integer( project.getState() ) );
+                context.put( ContinuumBuildConstant.KEY_PROJECT_STATE, project.getState() );
                 if ( buildResult != null )
                 {
-                    context.put( ContinuumBuildConstant.KEY_LATEST_UPDATE_DATE, new Date( buildResult.getStartTime() ) );
+                    context.put( ContinuumBuildConstant.KEY_LATEST_UPDATE_DATE,
+                                 new Date( buildResult.getStartTime() ) );
                 }
 
                 LocalRepository localRepo = project.getProjectGroup().getLocalRepository();
@@ -202,7 +203,7 @@
                     context.put( ContinuumBuildConstant.KEY_SCM_PASSWORD, project.getScmPassword() );
                 }
 
-                context.put( ContinuumBuildConstant.KEY_BUILD_DEFINITION_ID, new Integer( buildDefinitionId ) );
+                context.put( ContinuumBuildConstant.KEY_BUILD_DEFINITION_ID, buildDefinitionId );
                 context.put( ContinuumBuildConstant.KEY_BUILD_FILE, buildDef.getBuildFile() );
                 context.put( ContinuumBuildConstant.KEY_GOALS, buildDef.getGoals() );
 
@@ -214,12 +215,14 @@
                 {
                     context.put( ContinuumBuildConstant.KEY_ARGUMENTS, buildDef.getArguments() );
                 }
-                context.put( ContinuumBuildConstant.KEY_TRIGGER, new Integer( trigger ) );
-                context.put( ContinuumBuildConstant.KEY_BUILD_FRESH, new Boolean( buildDef.isBuildFresh() ) );
-                context.put( ContinuumBuildConstant.KEY_ALWAYS_BUILD, new Boolean( buildDef.isAlwaysBuild() ) );
-                context.put( ContinuumBuildConstant.KEY_OLD_SCM_CHANGES, getOldScmChanges( project.getId(), buildDefinitionId ) );
+                context.put( ContinuumBuildConstant.KEY_TRIGGER, trigger );
+                context.put( ContinuumBuildConstant.KEY_BUILD_FRESH, buildDef.isBuildFresh() );
+                context.put( ContinuumBuildConstant.KEY_ALWAYS_BUILD, buildDef.isAlwaysBuild() );
+                context.put( ContinuumBuildConstant.KEY_OLD_SCM_CHANGES,
+                             getOldScmChanges( project.getId(), buildDefinitionId ) );
                 context.put( ContinuumBuildConstant.KEY_BUILD_AGENT_URL, buildAgentUrl );
-                context.put( ContinuumBuildConstant.KEY_MAX_JOB_EXEC_TIME, new Integer( buildDef.getSchedule().getMaxJobExecutionTime() ) );
+                context.put( ContinuumBuildConstant.KEY_MAX_JOB_EXEC_TIME,
+                             buildDef.getSchedule().getMaxJobExecutionTime() );
 
                 buildContext.add( context );
             }
@@ -237,7 +240,9 @@
     {
         try
         {
-            ProjectScmRoot scmRoot = projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress( task.getProjectGroupId(), task.getScmRootAddress() );
+            ProjectScmRoot scmRoot =
+                projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress( task.getProjectGroupId(),
+                                                                                    task.getScmRootAddress() );
 
             if ( scmRoot.getState() == ContinuumProjectState.UPDATING )
             {
@@ -254,9 +259,10 @@
                     Project project = projectDao.getProject( projectId );
                     BuildDefinition buildDef = buildDefinitionDao.getBuildDefinition( buildDefinitionId );
                     BuildResult latestBuildResult = buildResultDao.
-                                                        getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId );
-                    if ( latestBuildResult == null || ( latestBuildResult.getStartTime() >= startTime && latestBuildResult.getEndTime() > 0 && 
-                           latestBuildResult.getEndTime() < endTime ) || latestBuildResult.getStartTime() < startTime )
+                        getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId );
+                    if ( latestBuildResult == null ||
+                        ( latestBuildResult.getStartTime() >= startTime && latestBuildResult.getEndTime() > 0 &&
+                            latestBuildResult.getEndTime() < endTime ) || latestBuildResult.getStartTime() < startTime )
                     {
                         BuildResult buildResult = new BuildResult();
                         buildResult.setBuildDefinition( buildDef );
@@ -288,7 +294,8 @@
 
         if ( oldBuildResult != null )
         {
-            ScmResult scmResult = getOldScmResults( projectId, oldBuildResult.getBuildNumber(), oldBuildResult.getEndTime() );
+            ScmResult scmResult =
+                getOldScmResults( projectId, oldBuildResult.getBuildNumber(), oldBuildResult.getEndTime() );
 
             scmChanges = getScmChanges( scmResult );
         }
@@ -304,7 +311,7 @@
         {
             for ( Object obj : scmResult.getChanges() )
             {
-                ChangeSet changeSet = (ChangeSet) obj; 
+                ChangeSet changeSet = (ChangeSet) obj;
 
                 Map map = new HashMap();
                 if ( StringUtils.isNotEmpty( changeSet.getAuthor() ) )
@@ -367,7 +374,7 @@
                 }
                 else
                 {
-                    map.put( ContinuumBuildConstant.KEY_CHANGEFILE_STATUS, "" );   
+                    map.put( ContinuumBuildConstant.KEY_CHANGEFILE_STATUS, "" );
                 }
                 scmChangeFiles.add( map );
             }
@@ -379,19 +386,19 @@
         throws ContinuumStoreException
     {
         List<BuildResult> results = buildResultDao.getBuildResultsForProjectFromId( projectId, startId );
-    
+
         ScmResult res = new ScmResult();
-    
+
         if ( results != null && results.size() > 0 )
         {
             for ( BuildResult result : results )
             {
                 ScmResult scmResult = result.getScmResult();
-    
+
                 if ( scmResult != null )
                 {
                     List<ChangeSet> changes = scmResult.getChanges();
-    
+
                     if ( changes != null )
                     {
                         for ( ChangeSet changeSet : changes )
@@ -409,7 +416,7 @@
                 }
             }
         }
-    
+
         return res;
     }
 }

Modified: continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/ThreadedDistributedBuildTaskQueueExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/ThreadedDistributedBuildTaskQueueExecutor.java?rev=751864&r1=751863&r2=751864&view=diff
==============================================================================
--- continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/ThreadedDistributedBuildTaskQueueExecutor.java (original)
+++ continuum/trunk/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/ThreadedDistributedBuildTaskQueueExecutor.java Mon Mar  9 22:02:34 2009
@@ -51,13 +51,19 @@
 
     private Logger log = LoggerFactory.getLogger( this.getClass() );
 
-    /** @requirement */
+    /**
+     * @requirement
+     */
     private TaskQueue queue;
 
-    /** @requirement */
+    /**
+     * @requirement
+     */
     private DistributedBuildTaskExecutor executor;
 
-    /** @configuration */
+    /**
+     * @configuration
+     */
     private String name;
 
     // ----------------------------------------------------------------------
@@ -91,8 +97,8 @@
                 }
                 catch ( InterruptedException e )
                 {
-                    log.info( "Executor thread interrupted, command: "
-                        + ( command == SHUTDOWN ? "Shutdown" : command == CANCEL_TASK ? "Cancel task" : "Unknown" ) );
+                    log.info( "Executor thread interrupted, command: " +
+                        ( command == SHUTDOWN ? "Shutdown" : command == CANCEL_TASK ? "Cancel task" : "Unknown" ) );
                     continue;
                 }
 
@@ -212,8 +218,9 @@
                 }
                 else
                 {
-                    log.warn( "Task not cancelled (Flags: done: " + future.isDone() + " cancelled: "
-                        + future.isCancelled() + ")" );
+                    log.warn(
+                        "Task not cancelled (Flags: done: " + future.isDone() + " cancelled: " + future.isCancelled() +
+                            ")" );
                 }
             }
             else

Modified: continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/installation/DefaultInstallationService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/installation/DefaultInstallationService.java?rev=751864&r1=751863&r2=751864&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/installation/DefaultInstallationService.java (original)
+++ continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/installation/DefaultInstallationService.java Mon Mar  9 22:02:34 2009
@@ -24,7 +24,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -56,9 +55,8 @@
 /**
  * @author <a href="mailto:olamy@codehaus.org">olamy</a>
  * @version $Id$
- * TODO use some cache mechanism to prevent always reading from store ?
+ *          TODO use some cache mechanism to prevent always reading from store ?
  * @since 13 juin 07
- * 
  */
 @Service("installationService")
 public class DefaultInstallationService
@@ -90,8 +88,8 @@
                               new ExecutorConfigurator( "java", "bin", "JAVA_HOME", "-version" ) );
         this.typesValues.put( InstallationService.MAVEN1_TYPE,
                               new ExecutorConfigurator( "maven", "bin", "MAVEN_HOME", "-v" ) );
-        this.typesValues
-            .put( InstallationService.MAVEN2_TYPE, new ExecutorConfigurator( "mvn", "bin", "M2_HOME", "-v" ) );
+        this.typesValues.put( InstallationService.MAVEN2_TYPE,
+                              new ExecutorConfigurator( "mvn", "bin", "M2_HOME", "-v" ) );
     }
 
     /**
@@ -120,7 +118,7 @@
                 "Installation with name " + installation.getName() + " already exists" );
         }
         // TODO must be done in the same transaction
-        Installation storedOne = null;
+        Installation storedOne;
         try
         {
             String envVarName = this.getEnvVar( installation.getType() );
@@ -402,15 +400,14 @@
             if ( StringUtils.isNotEmpty( path ) )
             {
                 executable.append( path ).append( File.separator );
-                executable.append( executorConfigurator.getRelativePath() + File.separator );
+                executable.append( executorConfigurator.getRelativePath() ).append( File.separator );
                 commandline.addEnvironment( executorConfigurator.getEnvVar(), path );
             }
             //Installations are env var they must be add if exists
             Map<String, String> environments = getEnvVars( profile );
             // no null check we use a private method just here
-            for ( Iterator<String> iterator = environments.keySet().iterator(); iterator.hasNext(); )
+            for ( String key : environments.keySet() )
             {
-                String key = iterator.next();
                 String value = environments.get( key );
                 commandline.addEnvironment( key, value );
             }
@@ -441,8 +438,7 @@
         }
         catch ( CommandLineException e )
         {
-            log.error(
-                "fail to execute " + executable + " with arg " + executorConfigurator.getVersionArgument() );
+            log.error( "fail to execute " + executable + " with arg " + executorConfigurator.getVersionArgument() );
             throw new InstallationException( e.getMessage(), e );
         }
     }

Modified: continuum/trunk/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java?rev=751864&r1=751863&r2=751864&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java (original)
+++ continuum/trunk/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java Mon Mar  9 22:02:34 2009
@@ -65,7 +65,7 @@
 
     @Resource
     private SystemConfigurationDao systemConfigurationDao;
-        
+
     @Resource
     private BuildQueueService buildQueueService;
 
@@ -101,7 +101,7 @@
     {
         this.scheduleDao = scheduleDao;
     }
-    
+
     public BuildQueueService getBuildQueueService()
     {
         return buildQueueService;
@@ -111,7 +111,7 @@
     {
         this.buildQueueService = buildQueueService;
     }
-    
+
     public SystemConfigurationDao getSystemConfigurationDao()
     {
         return systemConfigurationDao;
@@ -168,7 +168,7 @@
         generalConfiguration.setBaseUrl( url );
     }
 
-    /** 
+    /**
      * @see org.apache.maven.continuum.configuration.ConfigurationService#getBuildOutputDirectory()
      */
     public File getBuildOutputDirectory()
@@ -345,7 +345,7 @@
                 {
                     agent.setDescription( buildAgent.getDescription() );
                     agent.setEnabled( buildAgent.isEnabled() );
-                    
+
                     return;
                 }
             }
@@ -413,7 +413,7 @@
                 if ( groups.getName().equals( buildAgentGroup.getName() ) )
                 {
                     groups.setName( buildAgentGroup.getName() );
-                    groups.setBuildAgents( buildAgentGroup.getBuildAgents()  );
+                    groups.setBuildAgents( buildAgentGroup.getBuildAgents() );
 
                     return;
                 }
@@ -446,7 +446,7 @@
                 }
             }
             generalConfiguration.setBuildAgentGroups( buildAgentGroupConfiguration );
-        }        
+        }
     }
 
     public void removeBuildAgent( BuildAgentGroupConfiguration buildAgentGroup, BuildAgentConfiguration buildAgent )
@@ -492,7 +492,7 @@
         return null;
     }
 
-    public BuildAgentConfiguration getBuildAgent(String url)
+    public BuildAgentConfiguration getBuildAgent( String url )
     {
         List<BuildAgentConfiguration> buildAgents = generalConfiguration.getBuildAgents();
         if ( buildAgents == null )
@@ -502,7 +502,7 @@
 
         for ( BuildAgentConfiguration agent : buildAgents )
         {
-            if ( agent.getUrl().equals(url ) )
+            if ( agent.getUrl().equals( url ) )
             {
                 return agent;
             }
@@ -584,9 +584,9 @@
         {
             return null;
         }
-        
+
         File dir = new File( getReleaseOutputDirectory(), Integer.toString( projectGroupId ) );
-        
+
         try
         {
             dir = dir.getCanonicalFile();
@@ -594,7 +594,7 @@
         catch ( IOException e )
         {
         }
-        
+
         return dir;
     }
 
@@ -607,7 +607,7 @@
         {
             return null;
         }
-        
+
         if ( !dir.exists() && !dir.mkdirs() )
         {
             throw new ConfigurationException(
@@ -639,17 +639,17 @@
             return null;
         }
     }
-    
+
     public int getNumberOfBuildsInParallel()
     {
         return generalConfiguration.getNumberOfBuildsInParallel();
     }
-    
+
     public void setNumberOfBuildsInParallel( int num )
     {
         generalConfiguration.setNumberOfBuildsInParallel( num );
     }
-    
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -663,7 +663,7 @@
 
         File f = null;
 
-        if ( filename != null && filename.length() != 0 )
+        if ( filename.length() != 0 )
         {
             f = new File( filename );
 
@@ -675,7 +675,11 @@
 
         try
         {
-            return f.getCanonicalFile();
+            if ( f != null )
+            {
+                return f.getCanonicalFile();
+            }
+            return null;
         }
         catch ( IOException e )
         {
@@ -740,7 +744,8 @@
     }
 
     public Schedule getDefaultSchedule()
-        throws ContinuumStoreException, ConfigurationLoadingException, ContinuumConfigurationException, BuildQueueServiceException
+        throws ContinuumStoreException, ConfigurationLoadingException, ContinuumConfigurationException,
+        BuildQueueServiceException
     {
         // Schedule
         Schedule defaultSchedule = scheduleDao.getScheduleByName( DEFAULT_SCHEDULE_NAME );
@@ -754,28 +759,29 @@
 
         return defaultSchedule;
     }
-    
+
     public BuildQueue getDefaultBuildQueue()
         throws BuildQueueServiceException
-    {     
+    {
         BuildQueue defaultBuildQueue = buildQueueService.getBuildQueueByName( DEFAULT_BUILD_QUEUE_NAME );
-    
+
         if ( defaultBuildQueue == null )
         {
             defaultBuildQueue = createDefaultBuildQueue();
-            
+
             defaultBuildQueue = buildQueueService.addBuildQueue( defaultBuildQueue );
         }
-    
+
         return defaultBuildQueue;
     }
-    
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
 
     private Schedule createDefaultSchedule()
-        throws ConfigurationLoadingException, ContinuumConfigurationException, ContinuumStoreException, BuildQueueServiceException
+        throws ConfigurationLoadingException, ContinuumConfigurationException, ContinuumStoreException,
+        BuildQueueServiceException
     {
 
         log.info( "create Default Schedule" );
@@ -795,22 +801,22 @@
         schedule.setCronExpression( systemConf.getDefaultScheduleCronExpression() );
 
         schedule.setActive( true );
-        
+
         BuildQueue buildQueue = getDefaultBuildQueue();
-        
+
         schedule.addBuildQueue( buildQueue );
 
         return schedule;
     }
-    
+
     private BuildQueue createDefaultBuildQueue()
     {
         log.info( "create Default Build Queue" );
-        
+
         BuildQueue buildQueue = new BuildQueue();
-        
-        buildQueue.setName( DEFAULT_BUILD_QUEUE_NAME );        
-        
+
+        buildQueue.setName( DEFAULT_BUILD_QUEUE_NAME );
+
         return buildQueue;
     }
 }

Modified: continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/installation/DefaultInstallationServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/installation/DefaultInstallationServiceTest.java?rev=751864&r1=751863&r2=751864&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/installation/DefaultInstallationServiceTest.java (original)
+++ continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/installation/DefaultInstallationServiceTest.java Mon Mar  9 22:02:34 2009
@@ -39,34 +39,14 @@
 public class DefaultInstallationServiceTest
     extends AbstractContinuumTest
 {
-    private static final String DEFAULT_INSTALLATION_NAME = "defaultInstallation";
-
     private static final String NEW_INSTALLATION_NAME = "newInstallation";
 
-    //public Installation defaultInstallation;
-
     protected void setUp()
         throws Exception
     {
         super.setUp();
         DaoUtils daoUtils = (DaoUtils) lookup( DaoUtils.class.getName() );
         daoUtils.eraseDatabase();
-        /*if ( getInstallationService().getAllInstallations().isEmpty() )
-        {
-            defaultInstallation = createDefault();
-            ContinuumStore store = getStore();
-            defaultInstallation = store.addInstallation( defaultInstallation );
-        }*/
-    }
-
-    private Installation createDefaultInstallation()
-    {
-        Installation installation = new Installation();
-        installation.setType( "description" );
-        installation.setName( DEFAULT_INSTALLATION_NAME );
-        installation.setVarName( "varName" );
-        installation.setVarValue( "varValue" );
-        return installation;
     }
 
     private InstallationService getInstallationService()
@@ -82,7 +62,7 @@
     {
 
         Installation installation = new Installation();
-        installation.setType( InstallationService.JDK_TYPE );
+        installation.setType( type );
         installation.setName( name );
         installation.setVarName( varName );
         installation.setVarValue( varValue );
@@ -110,7 +90,7 @@
         assertEquals( "bar", getted.getVarValue() );
         try
         {
-            added = this.addInstallation( NEW_INSTALLATION_NAME, null, "bar", InstallationService.JDK_TYPE );
+            this.addInstallation( NEW_INSTALLATION_NAME, null, "bar", InstallationService.JDK_TYPE );
             fail( "not in AlreadyExistsInstallationException" );
         }
         catch ( AlreadyExistsInstallationException e )
@@ -210,11 +190,11 @@
         installation.setName( "automaticJdk" );
         installation.setVarName( "automaticvarName" );
         installation.setVarValue( "automaticvarValue" );
-        installation = getInstallationService().add( installation, true );
+        getInstallationService().add( installation, true );
         ProfileService profileService = (ProfileService) lookup( ProfileService.ROLE, "default" );
         List<Profile> profiles = profileService.getAllProfiles();
         assertEquals( 1, profiles.size() );
-        Profile profile = (Profile) profiles.get( 0 );
+        Profile profile = profiles.get( 0 );
         assertEquals( "automaticJdk", profile.getName() );
         Installation jdk = profile.getJdk();
         assertNotNull( jdk );

Modified: continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/profile/DefaultProfileServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/profile/DefaultProfileServiceTest.java?rev=751864&r1=751863&r2=751864&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/profile/DefaultProfileServiceTest.java (original)
+++ continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/profile/DefaultProfileServiceTest.java Mon Mar  9 22:02:34 2009
@@ -168,7 +168,7 @@
         defaultProfile.setName( name );
         try
         {
-            getted = getProfileService().addProfile( defaultProfile );
+            getProfileService().addProfile( defaultProfile );
             fail( "no AlreadyExistsProfileException with an already exist name " );
         }
         catch ( AlreadyExistsProfileException e )
@@ -274,7 +274,7 @@
         Profile profile = getProfileService().getProfile( jdk1mvn205.getId() );
         getProfileService().setJdkInProfile( profile, jdk2 );
 
-        profile = getProfileService().getProfile( jdk1mvn205.getId() );
+        getProfileService().getProfile( jdk1mvn205.getId() );
         InstallationService installationService = (InstallationService) lookup( InstallationService.ROLE, "default" );
         installationService.delete( jdk2 );
     }

Modified: continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/utils/ContinuumUtilsTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/utils/ContinuumUtilsTest.java?rev=751864&r1=751863&r2=751864&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/utils/ContinuumUtilsTest.java (original)
+++ continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/utils/ContinuumUtilsTest.java Mon Mar  9 22:02:34 2009
@@ -19,8 +19,6 @@
  * under the License.
  */
 
-import org.apache.continuum.utils.ContinuumUtils;
-
 import junit.framework.TestCase;
 
 /**

Modified: continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/utils/ProjectSorterTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/utils/ProjectSorterTest.java?rev=751864&r1=751863&r2=751864&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/utils/ProjectSorterTest.java (original)
+++ continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/utils/ProjectSorterTest.java Mon Mar  9 22:02:34 2009
@@ -61,11 +61,11 @@
 
         assertNotNull( sortedList );
 
-        Project p1 = (Project) sortedList.get( 0 );
+        Project p1 = sortedList.get( 0 );
         assertEquals( top.getArtifactId(), p1.getArtifactId() );
-        Project p2 = (Project) sortedList.get( 1 );
+        Project p2 = sortedList.get( 1 );
         assertEquals( c1.getArtifactId(), p2.getArtifactId() );
-        Project p3 = (Project) sortedList.get( 2 );
+        Project p3 = sortedList.get( 2 );
         assertEquals( c2.getArtifactId(), p3.getArtifactId() );
     }
 
@@ -96,11 +96,11 @@
 
         assertNotNull( sortedList );
 
-        Project p1 = (Project) sortedList.get( 0 );
+        Project p1 = sortedList.get( 0 );
         assertEquals( top.getArtifactId(), p1.getArtifactId() );
-        Project p2 = (Project) sortedList.get( 1 );
+        Project p2 = sortedList.get( 1 );
         assertEquals( c1.getArtifactId(), p2.getArtifactId() );
-        Project p3 = (Project) sortedList.get( 2 );
+        Project p3 = sortedList.get( 2 );
         assertEquals( c2.getArtifactId(), p3.getArtifactId() );
 
     }

Modified: continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java?rev=751864&r1=751863&r2=751864&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java (original)
+++ continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/configuration/ConfigurationServiceTest.java Mon Mar  9 22:02:34 2009
@@ -65,8 +65,8 @@
         log.info( "myBuildOutputDir " + new File( getBasedir(), "target/myBuildOutputDir" ).getAbsolutePath() );
 
         log.info( "getBuildOutputDirectory " + service.getBuildOutputDirectory().getAbsolutePath() );
-        assertEquals( new File( getBasedir(), "target/myBuildOutputDir" ).getAbsolutePath(), service
-            .getBuildOutputDirectory().getAbsolutePath() );
+        assertEquals( new File( getBasedir(), "target/myBuildOutputDir" ).getAbsolutePath(),
+                      service.getBuildOutputDirectory().getAbsolutePath() );
     }
 
     public void testConfigurationService()
@@ -91,7 +91,7 @@
 //        assertEquals( "working-directory", service.getWorkingDirectory().getName() );
 
         assertEquals( "check # build agents", 1, service.getBuildAgents().size() );
-        
+
         service.setUrl( "http://test/zloug" );
         service.setBuildOutputDirectory( new File( "testBuildOutputDir" ) );
 
@@ -106,7 +106,7 @@
         service.reload();
 
         assertEquals( "http://test/zloug", service.getUrl() );
-        assertEquals( "check # build agents", 2, service.getBuildAgents().size() );        
+        assertEquals( "check # build agents", 2, service.getBuildAgents().size() );
         assertEquals( "http://test/xmlrpc", service.getBuildAgents().get( 1 ).getUrl() );
         assertEquals( "windows", service.getBuildAgents().get( 1 ).getDescription() );
         assertFalse( service.getBuildAgents().get( 1 ).isEnabled() );
@@ -130,9 +130,9 @@
         service.reload();
         assertEquals( "check # build agent groups", 1, service.getBuildAgentGroups().size() );
         assertEquals( "group-1", service.getBuildAgentGroups().get( 0 ).getName() );
-        assertEquals( "windows", service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 0 ).getDescription());
+        assertEquals( "windows", service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 0 ).getDescription() );
 
-        BuildAgentConfiguration buildAgent2 = new BuildAgentConfiguration( "http://machine-1/xmlrpc", "node-1", true);
+        BuildAgentConfiguration buildAgent2 = new BuildAgentConfiguration( "http://machine-1/xmlrpc", "node-1", true );
         //buildAgentGroup.addBuildAgent( buildAgent2 );
         service.addBuildAgent( buildAgentGroup, buildAgent2 );
 
@@ -142,13 +142,11 @@
         assertEquals( "check # build agent groups", 1, service.getBuildAgentGroups().size() );
         assertEquals( "check # build agent groups", 2, service.getBuildAgentGroups().get( 0 ).getBuildAgents().size() );
         assertEquals( "group-1", service.getBuildAgentGroups().get( 0 ).getName() );
-        assertEquals( "windows", service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 0 ).getDescription());     
+        assertEquals( "windows", service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 0 ).getDescription() );
         assertEquals( "http://machine-1/xmlrpc",
                       service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 1 ).getUrl() );
-        assertEquals( "node-1",
-                      service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 1 ).getDescription() );
-        assertEquals( true,
-                      service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 1 ).isEnabled() );
+        assertEquals( "node-1", service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 1 ).getDescription() );
+        assertEquals( true, service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 1 ).isEnabled() );
 
         service.removeBuildAgent( buildAgentGroup, buildAgent2 );
         service.store();
@@ -156,6 +154,6 @@
 
         assertEquals( "check # build agent groups", 1, service.getBuildAgentGroups().size() );
         assertEquals( "group-1", service.getBuildAgentGroups().get( 0 ).getName() );
-        assertEquals( "windows", service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 0 ).getDescription());
+        assertEquals( "windows", service.getBuildAgentGroups().get( 0 ).getBuildAgents().get( 0 ).getDescription() );
     }
 }

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=751864&r1=751863&r2=751864&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 Mon Mar  9 22:02:34 2009
@@ -150,11 +150,13 @@
                 {
                     try
                     {
-                        SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( agent.getUrl() ) );
-                        
+                        SlaveBuildAgentTransportClient client =
+                            new SlaveBuildAgentTransportClient( new URL( agent.getUrl() ) );
+
                         if ( client.ping() )
                         {
-                            log.info( "agent is enabled, add TaskQueueExecutor for build agent '" + agent.getUrl() + "'" );
+                            log.info(
+                                "agent is enabled, add TaskQueueExecutor for build agent '" + agent.getUrl() + "'" );
                             addTaskQueueExecutor( agent.getUrl() );
                         }
                         else
@@ -169,12 +171,14 @@
                     }
                     catch ( ContinuumException e )
                     {
-                        throw new InitializationException( "Error while initializing distributed build task queue executors", e );
+                        throw new InitializationException(
+                            "Error while initializing distributed build task queue executors", e );
                     }
                     catch ( Exception e )
                     {
                         agent.setEnabled( false );
-                        log.info( "unable to ping build agent '" + agent.getUrl() + "': " + ContinuumUtils.throwableToString( e ) );
+                        log.info( "unable to ping build agent '" + agent.getUrl() + "': " +
+                            ContinuumUtils.throwableToString( e ) );
                     }
                 }
             }
@@ -185,15 +189,16 @@
         throws ContinuumException
     {
         List<BuildAgentConfiguration> agents = configurationService.getBuildAgents();
-        
+
         for ( BuildAgentConfiguration agent : agents )
         {
             if ( agent.isEnabled() && !taskQueueExecutors.containsKey( agent.getUrl() ) )
             {
                 try
                 {
-                    SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( agent.getUrl() ) );
-                    
+                    SlaveBuildAgentTransportClient client =
+                        new SlaveBuildAgentTransportClient( new URL( agent.getUrl() ) );
+
                     if ( client.ping() )
                     {
                         log.info( "agent is enabled, add TaskQueueExecutor for build agent '" + agent.getUrl() + "'" );
@@ -212,7 +217,8 @@
                 catch ( Exception e )
                 {
                     agent.setEnabled( false );
-                    log.info( "unable to ping build agent '" + agent.getUrl() + "': " + ContinuumUtils.throwableToString( e ) );
+                    log.info( "unable to ping build agent '" + agent.getUrl() + "': " +
+                        ContinuumUtils.throwableToString( e ) );
                 }
             }
             else if ( !agent.isEnabled() && taskQueueExecutors.containsKey( agent.getUrl() ) )
@@ -227,7 +233,8 @@
         throws ContinuumException
     {
         log.info( "remove TaskQueueExecutor for build agent '" + buildAgentUrl + "'" );
-        ThreadedDistributedBuildTaskQueueExecutor executor = (ThreadedDistributedBuildTaskQueueExecutor) taskQueueExecutors.get( buildAgentUrl );
+        ThreadedDistributedBuildTaskQueueExecutor executor =
+            (ThreadedDistributedBuildTaskQueueExecutor) taskQueueExecutors.get( buildAgentUrl );
 
         if ( executor == null )
         {
@@ -254,7 +261,7 @@
     public boolean isBuildAgentBusy( String buildAgentUrl )
     {
         DistributedBuildTaskQueueExecutor executor = taskQueueExecutors.get( buildAgentUrl );
-        
+
         if ( executor != null && executor.getCurrentTask() != null )
         {
             log.info( "build agent '" + buildAgentUrl + "' is busy" );
@@ -269,9 +276,9 @@
         throws ContinuumException
     {
         try
-        {            
+        {
             DistributedBuildTaskQueueExecutor taskQueueExecutor = (DistributedBuildTaskQueueExecutor) container.
-                                                                          lookup( DistributedBuildTaskQueueExecutor.class, "distributed-build-project" );
+                lookup( DistributedBuildTaskQueueExecutor.class, "distributed-build-project" );
             taskQueueExecutor.setBuildAgentUrl( url );
             taskQueueExecutors.put( url, taskQueueExecutor );
         }
@@ -284,7 +291,7 @@
     public void cancelDistributedBuild( String buildAgentUrl, int projectGroupId, String scmRootAddress )
         throws ContinuumException
     {
-        DistributedBuildTaskQueueExecutor taskQueueExecutor = (DistributedBuildTaskQueueExecutor) taskQueueExecutors.get( buildAgentUrl );
+        DistributedBuildTaskQueueExecutor taskQueueExecutor = taskQueueExecutors.get( buildAgentUrl );
 
         if ( taskQueueExecutor != null )
         {
@@ -292,30 +299,33 @@
             {
                 if ( taskQueueExecutor.getCurrentTask() instanceof PrepareBuildProjectsTask )
                 {
-                    PrepareBuildProjectsTask currentTask = (PrepareBuildProjectsTask) taskQueueExecutor.getCurrentTask();
-                    
-                    if ( currentTask.getProjectGroupId() == projectGroupId && 
-                         currentTask.getScmRootAddress().equals( scmRootAddress ) )
+                    PrepareBuildProjectsTask currentTask = (PrepareBuildProjectsTask) taskQueueExecutor.getCurrentTask()
+                        ;
+
+                    if ( currentTask.getProjectGroupId() == projectGroupId &&
+                        currentTask.getScmRootAddress().equals( scmRootAddress ) )
                     {
-                        log.info( "cancelling task for project group " + projectGroupId + 
-                                  " with scm root address " + scmRootAddress );
+                        log.info( "cancelling task for project group " + projectGroupId + " with scm root address " +
+                            scmRootAddress );
                         taskQueueExecutor.cancelTask( currentTask );
 
                         try
                         {
-                            SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
+                            SlaveBuildAgentTransportClient client =
+                                new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
                             client.cancelBuild();
                         }
                         catch ( Exception e )
                         {
                             log.error( "Error while cancelling build in build agent '" + buildAgentUrl + "'" );
-                            throw new ContinuumException( "Error while cancelling build in build agent '" + buildAgentUrl + "'", e );
+                            throw new ContinuumException(
+                                "Error while cancelling build in build agent '" + buildAgentUrl + "'", e );
                         }
                     }
                     else
                     {
-                        log.info( "current task not for project group " + projectGroupId + 
-                                  " with scm root address " + scmRootAddress );
+                        log.info( "current task not for project group " + projectGroupId + " with scm root address " +
+                            scmRootAddress );
                     }
                 }
                 else
@@ -366,7 +376,7 @@
             // ----------------------------------------------------------------------
 
             BuildResult buildResult = convertMapToBuildResult( context );
-            
+
             if ( buildResult.getState() != ContinuumProjectState.CANCELLED )
             {
                 buildResult.setBuildDefinition( buildDefinition );
@@ -385,7 +395,7 @@
                 }
 
                 buildResultDao.addBuildResult( project, buildResult );
-            
+
                 project.setOldState( project.getState() );
                 project.setState( ContinuumBuildConstant.getBuildState( context ) );
                 project.setBuildNumber( buildNumber );
@@ -400,10 +410,11 @@
             projectDao.updateProject( project );
 
             File buildOutputFile = configurationService.getBuildOutputFile( buildResult.getId(), project.getId() );
-            
+
             FileWriter fstream = new FileWriter( buildOutputFile );
-            BufferedWriter out = new BufferedWriter(fstream);
-            out.write( ContinuumBuildConstant.getBuildOutput( context ) == null ? "" : ContinuumBuildConstant.getBuildOutput( context ) );
+            BufferedWriter out = new BufferedWriter( fstream );
+            out.write( ContinuumBuildConstant.getBuildOutput( context ) == null ? ""
+                : ContinuumBuildConstant.getBuildOutput( context ) );
             out.close();
 
             if ( buildResult.getState() != ContinuumProjectState.CANCELLED )
@@ -433,10 +444,11 @@
 
         try
         {
-            ProjectScmRoot scmRoot = projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress( projectGroupId, scmRootAddress );
-            
+            ProjectScmRoot scmRoot =
+                projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress( projectGroupId, scmRootAddress );
+
             String error = ContinuumBuildConstant.getScmError( context );
-            
+
             if ( StringUtils.isEmpty( error ) )
             {
                 scmRoot.setState( ContinuumProjectState.UPDATED );
@@ -463,12 +475,12 @@
 
         for ( String url : taskQueueExecutors.keySet() )
         {
-            DistributedBuildTaskQueueExecutor taskQueueExecutor = (DistributedBuildTaskQueueExecutor) taskQueueExecutors.get( url );
+            DistributedBuildTaskQueueExecutor taskQueueExecutor = taskQueueExecutors.get( url );
 
             if ( taskQueueExecutor.getCurrentTask() != null )
             {
                 PrepareBuildProjectsTask task = (PrepareBuildProjectsTask) taskQueueExecutor.getCurrentTask();
-                
+
                 map.put( url, task );
             }
         }
@@ -484,7 +496,7 @@
         try
         {
             SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
-            
+
             List<Map> installationsList = client.getAvailableInstallations();
 
             for ( Map context : installationsList )
@@ -496,7 +508,7 @@
                 installation.setVarValue( ContinuumBuildConstant.getInstallationVarValue( context ) );
                 installations.add( installation );
             }
-            
+
             return installations;
         }
         catch ( Exception e )
@@ -504,7 +516,7 @@
             throw new ContinuumException( "Unable to get available installations of build agent", e );
         }
     }
-    
+
     public void startProjectBuild( int projectId )
         throws ContinuumException
     {
@@ -528,8 +540,9 @@
         {
             int projectGroupId = ContinuumBuildConstant.getProjectGroupId( context );
             String scmRootAddress = ContinuumBuildConstant.getScmRootAddress( context );
-            
-            ProjectScmRoot scmRoot = projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress( projectGroupId, scmRootAddress );
+
+            ProjectScmRoot scmRoot =
+                projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress( projectGroupId, scmRootAddress );
             scmRoot.setOldState( scmRoot.getState() );
             scmRoot.setState( ContinuumProjectState.UPDATING );
             projectScmRootDao.updateProjectScmRoot( scmRoot );
@@ -545,9 +558,9 @@
         throws ContinuumException
     {
         Map<String, Object> map = new HashMap<String, Object>();
-        
+
         String buildAgentUrl = getBuildAgent( projectId );
-        
+
         if ( buildAgentUrl == null )
         {
             return null;
@@ -558,7 +571,7 @@
             SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new URL( buildAgentUrl ) );
 
             Map result = client.getBuildResult( projectId );
-            
+
             if ( result != null )
             {
                 int buildDefinitionId = ContinuumBuildConstant.getBuildDefinitionId( result );
@@ -576,7 +589,7 @@
                 buildResult.setScmResult( getScmResult( result ) );
 
                 String buildOutput = ContinuumBuildConstant.getBuildOutput( result );
-                
+
                 map.put( ContinuumBuildConstant.KEY_BUILD_RESULT, buildResult );
                 map.put( ContinuumBuildConstant.KEY_BUILD_OUTPUT, buildOutput );
             }
@@ -745,6 +758,7 @@
         }
         return "";
     }
+
     public boolean shouldBuild( Map context )
     {
         try
@@ -759,7 +773,8 @@
 
             BuildDefinition buildDefinition = buildDefinitionDao.getBuildDefinition( buildDefinitionId );
 
-            BuildResult oldBuildResult = buildResultDao.getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId );
+            BuildResult oldBuildResult =
+                buildResultDao.getLatestBuildResultForBuildDefinition( projectId, buildDefinitionId );
 
             List<ProjectDependency> modifiedDependencies = getModifiedDependencies( oldBuildResult, context );
 
@@ -814,8 +829,8 @@
 
             if ( project.getOldState() != ContinuumProjectState.NEW &&
                 project.getOldState() != ContinuumProjectState.CHECKEDOUT &&
-                trigger != ContinuumProjectState.TRIGGER_FORCED &&
-                project.getState() != ContinuumProjectState.NEW && project.getState() != ContinuumProjectState.CHECKEDOUT )
+                project.getState() != ContinuumProjectState.NEW &&
+                project.getState() != ContinuumProjectState.CHECKEDOUT )
             {
                 // Check SCM changes
                 allChangesUnknown = checkAllChangesUnknown( changes );
@@ -846,7 +861,8 @@
             if ( !shouldBuild && ( ( !allChangesUnknown && !changes.isEmpty() ) ||
                 project.getExecutorId().equals( ContinuumBuildExecutorConstants.MAVEN_TWO_BUILD_EXECUTOR ) ) )
             {
-                shouldBuild = shouldBuild( changes, buildDefinition, project, getMavenProjectVersion( context ), getMavenProjectModules( context ) );
+                shouldBuild = shouldBuild( changes, buildDefinition, project, getMavenProjectVersion( context ),
+                                           getMavenProjectModules( context ) );
             }
 
             if ( shouldBuild )
@@ -872,15 +888,15 @@
         return false;
     }
 
-    private boolean shouldBuild( List<ChangeSet> changes, BuildDefinition buildDefinition, Project project, 
+    private boolean shouldBuild( List<ChangeSet> changes, BuildDefinition buildDefinition, Project project,
                                  String mavenProjectVersion, List<String> mavenProjectModules )
     {
         //Check if it's a recursive build
         boolean isRecursive = false;
-        if (StringUtils.isNotEmpty( buildDefinition.getArguments() ) )
+        if ( StringUtils.isNotEmpty( buildDefinition.getArguments() ) )
         {
             isRecursive = buildDefinition.getArguments().indexOf( "-N" ) < 0 &&
-                buildDefinition.getArguments().indexOf( "--non-recursive" ) < 0 ;
+                buildDefinition.getArguments().indexOf( "--non-recursive" ) < 0;
         }
 
         if ( isRecursive && changes != null && !changes.isEmpty() )
@@ -898,7 +914,7 @@
             return true;
         }
 
-        if ( changes.isEmpty() )
+        if ( changes == null || changes.isEmpty() )
         {
             if ( log.isInfoEnabled() )
             {
@@ -933,12 +949,12 @@
                         if ( log.isDebugEnabled() )
                         {
                             log.debug( "changeFile.name " + file.getName() + " removed because in a module" );
-                        }                    
+                        }
                         files.remove( file );
                         found = true;
                         break;
                     }
-                    if (log.isDebugEnabled())
+                    if ( log.isDebugEnabled() )
                     {
                         log.debug( "not removing file " + file.getName() + " not in module " + module );
                     }
@@ -990,38 +1006,39 @@
         {
             return null;
         }
-    
+
         try
         {
             Project project = projectDao.getProjectWithAllDetails( ContinuumBuildConstant.getProjectId( context ) );
             List<ProjectDependency> dependencies = project.getDependencies();
-    
+
             if ( dependencies == null )
             {
                 dependencies = new ArrayList<ProjectDependency>();
             }
-    
+
             if ( project.getParent() != null )
             {
                 dependencies.add( project.getParent() );
             }
-    
+
             if ( dependencies.isEmpty() )
             {
                 return null;
             }
-    
+
             List<ProjectDependency> modifiedDependencies = new ArrayList<ProjectDependency>();
-    
+
             for ( ProjectDependency dep : dependencies )
             {
                 Project dependencyProject =
                     projectDao.getProject( dep.getGroupId(), dep.getArtifactId(), dep.getVersion() );
-    
+
                 if ( dependencyProject != null )
                 {
                     List buildResults = buildResultDao.getBuildResultsInSuccessForProject( dependencyProject.getId(),
-                                                                                           oldBuildResult.getEndTime() );
+                                                                                           oldBuildResult.getEndTime() )
+                        ;
                     if ( buildResults != null && !buildResults.isEmpty() )
                     {
                         log.debug( "Dependency changed: " + dep.getGroupId() + ":" + dep.getArtifactId() + ":" +
@@ -1030,24 +1047,24 @@
                     }
                     else
                     {
-                        log.debug( "Dependency not changed: " + dep.getGroupId() + ":" + dep.getArtifactId() +
-                            ":" + dep.getVersion() );
+                        log.debug( "Dependency not changed: " + dep.getGroupId() + ":" + dep.getArtifactId() + ":" +
+                            dep.getVersion() );
                     }
                 }
                 else
                 {
-                    log.debug( "Skip non Continuum project: " + dep.getGroupId() + ":" + dep.getArtifactId() +
-                        ":" + dep.getVersion() );
+                    log.debug( "Skip non Continuum project: " + dep.getGroupId() + ":" + dep.getArtifactId() + ":" +
+                        dep.getVersion() );
                 }
             }
-    
+
             return modifiedDependencies;
         }
         catch ( ContinuumStoreException e )
         {
             log.warn( "Can't get the project dependencies", e );
         }
-    
+
         return null;
     }
 
@@ -1055,11 +1072,11 @@
         throws ContinuumException
     {
         Map<String, PrepareBuildProjectsTask> map = getDistributedBuildProjects();
-        
+
         for ( String url : map.keySet() )
         {
             PrepareBuildProjectsTask task = map.get( url );
-            
+
             for ( Integer id : task.getProjectsBuildDefinitionsMap().keySet() )
             {
                 if ( projectId == id )
@@ -1068,7 +1085,7 @@
                 }
             }
         }
-        
+
         return null;
     }
 
@@ -1122,9 +1139,9 @@
         return envVars;
     }
 
-    private List getScmChanges( Map context )
+    private List<ChangeSet> getScmChanges( Map context )
     {
-        List changes = new ArrayList();
+        List<ChangeSet> changes = new ArrayList<ChangeSet>();
         List<Map> scmChanges = ContinuumBuildConstant.getScmChanges( context );
 
         if ( scmChanges != null )
@@ -1164,7 +1181,7 @@
     private ProjectDependency getProjectParent( Map context )
     {
         Map map = ContinuumBuildConstant.getProjectParent( context );
-        
+
         if ( map != null && map.size() > 0 )
         {
             ProjectDependency parent = new ProjectDependency();
@@ -1183,7 +1200,7 @@
         List<ProjectDependency> projectDependencies = new ArrayList<ProjectDependency>();
 
         List<Map> dependencies = ContinuumBuildConstant.getProjectDependencies( context );
-        
+
         if ( dependencies != null )
         {
             for ( Map map : dependencies )



Mime
View raw message