continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r165048 - /maven/continuum/trunk/continuum-core /maven/continuum/trunk/continuum-core-it /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm /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-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc
Date Wed, 27 Apr 2005 21:06:58 GMT
Author: trygvis
Date: Wed Apr 27 14:06:57 2005
New Revision: 165048

URL: http://svn.apache.org/viewcvs?rev=165048&view=rev
Log:
o Finalizing CONTINUUM-60.
o Added tests to the integration test.
o Removing "ContinuumBuildResult.updatedFiles", it's replaced with the UpdateScmResult.

Modified:
    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/pom.xml
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ContinuumStore.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-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java
    maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultXmlRpcHelper.java

Modified: maven/continuum/trunk/continuum-core-it/continuum.py
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/continuum.py?rev=165048&r1=165047&r2=165048&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/continuum.py (original)
+++ maven/continuum/trunk/continuum-core-it/continuum.py Wed Apr 27 14:06:57 2005
@@ -89,7 +89,7 @@
     for build in result[ "builds" ]:
         builds.append( Build( build ) )
 
-    return builds;
+    return builds
 
 def getBuild( buildId ):
     result = checkResult( server.continuum.getBuild( buildId ) )
@@ -116,6 +116,7 @@
         self.version = map[ "version" ]
         self.builderId = map[ "builderId" ]
         self.configuration = map[ "configuration" ]
+        self.checkOutScmResult = CheckOutScmResult( map[ "checkOutScmResult" ] )
 
     def __str__( self ):
         str = "id: " + self.id + os.linesep +\
@@ -123,7 +124,8 @@
               "nagEmailAddress: " + self.nagEmailAddress + os.linesep +\
               "state: " + self.state + os.linesep +\
               "version: " + self.version + os.linesep +\
-              "builder id: " + self.builderId + os.linesep
+              "builder id: " + self.builderId + os.linesep +\
+              "check out ok: " + self.checkOutResult.success + os.linesep
 
         if ( len( self.configuration.keys() ) > 0 ):
             conf = ""
@@ -147,6 +149,10 @@
         self.totalTime = map[ "totalTime" ]
         self.error = map.get( "error" )
         self.map = map
+        if ( map.has_key( "updateScmResult" ) ):
+            self.updateScmResult = UpdateScmResult( map[ "updateScmResult" ] )
+        else:
+            self.updateScmResult = None
 
         if ( self.error == None ):
             self.error = ""
@@ -159,7 +165,9 @@
 State: %(state)s
 Start time: %(startTime)s
 End time: %(endTime)s
-Build time: %(totalTime)ss""" % map
+Build time: %(totalTime)ss
+""" % map
+
         if ( self.error != "" ):
             value += "Error: %(error)s" % map
 
@@ -170,7 +178,7 @@
         # This is the common stuff between all ContinuumBuildResult objects
         self.success = map[ "success" ] == "true"
         self.buildExecuted = map[ "buildExecuted" ] == "true"
-        self.changedFiles = map[ "changedFiles" ]
+        #self.changedFiles = map[ "changedFiles" ]
 
         # These fields just happen to be the same for all the build results
         if ( self.buildExecuted ):
@@ -192,3 +200,69 @@
                    value += os.linesep + "Standard error: " + self.standardError
 
         return value
