continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r417813 - in /maven/continuum/trunk: continuum-core-it/continuum.py continuum-core-it/continuum_cli.py continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java
Date Wed, 28 Jun 2006 16:38:18 GMT
Author: trygvis
Date: Wed Jun 28 09:38:17 2006
New Revision: 417813

URL: http://svn.apache.org/viewvc?rev=417813&view=rev
Log:
Fixing CONTINUUM-735: XmlRpc does not expose getBuildOutput.
Submitted by Andrew Williams. Thanks for your work!
o Added getBuildOutput
o Removed all scm related code and replace with the now-compliant new code (according to the
.mdo)
o Tidy intents and remove extra debug
o Fix continuum_cli.py to work with all my changes so far, removing old code that has been
replaced

Modified:
    maven/continuum/trunk/continuum-core-it/continuum.py
    maven/continuum/trunk/continuum-core-it/continuum_cli.py
    maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java

Modified: maven/continuum/trunk/continuum-core-it/continuum.py
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core-it/continuum.py?rev=417813&r1=417812&r2=417813&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/continuum.py (original)
+++ maven/continuum/trunk/continuum-core-it/continuum.py Wed Jun 28 09:38:17 2006
@@ -137,24 +137,14 @@
 
         return builds
 
-#    def getBuildResultForBuild( self, buildId ):
-#        result = checkResult( self.server.continuum.getBuildResultForBuild( buildId ) )
-#
-#        buildResult = result[ "buildResult" ]
-#
-#        if ( len( buildResult ) == 0 ):
-#            return None
-#
-#        return BuildResult( buildResult )
+    def getBuildOutput( self, projectId, buildId ):
+        return checkResult( self.server.continuum.getBuildOutput( projectId, buildId ) )[
"buildOutput" ]
 
     def getChangedFilesForBuild( self, buildId ):
-        result = checkResult( self.server.continuum.getBuildResultForBuild( buildId ) )
+        result = checkResult( self.server.continuum.getBuild( buildId ) )
+        scmResult = ScmResult( result[ "scmResult" ] )
 
-        changedFiles = []
-        for changedFile in result[ "changedFiles" ]:
-            changedFiles.append( ScmFile( changedFile ) )
-
-        return changedFiles
+        return scmResult.changes
 
     ####################################################################
     # Maven 2.x projects
@@ -253,21 +243,6 @@
         else:
             self.commandLineArguments = ""
 
-#        self.configuration = map[ "configuration" ]
-
-        if ( map.has_key( "checkOutScmResult" ) ):
-            self.checkOutScmResult = CheckOutScmResult( map[ "checkOutScmResult" ] )
-        else:
-            self.checkOutScmResult = None
-        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
-
         self.dependencies = list()
         if ( map.has_key( "dependencies" ) ):
             for f in map[ "dependencies" ]:
@@ -326,7 +301,6 @@
 
         if ( map == None ):
             return
-        print map 
 #        self.executable = map[ "executable" ]
 #        self.targets = map[ "goals" ]
 
@@ -350,13 +324,10 @@
 
 class Build:
     def __init__( self, map ):
-        print map
         map[ "totalTime" ] = int( map[ "endTime" ] )/ 1000 - int( map[ "startTime" ] ) /
1000
-        map[ "startTime" ] = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime( int( map[ "startTime"
] ) / 1000 ) )
-        map[ "endTime" ] = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime( int( map[ "endTime"
] ) / 1000 ) )
 
         self.id = map[ "id" ]
-	self.buildNumber = map[ "buildNumber" ]
+        self.buildNumber = map[ "buildNumber" ]
         if self.buildNumber == '0':
             self.buildNumber = ''
         self.state = int( map[ "state" ] )
@@ -364,18 +335,18 @@
             self.forced = map[ "trigger" ] == Continuum.TRIGGER_FORCED
             self.trigger = int( map[ "trigger" ] )
         else:
-            self.forced = false
+            self.forced = False
             self.trigger = 0
 
-        self.startTime = map[ "startTime" ]
-        self.endTime = map[ "endTime" ]
+        self.startTime = gmtime( int( map[ "startTime" ] ) / 1000 )
+        self.endTime = gmtime( int( map[ "endTime" ] ) / 1000 )
         self.totalTime = map[ "totalTime" ]
         self.error = map.get( "error" )
         self.map = map
-        if ( map.has_key( "updateScmResult" ) ):
-            self.updateScmResult = UpdateScmResult( map[ "updateScmResult" ] )
+        if ( map.has_key( "scmResult" ) ):
+            self.scmResult = ScmResult( map[ "scmResult" ] )
         else:
-            self.updateScmResult = None
+            self.scmResult = None
 
         if ( self.error == None ):
             self.error = ""
@@ -395,7 +366,7 @@
     def __str__( self ):
         s = "Id: " + self.id + os.linesep +\
             "State: " + decodeState( self.state ) + os.linesep +\
-            "End time: " + self.endTime + os.linesep +\
+            "End time: " + strftime( "%a, %d %b %Y %H:%M:%S +0000", self.endTime ) + os.linesep
+\
             "Build time: " + self.totalTime + os.linesep
 
         if ( self.error != "" ):
