continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r170457 - /maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder /maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store /maven/continuum/trunk/continuum-core-it /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store /maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store /maven/continuum/trunk/continuum-model/src/main/resources /maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action /maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/context
Date Mon, 16 May 2005 21:36:36 GMT
Author: trygvis
Date: Mon May 16 14:36:35 2005
New Revision: 170457

URL: http://svn.apache.org/viewcvs?rev=170457&view=rev
Log:
Fixing CONTINUUM-130: "Save error messages when a check out fails"
o Adding checkOutErrorMessage and checkOutErrorException fields in the
  ContinuumProject.
o Improving error handling in the CheckOutTaskExecutor, making sure any SCM
  errors will be stored.

Added:
    maven/continuum/trunk/continuum-core-it/it-2.py
Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/trunk/continuum-core-it/continuum.py
    maven/continuum/trunk/continuum-core-it/continuum_cli.py
    maven/continuum/trunk/continuum-core-it/it.py
    maven/continuum/trunk/continuum-core-it/it_utils.py
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
    maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
    maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/CallApplicationModel.java
    maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/context/DefaultViewContextPopulator.java

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/AbstractContinuumProjectBuilder.java
Mon May 16 14:36:35 2005
@@ -24,7 +24,6 @@
 
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.IOUtil;
-import org.apache.maven.continuum.project.ContinuumProject;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
Mon May 16 14:36:35 2005
@@ -121,10 +121,10 @@
     // Project and Build state transitions
     // ----------------------------------------------------------------------
 
-//    void setBuildSignalled( String projectId )
-//        throws ContinuumStoreException;
-
-    void setCheckoutDone( String projectId, CheckOutScmResult scmResult )
+    void setCheckoutDone( String projectId,
+                          CheckOutScmResult scmResult,
+                          String errorMessage,
+                          Throwable exception )
         throws ContinuumStoreException;
 
     void setIsUpdating( String projectId )

Modified: maven/continuum/trunk/continuum-core-it/continuum.py
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/continuum.py?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/continuum.py (original)
+++ maven/continuum/trunk/continuum-core-it/continuum.py Mon May 16 14:36:35 2005
@@ -23,17 +23,24 @@
     print msg
     sys.exit( -1 )
 
+class XmlRpcException:
+    def __init__( self, method, message, stackTrace ):
+        self.method = method
+        self.message = message
+        self.stackTrace = stackTrace
+
+    def __str__( self ):
+        return "Error while executing method." + os.linesep + \
+               "Method: " + map[ "method" ] + os.linesep + \
+               "Message: " + map[ "message" ] + os.linesep + \
+               "Stack trace: " + map[ "stackTrace" ] + os.linesep
+
 def checkResult( map ):
     if ( map[ "result" ] == "ok" ):
         return map
 
-    print "Error while executing method."
-    print "Method: " + map[ "method" ]
-    print "Message: " + map[ "message" ]
-    print "Stack trace: " + map[ "stackTrace" ]
-
-    raise Exception( "Error while executing method" )
 
+    raise XmlRpcException( map[ "method" ], map[ "message" ], map[ "stackTrace" ] )
 def decodeState( state ):
     if ( state == 1 ):
         return STATE_NEW
@@ -164,6 +171,16 @@
         self.version = map[ "version" ]
         self.executorId = map[ "executorId" ]
         self.configuration = map[ "configuration" ]
+
+        if ( map.has_key( "checkOutErrorMessage" ) ):
+            self.checkOutErrorMessage = map[ "checkOutErrorMessage" ]
+        else:
+            self.checkOutErrorMessage = None
+
+        if ( map.has_key( "checkOutErrorException" ) ):
+            self.checkOutErrorException = map[ "checkOutErrorException" ]
+        else:
+            self.checkOutErrorException = None
 
         if ( map.has_key( "checkOutScmResult" ) ):
             self.checkOutScmResult = CheckOutScmResult( map[ "checkOutScmResult" ] )

