continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jzurb...@apache.org
Subject svn commit: r786863 [2/2] - in /continuum/branches/continuum-1.3.x: continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/ continuum-api/src/main/java/org/apache/continuum/buildmanager/ continuum-api/src/main/java/org/apache/cont...
Date Sat, 20 Jun 2009 17:07:10 GMT
Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Sat Jun 20 17:07:08 2009
@@ -31,6 +31,7 @@
 import org.apache.continuum.dao.ProjectScmRootDao;
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.utils.ContinuumUtils;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.core.action.ExecuteBuilderContinuumAction;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
@@ -118,14 +119,15 @@
     /**
      * @param projectId
      * @param buildDefinitionId
-     * @param trigger
+     * @param buildTrigger
+     * @param scmResult
      * @throws TaskExecutionException
      */
-    public void build( int projectId, int buildDefinitionId, int trigger, ScmResult scmResult
)
+    public void build( int projectId, int buildDefinitionId, BuildTrigger buildTrigger, ScmResult
scmResult )
         throws TaskExecutionException
     {
         log.info( "Initializing build" );
-        BuildContext context = initializeBuildContext( projectId, buildDefinitionId, trigger,
scmResult );
+        BuildContext context = initializeBuildContext( projectId, buildDefinitionId, buildTrigger,
scmResult );
 
         // ignore this if AlwaysBuild ?
         if ( !checkScmResult( context ) )
@@ -320,11 +322,12 @@
      *
      * @param projectId
      * @param buildDefinitionId
-     * @param trigger
+     * @param buildTrigger
+     * @param scmResult
      * @return
      * @throws TaskExecutionException
      */
-    protected BuildContext initializeBuildContext( int projectId, int buildDefinitionId,
int trigger,
+    protected BuildContext initializeBuildContext( int projectId, int buildDefinitionId,
BuildTrigger buildTrigger,
                                                    ScmResult scmResult )
         throws TaskExecutionException
     {
@@ -332,7 +335,7 @@
 
         context.setStartTime( System.currentTimeMillis() );
 
-        context.setTrigger( trigger );
+        context.setBuildTrigger( buildTrigger );
 
         try
         {
@@ -375,7 +378,7 @@
 
         AbstractContinuumAction.setBuildDefinition( actionContext, context.getBuildDefinition()
);
 
-        AbstractContinuumAction.setTrigger( actionContext, trigger );
+        AbstractContinuumAction.setBuildTrigger( actionContext, buildTrigger );
 
         AbstractContinuumAction.setScmResult( actionContext, context.getScmResult() );
 
@@ -471,7 +474,7 @@
             return true;
         }
 
-        if ( context.getTrigger() == ContinuumProjectState.TRIGGER_FORCED )
+        if ( context.getBuildTrigger().getTrigger() == ContinuumProjectState.TRIGGER_FORCED
)
         {
             log.info( "The project build is forced, building" );
             return true;
@@ -483,7 +486,7 @@
 
         if ( project.getOldState() != ContinuumProjectState.NEW &&
             project.getOldState() != ContinuumProjectState.CHECKEDOUT &&
-            context.getTrigger() != ContinuumProjectState.TRIGGER_FORCED &&
+            context.getBuildTrigger().getTrigger() != ContinuumProjectState.TRIGGER_FORCED
&&
             project.getState() != ContinuumProjectState.NEW && project.getState()
!= ContinuumProjectState.CHECKEDOUT )
         {
             // Check SCM changes
@@ -674,7 +677,9 @@
 
         build.setState( ContinuumProjectState.ERROR );
 
-        build.setTrigger( context.getTrigger() );
+        build.setTrigger( context.getBuildTrigger().getTrigger() );
+        
+        build.setUsername( context.getBuildTrigger().getUsername() );
 
         build.setStartTime( context.getStartTime() );
 

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/buildqueue/evaluator/BuildProjectTaskViabilityEvaluator.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/buildqueue/evaluator/BuildProjectTaskViabilityEvaluator.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/buildqueue/evaluator/BuildProjectTaskViabilityEvaluator.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/buildqueue/evaluator/BuildProjectTaskViabilityEvaluator.java
Sat Jun 20 17:07:08 2009
@@ -117,7 +117,7 @@
                 // If this build is forces, don't remove it
                 // ----------------------------------------------------------------------
 
-                if ( task.getTrigger() == ContinuumProjectState.TRIGGER_FORCED )
+                if ( task.getBuildTrigger().getTrigger() == ContinuumProjectState.TRIGGER_FORCED
)
                 {
                     continue;
                 }

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
Sat Jun 20 17:07:08 2009
@@ -24,6 +24,7 @@
 import java.util.Map;
 
 import org.apache.continuum.model.project.ProjectScmRoot;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.model.project.Project;
@@ -69,7 +70,7 @@
 
     private static final String KEY_UPDATE_DEPENDENCIES = "update-dependencies";
 
-    private static final String KEY_TRIGGER = "trigger";
+    private static final String KEY_BUILD_TRIGGER = "buildTrigger";
 
     private static final String KEY_SCM_RESULT = "scmResult";
 
@@ -165,14 +166,15 @@
         context.put( KEY_BUILD_ID, buildId );
     }
 
-    public static int getTrigger( Map<String, Object> context )
+    public static BuildTrigger getBuildTrigger( Map<String, Object> context )
     {
-        return getInteger( context, KEY_TRIGGER );
+    	BuildTrigger defaultValue = new BuildTrigger( 0, "" );
+    	return (BuildTrigger) getObject( context, KEY_BUILD_TRIGGER, defaultValue );
     }
 
-    public static void setTrigger( Map<String, Object> context, int trigger )
+    public static void setBuildTrigger( Map<String, Object> context, BuildTrigger buildTrigger
)
     {
-        context.put( KEY_TRIGGER, trigger );
+    	context.put( KEY_BUILD_TRIGGER, buildTrigger );
     }
 
     public static Project getUnvalidatedProject( Map<String, Object> context )

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateBuildProjectTaskAction.java
Sat Jun 20 17:07:08 2009
@@ -25,6 +25,7 @@
 
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -64,7 +65,7 @@
             AbstractContinuumAction.getProjectsBuildDefinitionsMap( context );
         Map<Integer, ScmResult> scmResultMap = AbstractContinuumAction.getScmResultMap(
context );
         List<Project> projectsToBeBuilt = new ArrayList<Project>();
-        int trigger = AbstractContinuumAction.getTrigger( context );
+        BuildTrigger buildTrigger = AbstractContinuumAction.getBuildTrigger( context );
         int projectGroupId = AbstractContinuumAction.getProjectGroupId( context );
 
         // update state of each project first
@@ -129,6 +130,6 @@
         }
 
         parallelBuildsManager.buildProjects( projectsToBeBuilt, projectsBuildDefinitionsMap,

-                                             trigger, scmResultMap, projectGroupId );
+        		                             buildTrigger, scmResultMap, projectGroupId );
     }
 }

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
Sat Jun 20 17:07:08 2009
@@ -27,6 +27,7 @@
 import org.apache.continuum.dao.BuildResultDao;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.utils.ContinuumUtils;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.execution.ContinuumBuildCancelledException;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutionResult;
