continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r164975 - /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-model/src/main/resources
Date Wed, 27 Apr 2005 12:47:57 GMT
Author: trygvis
Date: Wed Apr 27 05:47:56 2005
New Revision: 164975

URL: http://svn.apache.org/viewcvs?rev=164975&view=rev
Log:
Fixing CONTINUUM-90: "Store the SCM results"
o Added data objects for CheckOutScmResult and UpdateScmResult that closely
  mirrors the equals results in maven-scm.
o When checking out and updating the project the results are stored with the
  project or build respectively.

Modified:
    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/ContinuumScm.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScmException.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-model/src/main/resources/continuum.mdo

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=164975&r1=164974&r2=164975&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 05:47:56 2005
@@ -42,9 +42,9 @@
 import org.apache.maven.continuum.project.MavenOneProject;
 import org.apache.maven.continuum.project.MavenTwoProject;
 import org.apache.maven.continuum.project.ShellProject;
-import org.apache.maven.continuum.project.ScmFile;
 import org.apache.maven.continuum.scm.ContinuumScm;
 import org.apache.maven.continuum.scm.ContinuumScmException;
+import org.apache.maven.continuum.scm.CheckOutScmResult;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 
@@ -758,11 +758,17 @@
 
         try
         {
-            scm.checkOut( project, checkoutDirectory);
+            CheckOutScmResult result = scm.checkOut( project, checkoutDirectory);
+
+            store.setProjectCheckOutScmResult( project.getId(), result );
         }
