continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r727313 - in /continuum/branches/continuum-distributed-builds: continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/ continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/ continuum-builde...
Date Wed, 17 Dec 2008 08:31:27 GMT
Author: ctan
Date: Wed Dec 17 00:31:26 2008
New Revision: 727313

URL: http://svn.apache.org/viewvc?rev=727313&view=rev
Log:
- more fixes in transport test, distributed build implementation

Added:
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/continuum/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/continuum/web/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/continuum/web/startup/
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/continuum/web/startup/BuildAgentStartup.java
  (with props)
Modified:
    continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/pom.xml
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentManager.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/spring-context.xml
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/pom.xml
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/resources/log4j.xml
    continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/webapp/WEB-INF/web.xml

Modified: continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-api/src/main/java/org/apache/continuum/builder/distributed/manager/DistributedBuildManager.java
Wed Dec 17 00:31:26 2008
@@ -23,7 +23,10 @@
     void prepareBuildFinished( Map context )
         throws ContinuumException;
 
-    void updateProjectCurrentlyBuilding( int projectId )
+    void startProjectBuild( int projectId )
+        throws ContinuumException;
+
+    void startPrepareBuild( Map context )
         throws ContinuumException;
 
     void reload()

Modified: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/executor/DistributedBuildProjectTaskExecutor.java
Wed Dec 17 00:31:26 2008
@@ -79,21 +79,12 @@
         {
             SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new
URL( buildAgentUrl ) );
 
-            ProjectScmRoot scmRoot = projectScmRootDao.
-                getProjectScmRootByProjectGroupAndScmRootAddress( prepareBuildTask.getProjectGroupId(),

-                                                                  prepareBuildTask.getScmRootAddress()
);
-
             log.info( "initializing buildContext" );
             List buildContext = initializeBuildContext( prepareBuildTask.getProjectsBuildDefinitionsMap(),

                                                         prepareBuildTask.getTrigger(), 
                                                         prepareBuildTask.getScmRootAddress()
);
 
             startTime = System.currentTimeMillis();
-
-            scmRoot.setOldState( scmRoot.getState() );
-            scmRoot.setState( ContinuumProjectState.UPDATING );
-            projectScmRootDao.updateProjectScmRoot( scmRoot );
-
             client.buildProjects( buildContext );
 
             endTime = System.currentTimeMillis();

Modified: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
Wed Dec 17 00:31:26 2008
@@ -497,7 +497,7 @@
         return null;
     }
 
-    public void updateProjectCurrentlyBuilding( int projectId )
+    public void startProjectBuild( int projectId )
         throws ContinuumException
     {
         try
@@ -513,6 +513,26 @@
         }
     }
 
+    public void startPrepareBuild( Map context )
+        throws ContinuumException
+    {
+        try
+        {
+            int projectGroupId = ContinuumBuildConstant.getProjectGroupId( context );
+            String scmRootAddress = ContinuumBuildConstant.getScmRootAddress( context );
+            
+            ProjectScmRoot scmRoot = projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress(
projectGroupId, scmRootAddress );
+            scmRoot.setOldState( scmRoot.getState() );
+            scmRoot.setState( ContinuumProjectState.UPDATING );
+            projectScmRootDao.updateProjectScmRoot( scmRoot );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            log.error( "Error while updating project scm root's state", e );
+            throw new ContinuumException( "Error while updating project scm root's state",
e );
+        }
+    }
+
     public Map<String, Object> getBuildResult( int projectId )
         throws ContinuumException
     {

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/pom.xml?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/pom.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/pom.xml
Wed Dec 17 00:31:26 2008
@@ -53,6 +53,10 @@
       <artifactId>continuum-scm</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-distributed-build-transport-master-client</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>file-management</artifactId>
     </dependency>

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentManager.java?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentManager.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/BuildAgentManager.java
Wed Dec 17 00:31:26 2008
@@ -1,6 +1,7 @@
 package org.apache.continuum.buildagent.manager;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.continuum.buildagent.buildcontext.BuildContext;
 import org.apache.maven.continuum.ContinuumException;
@@ -11,4 +12,10 @@
 
     void prepareBuildProjects( List<BuildContext> buildContextList )
         throws ContinuumException;
+
+    void returnBuildResult( Map result )
+        throws ContinuumException;
+    
+    void startProjectBuild( int projectId )
+        throws ContinuumException;
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/manager/DefaultBuildAgentManager.java
Wed Dec 17 00:31:26 2008
@@ -1,5 +1,7 @@
 package org.apache.continuum.buildagent.manager;
 
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -10,6 +12,7 @@
 import org.apache.continuum.buildagent.utils.BuildContextToBuildDefinition;
 import org.apache.continuum.buildagent.utils.BuildContextToProject;
 import org.apache.continuum.buildagent.utils.ContinuumBuildAgentUtil;
+import org.apache.continuum.distributed.transport.master.MasterBuildAgentTransportClient;
 import org.apache.continuum.taskqueue.BuildProjectTask;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -67,11 +70,12 @@
                         break;
                     }
                     