@@ -87,7 +88,7 @@
 
         BuildDefinition buildDefinition = getBuildDefinition( context );
 
-        int trigger = getTrigger( context );
+        BuildTrigger buildTrigger = getBuildTrigger( context );
 
         ScmResult scmResult = getScmResult( context );
 
@@ -105,7 +106,9 @@
 
         buildResult.setState( ContinuumProjectState.BUILDING );
 
-        buildResult.setTrigger( trigger );
+        buildResult.setTrigger( buildTrigger.getTrigger() );
+        
+        buildResult.setUsername( buildTrigger.getUsername() );
 
         buildResult.setScmResult( scmResult );
 

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
Sat Jun 20 17:07:08 2009
@@ -33,6 +33,7 @@
 import org.apache.continuum.taskqueue.PrepareBuildProjectsTask;
 import org.apache.continuum.utils.ContinuumUtils;
 import org.apache.continuum.utils.ProjectSorter;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.core.action.CheckWorkingDirectoryAction;
 import org.apache.maven.continuum.core.action.CheckoutProjectContinuumAction;
@@ -108,7 +109,7 @@
         PrepareBuildProjectsTask prepareTask = (PrepareBuildProjectsTask) task;
 
         Map<Integer, Integer> projectsBuildDefinitionsMap = prepareTask.getProjectsBuildDefinitionsMap();
-        int trigger = prepareTask.getTrigger();
+        BuildTrigger buildTrigger = prepareTask.getBuildTrigger();
         Set<Integer> projectsId = projectsBuildDefinitionsMap.keySet();
         Map<String, Object> context = new HashMap<String, Object>();
         Map<Integer, ScmResult> scmResultMap = new HashMap<Integer, ScmResult>();