+
+class ScmResult:
+    def __init__( self, map ):
+        self.map = map
+        self.success = map[ "success" ] == "true"
+
+        if ( map.has_key( "providerMessage" ) ):
+            self.providerMessage = map[ "providerMessage" ]
+        else:
+            self.providerMessage = ""
+
+        if ( map.has_key( "commandOutput" ) ):
+            self.commandOutput = map[ "commandOutput" ]
+        else:
+            self.commandOutput = ""
+
+    def __str__( self ):
+        value = "Success: " + str( self.success ) + os.linesep +\
+                 "Provider Message: " + self.providerMessage + os.linesep +\
+                 "Command output: " + self.commandOutput
+
+        return value
+
+class CheckOutScmResult( ScmResult ):
+    def __init__( self, map ):
+        self.map = map
+        ScmResult.__init__( self, map )
+        self.checkedOutFiles = list()
+
+        for file in map[ "checkedOutFiles" ]:
+            self.checkedOutFiles.append( ScmFile( file ) )
+
+    def __str__( self ):
+        value = ScmResult.__str__( self ) + os.linesep
+
+        value += "Checked out files: " + os.linesep
+        for file in self.checkedOutFiles:
+            value += " " + file.path + os.linesep
+
+        return value
+
+class UpdateScmResult( ScmResult ):
+    def __init__( self, map ):
+        self.map = map
+        ScmResult.__init__( self, map )
+        self.updatedFiles = list()
+
+        for file in map[ "updatedFiles" ]:
+            self.updatedFiles.append( ScmFile( file ) )
+
+    def __str__( self ):
+        value = ScmResult.__str__( self ) + os.linesep
+
+        value += "Updated files: " + os.linesep
+        if ( len( self.updatedFiles ) > 0):
+            for file in self.updatedFiles:
+                value += " " + file.path + os.linesep
+        else:
+            value += " No files updated"
+
+        return value
+
+class ScmFile:
+    def __init__( self, map ):
+        self.map = map
+        self.path = map[ "path" ]

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=165048&r1=165047&r2=165048&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/continuum_cli.py (original)
+++ maven/continuum/trunk/continuum-core-it/continuum_cli.py Wed Apr 27 14:06:57 2005
@@ -58,7 +58,10 @@
 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():
@@ -95,6 +98,11 @@
         build = continuum.getBuild( args[ 0 ] );
 
         print build
+
+        if ( build.updateScmResult != None and len( build.updateScmResult.updatedFiles )
> 0 ):
+            print "Updated files:"
+            print build.updateScmResult
+        print ""
 
         buildResult = continuum.getBuildResult( args[ 0 ] );
 

Modified: maven/continuum/trunk/continuum-core-it/it.py
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/it.py?rev=165048&r1=165047&r2=165048&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/it.py (original)
+++ maven/continuum/trunk/continuum-core-it/it.py Wed Apr 27 14:06:57 2005
@@ -62,6 +62,28 @@
     assertEquals( "project.version", version, project.version )
     assertEquals( "project.builderId", builderId, project.builderId )
 
+def assertCheckedOutFiles( project, expectedCheckedOutFiles ):
+    actualCheckedOutFiles = project.checkOutScmResult.checkedOutFiles
+    if ( len( expectedCheckedOutFiles ) != len( actualCheckedOutFiles ) ):
+        print "Expected files: "
+        for expectedFile in expectedCheckedOutFiles:
+            print " " + expectedFile.path
+
+        print "Actual files: "
+        for actualFile in actualCheckedOutFiles:
+            print " " + actualFile.path
+
+    assertEquals( "The expected and actual lists of checked out files doesn't have the same
length.", 
+                  len( expectedCheckedOutFiles ),
+                  len( actualCheckedOutFiles ) )
+
+    i = 0
+    for expectedFile in expectedCheckedOutFiles:
+        actualFile = actualCheckedOutFiles[ i ]
+        i += 1
+
+        assertEquals( "File #" + str( i ) + " doesn't match the expected path.", expectedFile,
actualFile.path )
+
 def assertSuccessfulNoBuildPerformed( buildId ):
     build = waitForBuild( buildId )
     assertEquals( "The build wasn't successful.", continuum.STATE_OK, build.state )
@@ -111,6 +133,7 @@
     assertEquals( "Standard error wasn't empty.", 0, len( buildResult.standardError ) )
 
 def removeProject( projectId ):
+    return
     continuum.removeProject( projectId )
 
     map = continuum.server.continuum.getProject( projectId )
@@ -122,8 +145,6 @@
 def execute( workingDirectory, command ):
     cwd = os.getcwd()
     os.chdir( workingDirectory )
-#    print "workingDirectory: " + workingDirectory
-#    print "command: " + command
     file = os.popen( command )
     os.chdir( cwd )
 
@@ -317,6 +338,7 @@
     maven1Id = continuum.addProjectFromUrl( "file:" + maven1Project + "/project.xml", "maven-1"
)
     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" ] )
 
     progress( "Building Maven 1 project" )
     buildId = continuum.buildProject( maven1.id )

Modified: maven/continuum/trunk/continuum-core/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/pom.xml?rev=165048&r1=165047&r2=165048&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/pom.xml (original)
+++ maven/continuum/trunk/continuum-core/pom.xml Wed Apr 27 14:06:57 2005
@@ -129,6 +129,12 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>xml-apis</groupId>
+      <artifactId>xml-apis</artifactId>
+      <version>2.0.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>xerces</groupId>
       <artifactId>xercesImpl</artifactId>
       <version>2.6.2</version>

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=165048&r1=165047&r2=165048&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Wed Apr 27 14:06:57 2005
@@ -709,7 +709,9 @@
 
             store.setWorkingDirectory( projectId, projectWorkingDirectory.getAbsolutePath()
);
 
