continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r164216 - /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/builder/shell /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/resources/META-INF/plexus /maven/continuum/trunk/continuum-web/src/main/resources/templates/screens
Date Fri, 22 Apr 2005 11:00:05 GMT
Author: trygvis
Date: Fri Apr 22 04:00:04 2005
New Revision: 164216

URL: http://svn.apache.org/viewcvs?rev=164216&view=rev
Log:
o Removing the custom code segments in the model, wasn't worth it.
o Fixing a bug in removeProject, making sure not to delete null build results.
o Logging the working directory when executing a command.
o Added getChangedFilesForBuild() to the store, application interface and
  scalars available to the ProjectBuild view.

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/Continuum.java
    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/builder/shell/DefaultShellCommandHelper.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-model/src/main/resources/continuum.mdo
    maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuild.vm

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/Continuum.java?rev=164216&r1=164215&r2=164216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/Continuum.java
Fri Apr 22 04:00:04 2005
@@ -19,6 +19,7 @@
 import java.net.URL;
 import java.util.Iterator;
 import java.util.Properties;
+import java.util.List;
 
 import org.apache.maven.continuum.project.AntProject;
 import org.apache.maven.continuum.project.ContinuumBuild;
@@ -99,6 +100,9 @@
         throws ContinuumException;
 
     ContinuumBuildResult getBuildResultForBuild( String buildId )
+        throws ContinuumException;
+
+    public List getChangedFilesForBuild( String buildId )
         throws ContinuumException;
 
     // ----------------------------------------------------------------------

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=164216&r1=164215&r2=164216&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
Fri Apr 22 04:00:04 2005
@@ -24,6 +24,7 @@
 import java.net.URL;
 import java.util.Iterator;
 import java.util.Properties;
+import java.util.List;
 
 import org.apache.maven.continuum.buildcontroller.BuildController;
 import org.apache.maven.continuum.builder.ContinuumBuilder;
@@ -41,6 +42,7 @@
 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.store.ContinuumStore;