@@ -120,7 +121,7 @@
                 int buildDefinitionId = projectsBuildDefinitionsMap.get( projectId );
 
                 log.info( "Initializing prepare build" );
-                context = initializeContext( projectId, buildDefinitionId );
+                context = initializeContext( projectId, buildDefinitionId, prepareTask.getBuildTrigger()
);
 
                 log.info(
                     "Starting prepare build of project: " + AbstractContinuumAction.getProject(
context ).getName() );
@@ -173,11 +174,11 @@
         if ( checkProjectScmRoot( context ) )
         {
             int projectGroupId = AbstractContinuumAction.getProjectGroupId( context );
-            buildProjects( projectGroupId, projectsBuildDefinitionsMap, trigger, scmResultMap
);
+            buildProjects( projectGroupId, projectsBuildDefinitionsMap, buildTrigger, scmResultMap
);
         }
     }
 
-    private Map<String, Object> initializeContext( int projectId, int buildDefinitionId
)
+    private Map<String, Object> initializeContext( int projectId, int buildDefinitionId,
BuildTrigger buildTrigger )
         throws TaskExecutionException
     {
         Map<String, Object> context = new HashMap<String, Object>();
@@ -202,6 +203,7 @@
             AbstractContinuumAction.setProjectGroupId( context, projectGroup.getId() );
             AbstractContinuumAction.setProjectId( context, projectId );
             AbstractContinuumAction.setProject( context, project );
+            AbstractContinuumAction.setBuildTrigger( context, buildTrigger );
 
             AbstractContinuumAction.setBuildDefinitionId( context, buildDefinitionId );
             AbstractContinuumAction.setBuildDefinition( context,
@@ -500,8 +502,8 @@
         }
     }
 
-    private void buildProjects( int projectGroupId, Map<Integer, Integer> projectsAndBuildDefinitionsMap,
int trigger,
-                                Map<Integer, ScmResult> scmResultMap )
+    private void buildProjects( int projectGroupId, Map<Integer, Integer> projectsAndBuildDefinitionsMap,
+    		                    BuildTrigger buildTrigger, Map<Integer, ScmResult> scmResultMap
)
         throws TaskExecutionException
     {
         List<Project> projects = projectDao.getProjectsWithDependenciesByGroupId( projectGroupId
);
@@ -560,7 +562,7 @@
             Map<String, Object> context = new HashMap<String, Object>();
             AbstractContinuumAction.setListOfProjects( context, projectsToBeBuilt );
             AbstractContinuumAction.setProjectsBuildDefinitionsMap( context, projectsBuildDefinitionsMap
);
-            AbstractContinuumAction.setTrigger( context, trigger );
+            AbstractContinuumAction.setBuildTrigger( context, buildTrigger );
             AbstractContinuumAction.setScmResultMap( context, scmResultMap );
             AbstractContinuumAction.setProjectGroupId( context, projectGroupId );
 

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/buildmanager/ParallelBuildsManagerTest.java
Sat Jun 20 17:07:08 2009
@@ -33,6 +33,7 @@
 import org.apache.continuum.taskqueue.CheckOutTask;
 import org.apache.continuum.taskqueue.OverallBuildQueue;
 import org.apache.continuum.taskqueueexecutor.ParallelBuildsThreadedTaskQueueExecutor;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildQueue;
@@ -310,7 +311,7 @@
 
         recordBuildProjectBuildQueuesAreEmpty();
 
-        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", 1, null, 1 );
+        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", new BuildTrigger(
1, "test-user" ), null, 1 );
 
         context.assertIsSatisfied();
     }
@@ -326,7 +327,7 @@
 
         recordBuildProjectBuildQueuesAreEmpty();
 
-        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", 1, null, 1 );
+        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", new BuildTrigger(
1, "test-user" ), null, 1 );
         context.assertIsSatisfied();
 
         //queue second project - 1st queue is not empty, 2nd queue is empty 