-        catch ( ContinuumScmException ex )
+        catch ( ContinuumScmException e )
+        {
+            throw new ContinuumException( "Error while checking out the project.", e );
+        }
+        catch ( ContinuumStoreException e )
         {
-            throw new ContinuumException( "Error while checking out the project.", ex );
+            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=164975&r1=164974&r2=164975&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 05:47:56 2005
@@ -31,9 +31,9 @@
 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;
 import org.apache.maven.continuum.store.ContinuumStoreException;
-import org.apache.maven.scm.command.update.UpdateScmResult;
 
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
@@ -204,6 +204,8 @@
             notifier.checkoutStarted( build );
 
             scmResult = scm.updateProject( project );
+
+            store.setBuildUpdateScmResult( build.getId(), scmResult );
         }
         finally
         {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScm.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScm.java?rev=164975&r1=164974&r2=164975&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScm.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScm.java
Wed Apr 27 05:47:56 2005
@@ -19,7 +19,6 @@
 import java.io.File;
 
 import org.apache.maven.continuum.project.ContinuumProject;
-import org.apache.maven.scm.command.update.UpdateScmResult;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -29,10 +28,10 @@
 {
     String ROLE = ContinuumScm.class.getName();
 
-    void checkOut( ContinuumProject project, File workingDirectory )
+    CheckOutScmResult checkOut( ContinuumProject project, File workingDirectory )
         throws ContinuumScmException;
 
-    void checkOutProject( ContinuumProject project )
+    CheckOutScmResult checkOutProject( ContinuumProject project )
         throws ContinuumScmException;
 
     UpdateScmResult updateProject( ContinuumProject project )

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScmException.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScmException.java?rev=164975&r1=164974&r2=164975&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScmException.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/ContinuumScmException.java
Wed Apr 27 05:47:56 2005
@@ -16,8 +16,6 @@
  * limitations under the License.
  */
 
-import org.apache.maven.scm.ScmResult;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id: ContinuumScmException.java,v 1.1.1.1 2005/03/29 20:42:02 trygvis Exp $

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=164975&r1=164974&r2=164975&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 05:47:56 2005
@@ -21,8 +21,6 @@
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
-import org.apache.maven.scm.command.checkout.CheckOutScmResult;
-import org.apache.maven.scm.command.update.UpdateScmResult;
 import org.apache.maven.scm.manager.ScmManager;
 import org.apache.maven.scm.repository.ScmRepository;
 import org.apache.maven.scm.repository.ScmRepositoryException;
@@ -44,7 +42,7 @@
     // ContinuumScm implementation
     // ----------------------------------------------------------------------
 
-    public void checkOut( ContinuumProject project, File workingDirectory )
+    public CheckOutScmResult checkOut( ContinuumProject project, File workingDirectory )
         throws ContinuumScmException
     {
         try
@@ -71,7 +69,7 @@
 
                 ScmFileSet fileSet = new ScmFileSet( workingDirectory );
 
-                result = scmManager.checkOut( repository, fileSet, tag );
+                result = convertCheckOutScmResult( scmManager.checkOut( repository, fileSet,
tag ) );
             }
 
             if ( !result.isSuccess() )
@@ -84,6 +82,8 @@
 
                 throw new ContinuumScmException( "Error while checking out the project.",
result );
             }
+
+            return result;
         }
         catch ( ScmRepositoryException e )
         {
@@ -101,7 +101,7 @@
      * @param project The project to check out.
      * @throws ContinuumScmException Thrown in case of a exception while checking out the
sources.
      */
-    public void checkOutProject( ContinuumProject project )
+    public CheckOutScmResult checkOutProject( ContinuumProject project )
         throws ContinuumScmException
     {
         String workingDirectory = project.getWorkingDirectory();
@@ -111,7 +111,7 @@
             throw new ContinuumScmException( "The working directory for the project has to
be set. Project: '" + project.getName() + "', id: '" + project.getId() + "'.");
         }
 
-        checkOut( project, new File( workingDirectory ) );
+        return checkOut( project, new File( workingDirectory ) );
     }
 
     public UpdateScmResult updateProject( ContinuumProject project )
@@ -138,7 +138,7 @@
 
             synchronized ( this )
             {
-                result = scmManager.update( repository, fileSet, tag );
+                result = convertUpdateScmResult( scmManager.update( repository, fileSet,
tag ) );
             }
 
             if ( !result.isSuccess() )
@@ -162,5 +162,39 @@
         {
             throw new ContinuumScmException( "Error while update sources.", ex );
         }
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    private CheckOutScmResult convertCheckOutScmResult( org.apache.maven.scm.command.checkout.CheckOutScmResult
scmResult )
+    {
+        CheckOutScmResult result = new CheckOutScmResult();
+
+        result.setSuccess( scmResult.isSuccess() );
+
+        result.setCommandOutput( scmResult.getCommandOutput() );
+
+        result.setProviderMessage( scmResult.getProviderMessage() );
+
+        result.setChekedOutFiles( scmResult.getCheckedOutFiles() );
+
+        return result;
+    }
+
+    private UpdateScmResult convertUpdateScmResult( org.apache.maven.scm.command.update.UpdateScmResult
scmResult )
+    {
+        UpdateScmResult result = new UpdateScmResult();
+
+        result.setSuccess( scmResult.isSuccess() );
+
+        result.setCommandOutput( scmResult.getCommandOutput() );
+
+        result.setProviderMessage( scmResult.getProviderMessage() );
+
+        result.setUpdatedFiles( scmResult.getUpdatedFiles() );
+
+        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=164975&r1=164974&r2=164975&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 05:47:56 2005
@@ -23,6 +23,8 @@
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumBuildResult;
 import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.scm.CheckOutScmResult;
+import org.apache.maven.continuum.scm.UpdateScmResult;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -55,6 +57,9 @@
     void setWorkingDirectory( String projectId, String workingDirectory )
         throws ContinuumStoreException;
 
+    void setProjectCheckOutScmResult( String projectId, CheckOutScmResult result )
+        throws ContinuumStoreException;
+
     void updateProject( String projectId, String name, String scmUrl, String nagEmailAddress,
String version )
         throws ContinuumStoreException;
 
@@ -96,5 +101,8 @@
         throws ContinuumStoreException;
 
     List getChangedFilesForBuild( String buildId )
+        throws ContinuumStoreException;
+
+    void setBuildUpdateScmResult( String buildId, UpdateScmResult scmResult )
         throws ContinuumStoreException;
 }

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=164975&r1=164974&r2=164975&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 05:47:56 2005
@@ -32,6 +32,8 @@
 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.UpdateScmResult;
 
 import org.codehaus.plexus.jdo.JdoFactory;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
@@ -203,6 +205,27 @@
         }
     }
 