@@ -421,8 +423,20 @@
     {
         try
         {
-            getLogger().info( "getBuildResultForBuild( String buildId )" );
             return store.getBuildResultForBuild( buildId );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumException( "Cannot retrieve build result for build with id
= " + buildId, e );
+        }
+    }
+
+    public List getChangedFilesForBuild( String buildId )
+        throws ContinuumException
+    {
+        try
+        {
+            return store.getChangedFilesForBuild( buildId );
         }
         catch ( ContinuumStoreException 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=164216&r1=164215&r2=164216&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
Fri Apr 22 04:00:04 2005
@@ -268,7 +268,9 @@
         {
             org.apache.maven.scm.ScmFile scmFile = (org.apache.maven.scm.ScmFile) it.next();
 
-            ScmFile file = new ScmFile( scmFile.getPath() );
+            ScmFile file = new ScmFile();
+
+            file.setPath( scmFile.getPath() );
 
             files.add( file );
         }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/shell/DefaultShellCommandHelper.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/shell/DefaultShellCommandHelper.java?rev=164216&r1=164215&r2=164216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/shell/DefaultShellCommandHelper.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/builder/shell/DefaultShellCommandHelper.java
Fri Apr 22 04:00:04 2005
@@ -46,6 +46,7 @@
         int exitCode;
 
         getLogger().info( "Executing: " + cl );
+        getLogger().info( "Working directory: " + workingDirectory.getAbsolutePath() );
 
         exitCode = CommandLineUtils.executeCommandLine( cl, stdout, stderr );
 

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=164216&r1=164215&r2=164216&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
Fri Apr 22 04:00:04 2005
@@ -18,6 +18,7 @@
 
 import java.util.Iterator;
 import java.util.Properties;
+import java.util.List;
 
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumBuildResult;
@@ -92,5 +93,8 @@
         throws ContinuumStoreException;
 
     ContinuumBuildResult getBuildResultForBuild( String buildId )
+        throws ContinuumStoreException;
+
+    List getChangedFilesForBuild( String buildId )
         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=164216&r1=164215&r2=164216&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
Fri Apr 22 04:00:04 2005
@@ -134,6 +134,11 @@
 //                System.err.println( "getBuildResult()" );
                 ContinuumBuildResult result = build.getBuildResult();
 
+                if ( result == null )
+                {
+                    continue;
+                }
+
 //                System.err.println( "result.getChangedFiles()" );
                 List changedFiles = result.getChangedFiles();
 
@@ -468,6 +473,52 @@
             ContinuumBuildResult result = store.getContinuumBuildResultByJdoId( id, true
);
 
             return result;
+        }
+        catch ( Exception e )
+        {
+            rollback( store );
+
+            throw new ContinuumStoreException( "Error while getting build result.", e );
+        }
+    }
+
+    public List getChangedFilesForBuild( String buildId )
+        throws ContinuumStoreException
+    {
+        try
+        {
+            store.begin();
+
+            ContinuumBuild build = store.getContinuumBuild( buildId, false );
+
+            if ( build.getBuildResult() == null )
+            {
+                store.commit();
+
+                return null;
+            }
+
+            Object id = JDOHelper.getObjectId( build.getBuildResult() );
+
+            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(); )
+            {
+                ScmFile scmFile = (ScmFile) it.next();
+
+                ScmFile file = new ScmFile();
+
+                file.setPath( scmFile.getPath() );
+
+                changedFiles.add( file );
+            }
+
+            store.commit();
+
+            return changedFiles;
         }
         catch ( Exception e )
         {

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=164216&r1=164215&r2=164216&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
Fri Apr 22 04:00:04 2005
@@ -356,7 +356,11 @@
 
         ContinuumBuildResult result = new ShellBuildResult();
 
-        result.addChangedFile( new ScmFile( "foo" ) );
+        ScmFile file = new ScmFile();
+
+        file.setPath( "foo" );
+
+        result.addChangedFile( file );
 
         store.setBuildResult( buildId, ContinuumProjectState.OK, result, null );
 

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=164216&r1=164215&r2=164216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Fri Apr 22 04:00:04
2005
@@ -363,25 +363,6 @@
           <type>String</type>
         </field>
       </fields>
-      <codeSegments>
-        <codeSegment>
-          <code>
-            public ScmFile()
-            {
-            }
-
-            public ScmFile( String path )
-            {
-              this.path = path;
-            }
-
-            public String toString()
-            {
-              return path;
-            }
-          </code>
-        </codeSegment>
-      </codeSegments>
     </class>
 
     <class>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml?rev=164216&r1=164215&r2=164216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
Fri Apr 22 04:00:04 2005
@@ -138,6 +138,10 @@
                 <id>buildResult</id>
                 <expression>getBuildResultForBuild(#buildId)</expression>
               </scalar>
+              <scalar>
+                <id>changedFiles</id>
+                <expression>getChangedFilesForBuild(#buildId)</expression>
+              </scalar>
             </scalars>
           </view>
         </views>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuild.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuild.vm?rev=164216&r1=164215&r2=164216&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuild.vm
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuild.vm
Fri Apr 22 04:00:04 2005
@@ -15,13 +15,17 @@
 
   <h4>Changes</h4>
   <p>
+    #if ( !$changedFiles.iterator().hasNext() )
+    <b>No files changed</b>
+    #else
     <table border="1" cellspacing="2" cellpadding="3" width="100%">
-      #foreach ( $file in $buildResult.changedFiles )
+      #foreach ( $file in $changedFiles )
       <tr class="a">
-        <td>$file</td>
+        <td>$file.path</td>
       </tr>
       #end
     </table>
+    #end
   </p>
 #if ( $buildResult.standardOutput )
 #set( $stdout = $buildResult.standardOutput )



Mime
View raw message