@@ -336,7 +337,7 @@
         final List<Task> tasks = new ArrayList<Task>();
         final List<Task> tasksOfFirstBuildQueue = new ArrayList<Task>();
         tasksOfFirstBuildQueue.add(
-            new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", buildDef.getDescription(),
null, 2 ) );
+        		new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2",
buildDef.getDescription(), null, 2 ) );
         context.checking( new Expectations()
         {
             {
@@ -356,7 +357,7 @@
 
         recordAddToBuildQueue();
 
-        buildsManager.buildProject( 2, buildDef, "continuum-project-test-2", 1, null, 2 );
+        buildsManager.buildProject( 2, buildDef, "continuum-project-test-2", new BuildTrigger(
1, "test-user" ), null, 2 );
         context.assertIsSatisfied();
 
         // queue third project - both queues have 1 task queued each
@@ -378,7 +379,7 @@
 
         recordAddToBuildQueue();
 
-        buildsManager.buildProject( 3, buildDef, "continuum-project-test-3", 1, null, 3 );
+        buildsManager.buildProject( 3, buildDef, "continuum-project-test-3", new BuildTrigger(
1, "test-user" ), null, 3 );
         context.assertIsSatisfied();
     }
 
@@ -604,7 +605,7 @@
             context.mock( TaskQueueExecutor.class, "checkout-queue-executor" );
 
         final List<Task> buildTasks = new ArrayList<Task>();
-        buildTasks.add( new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF",
null, 2 ) );
+        buildTasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2",
"BUILD_DEF", null, 2 ) );
 
         final List<CheckOutTask> checkoutTasks = new ArrayList<CheckOutTask>();
         checkoutTasks.add(
@@ -741,10 +742,10 @@
         buildDef.setSchedule( getSchedule( 1, 1, 2 ) );
 
         final TaskQueueExecutor buildQueueExecutor = context.mock( TaskQueueExecutor.class,
"build-queue-executor" );
-        final Task buildTask = new BuildProjectTask( 1, 1, 1, "continuum-project-test-1",
"BUILD_DEF", null, 1 );
+        final Task buildTask = new BuildProjectTask( 1, 1, new BuildTrigger( 1, "test-user"
), "continuum-project-test-1", "BUILD_DEF", null, 1 );
 
         final List<BuildProjectTask> buildTasks = new ArrayList<BuildProjectTask>();
-        buildTasks.add( new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF",
null, 2 ) );
+        buildTasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2",
"BUILD_DEF", null, 2 ) );
 
         final List<CheckOutTask> checkoutTasks = new ArrayList<CheckOutTask>();
         checkoutTasks.add(
@@ -816,7 +817,7 @@
                 one( overallBuildQueue ).addToBuildQueue( with( any( BuildProjectTask.class
) ) );
             }} );
 
-        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", 1, null, 1 );
+        buildsManager.buildProject( 1, buildDef, "continuum-project-test-1", new BuildTrigger(
1, "test-user" ), null, 1 );
         context.assertIsSatisfied();
     }
 
@@ -826,7 +827,7 @@
         setupMockOverallBuildQueues();
 
         final List<Task> tasks = new ArrayList<Task>();