-            scm.checkOutProject( project );
+            CheckOutScmResult result = scm.checkOutProject( project );
+
+            store.setProjectCheckOutScmResult( projectId, result );
 
             project = store.getProject( projectId );
 
@@ -759,16 +761,10 @@
         try
         {
             CheckOutScmResult result = scm.checkOut( project, checkoutDirectory);
-
-            store.setProjectCheckOutScmResult( project.getId(), result );
         }
         catch ( ContinuumScmException e )
         {
             throw new ContinuumException( "Error while checking out the project.", e );
-        }
-        catch ( ContinuumStoreException e )
-        {
-            throw new ContinuumException( "Error while storing the scm result.", e );
         }
     }
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=165048&r1=165047&r2=165048&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
Wed Apr 27 14:06:57 2005
@@ -17,9 +17,7 @@
  */
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.List;
 
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.builder.ContinuumBuilder;
@@ -29,7 +27,6 @@
 import org.apache.maven.continuum.project.ContinuumBuildResult;
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.project.ContinuumProjectState;
-import org.apache.maven.continuum.project.ScmFile;
 import org.apache.maven.continuum.scm.ContinuumScm;
 import org.apache.maven.continuum.scm.UpdateScmResult;
 import org.apache.maven.continuum.store.ContinuumStore;
@@ -261,23 +258,6 @@
 
             result.setBuildExecuted( false );
         }
-
-        List scmFiles = scmResult.getUpdatedFiles();
-
-        List files = new ArrayList( scmFiles.size() );
-
-        for ( Iterator it = scmFiles.iterator(); it.hasNext(); )
-        {
-            org.apache.maven.scm.ScmFile scmFile = (org.apache.maven.scm.ScmFile) it.next();
-
-            ScmFile file = new ScmFile();
-
-            file.setPath( scmFile.getPath() );
-
-            files.add( file );
-        }
-
-        result.setChangedFiles( files );
 
         return result;
     }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java?rev=165048&r1=165047&r2=165048&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
Wed Apr 27 14:06:57 2005
@@ -17,6 +17,7 @@
  */
 
 import java.io.File;
+import java.util.Iterator;
 
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.scm.ScmException;
@@ -178,7 +179,16 @@
 
         result.setProviderMessage( scmResult.getProviderMessage() );
 
-        result.setChekedOutFiles( scmResult.getCheckedOutFiles() );
+        for ( Iterator it = scmResult.getCheckedOutFiles().iterator(); it.hasNext(); )
+        {
+            org.apache.maven.scm.ScmFile scmFile = (org.apache.maven.scm.ScmFile) it.next();
+
+            ScmFile file = new ScmFile();
+
+            file.setPath( scmFile.getPath() );
+
+            result.addCheckedOutFile( file );
+        }
 
         return result;
     }
@@ -193,7 +203,16 @@
 
         result.setProviderMessage( scmResult.getProviderMessage() );
 
-        result.setUpdatedFiles( scmResult.getUpdatedFiles() );
+        for ( Iterator it = scmResult.getUpdatedFiles().iterator(); it.hasNext(); )
+        {
+            org.apache.maven.scm.ScmFile scmFile = (org.apache.maven.scm.ScmFile) it.next();
+
+            ScmFile file = new ScmFile();
+
+            file.setPath( scmFile.getPath() );
+
+            result.addUpdatedFile( file );
+        }
 
         return result;
     }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=165048&r1=165047&r2=165048&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
Wed Apr 27 14:06:57 2005
@@ -78,6 +78,9 @@
     ContinuumProject getProjectByBuild( String buildId )
         throws ContinuumStoreException;
 
+    CheckOutScmResult getCheckOutScmResultForProject( String projectId )
+        throws ContinuumStoreException;
+
     // ----------------------------------------------------------------------
     // Build
     // ----------------------------------------------------------------------

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=165048&r1=165047&r2=165048&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
Wed Apr 27 14:06:57 2005
@@ -31,8 +31,8 @@
 import org.apache.maven.continuum.project.ContinuumJPoxStore;
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.project.ContinuumProjectState;
-import org.apache.maven.continuum.project.ScmFile;
 import org.apache.maven.continuum.scm.CheckOutScmResult;
