You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ke...@apache.org on 2006/08/11 01:28:03 UTC
svn commit: r430587 - in /maven/continuum/trunk:
continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/
continuum-core/src/main/java/org/apache/maven/continuum/
continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/...
Author: kenney
Date: Thu Aug 10 16:28:02 2006
New Revision: 430587
URL: http://svn.apache.org/viewvc?rev=430587&view=rev
Log:
Refactored the DefaultBuildController to have better exception
handling. Cleaned up the code and added a BuildContext bean to store
all build related information so it can be passed around to the different methods.
The rest is code cleanup:
* Remove unused code (private methods that were not called, unused variables, unused imports)
* Recorganize declarations of local variables to their proper scope
* Fix possible NPE's
* Remove bogus null/non-null checks.
Added:
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java (with props)
Modified:
maven/continuum/trunk/continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilder.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildController.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java
maven/continuum/trunk/continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/AbstractContinuumNotifier.java
maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java
Modified: maven/continuum/trunk/continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilder.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilder.java (original)
+++ maven/continuum/trunk/continuum-cc/src/main/java/org/apache/maven/continuum/project/builder/cc/CruiseControlProjectBuilder.java Thu Aug 10 16:28:02 2006
@@ -280,6 +280,9 @@
"Unsupported modification set found '" + modifactionset.getName() + "'." );
}
+ // FIXME: this break ensures that null-checks for scmURL above
+ // are useless - scmURL is always null. Either remove the break or drop
+ // the checks.
break;
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Thu Aug 10 16:28:02 2006
@@ -24,9 +24,7 @@
import org.apache.maven.continuum.configuration.ConfigurationService;
import org.apache.maven.continuum.configuration.ConfigurationStoringException;
import org.apache.maven.continuum.core.action.AbstractContinuumAction;
-import org.apache.maven.continuum.core.action.AddProjectToCheckOutQueueAction;
import org.apache.maven.continuum.core.action.CreateProjectsFromMetadata;
-import org.apache.maven.continuum.core.action.StoreProjectAction;
import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
import org.apache.maven.continuum.initialization.ContinuumInitializationException;
@@ -156,8 +154,6 @@
public DefaultContinuum()
{
- super();
-
Runtime.getRuntime().addShutdownHook( new Thread()
{
public void run()
@@ -342,7 +338,7 @@
{
Map context = new HashMap();
- context.put( AddProjectToCheckOutQueueAction.KEY_PROJECT_ID, new Integer( projectId ) );
+ context.put( AbstractContinuumAction.KEY_PROJECT_ID, new Integer( projectId ) );
executeAction( "add-project-to-checkout-queue", context );
}
@@ -402,8 +398,8 @@
if ( buildDefId == null )
{
- throw new ContinuumException(
- "Project (id=" + project.getId() + " doens't have a default build definition." );
+ throw new ContinuumException( "Project (id=" + project.getId()
+ + " doens't have a default build definition." );
}
buildProject( project, buildDefId.intValue(), trigger );
@@ -424,6 +420,7 @@
if ( projectsMap == null )
{
// We don't have projects attached to this schedule
+ getLogger().info( "No projects to build for schedule " + schedule );
return;
}
@@ -440,25 +437,34 @@
projectsList = getProjects();
}
+ getLogger().info( "Building " + projectsList.size() + " projects" );
+
for ( Iterator projectIterator = projectsList.iterator(); projectIterator.hasNext(); )
{
Project project = (Project) projectIterator.next();
+ // FIXME: if store.getProjectIdsAndBuildDefinitionsIdsBySchedule above throws a CycleDetectedException,
+ // then projectsMap is null.
List buildDefIds = (List) projectsMap.get( new Integer( project.getId() ) );
if ( buildDefIds != null && !buildDefIds.isEmpty() )
{
+ getLogger().info( "Processing " + buildDefIds.size() + " build definitions for project " + project );
for ( Iterator buildDefinitionIterator = buildDefIds.iterator(); buildDefinitionIterator.hasNext(); )
{
Integer buildDefId = (Integer) buildDefinitionIterator.next();
- if ( buildDefId != null && !isInBuildingQueue( project.getId(), buildDefId.intValue() ) &&
- !isInCheckoutQueue( project.getId() ) )
+ if ( buildDefId != null && !isInBuildingQueue( project.getId(), buildDefId.intValue() )
+ && !isInCheckoutQueue( project.getId() ) )
{
buildProject( project, buildDefId.intValue(), ContinuumProjectState.TRIGGER_SCHEDULED, false );
}
}
}
+ else
+ {
+ getLogger().info( "No build definitions, not building for project " + project );
+ }
}
}
@@ -474,7 +480,6 @@
buildProject( projectId, buildDefinitionId, ContinuumProjectState.TRIGGER_FORCED );
}
-
public void buildProject( int projectId, int trigger )
throws ContinuumException
{
@@ -535,10 +540,10 @@
try
{
- if ( project.getState() != ContinuumProjectState.NEW &&
- project.getState() != ContinuumProjectState.CHECKEDOUT &&
- project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED &&
- project.getState() != ContinuumProjectState.ERROR )
+ if ( project.getState() != ContinuumProjectState.NEW
+ && project.getState() != ContinuumProjectState.CHECKEDOUT
+ && project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED
+ && project.getState() != ContinuumProjectState.ERROR )
{
ContinuumBuildExecutor executor = executorManager.getBuildExecutor( project.getExecutorId() );
@@ -559,8 +564,7 @@
}
}
- getLogger().info(
- "Enqueuing '" + project.getName() + "' (Build definition id=" + buildDefinitionId + ")." );
+ getLogger().info( "Enqueuing '" + project.getName() + "' (Build definition id=" + buildDefinitionId + ")." );
buildQueue.put( new BuildProjectTask( project.getId(), buildDefinitionId, trigger ) );
}
@@ -763,7 +767,7 @@
//
// ----------------------------------------------------------------------
- context.put( CreateProjectsFromMetadata.KEY_WORKING_DIRECTORY, getWorkingDirectory() );
+ context.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, getWorkingDirectory() );
context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT, project );
@@ -782,7 +786,7 @@
executeAction( "add-project-to-checkout-queue", context );
- return ( (Integer) context.get( StoreProjectAction.KEY_PROJECT_ID ) ).intValue();
+ return ( (Integer) context.get( AbstractContinuumAction.KEY_PROJECT_ID ) ).intValue();
}
private ContinuumProjectBuildingResult executeAddProjectsFromMetadataActivity( String metadataUrl,
@@ -795,7 +799,7 @@
context.put( CreateProjectsFromMetadata.KEY_URL, metadataUrl );
- context.put( CreateProjectsFromMetadata.KEY_WORKING_DIRECTORY, getWorkingDirectory() );
+ context.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, getWorkingDirectory() );
// ----------------------------------------------------------------------
// Create the projects from the URL
@@ -803,8 +807,8 @@
executeAction( "create-projects-from-metadata", context );
- ContinuumProjectBuildingResult result =
- (ContinuumProjectBuildingResult) context.get( CreateProjectsFromMetadata.KEY_PROJECT_BUILDING_RESULT );
+ ContinuumProjectBuildingResult result = (ContinuumProjectBuildingResult) context
+ .get( CreateProjectsFromMetadata.KEY_PROJECT_BUILDING_RESULT );
if ( result.getProjects() != null )
{
@@ -849,7 +853,8 @@
projectGroup = store.getProjectGroupByGroupIdWithProjects( projectGroup.getGroupId() );
getLogger().info(
- "Using existing project group with the group id: '" + projectGroup.getGroupId() + "'." );
+ "Using existing project group with the group id: '" + projectGroup.getGroupId()
+ + "'." );
}
catch ( ContinuumObjectNotFoundException e )
{
@@ -857,7 +862,7 @@
Map pgContext = new HashMap();
- pgContext.put( CreateProjectsFromMetadata.KEY_WORKING_DIRECTORY, getWorkingDirectory() );
+ pgContext.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, getWorkingDirectory() );
pgContext.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT_GROUP, projectGroup );
@@ -900,11 +905,11 @@
context = new HashMap();
context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT, project );
-//
-// executeAction( "validate-project", context );
-//
-// executeAction( "store-project", context );
-//
+ //
+ // executeAction( "validate-project", context );
+ //
+ // executeAction( "store-project", context );
+ //
context.put( AbstractContinuumAction.KEY_PROJECT_ID, new Integer( project.getId() ) );
executeAction( "add-project-to-checkout-queue", context );
@@ -992,8 +997,8 @@
if ( value instanceof String )
{
String val = (String) value;
- if ( !"sendOnSuccess".equals( val ) && !"sendOnFailure".equals( val ) && !"sendOnError".equals( val ) &&
- !"sendOnWarning".equals( val ) )
+ if ( !"sendOnSuccess".equals( val ) && !"sendOnFailure".equals( val ) && !"sendOnError".equals( val )
+ && !"sendOnWarning".equals( val ) )
{
if ( !StringUtils.isEmpty( val ) )
{
@@ -1541,8 +1546,8 @@
if ( configuration.get( "conf.workingDirectory" ) != null )
{
- configurationService.setWorkingDirectory(
- configurationService.getFile( (String) configuration.get( "conf.workingDirectory" ) ) );
+ configurationService.setWorkingDirectory( configurationService.getFile( (String) configuration
+ .get( "conf.workingDirectory" ) ) );
}
else
{
@@ -1551,8 +1556,8 @@
if ( configuration.get( "conf.buildOutputDirectory" ) != null )
{
- configurationService.setBuildOutputDirectory(
- configurationService.getFile( (String) configuration.get( "conf.buildOutputDirectory" ) ) );
+ configurationService.setBuildOutputDirectory( configurationService.getFile( (String) configuration
+ .get( "conf.buildOutputDirectory" ) ) );
}
else
{
@@ -1561,8 +1566,8 @@
if ( configuration.get( "conf.deploymentRepositoryDirectory" ) != null )
{
- configurationService.setDeploymentRepositoryDirectory( configurationService.getFile(
- (String) configuration.get( "conf.deploymentRepositoryDirectory" ) ) );
+ configurationService.setDeploymentRepositoryDirectory( configurationService
+ .getFile( (String) configuration.get( "conf.deploymentRepositoryDirectory" ) ) );
}
if ( configuration.get( "conf.url" ) != null )
@@ -1909,16 +1914,16 @@
{
if ( !wdFile.isDirectory() )
{
- throw new InitializationException(
- "The specified working directory isn't a directory: " + "'" + wdFile.getAbsolutePath() + "'." );
+ throw new InitializationException( "The specified working directory isn't a directory: " + "'"
+ + wdFile.getAbsolutePath() + "'." );
}
}
else
{
if ( !wdFile.mkdirs() )
{
- throw new InitializationException(
- "Could not making the working directory: " + "'" + wdFile.getAbsolutePath() + "'." );
+ throw new InitializationException( "Could not making the working directory: " + "'"
+ + wdFile.getAbsolutePath() + "'." );
}
}
@@ -1945,10 +1950,10 @@
}
}
- if ( project.getState() != ContinuumProjectState.NEW &&
- project.getState() != ContinuumProjectState.CHECKEDOUT &&
- project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED &&
- project.getState() != ContinuumProjectState.ERROR )
+ if ( project.getState() != ContinuumProjectState.NEW
+ && project.getState() != ContinuumProjectState.CHECKEDOUT
+ && project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED
+ && project.getState() != ContinuumProjectState.ERROR )
{
int state = project.getState();
@@ -1958,8 +1963,9 @@
try
{
- getLogger().info( "Fix project state for project " + project.getId() + ":" + project.getName() +
- ":" + project.getVersion() );
+ getLogger().info(
+ "Fix project state for project " + project.getId() + ":" + project.getName()
+ + ":" + project.getVersion() );
store.updateProject( project );
@@ -1976,8 +1982,9 @@
}
}
- getLogger().info( " " + project.getId() + ":" + project.getName() + ":" + project.getVersion() + ":" +
- project.getExecutorId() );
+ getLogger().info(
+ " " + project.getId() + ":" + project.getName() + ":" + project.getVersion() + ":"
+ + project.getExecutorId() );
}
}
@@ -2281,7 +2288,6 @@
throw new ContinuumException( "Error retrieving the requested project", e );
}
}
-
// ----------------------------------------------------------------------
// Private Utilities
Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java?rev=430587&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java (added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java Thu Aug 10 16:28:02 2006
@@ -0,0 +1,129 @@
+package org.apache.maven.continuum.buildcontroller;
+
+import org.apache.maven.continuum.core.action.AbstractContinuumAction;
+import org.apache.maven.continuum.model.project.BuildDefinition;
+import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.scm.ScmResult;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ * This class holds build context information.
+ *
+ * @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
+ *
+ */
+public class BuildContext
+{
+
+ private long startTime;
+
+ private Project project;
+
+ private BuildDefinition buildDefinition;
+
+ private BuildResult oldBuildResult;
+
+ private ScmResult oldScmResult;
+
+ private Map actionContext;
+
+ private ScmResult scmResult;
+
+ private int trigger;
+
+ private BuildResult buildResult;
+
+ public void setStartTime( long startTime )
+ {
+ this.startTime = startTime;
+ }
+
+ public long getStartTime()
+ {
+ return startTime;
+ }
+
+ public void setProject( Project project )
+ {
+ this.project = project;
+ }
+
+ public Project getProject()
+ {
+ return project;
+ }
+
+ public void setBuildDefinition( BuildDefinition buildDefinition )
+ {
+ this.buildDefinition = buildDefinition;
+ }
+
+ public BuildDefinition getBuildDefinition()
+ {
+ return buildDefinition;
+ }
+
+ public void setBuildResult( BuildResult build )
+ {
+ this.buildResult = build;
+ }
+
+ public BuildResult getBuildResult()
+ {
+ return buildResult;
+ }
+
+ public void setOldBuildResult( BuildResult buildResult )
+ {
+ this.oldBuildResult = buildResult;
+ }
+
+ public BuildResult getOldBuildResult()
+ {
+ return oldBuildResult;
+ }
+
+ public void setOldScmResult( ScmResult oldScmResult )
+ {
+ this.oldScmResult = oldScmResult;
+ }
+
+ public ScmResult getOldScmResult()
+ {
+ return oldScmResult;
+ }
+
+ public void setScmResult( ScmResult scmResult )
+ {
+ this.scmResult = scmResult;
+ }
+
+ public ScmResult getScmResult()
+ {
+ return scmResult;
+ }
+
+ public Map getActionContext()
+ {
+ if ( actionContext == null )
+ {
+ actionContext = new HashMap();
+ }
+ return actionContext;
+ }
+
+ public int getTrigger()
+ {
+ return trigger;
+ }
+
+ public void setTrigger( int trigger )
+ {
+ this.trigger = trigger;
+ }
+
+}
Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildContext.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildController.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildController.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildController.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/BuildController.java Thu Aug 10 16:28:02 2006
@@ -1,5 +1,7 @@
package org.apache.maven.continuum.buildcontroller;
+import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
+
/*
* Copyright 2004-2005 The Apache Software Foundation.
*
@@ -24,5 +26,6 @@
{
String ROLE = BuildController.class.getName();
- void build( int projectId, int buildDefinitionId, int trigger );
+ void build( int projectId, int buildDefinitionId, int trigger )
+ throws TaskExecutionException;
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java Thu Aug 10 16:28:02 2006
@@ -26,15 +26,17 @@
import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
import org.apache.maven.continuum.project.ContinuumProjectState;
import org.apache.maven.continuum.scm.ContinuumScmException;
+import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
import org.apache.maven.continuum.utils.ContinuumUtils;
import org.apache.maven.continuum.utils.WorkingDirectoryService;
import org.codehaus.plexus.action.ActionManager;
+import org.codehaus.plexus.action.ActionNotFoundException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
import org.codehaus.plexus.util.StringUtils;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -72,311 +74,387 @@
// ----------------------------------------------------------------------
/**
+ * @throws TaskExecutionException
* @todo structure of this method is a bit of a mess (too much exception/finally code)
*/
public void build( int projectId, int buildDefinitionId, int trigger )
+ throws TaskExecutionException
{
- long startTime = System.currentTimeMillis();
+ getLogger().info( "Initializing build" );
+ BuildContext context = initializeBuildContext( projectId, buildDefinitionId, trigger );
- // ----------------------------------------------------------------------
- // Initialize the context
- // ----------------------------------------------------------------------
+ getLogger().info( "Starting build" );
+ startBuild( context );
- // if these calls fail we're screwed anyway
- // and it will only be logged through the logger.
+ try
+ {
+ // ----------------------------------------------------------------------
+ // TODO: Centralize the error handling from the SCM related actions.
+ // ContinuumScmResult should return a ContinuumScmResult from all
+ // methods, even in a case of failure.
+ // ----------------------------------------------------------------------
+ getLogger().info( "Updating working dir" );
+ updateWorkingDirectory( context );
- Project project;
+ getLogger().info( "Merging SCM results" );
+ mergeScmResults( context );
- BuildDefinition buildDefinition;
+ if ( !checkScmResult( context ) )
+ {
+ getLogger().info( "Error updating from SCM, not building" );
+ return;
+ }
- BuildResult oldBuildResult = null;
+ if ( !shouldBuild( context ) )
+ {
+ getLogger().info( "No changes, not building" );
+ return;
+ }
- BuildResult build = null;
+ getLogger().info( "Changes found, building" );
- try
- {
- project = store.getProject( projectId );
+ Map actionContext = context.getActionContext();
- project.setOldState( project.getState() );
+ performAction( "update-project-from-working-directory", context );
- project.setState( ContinuumProjectState.BUILDING );
+ performAction( "execute-builder", context );
- store.updateProject( project );
+ performAction( "deploy-artifact", context );
- buildDefinition = store.getBuildDefinition( buildDefinitionId );
+ String s = (String) actionContext.get( AbstractContinuumAction.KEY_BUILD_ID );
- notifierDispatcher.buildStarted( project );
+ if ( s != null )
+ {
+ try
+ {
+ context.setBuildResult( store.getBuildResult( Integer.valueOf( s ).intValue() ) );
+ }
+ catch ( NumberFormatException e )
+ {
+ throw new TaskExecutionException( "Internal error: build id not an integer", e );
+ }
+ catch ( ContinuumObjectNotFoundException e )
+ {
+ throw new TaskExecutionException( "Internal error: Cannot find build result", e );
+ }
+ catch ( ContinuumStoreException e )
+ {
+ throw new TaskExecutionException( "Error loading build result", e );
+ }
+ }
}
- catch ( ContinuumStoreException ex )
+ finally
{
- getLogger().error( "Internal error while getting the project.", ex );
+ endBuild( context );
+ }
+ }
- return;
+ /**
+ * Checks if the build should be marked as ERROR and notifies
+ * the end of the build.
+ *
+ * @param context
+ * @throws TaskExecutionException
+ */
+ private void endBuild( BuildContext context )
+ throws TaskExecutionException
+ {
+ Project project = context.getProject();
+
+ if ( project.getState() != ContinuumProjectState.NEW && project.getState() != ContinuumProjectState.CHECKEDOUT
+ && project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED
+ && project.getState() != ContinuumProjectState.ERROR )
+ {
+ try
+ {
+ project.setState( ContinuumProjectState.ERROR );
+
+ store.updateProject( project );
+ }
+ catch ( ContinuumStoreException e )
+ {
+ throw new TaskExecutionException( "Error storing the project", e );
+ }
+ finally
+ {
+ notifierDispatcher.buildComplete( project, context.getBuildResult() );
+ }
}
+ }
+
+ private void updateBuildResult( BuildContext context, String error )
+ throws TaskExecutionException
+ {
+ BuildResult build = context.getBuildResult();
+
+ build.setError( error );
try
{
- oldBuildResult = store.getBuildResult( buildDefinition.getLatestBuildId() );
+ store.updateBuildResult( build );
+
+ build = store.getBuildResult( build.getId() );
}
- catch ( ContinuumStoreException ex )
+ catch ( ContinuumStoreException e )
{
- // Nothing to do
+ throw new TaskExecutionException( "Error updating build result", e );
}
- ScmResult oldScmResult = null;
+ context.getProject().setState( build.getState() );
- if ( oldBuildResult != null )
+ try
{
- oldScmResult = getOldScmResult( project, oldBuildResult.getEndTime() );
+ store.updateProject( context.getProject() );
}
-
- // ----------------------------------------------------------------------
- // TODO: Centralize the error handling from the SCM related actions.
- // ContinuumScmResult should return a ContinuumScmResult from all
- // methods, even in a case of failure.
- // ----------------------------------------------------------------------
-
- try
+ catch ( ContinuumStoreException e )
{
- Map actionContext = new HashMap();
-
- actionContext.put( AbstractContinuumAction.KEY_PROJECT_ID, new Integer( projectId ) );
-
- actionContext.put( AbstractContinuumAction.KEY_PROJECT, project );
-
- actionContext.put( AbstractContinuumAction.KEY_BUILD_DEFINITION_ID, new Integer( buildDefinitionId ) );
-
- actionContext.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinition );
-
- actionContext.put( AbstractContinuumAction.KEY_TRIGGER, new Integer( trigger ) );
-
- actionContext.put( AbstractContinuumAction.KEY_FIRST_RUN, Boolean.valueOf( oldBuildResult == null ) );
-
- ScmResult scmResult = null;
-
- try
- {
- actionManager.lookup( "check-working-directory" ).execute( actionContext );
-
- boolean workingDirectoryExists = AbstractContinuumAction.getBoolean( actionContext,
- AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS );
+ throw new TaskExecutionException( "Error updating project", e );
+ }
+ }
- if ( workingDirectoryExists )
- {
- actionManager.lookup( "update-working-directory-from-scm" ).execute( actionContext );
+ private void startBuild( BuildContext context )
+ throws TaskExecutionException
+ {
- scmResult = AbstractContinuumAction.getUpdateScmResult( actionContext, null );
- }
- else
- {
- actionContext.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY,
- workingDirectoryService.getWorkingDirectory( project ).getAbsolutePath() );
+ Project project = context.getProject();
- actionManager.lookup( "checkout-project" ).execute( actionContext );
+ project.setOldState( project.getState() );
- scmResult = AbstractContinuumAction.getCheckoutResult( actionContext, null );
- }
+ project.setState( ContinuumProjectState.BUILDING );
- // ----------------------------------------------------------------------
- // Check to see if there was a error while checking out/updating the project
- // ----------------------------------------------------------------------
+ try
+ {
+ store.updateProject( project );
+ }
+ catch ( ContinuumStoreException e )
+ {
+ throw new TaskExecutionException( "Error persisting project", e );
+ }
- // Merge scm results so we'll have all changes since last execution of current build definition
- scmResult = mergeScmResults( oldScmResult, scmResult );
+ notifierDispatcher.buildStarted( project );
- if ( scmResult == null || !scmResult.isSuccess() )
- {
- // scmResult must be converted before sotring it because jpox modify value of all fields to null
- String error = convertScmResultToError( scmResult );
+ }
- build = makeAndStoreBuildResult( project, scmResult, startTime, trigger );
+ /**
+ * Initializes a BuildContext for the build.
+ *
+ * @param projectId
+ * @param buildDefinitionId
+ * @param trigger
+ * @return
+ * @throws TaskExecutionException
+ */
+ private BuildContext initializeBuildContext( int projectId, int buildDefinitionId, int trigger )
+ throws TaskExecutionException
+ {
+ BuildContext context = new BuildContext();
- build.setError( error );
+ context.setStartTime( System.currentTimeMillis() );
- store.updateBuildResult( build );
+ context.setTrigger( trigger );
- build = store.getBuildResult( build.getId() );
+ try
+ {
+ context.setProject( store.getProject( projectId ) );
- project.setState( build.getState() );
+ BuildDefinition buildDefinition = store.getBuildDefinition( buildDefinitionId );
- store.updateProject( project );
+ context.setBuildDefinition( buildDefinition );
- return;
- }
+ try
+ {
+ BuildResult oldBuildResult = store.getBuildResult( buildDefinition.getLatestBuildId() );
- actionContext.put( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT, scmResult );
+ context.setOldBuildResult( oldBuildResult );
- List changes = scmResult.getChanges();
+ context.setOldScmResult( getOldScmResult( projectId, oldBuildResult.getEndTime() ) );
- Iterator iterChanges = changes.iterator();
+ }
+ catch ( ContinuumObjectNotFoundException ex )
+ {
+ // Nothing to do
+ }
+ }
+ catch ( ContinuumStoreException e )
+ {
+ throw new TaskExecutionException( "Error initializing the build context", e );
+ }
- ChangeSet changeSet;
+ Map actionContext = context.getActionContext();
- List changeFiles;
+ actionContext.put( AbstractContinuumAction.KEY_PROJECT_ID, new Integer( projectId ) );
- Iterator iterFiles;
+ actionContext.put( AbstractContinuumAction.KEY_PROJECT, context.getProject() );
- ChangeFile changeFile;
+ actionContext.put( AbstractContinuumAction.KEY_BUILD_DEFINITION_ID, new Integer( buildDefinitionId ) );
- boolean allChangesUnknown = true;
+ actionContext.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, context.getBuildDefinition() );
- while ( iterChanges.hasNext() )
- {
- changeSet = (ChangeSet) iterChanges.next();
+ actionContext.put( AbstractContinuumAction.KEY_TRIGGER, new Integer( trigger ) );
- changeFiles = changeSet.getFiles();
+ actionContext
+ .put( AbstractContinuumAction.KEY_FIRST_RUN, Boolean.valueOf( context.getOldBuildResult() == null ) );
- iterFiles = changeFiles.iterator();
+ return context;
+ }
- while ( iterFiles.hasNext() )
- {
- changeFile = (ChangeFile) iterFiles.next();
+ private void updateWorkingDirectory( BuildContext buildContext )
+ throws TaskExecutionException
+ {
+ Map actionContext = buildContext.getActionContext();
- if ( !"unknown".equalsIgnoreCase( changeFile.getStatus() ) )
- {
- allChangesUnknown = false;
- break;
- }
- }
+ performAction( "check-working-directory", buildContext );
- if ( !allChangesUnknown )
- {
- break;
- }
- }
+ boolean workingDirectoryExists = AbstractContinuumAction
+ .getBoolean( actionContext, AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS );
- if ( oldBuildResult != null && allChangesUnknown &&
- project.getOldState() != ContinuumProjectState.NEW &&
- project.getOldState() != ContinuumProjectState.CHECKEDOUT &&
- trigger != ContinuumProjectState.TRIGGER_FORCED &&
- project.getState() != ContinuumProjectState.NEW &&
- project.getState() != ContinuumProjectState.CHECKEDOUT )
- {
- if ( changes.size() > 0 )
- {
- getLogger().info( "The project was not built because all changes are unknown." );
- }
- else
- {
- getLogger().info( "The project was not built because there are no changes." );
- }
+ ScmResult scmResult;
- project.setState( project.getOldState() );
+ if ( workingDirectoryExists )
+ {
+ performAction( "update-working-directory-from-scm", buildContext );
- project.setOldState( 0 );
+ scmResult = AbstractContinuumAction.getUpdateScmResult( actionContext, null );
+ }
+ else
+ {
+ Project project = (Project) actionContext.get( AbstractContinuumAction.KEY_PROJECT );
- store.updateProject( project );
+ actionContext.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, workingDirectoryService
+ .getWorkingDirectory( project ).getAbsolutePath() );
- return;
- }
+ performAction( "checkout-project", buildContext );
- actionManager.lookup( "update-project-from-working-directory" ).execute( actionContext );
+ scmResult = AbstractContinuumAction.getCheckoutResult( actionContext, null );
+ }
- actionManager.lookup( "execute-builder" ).execute( actionContext );
+ buildContext.setScmResult( scmResult );
+ }
- actionManager.lookup( "deploy-artifact" ).execute( actionContext );
+ private void performAction( String actionName, BuildContext context )
+ throws TaskExecutionException
+ {
+ String error = null;
+ TaskExecutionException exception = null;
- String s = (String) actionContext.get( AbstractContinuumAction.KEY_BUILD_ID );
+ try
+ {
+ getLogger().info( "Performing action " + actionName );
+ actionManager.lookup( actionName ).execute( context.getActionContext() );
+ return;
+ }
+ catch ( ActionNotFoundException e )
+ {
+ error = ContinuumUtils.throwableToString( e );
+ exception = new TaskExecutionException( "Error looking up action '" + actionName + "'", e );
+ }
+ catch ( ContinuumScmException e )
+ {
+ ScmResult result = e.getResult();
- if ( s != null )
- {
- build = store.getBuildResult( Integer.valueOf( s ).intValue() );
- }
- }
- catch ( Throwable e )
+ if ( result != null )
{
- getLogger().error( "Error while building project.", e );
-
- String s = (String) actionContext.get( AbstractContinuumAction.KEY_BUILD_ID );
-
- if ( s != null )
- {
- build = store.getBuildResult( Integer.valueOf( s ).intValue() );
- }
- else
- {
- build = makeAndStoreBuildResult( project, scmResult, startTime, trigger );
- }
-
- // This can happen if the "update project from scm" action fails
-
- String error = null;
+ error = convertScmResultToError( result );
+ }
- if ( e instanceof ContinuumScmException )
- {
- ContinuumScmException ex = (ContinuumScmException) e;
+ if ( error == null )
+ {
+ error = ContinuumUtils.throwableToString( e );
+ }
- ScmResult result = ex.getResult();
+ exception = new TaskExecutionException( "SCM error while executing '" + actionName + "'", e );
+ }
+ catch ( Exception e )
+ {
+ exception = new TaskExecutionException( "Error executing action '" + actionName + "'", e );
+ }
- if ( result != null )
- {
- error = convertScmResultToError( result );
- }
+ // TODO: clean this up. We catch the original exception from the action, and then update the buildresult
+ // for it - we need to because of the specialized error message for SCM.
+ // If updating the buildresult fails, log the previous error and throw the new one.
+ // If updating the buildresult succeeds, throw the original exception. The build result should NOT
+ // be updated again - a TaskExecutionException is final, no further action should be taken upon it.
- }
- if ( error == null )
- {
- error = ContinuumUtils.throwableToString( e );
- }
+ try
+ {
+ updateBuildResult( context, error );
+ }
+ catch ( TaskExecutionException e )
+ {
+ getLogger().error( "Error updating build result after receiving the following exception: ", exception );
+ throw e;
+ }
- build.setError( error );
+ throw exception;
+ }
- store.updateBuildResult( build );
+ private boolean shouldBuild( BuildContext context )
+ throws TaskExecutionException
+ {
+ //oldBuildResult != null &&
+ // List changes, Project project, int trigger )
+ // scmResult.getChanges(), project, trigger ) )
- build = store.getBuildResult( build.getId() );
+ boolean allChangesUnknown = checkAllChangesUnknown( context.getScmResult().getChanges() );
- project.setState( build.getState() );
+ Project project = context.getProject();
- store.updateProject( project );
- }
- }
- catch ( Exception ex )
+ if ( allChangesUnknown && project.getOldState() != ContinuumProjectState.NEW
+ && project.getOldState() != ContinuumProjectState.CHECKEDOUT
+ && context.getTrigger() != ContinuumProjectState.TRIGGER_FORCED
+ && project.getState() != ContinuumProjectState.NEW
+ && project.getState() != ContinuumProjectState.CHECKEDOUT )
{
- if ( !Thread.interrupted() )
+ if ( context.getScmResult().getChanges().size() > 0 )
{
- getLogger().error( "Internal error while building the project.", ex );
+ getLogger().info( "The project was not built because all changes are unknown." );
+ }
+ else
+ {
+ getLogger().info( "The project was not built because there are no changes." );
}
- String error = ContinuumUtils.throwableToString( ex );
+ project.setState( project.getOldState() );
- build.setError( error );
+ project.setOldState( 0 );
try
{
- store.updateBuildResult( build );
-
- build = store.getBuildResult( build.getId() );
-
- project.setState( build.getState() );
-
store.updateProject( project );
}
- catch ( Exception e )
+ catch ( ContinuumStoreException e )
{
- getLogger().error( "Can't store updating project.", e );
+ throw new TaskExecutionException( "Error storing project", e );
}
+
+ return false;
}
- finally
+
+ return true;
+ }
+
+ private boolean checkAllChangesUnknown( List changes )
+ {
+ for ( Iterator iterChanges = changes.iterator(); iterChanges.hasNext(); )
{
- if ( project.getState() != ContinuumProjectState.NEW &&
- project.getState() != ContinuumProjectState.CHECKEDOUT &&
- project.getState() != ContinuumProjectState.OK && project.getState() != ContinuumProjectState.FAILED &&
- project.getState() != ContinuumProjectState.ERROR )
+ ChangeSet changeSet = (ChangeSet) iterChanges.next();
+
+ List changeFiles = changeSet.getFiles();
+
+ Iterator iterFiles = changeFiles.iterator();
+
+ while ( iterFiles.hasNext() )
{
- try
- {
- project.setState( ContinuumProjectState.ERROR );
+ ChangeFile changeFile = (ChangeFile) iterFiles.next();
- store.updateProject( project );
- }
- catch ( ContinuumStoreException e )
+ if ( !"unknown".equalsIgnoreCase( changeFile.getStatus() ) )
{
- getLogger().error( "Internal error while storing the project.", e );
+ return false;
}
}
-
- notifierDispatcher.buildComplete( project, build );
}
+
+ return true;
}
private String convertScmResultToError( ScmResult result )
@@ -391,24 +469,24 @@
{
if ( result.getCommandLine() != null )
{
- error = "Command line: " + StringUtils.clean( result.getCommandLine() ) +
- System.getProperty( "line.separator" );
+ error = "Command line: " + StringUtils.clean( result.getCommandLine() )
+ + System.getProperty( "line.separator" );
}
if ( result.getProviderMessage() != null )
{
- error = "Provider message: " + StringUtils.clean( result.getProviderMessage() ) +
- System.getProperty( "line.separator" );
+ error = "Provider message: " + StringUtils.clean( result.getProviderMessage() )
+ + System.getProperty( "line.separator" );
}
if ( result.getCommandOutput() != null )
{
error += "Command output: " + System.getProperty( "line.separator" );
- error += "-------------------------------------------------------------------------------" +
- System.getProperty( "line.separator" );
+ error += "-------------------------------------------------------------------------------"
+ + System.getProperty( "line.separator" );
error += StringUtils.clean( result.getCommandOutput() ) + System.getProperty( "line.separator" );
- error += "-------------------------------------------------------------------------------" +
- System.getProperty( "line.separator" );
+ error += "-------------------------------------------------------------------------------"
+ + System.getProperty( "line.separator" );
}
if ( result.getException() != null )
@@ -425,29 +503,48 @@
//
// ----------------------------------------------------------------------
- private BuildResult makeAndStoreBuildResult( Project project, ScmResult scmResult, long startTime, int trigger )
- throws ContinuumStoreException
+ private BuildResult makeAndStoreBuildResult( BuildContext context, String error )
+ throws TaskExecutionException
{
+ // Project project, ScmResult scmResult, long startTime, int trigger )
+ // project, scmResult, startTime, trigger );
+
BuildResult build = new BuildResult();
build.setState( ContinuumProjectState.ERROR );
- build.setTrigger( trigger );
+ build.setTrigger( context.getTrigger() );
- build.setStartTime( startTime );
+ build.setStartTime( context.getStartTime() );
build.setEndTime( System.currentTimeMillis() );
- build.setScmResult( scmResult );
+ build.setScmResult( context.getScmResult() );
- store.addBuildResult( project, build );
+ if ( error != null )
+ {
+ build.setError( error );
+ }
- return store.getBuildResult( build.getId() );
+ try
+ {
+ store.addBuildResult( context.getProject(), build );
+
+ build = store.getBuildResult( build.getId() );
+
+ context.setBuildResult( build );
+
+ return build;
+ }
+ catch ( ContinuumStoreException e )
+ {
+ throw new TaskExecutionException( "Error storing build result", e );
+ }
}
- private ScmResult getOldScmResult( Project project, long fromDate )
+ private ScmResult getOldScmResult( int projectId, long fromDate )
{
- List results = store.getBuildResultsForProject( project.getId(), fromDate );
+ List results = store.getBuildResultsForProject( projectId, fromDate );
ScmResult res = new ScmResult();
@@ -487,32 +584,78 @@
return res;
}
- private ScmResult mergeScmResults( ScmResult oldScmResult, ScmResult newScmResult )
+ /**
+ * Merges scm results so we'll have all changes since last execution of current build definition
+ */
+ private void mergeScmResults( BuildContext context )
{
+ ScmResult oldScmResult = context.getOldScmResult();
+ ScmResult newScmResult = context.getScmResult();
+
if ( oldScmResult != null )
{
if ( newScmResult == null )
{
- return oldScmResult;
+ context.setScmResult( oldScmResult );
}
-
- List oldChanges = oldScmResult.getChanges();
-
- List newChanges = newScmResult.getChanges();
-
- for ( Iterator i = newChanges.iterator(); i.hasNext(); )
+ else
{
- ChangeSet change = (ChangeSet) i.next();
+ List oldChanges = oldScmResult.getChanges();
- if ( !oldChanges.contains( change ) )
+ List newChanges = newScmResult.getChanges();
+
+ for ( Iterator i = newChanges.iterator(); i.hasNext(); )
{
- oldChanges.add( change );
+ ChangeSet change = (ChangeSet) i.next();
+
+ if ( !oldChanges.contains( change ) )
+ {
+ oldChanges.add( change );
+ }
}
+
+ newScmResult.setChanges( oldChanges );
+
}
+ }
+ }
+
+ /**
+ * Check to see if there was a error while checking out/updating the project
+ *
+ * @throws TaskExecutionException
+ */
+ private boolean checkScmResult( BuildContext context )
+ throws TaskExecutionException
+ {
+ ScmResult scmResult = context.getScmResult();
+
+ if ( scmResult == null || !scmResult.isSuccess() )
+ {
+ // scmResult must be converted before storing it because jpox modifies values of all fields to null
+ String error = convertScmResultToError( scmResult );
- newScmResult.setChanges( oldChanges );
+ BuildResult build = makeAndStoreBuildResult( context, error );
+
+ try
+ {
+ Project project = context.getProject();
+
+ project.setState( build.getState() );
+
+ store.updateProject( project );
+
+ return false;
+ }
+ catch ( ContinuumStoreException e )
+ {
+ throw new TaskExecutionException( "Error storing project", e );
+ }
}
- return newScmResult;
+ context.getActionContext().put( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT, scmResult );
+
+ return true;
}
+
}
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java Thu Aug 10 16:28:02 2006
@@ -53,12 +53,6 @@
private boolean loaded = false;
// ----------------------------------------------------------------------
- // Continuum specifics we'll refactor out later
- // ----------------------------------------------------------------------
-
- private Map jdks;
-
- // ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
@@ -127,7 +121,7 @@
public void setJdks( Map jdks )
{
- this.jdks = jdks;
+ // no-op
}
public String getCompanyLogo()
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java Thu Aug 10 16:28:02 2006
@@ -115,7 +115,6 @@
// ----------------------------------------------------------------------
public Schedule createDefaultSchedule()
- throws ContinuumInitializationException
{
Schedule schedule = new Schedule();
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumBuildJob.java Thu Aug 10 16:28:02 2006
@@ -21,10 +21,8 @@
import org.apache.maven.continuum.model.project.Schedule;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.scheduler.AbstractJob;
-import org.quartz.InterruptableJob;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
-import org.quartz.UnableToInterruptJobException;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -73,7 +71,7 @@
{
if ( schedule.getDelay() > 0 )
{
- Thread.currentThread().sleep( schedule.getDelay() * 1000 );
+ Thread.sleep( schedule.getDelay() * 1000 );
}
}
catch( InterruptedException e )
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java Thu Aug 10 16:28:02 2006
@@ -17,7 +17,6 @@
*/
import org.apache.maven.continuum.core.action.AbstractContinuumAction;
-import org.apache.maven.continuum.core.action.CheckoutProjectContinuumAction;
import org.apache.maven.continuum.model.project.Project;
import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
@@ -76,11 +75,11 @@
Map context = new HashMap();
- context.put( CheckoutProjectContinuumAction.KEY_PROJECT_ID, new Integer( projectId ) );
+ context.put( AbstractContinuumAction.KEY_PROJECT_ID, new Integer( projectId ) );
- context.put( CheckoutProjectContinuumAction.KEY_PROJECT, project );
+ context.put( AbstractContinuumAction.KEY_PROJECT, project );
- context.put( CheckoutProjectContinuumAction.KEY_WORKING_DIRECTORY, workingDirectory );
+ context.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, workingDirectory );
try
{
Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java (original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.java Thu Aug 10 16:28:02 2006
@@ -22,6 +22,7 @@
import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
import org.apache.maven.continuum.project.ContinuumProjectState;
import org.codehaus.plexus.mailsender.MailMessage;
+import org.codehaus.plexus.mailsender.MailSender;
import org.codehaus.plexus.mailsender.test.MockMailSender;
import org.codehaus.plexus.notification.notifier.Notifier;
import org.codehaus.plexus.util.CollectionUtils;
@@ -119,7 +120,7 @@
//
// ----------------------------------------------------------------------
- MockMailSender mailSender = (MockMailSender) lookup( MockMailSender.ROLE );
+ MockMailSender mailSender = (MockMailSender) lookup( MailSender.ROLE );
assertEquals( 1, mailSender.getReceivedEmailSize() );
Modified: maven/continuum/trunk/continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/AbstractContinuumNotifier.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/AbstractContinuumNotifier.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/AbstractContinuumNotifier.java (original)
+++ maven/continuum/trunk/continuum-notifiers/continuum-notifier-api/src/main/java/org/apache/maven/continuum/notification/AbstractContinuumNotifier.java Thu Aug 10 16:28:02 2006
@@ -25,8 +25,6 @@
import org.apache.maven.continuum.project.ContinuumProjectState;
import org.codehaus.plexus.notification.notifier.AbstractNotifier;
-import java.util.Map;
-
public abstract class AbstractContinuumNotifier
extends AbstractNotifier
{
Modified: maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java (original)
+++ maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java Thu Aug 10 16:28:02 2006
@@ -189,11 +189,11 @@
else
{
buildDefinitions = new ArrayList();
+
+ projects.put( obj[0], buildDefinitions );
}
buildDefinitions.add( obj[1] );
-
- projects.put( obj[0], buildDefinitions );
}
return projects;
Modified: maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java (original)
+++ maven/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java Thu Aug 10 16:28:02 2006
@@ -538,7 +538,6 @@
}
public void testGetAllProjects()
- throws ContinuumStoreException
{
List projects = store.getAllProjectsByName();
assertEquals( "check items", Arrays.asList( new Project[]{testProject1, testProject2} ), projects );
@@ -550,7 +549,6 @@
}
public void testAddSchedule()
- throws ContinuumStoreException
{
Schedule newSchedule = createTestSchedule( "testAddSchedule", "testAddSchedule desc", 10, "cron test", false );
Schedule copy = createTestSchedule( newSchedule );
@@ -580,7 +578,6 @@
}
public void testRemoveSchedule()
- throws ContinuumStoreException
{
Schedule schedule = (Schedule) store.getAllSchedulesByName().get( 2 );
@@ -609,7 +606,6 @@
}
public void testAddProfile()
- throws ContinuumStoreException
{
Installation installationJava14 = createTestInstallation( testInstallationJava14 );
Installation installationMaven20a3 = createTestInstallation( testInstallationMaven20a3 );
@@ -646,7 +642,6 @@
}
public void testRemoveProfile()
- throws ContinuumStoreException
{
Profile profile = (Profile) store.getAllProfilesByName().get( 2 );
@@ -829,7 +824,6 @@
}
public void testGetAllProjectsGroupWithDetails()
- throws ContinuumObjectNotFoundException
{
List projectGroups = store.getAllProjectGroupsWithBuildDetails();
ProjectGroup group1 = (ProjectGroup) projectGroups.get( 0 );
Modified: maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java (original)
+++ maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java Thu Aug 10 16:28:02 2006
@@ -33,7 +33,7 @@
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
-import java.io.File;
+
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
Modified: maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java?rev=430587&r1=430586&r2=430587&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java (original)
+++ maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java Thu Aug 10 16:28:02 2006
@@ -469,22 +469,6 @@
return xmlRpcHelper.objectToHashtable( object, excludedProperties );
}
- private Hashtable convertScmFile( Object object )
- throws IllegalAccessException, InvocationTargetException
- {
- Set excludedProperties = new HashSet();
-
- return xmlRpcHelper.objectToHashtable( object, excludedProperties );
- }
-
- private Hashtable convertScmResult( Object object )
- throws IllegalAccessException, InvocationTargetException
- {
- Set excludedProperties = new HashSet();
-
- return xmlRpcHelper.objectToHashtable( object, excludedProperties );
- }
-
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------