-        tasks.add( new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF",
null, 2  ) );
+        tasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2",
"BUILD_DEF", null, 2  ) );
 
         context.checking( new Expectations()
         {

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueueTest.java
Sat Jun 20 17:07:08 2009
@@ -25,6 +25,7 @@
 
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.taskqueueexecutor.ParallelBuildsThreadedTaskQueueExecutor;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
 import org.codehaus.plexus.taskqueue.Task;
@@ -184,7 +185,7 @@
         throws Exception
     {
         final BuildProjectTask buildTask =
-            new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF", null,
2 );
+        	new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2",
"BUILD_DEF", null, 2 );
         final TaskQueue buildQueue = context.mock( TaskQueue.class, "build-queue" );
 
         context.checking( new Expectations()
@@ -205,7 +206,7 @@
     {
         final TaskQueue buildQueue = context.mock( TaskQueue.class, "build-queue" );
         final List<Task> tasks = new ArrayList<Task>();
-        tasks.add( new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF",
null, 2 ) );
+        tasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2",
"BUILD_DEF", null, 2 ) );
 
         context.checking( new Expectations()
         {
@@ -229,7 +230,7 @@
     {
         final TaskQueue buildQueue = context.mock( TaskQueue.class, "build-queue" );
         final List<Task> tasks = new ArrayList<Task>();
-        tasks.add( new BuildProjectTask( 2, 1, 1, "continuum-project-test-2", "BUILD_DEF",
null, 2 ) );
+        tasks.add( new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user" ), "continuum-project-test-2",
"BUILD_DEF", null, 2 ) );
 
         context.checking( new Expectations()
         {
@@ -248,7 +249,7 @@
     public void testCancelBuildTask()
         throws Exception
     {
-        final Task buildTask = new BuildProjectTask( 2, 1, 1, "continuum-project-test-2",
"BUILD_DEF", null, 2 );
+    	final Task buildTask = new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user"
), "continuum-project-test-2", "BUILD_DEF", null, 2 );
 
         context.checking( new Expectations()
         {
@@ -266,7 +267,7 @@
     public void testCancelCurrentBuild()
         throws Exception
     {
-        final Task buildTask = new BuildProjectTask( 2, 1, 1, "continuum-project-test-2",
"BUILD_DEF", null, 2 );
+    	final Task buildTask = new BuildProjectTask( 2, 1, new BuildTrigger( 1, "test-user"
), "continuum-project-test-2", "BUILD_DEF", null, 2 );
 
         context.checking( new Expectations()
         {
@@ -302,14 +303,14 @@
                 one( buildQueue ).remove( with( any( Task.class ) ) );
             }} );
 
-        overallQueue.removeProjectFromBuildQueue( 1, 1, 1, "continuum-project-test-1", 1
);
+        overallQueue.removeProjectFromBuildQueue( 1, 1, new BuildTrigger( 1, "test-user"
), "continuum-project-test-1", 1 );
         context.assertIsSatisfied();
     }
 
     public void testRemoveProjectFromBuildQueue()
         throws Exception
     {
-        final Task buildTask = new BuildProjectTask( 1, 1, 1, "continuum-project-test-2",
"BUILD_DEF", null, 1 );
+    	final Task buildTask = new BuildProjectTask( 1, 1, new BuildTrigger( 1, "test-user"
), "continuum-project-test-2", "BUILD_DEF", null, 1 );
 
         final TaskQueue buildQueue = context.mock( TaskQueue.class, "build-queue" );
         final List<Task> tasks = new ArrayList<Task>();

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
Sat Jun 20 17:07:08 2009
@@ -32,6 +32,7 @@
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.continuum.repository.RepositoryService;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
@@ -518,7 +519,7 @@
 
         try
         {
-            continuum.buildProject( 1 );
+        	continuum.buildProject( 1, "test-user" );
             fail( "An exception should have been thrown." );
         }
         catch ( ContinuumException e )
@@ -564,7 +565,7 @@
 
         try
         {
-            continuum.buildProjectGroup( 1 );
+        	continuum.buildProjectGroup( 1, new BuildTrigger( 1, "test-user" ) );
             fail( "An exception should have been thrown." );
         }
         catch ( ContinuumException e )

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/BuildProjectTaskExecutorTest.java
Sat Jun 20 17:07:08 2009
@@ -25,6 +25,7 @@
 import java.util.Map;
 
 import org.apache.continuum.taskqueue.BuildProjectTask;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.AbstractContinuumTest;
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -245,8 +246,8 @@
 
         // projectGroup = continuumStore.addProjectGroup( projectGroup );
 
-        BuildProjectTask task = new BuildProjectTask( project.getId(), buildDefinition.getId(),
0, project.getName(),
-                                                      buildDefinition.getDescription(), null,
projectGroupId );
+        BuildProjectTask task = new BuildProjectTask( project.getId(), buildDefinition.getId(),
new BuildTrigger( 0, "" ),
+        		                                 project.getName(), buildDefinition.getDescription(),
null, projectGroupId );
 
         task.setMaxExecutionTime( maxRunTime );
 

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java
Sat Jun 20 17:07:08 2009
@@ -21,6 +21,7 @@
 
 import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildResultDao;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.AbstractContinuumTest;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -127,7 +128,7 @@
         throws Exception
     {
         return controller.initializeBuildContext( projectId2, buildDefinitionId2,
-                                                  ContinuumProjectState.TRIGGER_SCHEDULED,
new ScmResult() );
+                          new BuildTrigger( ContinuumProjectState.TRIGGER_SCHEDULED, "" ),
new ScmResult() );
     }
 
     private BuildContext getContext( int hourOfLastExecution )

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue/BuildQueueTest.java
Sat Jun 20 17:07:08 2009
@@ -20,6 +20,7 @@
  */
 
 import org.apache.continuum.taskqueue.BuildProjectTask;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.AbstractContinuumTest;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
@@ -133,7 +134,7 @@
         throws Exception
     {
         ProjectGroup group = getDefaultProjectGroup();
-        buildQueue.put( new BuildProjectTask( projectId, 0, trigger, null, null, null, group.getId()
) );
+        buildQueue.put( new BuildProjectTask( projectId, 0, new BuildTrigger( trigger, ""
), null, null, null, group.getId() ) );
     }
 
     private void assertNextBuildIs( int expectedProjectId )

Modified: continuum/branches/continuum-1.3.x/continuum-data-management/continuum-legacy/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-data-management/continuum-legacy/src/main/mdo/continuum.xml?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-data-management/continuum-legacy/src/main/mdo/continuum.xml
(original)
+++ continuum/branches/continuum-1.3.x/continuum-data-management/continuum-legacy/src/main/mdo/continuum.xml
Sat Jun 20 17:07:08 2009
@@ -504,6 +504,11 @@
           <version>1.0.9</version>
           <type>int</type>
         </field>
+        <field>
+          <name>username</name>
+          <version>1.0.9+</version>
+          <type>String</type>
+        </field>
         <field jpox.column="resultstate">
           <name>state</name>
           <version>1.1.0+</version>

Modified: continuum/branches/continuum-1.3.x/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-model/src/main/mdo/continuum.xml?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-model/src/main/mdo/continuum.xml (original)
+++ continuum/branches/continuum-1.3.x/continuum-model/src/main/mdo/continuum.xml Sat Jun
20 17:07:08 2009
@@ -585,6 +585,11 @@
           <version>1.0.9</version>
           <type>int</type>
         </field>
+        <field>
+          <name>username</name>
+          <version>1.0.9+</version>
+          <type>String</type>
+        </field>
         <field jpox.column="resultstate">
           <name>state</name>
           <version>1.1.0+</version>

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java
Sat Jun 20 17:07:08 2009
@@ -20,7 +20,9 @@
  */
 
 import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.codehaus.plexus.util.StringUtils;
@@ -56,27 +58,29 @@
         {
             return REQUIRES_AUTHORIZATION;
         }
+        
+        BuildTrigger buildTrigger = new BuildTrigger( ContinuumProjectState.TRIGGER_FORCED,
getPrincipal() );
 
         if ( projectId > 0 )
         {
             if ( buildDefinitionId > 0 )
             {
-                getContinuum().buildProjectWithBuildDefinition( projectId, buildDefinitionId
);
+            	getContinuum().buildProjectWithBuildDefinition( projectId, buildDefinitionId,
buildTrigger );
             }
             else
             {
-                getContinuum().buildProject( projectId );
+            	getContinuum().buildProject( projectId, buildTrigger.getUsername() );
             }
         }
         else
         {
             if ( buildDefinitionId > 0 )
             {
-                getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId
);
+            	getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId,
buildTrigger );
             }
             else
             {
-                getContinuum().buildProjects();
+            	getContinuum().buildProjects( buildTrigger.getUsername() );
             }
         }
         

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
Sat Jun 20 17:07:08 2009
@@ -34,6 +34,7 @@
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
@@ -562,14 +563,16 @@
             addActionError( authzE.getMessage() );
             return REQUIRES_AUTHORIZATION;
         }
+        
+        BuildTrigger buildTrigger = new BuildTrigger( ContinuumProjectState.TRIGGER_FORCED,
getPrincipal() );
 
         if ( this.getBuildDefinitionId() == -1 )
         {
-            getContinuum().buildProjectGroup( projectGroupId );
+        	getContinuum().buildProjectGroup( projectGroupId, buildTrigger );
         }
         else
         {
-            getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId
);
+        	getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId,
buildTrigger );
         }
 
         AuditLog event = new AuditLog( "Project Group id=" + projectGroupId, AuditLogConstants.FORCE_BUILD
);

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/QueuesAction.java
Sat Jun 20 17:07:08 2009
@@ -29,6 +29,7 @@
 import org.apache.continuum.taskqueue.BuildProjectTask;
 import org.apache.continuum.taskqueue.CheckOutTask;
 import org.apache.continuum.taskqueue.PrepareBuildProjectsTask;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