@@ -424,6 +395,11 @@
         else:
             self.commandOutput = ""
 
+        self.changes = list()
+        if ( map.has_key( "changes" ) ):
+            for f in map[ "changes" ]:
+                self.changes.append( ChangeSet( f ) )
+
     def __str__( self ):
         value = "Success: " + str( self.success ) + os.linesep +\
                 "Provider Message: " + self.providerMessage + os.linesep +\
@@ -431,49 +407,33 @@
 
         return value
 
-class CheckOutScmResult( ScmResult ):
+class ChangeSet:
     def __init__( self, map ):
         self.map = map
-        ScmResult.__init__( self, map )
-        self.checkedOutFiles = list()
-
-        for f in map[ "checkedOutFiles" ]:
-            self.checkedOutFiles.append( ScmFile( f ) )
+        self.author = map[ "author" ]
+        self.comment = map[ "comment" ]
+        self.date = gmtime( int( map[ "date" ] ) / 1000 )
+
+        self.files = list()
+        for f in map[ "files" ]:
+            self.files.append( ChangeFile( f ) )
 
     def __str__( self ):
-        value = ScmResult.__str__( self ) + os.linesep
-
-        value += "Checked out files: " + os.linesep
-        for f in self.checkedOutFiles:
-            value += " " + f.path + os.linesep
+        value = "Author: " + self.author + os.linesep +\
+                "Comment: " + self.comment
 
         return value
 
-class UpdateScmResult( ScmResult ):
+class ChangeFile:
     def __init__( self, map ):
         self.map = map
-        ScmResult.__init__( self, map )
-        self.updatedFiles = list()
-
-        for f in map[ "updatedFiles" ]:
-            self.updatedFiles.append( ScmFile( f ) )
+        self.name = map[ "name" ]
+        self.revision = map[ "revision" ]
 
     def __str__( self ):
-        value = ScmResult.__str__( self ) + os.linesep
-
-        value += "Updated files: " + os.linesep
-        if ( len( self.updatedFiles ) > 0):
-            for f in self.updatedFiles:
-                value += " " + f.path + os.linesep
-        else:
-            value += " No files updated"
+        value = "File: " + self.name + " (" + self.revision + ")"
 
         return value
-
-class ScmFile:
-    def __init__( self, map ):
-        self.map = map
-        self.path = map[ "path" ]
 
 class ContinuumDependency:
     def __init__( self, map ):

Modified: maven/continuum/trunk/continuum-core-it/continuum_cli.py
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core-it/continuum_cli.py?rev=417813&r1=417812&r2=417813&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/continuum_cli.py (original)
+++ maven/continuum/trunk/continuum-core-it/continuum_cli.py Wed Jun 28 09:38:17 2006
@@ -2,6 +2,7 @@
 
 import cli
 import continuum
+import time
 
 ##########################################################
 # Build your commands in this class.  Each method that
@@ -75,24 +76,13 @@
         print "Executor type:      " + project.executorId
         print "SCM URL:            " + project.scmUrl
 
-        if ( not isEmpty( project.checkOutErrorMessage ) or not isEmpty( project.checkOutErrorException
) ):
-            print ""
-            print "There was a error while checking out the project:"
-            if ( project.checkOutErrorMessage != None ):
-                print "Error message: " + project.checkOutErrorMessage
-            if ( project.checkOutErrorException != None ):
-                print "Exception: " + project.checkOutErrorException
-        else:
-            print ""
-            print project.checkOutScmResult
-
-            builds = c.getBuildsForProject( int( project.id ) )
-            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
+        builds = c.getBuildsForProject( int( project.id ) )
+        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
|" % { 'id': build.id, 'state': build.state, 'startTime' : time.strftime( "%a, %d %b %Y %H:%M:%S
+0000", build.startTime ), 'endTime': time.strftime( "%a, %d %b %Y %H:%M:%S +0000", build.endTime
), 'totalTime': build.totalTime }
 
         print ""
         print "Notifiers:"
@@ -130,7 +120,7 @@
     def do_showBuild( self, args ):
         """Shows the result of a build."""
 
-        build = c.getBuild( args[ 0 ] );
+        build = c.getBuild( int( args[ 0 ] ) )
 
         print build
 

Modified: maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java?rev=417813&r1=417812&r2=417813&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java
Wed Jun 28 09:38:17 2006
@@ -146,6 +146,20 @@
         }
     }
 
+    public Hashtable getBuildOutput( int projectId, int buildId )
+    {
+        try
+        {
+            String output = continuum.getBuildOutput( projectId, buildId );
+
+            return makeHashtable( "buildOutput", output );
+        }
+        catch ( Throwable e )
+        {
+            return handleException( "ContinuumXmlRpc.getBuildOutput()", "Project id: '" +
projectId + "' Build id: '" + buildId + "'.", e );
+        }
+    }
+
     // ----------------------------------------------------------------------
     // Build handling
     // ----------------------------------------------------------------------



Mime
View raw message