Modified: maven/continuum/trunk/continuum-core-it/continuum_cli.py
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/continuum_cli.py?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/continuum_cli.py (original)
+++ maven/continuum/trunk/continuum-core-it/continuum_cli.py Mon May 16 14:36:35 2005
@@ -63,26 +63,33 @@
 
         print "Project details:"
         print """Id: %(id)s
-Name: %(name)s
-Version: %(version)s
-Working directory: %(workingDirectory)s
-Builder type: %(builderId)s""" % project.map
-
-        print ""
-        print "Checked out files:"
-        print project.checkOutScmResult
-
-        print "Project Configuration:"
-        for key in project.configuration.keys():
-            print key + "=" + project.configuration[ key ]
-
-        print ""
-        print "Project Builds:"
-        print "|  Id  |  State |           Start time            |             End time 
          | Build time |"
-        builds = continuum.getBuildsForProject( project.id, 0, 0 )
-        for build in builds:
-            build.state = continuum.decodeState( build.state )
-            print "| %(id)4s | %(state)6s | %(startTime)s | %(endTime)s | %(totalTime)10s
|" % build.map
+Name:               %(name)s
+Version:            %(version)s
+Working directory:  %(workingDirectory)s
+State:              %(state)s
+Executor type:      %(executorId)s""" % project.map
+
+        if ( project.checkOutErrorMessage != None and project.checkOutErrorException != None
):
+            print ""
+            print "There was a error while checking out the project:"
+            print "Error message: " + project.checkOutErrorMessage
+            print "Exception: " + project.checkOutErrorException
+        else:
+            print ""
+            print "Checked out files:"
+            print project.checkOutScmResult
+
+            print "Project Configuration:"
+            for key in project.configuration.keys():
+                print key + "=" + project.configuration[ key ]
+
+            builds = continuum.getBuildsForProject( project.id, 0, 0 )
+            print ""
+            print "Project Builds:"
+            print "|  Id  |  State |           Start time            |             End time
           | Build time |"
+            for build in builds:
+                build.state = continuum.decodeState( build.state )
+                print "| %(id)4s | %(state)6s | %(startTime)s | %(endTime)s | %(totalTime)10s
|" % build.map
 
     def do_showProjects(self, args):
         """Shows all Continuum projects registeret.
@@ -90,8 +97,11 @@
 
         projects = continuum.getAllProjects()
 
+        print ""
+        print "Projects:"
+        print "  Id |    State     | Executor | Name"
         for project in projects:
-            print "Id %(id)s, name: '%(name)s'" % project
+            print "%(id)4s | %(state)12s | %(executorId)s | %(name)s" % project.map
 
     def do_buildProject(self, args):
         """Build a Continuum project.

Added: maven/continuum/trunk/continuum-core-it/it-2.py
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/it-2.py?rev=170457&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core-it/it-2.py (added)
+++ maven/continuum/trunk/continuum-core-it/it-2.py Mon May 16 14:36:35 2005
@@ -0,0 +1,95 @@
+import continuum
+import os
+import shutil
+import sys
+import time
+import traceback
+from it_utils import *
+
+print "############################################################"
+print "Running integration tests"
+print ""
+print "NOTE:"
+print "When running these integration tests you will get some"
+print "stacktraces. This is normal and expected."
+print "############################################################"
+print ""
+
+progress( "Initializing SCM repositories." )
+
+basedir = os.getcwd() + "/target"
+cvsroot = basedir + "/cvsroot"
+svnroot = basedir + "/svnroot"
+maven1Project = basedir + "/maven-1"
+maven2Project = basedir + "/maven-2"
+antProject = basedir + "/ant"
+shellProject = basedir + "/shell"
+coDir = basedir + "/tmp-co"
+
+cleanDirectory( basedir )
+os.makedirs( basedir )
+os.makedirs( cvsroot )
+os.makedirs( svnroot )
+
+execute( os.getcwd(), "cvs -d " + cvsroot + " init" )
+execute( os.getcwd(), "svnadmin create " + svnroot )
+
+startTime = int( time.time() )
+
+#####################################################################
+#
+#####################################################################
+
+if 0:
+    progress( "Adding a project with a URL pointing to a nonexisting host" )
+
+    try:
+        continuum.addMavenTwoProject( "http://thishostnameshoulddefinitelyeverberesolvedorillfreakout/bar"
)
+
+        fail( "Expected XmlRpcException" )
+    except continuum.XmlRpcException:
+        pass
+
+#####################################################################
+#
+#####################################################################
+
+if 0:
+    progress( "Adding a project with a malformed URL" )
+
+    try:
+        continuum.addMavenTwoProject( "blah://foo/bar" )
+
+        fail( "Expected XmlRpcException" )
+    except continuum.XmlRpcException:
+        pass
+
+#####################################################################
+#
+#####################################################################
+
+if 1:
+    progress( "Adding a project with a malformed SCM URL (invalid SCM type)" )
+
+    writeMavenOnePom( "project.xml", "foo", "scm:crap:", "foo@bar" )
+
+    projectIds = continuum.addMavenOneProject( "file://" + basedir + "/project.xml" )
+
+    project = waitForCheckOut( projectIds[ 0 ] )
+
+    assertEquals( "The project state should be error.", continuum.STATE_ERROR, project.state
)
+    assertEquals( "The error message wasn't as expected.", "No such provider: 'crap'.", project.checkOutErrorMessage
)
+
+#####################################################################
+#
+#####################################################################
+
+endTime = int( time.time() )
+
+print ""
+print "##############################################"
+print "ALL TESTS PASSED"
+print "##############################################"
+print "Time elapsed: " + str( endTime - startTime ) + "s."
+print "##############################################"
+print ""

Modified: maven/continuum/trunk/continuum-core-it/it.py
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/it.py?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/it.py (original)
+++ maven/continuum/trunk/continuum-core-it/it.py Mon May 16 14:36:35 2005
@@ -40,7 +40,7 @@
     initMaven1Project( maven1Project, "cvs", cvsroot, "maven-1" )
     progress( "Adding Maven 1 project" )
     maven1Id = getProjectId( continuum.addMavenOneProject( "file:" + maven1Project + "/project.xml"
) )
-    waitForCheckOut( maven1Id );
+    waitForSuccessfulCheckOut( maven1Id );
     maven1 = continuum.getProject( maven1Id )
     assertProject( maven1Id, "Maven 1 Project", email, continuum.STATE_NEW, "1.0", "maven-1",
maven1 )
     assertCheckedOutFiles( maven1, [ "/project.xml", "/src/main/java/Foo.java" ] )
@@ -77,7 +77,7 @@
     initMaven2Project( maven2Project, cvsroot, "maven-2" )
     progress( "Adding Maven 2 project" )
     maven2Id = getProjectId( continuum.addMavenTwoProject( "file:" + maven2Project + "/pom.xml"
) )
-    waitForCheckOut( maven2Id );
+    waitForSuccessfulCheckOut( maven2Id );
     maven2 = continuum.getProject( maven2Id )
     assertProject( maven2Id, "Maven 2 Project", email, continuum.STATE_NEW, "2.0-SNAPSHOT",
"maven2", maven2 )
 
@@ -111,7 +111,7 @@
                                             "executable": "ant",
                                             "targets" : "clean, build"
                                         } )
-    waitForCheckOut( antSvnId );
+    waitForSuccessfulCheckOut( antSvnId );
     antSvn = continuum.getProject( antSvnId )
     assertProject( antSvnId, "Ant SVN Project", email, continuum.STATE_NEW, "3.0", "ant",
antSvn )
     progress( "Building SVN Ant project" )
@@ -126,7 +126,7 @@
     cvsImport( antProject, cvsroot, "ant-cvs" )
     antCvsId = continuum.addAntProject( "scm:cvs:local:" + basedir + "/cvsroot:ant-cvs",
"Ant CVS Project", email, "3.0",
                                       { "executable": "ant", "targets" : "clean, build"}
)
-    waitForCheckOut( antCvsId );
+    waitForSuccessfulCheckOut( antCvsId );
     antCvs = continuum.getProject( antCvsId )
     assertProject( antCvsId, "Ant CVS Project", email, continuum.STATE_NEW, "3.0", "ant",
antCvs )
     progress( "Building CVS Ant project" )
@@ -145,7 +145,7 @@
                                             "executable": "script.sh", 
                                             "arguments" : ""
                                          } )
-    waitForCheckOut( shellId );
+    waitForSuccessfulCheckOut( shellId );
     shell = continuum.getProject( shellId )
     assertProject( shellId, "Shell Project", email, continuum.STATE_NEW, "3.0", "shell",
shell )
 

Modified: maven/continuum/trunk/continuum-core-it/it_utils.py
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/it_utils.py?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/it_utils.py (original)
+++ maven/continuum/trunk/continuum-core-it/it_utils.py Mon May 16 14:36:35 2005
@@ -210,6 +210,13 @@
 
     return build
 
+def waitForSuccessfulCheckOut( projectId ):
+    project = waitForCheckOut( projectId )
+
+    assertEquals( "The check out was not successful for project #" + project.id, continuum.STATE_NEW,
project.state )
+
+    return project
+
 def waitForCheckOut( projectId ):
     timeout = 60
     sleepInterval = 0.1
@@ -224,8 +231,6 @@
         if ( timeout <= 0 ):
             fail( "Timeout while waiting for checkout (project id=%(id)s) to complete" %
{ "id" : project.id } )
 
-    assertEquals( "The check out was not successful for project #" + project.id, continuum.STATE_NEW,
project.state )
-
     return project
 
 def cleanDirectory( dir ):
@@ -258,10 +263,8 @@
 
     return projectIds[ 0 ]
 
-def initMaven1Project( basedir, scm, cvsroot, artifactId ):
-    cleanDirectory( basedir )
-    os.makedirs( basedir )
-    pom = file( basedir + "/project.xml", "w+" )
+def writeMavenOnePom( filename, artifactId, scmUrl, email ):
+    pom = file( basedir + "/" + filename, "w+" )
     pom.write( """
 <project>
   <pomVersion>3</pomVersion>
