continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r726005 - in /continuum/branches/continuum-distributed-builds/continuum-builder/src: main/java/org/apache/continuum/builder/distributed/manager/ main/java/org/apache/continuum/builder/utils/ test/java/org/apache/continuum/builder/distribute...
Date Fri, 12 Dec 2008 13:33:46 GMT
Author: ctan
Date: Fri Dec 12 05:33:46 2008
New Revision: 726005

URL: http://svn.apache.org/viewvc?rev=726005&view=rev
Log:
- made changes to updateProjectScmRoot() method
- fixed test

Modified:
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
    continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java
    continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java

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=726005&r1=726004&r2=726005&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
Fri Dec 12 05:33:46 2008
@@ -290,7 +290,9 @@
         try
         {
             int projectId = ContinuumBuildConstant.getProjectId( context );
-        
+            int projectGroupId = ContinuumBuildConstant.getProjectGroupId( context );
+            String scmRootAddress = ContinuumBuildConstant.getScmRootAddress( context );
+
             log.info( "update scm result of project" + projectId );
             Project project = projectDao.getProjectWithScmDetails( projectId );
             
@@ -314,31 +316,22 @@
             project.setScmResult( scmResult );
             projectDao.updateProject( project );
 
-            if ( error != null || ContinuumBuildConstant.isPrepareBuildFinished( context
) )
-            {
-                List<ProjectScmRoot> scmRoots = projectScmRootDao.getProjectScmRootByProjectGroup(
project.getProjectGroup().getId() );
-                
-                for ( ProjectScmRoot scmRoot : scmRoots )
-                {
-                    if ( project.getScmUrl().startsWith( scmRoot.getScmRootAddress() ) )
-                    {
-                        if ( error != null )
-                        {
-                            scmRoot.setError( error );
-                            scmRoot.setState( ContinuumProjectState.ERROR );
-                        }
-                        else
-                        {
-                            scmRoot.setState( ContinuumProjectState.UPDATED );
-                        }
-                        projectScmRootDao.updateProjectScmRoot( scmRoot );
-                    }
-                }
-            }
+            ProjectScmRoot scmRoot = projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress(
projectGroupId, scmRootAddress );
 
             if ( error != null )
             {
                 log.info( "scm error, not building" );
+                scmRoot.setError( error );
+                scmRoot.setState( ContinuumProjectState.ERROR );
+                projectScmRootDao.updateProjectScmRoot( scmRoot );
+            }
+            else if ( ContinuumBuildConstant.isPrepareBuildFinished( context ) )
+            {
+                log.info( "prepare build finished" );
+                scmRoot.setState( ContinuumProjectState.UPDATED );
+                projectScmRootDao.updateProjectScmRoot( scmRoot );
+
+                //TODO: set state of project to building
             }
         }
         catch ( ContinuumStoreException e )
@@ -398,6 +391,8 @@
             project.setState( ContinuumBuildConstant.getBuildState( context ) );
 
             projectDao.updateProject( project );
+
+            //TODO: set state of next project to building
         }
         catch ( ContinuumStoreException e )
         {

Modified: continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java?rev=726005&r1=726004&r2=726005&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/main/java/org/apache/continuum/builder/utils/ContinuumBuildConstant.java
Fri Dec 12 05:33:46 2008
@@ -115,6 +115,16 @@
         return getBoolean( context, KEY_PREPARE_BUILD_FINISHED );
     }
 
+    public static int getProjectGroupId( Map context )
+    {
+        return getInteger( context, KEY_PROJECT_GROUP_ID );
+    }
+
+    public static String getScmRootAddress( Map context )
+    {
+        return getString( context, KEY_SCM_ROOT_ADDRESS );
+    }
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------

Modified: continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java?rev=726005&r1=726004&r2=726005&view=diff
==============================================================================
--- continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
(original)
+++ continuum/branches/continuum-distributed-builds/continuum-builder/src/test/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManagerTest.java
Fri Dec 12 05:33:46 2008
@@ -47,6 +47,8 @@
 
         Map context = new HashMap();
         context.put( "project-id", project.getId() );
+        context.put( "project-group-id", project.getProjectGroup().getId() );
+        context.put( "scm-root-address", scmRoot.getScmRootAddress() );
         context.put( "scm-command-line", null );
         context.put( "scm-command-output", null );
         context.put( "scm-exception", null );



Mime
View raw message