+                    log.info( "Starting prepare build" );
+                    startPrepareBuild( buildContext );
+                    
                     log.info( "Initializing prepare build" );
                     initializeActionContext( buildContext );
                     
-                    log.info( "Starting prepare build" );
-    
                     try
                     {
                         if ( buildDef.isBuildFresh() )
@@ -101,6 +105,78 @@
         }
     }
 
+    public void startProjectBuild( int projectId )
+        throws ContinuumException
+    {
+        try
+        {
+            MasterBuildAgentTransportClient client = new MasterBuildAgentTransportClient(
+                new URL( buildAgentConfigurationService.getContinuumServerUrl() ) );
+            client.startProjectBuild( projectId );
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid continuum server URL '" + buildAgentConfigurationService.getContinuumServerUrl()
+ "'" );
+            throw new ContinuumException( "Invalid continuum server URL '" + buildAgentConfigurationService.getContinuumServerUrl()
+ "'" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error starting project build", e );
+            throw new ContinuumException( "Error starting project build", e );
+        }
+    }
+
+    public void returnBuildResult( Map buildResult )
+        throws ContinuumException
+    {
+        try
+        {
+            MasterBuildAgentTransportClient client = new MasterBuildAgentTransportClient(
+                new URL( buildAgentConfigurationService.getContinuumServerUrl() ) );
+            client.returnBuildResult( buildResult );
+        }
+        catch ( MalformedURLException e )
+        {
+            log.error( "Invalid continuum server URL '" + buildAgentConfigurationService.getContinuumServerUrl()
+ "'" );
+            throw new ContinuumException( "Invalid continuum server URL '" + buildAgentConfigurationService.getContinuumServerUrl()
+ "'" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Error while returning build result to the continuum server", e );
+            throw new ContinuumException( e.getMessage(), e );
+        }
+    }
+
+    private void startPrepareBuild( BuildContext buildContext )
+        throws ContinuumException
+    {
+        Map<String, Object> actionContext = buildContext.getActionContext();
+        
+        if ( actionContext == null || !( ContinuumBuildAgentUtil.getScmRootState( actionContext
) == ContinuumProjectState.UPDATING ) ) 
+        {
+            Map<String, Object> map = new HashMap<String, Object>();
+            map.put( ContinuumBuildAgentUtil.KEY_PROJECT_GROUP_ID, new Integer( buildContext.getProjectGroupId()
) );
+            map.put( ContinuumBuildAgentUtil.KEY_SCM_ROOT_ADDRESS, buildContext.getScmRootAddress()
);
+            
+            try
+            {
+                MasterBuildAgentTransportClient client = new MasterBuildAgentTransportClient(
+                    new URL( buildAgentConfigurationService.getContinuumServerUrl() ) );
+                client.startPrepareBuild( map );
+            }
+            catch ( MalformedURLException e )
+            {
+                log.error( "Invalid continuum server URL '" + buildAgentConfigurationService.getContinuumServerUrl()
+ "'" );
+                throw new ContinuumException( "Invalid continuum server URL '" + buildAgentConfigurationService.getContinuumServerUrl()
+ "'", e );
+            }
+            catch ( Exception e )
+            {
+                log.error( "Error starting prepare build", e );
+                throw new ContinuumException( "Error starting prepare build", e );
+            }
+        }
+    }
+
     private void initializeActionContext( BuildContext buildContext )
     {
         Map<String, Object> actionContext = new HashMap<String, Object>();
@@ -177,23 +253,59 @@
         {
             context.put( ContinuumBuildAgentUtil.KEY_SCM_ROOT_STATE, ContinuumProjectState.ERROR
);
         }
+
+        // connect to continuum server (master)
+        try
+        {
+            MasterBuildAgentTransportClient client = new MasterBuildAgentTransportClient(
+                 new URL( buildAgentConfigurationService.getContinuumServerUrl() ) );
+            client.returnScmResult( createScmResult( buildContext ) );
+        }
+        catch ( MalformedURLException e )
+        {
+            throw new ContinuumException( "Invalid Continuum Server URL '" + buildAgentConfigurationService.getContinuumServerUrl()
+ "'" );
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumException( "Error while returning scm result to the continuum
server", e );
+        }
     }
 
     private void endPrepareBuild( Map context )
         throws ContinuumException
     {
-        Map<String, Object> result = new HashMap<String, Object>();
-        result.put( ContinuumBuildAgentUtil.KEY_PROJECT_GROUP_ID, new Integer( ContinuumBuildAgentUtil.getProjectGroupId(
context ) ) );
-        result.put( ContinuumBuildAgentUtil.KEY_SCM_ROOT_ADDRESS, ContinuumBuildAgentUtil.getScmRootAddress(
context ) );
-        
-        String error = convertScmResultToError( ContinuumBuildAgentUtil.getScmResult( context,
null ) );
-        if ( StringUtils.isEmpty( error ) )
+        if ( context != null )
         {
-            result.put( ContinuumBuildAgentUtil.KEY_SCM_ERROR, "" );
-        }
-        else
-        {
-            result.put( ContinuumBuildAgentUtil.KEY_SCM_ERROR, error );
+            Map<String, Object> result = new HashMap<String, Object>();
+            result.put( ContinuumBuildAgentUtil.KEY_PROJECT_GROUP_ID, new Integer( ContinuumBuildAgentUtil.getProjectGroupId(
context ) ) );
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_ROOT_ADDRESS, ContinuumBuildAgentUtil.getScmRootAddress(
context ) );
+            result.put( ContinuumBuildAgentUtil.KEY_SCM_ROOT_STATE, new Integer( ContinuumBuildAgentUtil.getScmRootState(
context ) ) );
+            
+            String error = convertScmResultToError( ContinuumBuildAgentUtil.getScmResult(
context, null ) );
+            if ( StringUtils.isEmpty( error ) )
+            {
+                result.put( ContinuumBuildAgentUtil.KEY_SCM_ERROR, "" );
+            }
+            else
+            {
+                result.put( ContinuumBuildAgentUtil.KEY_SCM_ERROR, error );
+            }
+    
+            // connect to continuum server (master)
+            try
+            {
+                MasterBuildAgentTransportClient client = new MasterBuildAgentTransportClient(
+                     new URL( buildAgentConfigurationService.getContinuumServerUrl() ) );
+                client.prepareBuildFinished( result );
+            }
+            catch ( MalformedURLException e )
+            {
+                throw new ContinuumException( "Invalid Continuum Server URL '" + buildAgentConfigurationService.getContinuumServerUrl()
+ "'" );
+            }
+            catch ( Exception e )
+            {
+                throw new ContinuumException( "Error while finishing prepare build", e );
+            }
         }
     }
 

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/java/org/apache/continuum/buildagent/taskqueue/execution/BuildProjectTaskExecutor.java
Wed Dec 17 00:31:26 2008
@@ -10,9 +10,11 @@
 import org.apache.continuum.buildagent.buildcontext.BuildContext;
 import org.apache.continuum.buildagent.buildcontext.manager.BuildContextManager;
 import org.apache.continuum.buildagent.configuration.BuildAgentConfigurationService;
+import org.apache.continuum.buildagent.manager.BuildAgentManager;
 import org.apache.continuum.buildagent.utils.BuildContextToBuildDefinition;
 import org.apache.continuum.buildagent.utils.ContinuumBuildAgentUtil;
 import org.apache.continuum.taskqueue.BuildProjectTask;
+import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.scm.ScmException;
@@ -50,6 +52,11 @@
      */
     private BuildAgentConfigurationService buildAgentConfigurationService;
 
+    /**
+     * @plexus.requirement
+     */
+    private BuildAgentManager buildAgentManager;
+
     public void executeTask( Task task )
         throws TaskExecutionException
     {
@@ -100,9 +107,18 @@
     }
 
     private void startBuild( BuildContext buildContext )
+        throws TaskExecutionException
     {
-        // inform master that project is building ( to set the state )
-        
+        try
+        {
+            buildAgentManager.startProjectBuild( buildContext.getProjectId() );
+        }
+        catch ( ContinuumException e )
+        {
+            // do not throw exception, just log?
+            log.error( "Failed to start project '" + buildContext.getProjectName() + "'",
e );
+            throw new TaskExecutionException( "Failed to start project '" + buildContext.getProjectName()
+ "'", e );
+        }
     }
 
     private void endBuild( BuildContext buildContext )

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/spring-context.xml?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/spring-context.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-buildagent/continuum-buildagent-core/src/main/resources/META-INF/spring-context.xml
Wed Dec 17 00:31:26 2008
@@ -25,11 +25,13 @@
          class="org.apache.continuum.buildagent.build.execution.shell.ShellBuildExecutor"
autowire="byName">
   </bean>
 
-  <bean id="buildAgentConfigurationService" class="org.apache.continuum.buildagent.configuration.DefaultBuildAgentConfigurationService">
+  <bean id="buildAgentConfigurationService" class="org.apache.continuum.buildagent.configuration.DefaultBuildAgentConfigurationService"
+        init-method="initialize">
     <property name="configuration" ref="buildAgentConfiguration" />
   </bean>
   
-  <bean id="buildAgentConfiguration" class="org.apache.continuum.buildagent.configuration.DefaultBuildAgentConfiguration">
+  <bean id="buildAgentConfiguration" class="org.apache.continuum.buildagent.configuration.DefaultBuildAgentConfiguration"
+     init-method="initialize">
     <property name="configurationFile" value="file:${appserver.base}/conf/continuum-buildagent.xml"
/>
   </bean>
 

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-api/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportService.java
Wed Dec 17 00:31:26 2008
@@ -33,9 +33,11 @@
     
     public Boolean returnScmResult( Map scmResult ) throws Exception;
 
-    public Boolean returnProjectCurrentlyBuilding( Integer projectId ) throws Exception;
+    public Boolean startProjectBuild( Integer projectId ) throws Exception;
 
     public Boolean prepareBuildFinished( Map prepareBuildResult ) throws Exception; 
 
+    public Boolean startPrepareBuild( Map prepareBuildResult ) throws Exception;
+
     public Boolean ping() throws Exception;
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-client/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportClient.java
Wed Dec 17 00:31:26 2008
@@ -139,14 +139,14 @@
         return result;
     }
 