+import org.apache.maven.continuum.scm.ScmFile;
 import org.apache.maven.continuum.scm.UpdateScmResult;
 
 import org.codehaus.plexus.jdo.JdoFactory;
@@ -142,13 +142,13 @@
                 }
 
 //                System.err.println( "result.getChangedFiles()" );
-                List changedFiles = result.getChangedFiles();
+//                List changedFiles = result.getChangedFiles();
 
 //                System.err.println( "changedFiles.clear()" );
-                changedFiles.clear();
+//                changedFiles.clear();
 
 //                System.err.println( "pm.deletePersistentAll( changedFiles )" );
-                pm.deletePersistentAll( changedFiles );
+//                pm.deletePersistentAll( changedFiles );
 
 //                System.err.println( "result.setBuild( null )" );
                 result.setBuild( null );
@@ -344,6 +344,52 @@
         }
     }
 
+    public CheckOutScmResult getCheckOutScmResultForProject( String projectId )
+        throws ContinuumStoreException
+    {
+        try
+        {
+            store.begin();
+
+            ContinuumProject project = store.getContinuumProject( projectId, false );
+
+            if ( project.getCheckOutScmResult() == null )
+            {
+                store.commit();
+
+                return null;
+            }
+
+            PersistenceManager pm = JDOHelper.getPersistenceManager( project );
+
+            CheckOutScmResult result = project.getCheckOutScmResult();
+
+            pm.retrieve( result );
+
+            pm.makeTransient( result );
+
+            pm.retrieveAll( result.getCheckedOutFiles(), false );
+
+            pm.makeTransientAll( result.getCheckedOutFiles() );
+
+            store.commit();
+
+            for ( Iterator it = result.getCheckedOutFiles().iterator(); it.hasNext(); )
+            {
+                ScmFile scmFile = (ScmFile) it.next();
+                System.err.println( "scmfile.path: " + scmFile.getPath() );
+            }
+
+            return result;
+        }
+        catch ( Exception e )
+        {
+            rollback( store );
+
+            throw new ContinuumStoreException( "Error while getting build result.", e );
+        }
+    }
+
     // ----------------------------------------------------------------------
     // Build
     // ----------------------------------------------------------------------
@@ -526,9 +572,10 @@
             ContinuumBuildResult result = store.getContinuumBuildResultByJdoId( id, false
);
 
             // TODO: Having to copy the objects feels a /bit/ strange.
+
             List changedFiles = new ArrayList();
 
-            for ( Iterator it = result.getChangedFiles().iterator(); it.hasNext(); )
+            for ( Iterator it = build.getUpdateScmResult().getUpdatedFiles().iterator();
it.hasNext(); )
             {
                 ScmFile scmFile = (ScmFile) it.next();
 
@@ -560,7 +607,7 @@
 
             ContinuumBuild build = store.getContinuumBuild( buildId, false );
 
-            build.setScmResult( scmResult );
+            build.setUpdateScmResult( scmResult );
 
             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=165048&r1=165047&r2=165048&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
Wed Apr 27 14:06:57 2005
@@ -29,7 +29,8 @@
 import org.apache.maven.continuum.project.ContinuumJPoxStore;
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.project.ContinuumProjectState;
-import org.apache.maven.continuum.project.ScmFile;
+import org.apache.maven.continuum.scm.ScmFile;
+import org.apache.maven.continuum.scm.UpdateScmResult;
 
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.jdo.JdoFactory;
@@ -354,13 +355,17 @@
 
         String buildId = store.createBuild( projectId );
 
-        ContinuumBuildResult result = new ShellBuildResult();
+        UpdateScmResult updateScmResult = new UpdateScmResult();
 
         ScmFile file = new ScmFile();
 
         file.setPath( "foo" );
 
-        result.addChangedFile( file );
+        updateScmResult.addUpdatedFile( file );
+
+        store.setBuildUpdateScmResult( buildId, updateScmResult );
+
+        ContinuumBuildResult result = new ShellBuildResult();
 
         store.setBuildResult( buildId, ContinuumProjectState.OK, result, null );
 

Modified: maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java?rev=165048&r1=165047&r2=165048&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 Apr 27 14:06:57 2005
@@ -26,6 +26,9 @@
 import java.util.Vector;
 
 import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.scm.CheckOutScmResult;
+import org.apache.maven.continuum.scm.UpdateScmResult;
+import org.apache.maven.continuum.scm.ScmFile;
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumBuildResult;
 import org.apache.maven.continuum.project.ContinuumProject;
@@ -73,8 +76,12 @@
         }
     }
 