@@ -278,11 +281,15 @@
 </project>
 """ % {
         "artifactId" : artifactId,
-        "scm" : scm,
-        "scmUrl" : makeScmUrl( scm, cvsroot, artifactId ),
+        "scmUrl" : scmUrl,
         "email" : email
       } )
     pom.close()
+
+def initMaven1Project( basedir, scm, cvsroot, artifactId ):
+    cleanDirectory( basedir )
+    os.makedirs( basedir )
+    writeMavenOnePom( basedir + "/project.xml", artifactId, makeScmUrl( scm, cvsroot, artifactId
), email )
 
     os.makedirs( basedir + "/src/main/java" )
     foo = file( basedir + "/src/main/java/Foo.java", "w+" )

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
Mon May 16 14:36:35 2005
@@ -55,6 +55,7 @@
 import org.apache.maven.continuum.scm.queue.CheckOutTask;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
+
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
@@ -63,7 +64,6 @@
 import org.codehaus.plexus.taskqueue.TaskQueue;
 import org.codehaus.plexus.taskqueue.TaskQueueException;
 import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
 
 /**
@@ -179,27 +179,6 @@
     public Collection addProjectsFromUrl( URL url, String executorId )
         throws ContinuumException
     {
-        File pomFile;
-
-        try
-        {
-            String pom = IOUtil.toString( url.openStream() );
-
-            pomFile = File.createTempFile( "continuum-", "-pom-download" );
-
-            pomFile.deleteOnExit();
-
-            FileUtils.fileWrite( pomFile.getAbsolutePath(), pom );
-        }
-        catch ( IOException ex )
-        {
-            logAndCreateException( "Error while downloading the pom.", ex );
-        }
-
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
         ContinuumProjectBuilder projectBuilder = getProjectBuilder( executorId );
 
         ContinuumProjectBuildingResult result;
@@ -319,7 +298,7 @@
         }
         catch ( ContinuumScmException e )
         {
-            logAndCreateException( "Error while updating project.", e );
+            throw logAndCreateException( "Error while updating project.", e );
         }
 
         updateProjectFromCheckOut( project );
@@ -364,7 +343,7 @@
         }
         catch ( ContinuumStoreException ex )
         {
-            logAndCreateException( "Error while removing project.", ex );
+            throw logAndCreateException( "Error while removing project.", ex );
         }
     }
 
@@ -842,7 +821,7 @@
         }
         catch ( ContinuumBuildExecutorException e )
         {
-            logAndCreateException( "Error while updating project from check out.", e);
+            throw logAndCreateException( "Error while updating project from check out.",
e);
         }
 
         // ----------------------------------------------------------------------
@@ -881,9 +860,9 @@
         {
             if ( !wdFile.isDirectory() )
             {
-                String msg = "The specified working directory isn't a directory: " + "'"
+ 
+                String msg = "The specified working directory isn't a directory: " + "'"
+
                     wdFile.getAbsolutePath() + "'.";
-                
+
                 getLogger().error( msg );
                 throw new InitializationException( msg );
             }
@@ -892,7 +871,7 @@
         {
             if ( !wdFile.mkdirs() )
             {
-                String msg = "Could not making the working directory: " + "'" + 
+                String msg = "Could not making the working directory: " + "'" +
                     wdFile.getAbsolutePath() + "'." ;
 
                 getLogger().error( msg );
@@ -930,15 +909,15 @@
         {
             if ( !file.exists() )
             {
-                
-                    initializeStore( file );                
+
+                    initializeStore( file );
             }
             else
             {
                 properties.load( new FileInputStream( file ) );
-    
+
                 String state = properties.getProperty( DATABASE_INITIALIZED );
-    
+
                 if ( !state.equals( "true" ) )
                 {
                     initializeStore( file );
@@ -949,7 +928,7 @@
         {
             throw new StartingException( "Couldn't initialize store,", e );
         }
-        
+
         // ----------------------------------------------------------------------
         //
         // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
Mon May 16 14:36:35 2005
@@ -50,8 +50,6 @@
     {
         ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();
 
-        getLogger().info( "Downloading " + url.toExternalForm() );
-
         File pomFile = createMetadataFile( url );
 
         MavenOneProject project = new MavenOneProject();

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
Mon May 16 14:36:35 2005
@@ -24,6 +24,7 @@
 import org.apache.maven.continuum.scm.ContinuumScmException;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.maven.scm.manager.NoSuchScmProviderException;
 
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.taskqueue.Task;
@@ -68,7 +69,11 @@
             throw new TaskExecutionException( "Error while reading the project from the store.",
e );
         }
 
-        CheckOutScmResult result;
+        CheckOutScmResult result = null;
+
+        String errorMessage = null;
+
+        Throwable exception = null;
 
         try
         {
@@ -76,12 +81,26 @@
         }
         catch ( ContinuumScmException e )
         {
-            throw new TaskExecutionException( "Error while reading the project from the store.",
e );
+            // TODO: Dissect the scm exception to be able to give better feedback
+            Throwable cause = e.getCause();
+
+            if ( cause instanceof NoSuchScmProviderException )
+            {
+                errorMessage = cause.getMessage();
+            }
+            else
+            {
+                exception = e;
+            }
+        }
+        catch( Throwable e )
+        {
+            exception = e;
         }
 
         try
         {
-            store.setCheckoutDone( projectId, result );
+            store.setCheckoutDone( projectId, result, errorMessage, exception );
         }
         catch ( ContinuumStoreException e )
         {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
Mon May 16 14:36:35 2005
@@ -38,6 +38,7 @@
 
 import org.codehaus.plexus.jdo.JdoFactory;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -600,30 +601,10 @@
     //
     // ----------------------------------------------------------------------
 
-//    public void setBuildSignalled( String projectId )
-//        throws ContinuumStoreException
-//    {
-//        try
-//        {
-//            store.begin();
-//
-//            ContinuumProject project = store.getContinuumProject( projectId, false );
-//
-//            projectStateGuard.assertTransition( project, ContinuumProjectState.BUILD_SIGNALED
);
-//
-//            project.setState( ContinuumProjectState.BUILD_SIGNALED );
-//
-//            store.commit();
-//        }
-//        catch ( Exception e )
-//        {
-//            rollback( store );
-//
-//            throw new ContinuumStoreException( "Error while setting project state: '" +
projectId + "'.", e );
-//        }
-//    }
-
-    public void setCheckoutDone( String projectId, CheckOutScmResult scmResult )
+    public void setCheckoutDone( String projectId,
+                                 CheckOutScmResult scmResult,
+                                 String errorMessage,
+                                 Throwable exception )
         throws ContinuumStoreException
     {
         try
@@ -634,7 +615,10 @@
 
             int state;
 
-            if ( scmResult.isSuccess() )
+            if ( scmResult != null &&
+                 scmResult.isSuccess() &&
+                 StringUtils.isEmpty( errorMessage ) &&
+                 exception == null )
             {
                 state = ContinuumProjectState.NEW;
             }
@@ -648,6 +632,10 @@
             project.setState( state );
 
             project.setCheckOutScmResult( scmResult );
+
+            project.setCheckOutErrorMessage( errorMessage );
+
+            project.setCheckOutErrorException( throwableToString( exception ) );
 
             store.commit();
         }

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
Mon May 16 14:36:35 2005
@@ -36,7 +36,6 @@
 
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.jdo.JdoFactory;
-import org.codehaus.plexus.util.FileUtils;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -234,7 +233,7 @@
 
         checkOutScmResult.setSuccess( true );
 
-        store.setCheckoutDone( projectId, checkOutScmResult );
+        store.setCheckoutDone( projectId, checkOutScmResult, null, null );
 
         project = store.getProject( projectId );
 
@@ -648,7 +647,7 @@
 
         checkOutScmResult.setSuccess( true );
 
-        store.setCheckoutDone( projectId, checkOutScmResult );
+        store.setCheckoutDone( projectId, checkOutScmResult, null, null );
 
         ContinuumProject project = store.getProject( projectId );
 

Modified: maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Mon May 16 14:36:35
2005
@@ -89,6 +89,16 @@
             <type>CheckOutScmResult</type>
           </association>
         </field>
+        <field>
+          <name>checkOutErrorMessage</name>
+          <version>1.0.0</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>checkOutErrorException</name>
+          <version>1.0.0</version>
+          <type>String</type>
+        </field>
       </fields>
     </class>
 

Modified: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/CallApplicationModel.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/CallApplicationModel.java?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/CallApplicationModel.java
(original)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/CallApplicationModel.java
Mon May 16 14:36:35 2005
@@ -16,15 +16,16 @@
  * limitations under the License.
  */
 
-import ognl.Ognl;
-import org.codehaus.plexus.action.AbstractAction;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.codehaus.plexus.action.AbstractAction;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+
+import ognl.Ognl;
+
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id: Login.java,v 1.1 2005/04/01 00:11:34 jvanzyl Exp $
@@ -60,7 +61,6 @@
     // ----------------------------------------------------------------------
 
     public void initialize()
-        throws Exception
     {
         callMap = new HashMap();
 

Modified: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/context/DefaultViewContextPopulator.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/context/DefaultViewContextPopulator.java?rev=170457&r1=170456&r2=170457&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/context/DefaultViewContextPopulator.java
(original)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/context/DefaultViewContextPopulator.java
Mon May 16 14:36:35 2005
@@ -75,7 +75,6 @@
     }
 
     public void initialize()
-        throws Exception
     {
         viewMap = new HashMap();
 



Mime
View raw message