-    public Boolean returnProjectCurrentlyBuilding( Integer projectId )
+    public Boolean startProjectBuild( Integer projectId )
         throws Exception
     {
         Boolean result = null;
         
         try
         {
-            result = master.returnProjectCurrentlyBuilding( projectId );
+            result = master.startProjectBuild( projectId );
             log.info( "Return project currently building" );
         }
         catch ( Exception e )
@@ -157,4 +157,23 @@
 
         return result;
     }
+
+    public Boolean startPrepareBuild( Map prepareBuildResult )
+        throws Exception
+    {
+        Boolean result = null;
+
+        try
+        {
+            result = master.startPrepareBuild( prepareBuildResult );
+            log.info( "Started prepare build" );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed to start prepare build", e );
+            throw new Exception( "Failed to start prepare build", e );
+        }
+
+        return result;
+    }
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-master/continuum-distributed-build-transport-master-server/src/main/java/org/apache/continuum/distributed/transport/master/MasterBuildAgentTransportServer.java
Wed Dec 17 00:31:26 2008
@@ -71,11 +71,19 @@
         return Boolean.TRUE;
     }
 
-    public Boolean returnProjectCurrentlyBuilding( Integer projectId )
+    public Boolean startProjectBuild( Integer projectId )
         throws Exception
     {
-        log.info( "Project currently building returned." );
-        distributedBuildManager.updateProjectCurrentlyBuilding( projectId.intValue() );
+        log.info( "Start project build." );
+        distributedBuildManager.startProjectBuild( projectId.intValue() );
+        return Boolean.TRUE;
+    }
+
+    public Boolean startPrepareBuild( Map prepareBuildResult )
+        throws Exception
+    {
+        log.info( "Start prepare build." );
+        distributedBuildManager.startPrepareBuild( prepareBuildResult );
         return Boolean.TRUE;
     }
 }

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/pom.xml?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/pom.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/pom.xml
Wed Dec 17 00:31:26 2008
@@ -65,6 +65,12 @@
       <artifactId>slf4j-log4j12</artifactId>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.4</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
   
   <build>