@@ -443,8 +444,8 @@
             return REQUIRES_AUTHENTICATION;
         }
 
-        getContinuum().getBuildsManager().removeProjectFromBuildQueue( projectId, buildDefinitionId,
trigger,
-                                                                       projectName, projectGroupId
);
+        getContinuum().getBuildsManager().removeProjectFromBuildQueue( projectId, buildDefinitionId,
+        		                                     new BuildTrigger( trigger, "" ), projectName,
projectGroupId );
         Project project = getContinuum().getProject( projectId );
         project.setState( project.getOldState() );
         getContinuum().updateProject( project );

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/resources/localization/Continuum.properties
Sat Jun 20 17:07:08 2009
@@ -552,6 +552,7 @@
 buildResult.trigger = Build Trigger
 buildResult.state = State
 buildResult.buildNumber = Build#
+buildResult.username = Triggered by
 buildResult.buildError = Build Error
 buildResult.buildOutput = Output
 buildResult.noOutput = No output.

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp
Sat Jun 20 17:07:08 2009
@@ -66,6 +66,9 @@
                     </s:else>
                 </s:param>
             </c1:data>
+            <c1:data label="%{getText('buildResult.username')}">
+                <s:param name="after"><s:property value="buildResult.username"/></s:param>
+            </c1:data>
           </table>
         </div>
         <div class="functnbar3">