-    public Hashtable addProjectFromScm( String scmUrl, String builderType, String projectName,
String nagEmailAddress,
-                                     String version, Hashtable configuration )
+    public Hashtable addProjectFromScm( String scmUrl,
+                                        String builderType,
+                                        String projectName,
+                                        String nagEmailAddress,
+                                        String version,
+                                        Hashtable configuration )
     {
         try
         {
@@ -87,7 +94,11 @@
                 configurationProperties.put( entry.getKey().toString(), entry.getValue().toString()
);
             }
 
-            String projectId = continuum.addProjectFromScm( scmUrl, builderType, projectName,
nagEmailAddress, version,
+            String projectId = continuum.addProjectFromScm( scmUrl,
+                                                            builderType,
+                                                            projectName,
+                                                            nagEmailAddress,
+                                                            version,
                                                             configurationProperties );
 
             return makeHashtable( "projectId", projectId );
@@ -123,6 +134,13 @@
 
             hashtable.put( "configuration", configurationHashtable );
 
+            CheckOutScmResult result = store.getCheckOutScmResultForProject( projectId );
+
+            if ( result != null )
+            {
+                hashtable.put( "checkOutScmResult", xmlRpcHelper.objectToHashtable( result
) );
+            }
+
             return makeHashtable( "project", hashtable );
         }
         catch ( Throwable e )
@@ -235,7 +253,16 @@
             {
                 ContinuumBuild continuumBuild = (ContinuumBuild) it.next();
 
-                builds.add( xmlRpcHelper.objectToHashtable( continuumBuild, excludedProperties
) );
+                Hashtable build = xmlRpcHelper.objectToHashtable( continuumBuild, excludedProperties
);
+
+                UpdateScmResult result = continuumBuild.getUpdateScmResult();
+
+                if ( result != null )
+                {
+                    build.put( "updateScmResult", xmlRpcHelper.objectToHashtable( result
) );
+                }
+
+                builds.add( build );
             }
 
             return makeHashtable( "builds", builds );
@@ -250,15 +277,23 @@
     {
         try
         {
-            ContinuumBuild build = store.getBuild( buildId );
+            ContinuumBuild continuumBuild = store.getBuild( buildId );
 
             Set excludedProperties = new HashSet();
 
             excludedProperties.add( "project" );
 
-            excludedProperties.add( "builds" );
+            Hashtable build = makeHashtable( "build",
+                                             xmlRpcHelper.objectToHashtable( continuumBuild,
excludedProperties ) );
+
+            UpdateScmResult result = continuumBuild.getUpdateScmResult();
+
+            if ( result != null )
+            {
+                build.put( "updateScmResult", xmlRpcHelper.objectToHashtable( result ) );
+            }
 
-            return makeHashtable( "build", xmlRpcHelper.objectToHashtable( build, excludedProperties
) );
+            return build;
         }
         catch ( Throwable e )
         {

Modified: maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultXmlRpcHelper.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultXmlRpcHelper.java?rev=165048&r1=165047&r2=165048&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultXmlRpcHelper.java
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultXmlRpcHelper.java
Wed Apr 27 14:06:57 2005
@@ -23,6 +23,9 @@
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Set;
+import java.util.Collection;
+import java.util.Vector;
+import java.util.Iterator;
 
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.StringUtils;
@@ -135,6 +138,10 @@
             {
                 value = value.toString();
             }
+            else if ( value instanceof Collection )
+            {
+                value = collectionToVector( (Collection) value );
+            }
             else
             {
                 value = objectToHashtable( value );
@@ -148,5 +155,25 @@
         }
 
         return hashtable;
+    }
+
+    private Vector collectionToVector( Collection value )
+        throws IllegalAccessException, InvocationTargetException
+    {
+        if ( value instanceof Vector )
+        {
+            return (Vector) value;
+        }
+
+        Vector vector = new Vector( value.size() );
+
+        for ( Iterator it = value.iterator(); it.hasNext(); )
+        {
+            Object object = it.next();
+
+            vector.add( objectToHashtable( object ) );
+        }
+
+        return vector;
     }
 }



Mime
View raw message