@@ -86,6 +92,12 @@
               <maxIdleTime>60000</maxIdleTime>
             </connector>
           </connectors>
+          <systemProperties>
+            <systemProperty>
+              <name>appserver.base</name>
+              <value>${project.build.directory}/appserver-base</value>
+            </systemProperty>
+          </systemProperties>
         </configuration>
         <executions>
           <execution>

Added: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/continuum/web/startup/BuildAgentStartup.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/continuum/web/startup/BuildAgentStartup.java?rev=727313&view=auto
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/continuum/web/startup/BuildAgentStartup.java
(added)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/continuum/web/startup/BuildAgentStartup.java
Wed Dec 17 00:31:26 2008
@@ -0,0 +1,40 @@
+package org.apache.continuum.web.startup;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.codehaus.plexus.spring.PlexusToSpringUtils;
+import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+public class BuildAgentStartup
+    implements ServletContextListener
+{
+    private Logger log = LoggerFactory.getLogger( getClass() );
+    
+    /** 
+     * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
+     */
+    public void contextDestroyed( ServletContextEvent sce )
+    {
+        // nothing to do here
+
+    }
+    
+    /** 
+     * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
+     */
+    public void contextInitialized( ServletContextEvent sce )
+    {
+        log.info( "Initializing Build Agent Task Queue Executor" );
+
+        WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(
sce
+            .getServletContext() );
+        
+        TaskQueueExecutor buildAgent = (TaskQueueExecutor) wac.getBean( PlexusToSpringUtils
+            .buildSpringId( TaskQueueExecutor.class, "build-agent" ) );
+    }
+}

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/continuum/web/startup/BuildAgentStartup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/java/org/apache/continuum/web/startup/BuildAgentStartup.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/resources/log4j.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/resources/log4j.xml?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/resources/log4j.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/resources/log4j.xml
Wed Dec 17 00:31:26 2008
@@ -14,6 +14,9 @@
   <logger name="org.apache.continuum.buildagent">
     <level value="info"/>
   </logger>
+  <logger name="org.apache.continuum.web">
+    <level value="info"/>
+  </logger>
   <logger name="org.springframework">
     <level value="error"/>
   </logger>

Modified: continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/webapp/WEB-INF/web.xml?rev=727313&r1=727312&r2=727313&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/webapp/WEB-INF/web.xml
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-distributed-build/continuum-distributed-build-transport/continuum-distributed-build-transport-tests/src/main/webapp/WEB-INF/web.xml
Wed Dec 17 00:31:26 2008
@@ -9,6 +9,11 @@
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
   
+  <listener>
+    <!-- TODO: some Spring technique for this? -->
+  	<listener-class>org.apache.continuum.web.startup.BuildAgentStartup</listener-class>
+  </listener>
+  
   <context-param>
     <param-name>contextClass</param-name>
     <param-value>org.codehaus.plexus.spring.PlexusWebApplicationContext</param-value>



Mime
View raw message