+    public void setProjectCheckOutScmResult( String projectId, CheckOutScmResult result )
+        throws ContinuumStoreException
+    {
+        try
+        {
+            store.begin();
+
+            ContinuumProject project = store.getContinuumProject( projectId, false );
+
+            project.setCheckOutScmResult( result );
+
+            store.commit();
+        }
+        catch ( Exception e )
+        {
+            rollback( store );
+
+            throw new ContinuumStoreException( "Error while setting scm check out result
for project with id: '" + projectId + "'.", e );
+        }
+    }
+
     public void updateProject( String projectId, String name, String scmUrl, String nagEmailAddress,
String version )
         throws ContinuumStoreException
     {
@@ -525,6 +548,27 @@
             rollback( store );
 
             throw new ContinuumStoreException( "Error while getting build result.", e );
+        }
+    }
+
+    public void setBuildUpdateScmResult( String buildId, UpdateScmResult scmResult )
+        throws ContinuumStoreException
+    {
+        try
+        {
+            store.begin();
+
+            ContinuumBuild build = store.getContinuumBuild( buildId, false );
+
+            build.setScmResult( scmResult );
+
+            store.commit();
+        }
+        catch ( Exception e )
+        {
+            rollback( store );
+
+            throw new ContinuumStoreException( "Error while setting scm update result for
build: '" + buildId + "'.", e );
         }
     }
 

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=164975&r1=164974&r2=164975&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Wed Apr 27 05:47:56
2005
@@ -11,7 +11,7 @@
 
   <!--
    |
-   | ContinuumProject.
+   | Projects
    |
    |-->
   <classes>
@@ -82,6 +82,13 @@
             <multiplicity>*</multiplicity>
           </association>
         </field>
+        <field>
+          <name>checkOutScmResult</name>
+          <version>1.0.0</version>
+          <association>
+            <type>CheckOutScmResult</type>
+          </association>
+        </field>
       </fields>
     </class>
 
@@ -148,10 +155,10 @@
     </class>
 
     <!--
-    |
-    | ContinuumBuild
-    |
-    -->
+     |
+     | Builds
+     |
+     -->
     <class stash.storable="true">
       <name>ContinuumBuild</name>
       <version>1.0.0</version>
@@ -210,17 +217,6 @@
          |
          | -->
 
-        <!-- Experimental -->
-        <!--
-        <field>
-          <name>unitTests</name>
-          <version>1.0.0</version>
-          <association>
-            <type>UnitTest</type>
-            <multiplicity>*</multiplicity>
-          </association>
-        </field>
-        -->
         <field>
           <name>buildResult</name>
           <version>1.0.0</version>
@@ -232,87 +228,15 @@
             know how to work with.
           </description>
         </field>
-        <!--
-        <field>
-          <name>builderBuildResult</name>
-          <version>1.0.0</version>
-          <association>
-            <type>BuilderBuildResult</type>
-          </association>
-          <description>
-            This field contains a builder specific object that the view will
-            know how to work with.
-          </description>
-        </field>
-        -->
-      </fields>
-    </class>
-
-    <!-- Experimental -->
-    <!--
-    <class>
-      <name>UnitTest</name>
-      <version>1.0.0</version>
-      <fields>
-        <field>
-          <name>packageName</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
         <field>
-          <name>name</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        <field>
-          <name>testCases</name>
+          <name>scmResult</name>
           <version>1.0.0</version>
           <association>
-            <type>UnitTestCase</type>
-            <multiplicity>*</multiplicity>
+            <type>UpdateScmResult</type>
           </association>
         </field>
       </fields>
     </class>
-    -->
-
-    <!-- Experimental -->
-    <!--
-    <class>
-      <name>UnitTestCase</name>
-      <version>1.0.0</version>
-      <fields>
-        <field>
-          <name>name</name>
-          <version>1.0.0</version>
-          <type>String</type>
-        </field>
-        -->
-        <!-- passed, failed, error -->
-    <!--
-        <field>
-          <name>result</name>
-          <version>1.0.0</version>
-          <type>int</type>
-        </field>
-        <field>
-          <name>time</name>
-          <version>1.0.0</version>
-          <type>long</type>
-        </field>
-        <field>
-          <name>message</name>
-          <version>1.0.0</version>
-          <type>long</type>
-        </field>
-        <field>
-          <name>output</name>
-          <version>1.0.0</version>
-          <type>long</type>
-        </field>
-      </fields>
-    </class>
-    -->
 
     <!--
     |
@@ -457,6 +381,68 @@
           <name>exitCode</name>
           <version>1.0.0</version>
           <type>int</type>
+        </field>
+      </fields>
+    </class>
+
+    <!--
+     |
+     | Scm Result
+     |
+     |-->
+    <class><!-- abstract -->
+      <name>ScmResult</name>
+      <packageName>org.apache.maven.continuum.scm</packageName>
+      <version>1.0.0</version>
+      <fields>
+        <field>
+          <name>success</name>
+          <version>1.0.0</version>
+          <type>boolean</type>
+        </field>
+        <field>
+          <name>providerMessage</name>
+          <version>1.0.0</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>commandOutput</name>
+          <version>1.0.0</version>
+          <type>String</type>
+        </field>
+      </fields>
+    </class>
+
+    <class>
+      <name>CheckOutScmResult</name>
+      <packageName>org.apache.maven.continuum.scm</packageName>
+      <superClass>ScmResult</superClass>
+      <version>1.0.0</version>
+      <fields>
+        <field>
+          <name>chekedOutFiles</name>
+          <version>1.0.0</version>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+
+    <class>
+      <name>UpdateScmResult</name>
+      <packageName>org.apache.maven.continuum.scm</packageName>
+      <superClass>ScmResult</superClass>
+      <version>1.0.0</version>
+      <fields>
+        <field>
+          <name>updatedFiles</name>
+          <version>1.0.0</version>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
         </field>
       </fields>
     </class>



Mime
View raw message