Modified: continuum/branches/continuum-1.3.x/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?rev=786863&r1=786862&r2=786863&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Sat Jun 20 17:07:08 2009
@@ -35,6 +35,7 @@
 import org.apache.continuum.purge.ContinuumPurgeManagerException;
 import org.apache.continuum.purge.PurgeConfigurationServiceException;
 import org.apache.continuum.repository.RepositoryServiceException;
+import org.apache.continuum.utils.build.BuildTrigger;
 import org.apache.continuum.xmlrpc.release.ContinuumReleaseResult;
 import org.apache.continuum.xmlrpc.repository.DirectoryPurgeConfiguration;
 import org.apache.continuum.xmlrpc.repository.LocalRepository;
@@ -594,7 +595,7 @@
         ProjectSummary ps = getProjectSummary( projectId );
         checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
 
-        continuum.buildProject( projectId, ContinuumProjectState.TRIGGER_SCHEDULED );
+        continuum.buildProject( projectId, new BuildTrigger( ContinuumProjectState.TRIGGER_SCHEDULED,
"" ) );
         return 0;
     }
 
@@ -604,7 +605,7 @@
         ProjectSummary ps = getProjectSummary( projectId );
         checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
 
-        continuum.buildProject( projectId, buildDefinitionId, ContinuumProjectState.TRIGGER_SCHEDULED
);
+        continuum.buildProject( projectId, buildDefinitionId, new BuildTrigger( ContinuumProjectState.TRIGGER_SCHEDULED,
"" ) );
         return 0;
     }
 
@@ -614,7 +615,7 @@
         ProjectSummary ps = getProjectSummary( projectId );
         checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
 
-        continuum.buildProject( projectId );
+        continuum.buildProject( projectId, new BuildTrigger( ContinuumProjectState.TRIGGER_SCHEDULED,
"" ) );
         return 0;
     }
 
@@ -624,7 +625,7 @@
         ProjectSummary ps = getProjectSummary( projectId );
         checkBuildProjectInGroupAuthorization( ps.getProjectGroup().getName() );
 
-        continuum.buildProjectWithBuildDefinition( projectId, buildDefintionId );
+        continuum.buildProjectWithBuildDefinition( projectId, buildDefintionId, new BuildTrigger(
ContinuumProjectState.TRIGGER_SCHEDULED, "" ) );
         return 0;
     }
 
@@ -634,7 +635,7 @@
         ProjectGroupSummary pg = getProjectGroupSummary( projectGroupId );
         checkBuildProjectInGroupAuthorization( pg.getName() );
 
-        continuum.buildProjectGroup( projectGroupId );
+        continuum.buildProjectGroup( projectGroupId, new BuildTrigger( ContinuumProjectState.TRIGGER_SCHEDULED,
"" ) );
 
         return 0;
     }
@@ -645,7 +646,7 @@
         ProjectGroupSummary pg = getProjectGroupSummary( projectGroupId );
         checkBuildProjectInGroupAuthorization( pg.getName() );
 
-        continuum.buildProjectGroupWithBuildDefinition( projectGroupId, buildDefintionId
);
+        continuum.buildProjectGroupWithBuildDefinition( projectGroupId, buildDefintionId,
new BuildTrigger( ContinuumProjectState.TRIGGER_SCHEDULED, "" ) );
 
         return 0;
     }



Mime
View raw message