You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by br...@apache.org on 2008/03/04 23:32:25 UTC

svn commit: r633681 - in /continuum/trunk: ./ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-store/ continuum-store/src/main/java/org/apache/maven/continuum/store/ continuum-test/src/main/java/org/apache/maven/continuum/

Author: brett
Date: Tue Mar  4 14:32:23 2008
New Revision: 633681

URL: http://svn.apache.org/viewvc?rev=633681&view=rev
Log:
merge -r615020:632694 from branch

Modified:
    continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/trunk/continuum-store/pom.xml
    continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
    continuum/trunk/pom.xml

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=633681&r1=633680&r2=633681&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Tue Mar  4 14:32:23 2008
@@ -716,7 +716,10 @@
             for ( Object o : project.getBuildResults() )
             {
                 BuildResult br = (BuildResult) o;
-                store.removeBuildResult( br );
+                //Remove all modified dependencies to prevent SQL errors
+                br.setModifiedDependencies( null );
+                store.updateBuildResult( br );
+                removeBuildResult( br );
             }
 
             File workingDirectory = getWorkingDirectory( projectId );
@@ -1189,19 +1192,27 @@
         throws ContinuumException
     {
         BuildResult buildResult = getBuildResult( buildId );
+        removeBuildResult( buildResult );
+    }
+
+
+    private void removeBuildResult( BuildResult buildResult )
+        throws ContinuumException
+    {
         store.removeBuildResult( buildResult );
 
         // cleanup some files
         try
         {
             File buildOutputDirectory = getConfiguration().getBuildOutputDirectory( buildResult.getProject().getId() );
-            File buildDirectory = new File( buildOutputDirectory, Integer.toString( buildId ) );
+            File buildDirectory = new File( buildOutputDirectory, Integer.toString( buildResult.getId() ) );
 
             if ( buildDirectory.exists() )
             {
                 FileUtils.deleteDirectory( buildDirectory );
             }
-            File buildOutputFile = getConfiguration().getBuildOutputFile( buildId, buildResult.getProject().getId() );
+            File buildOutputFile =
+                getConfiguration().getBuildOutputFile( buildResult.getId(), buildResult.getProject().getId() );
             if ( buildOutputFile.exists() )
             {
                 buildOutputFile.delete();

Modified: continuum/trunk/continuum-store/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/pom.xml?rev=633681&r1=633680&r2=633681&view=diff
==============================================================================
--- continuum/trunk/continuum-store/pom.xml (original)
+++ continuum/trunk/continuum-store/pom.xml Tue Mar  4 14:32:23 2008
@@ -12,6 +12,11 @@
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-jdo2</artifactId>
     </dependency>
+    <!-- bcel is reauired by jpox 1.1.9 -->
+    <dependency>
+      <groupId>org.apache.bcel</groupId>
+      <artifactId>bcel</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.maven.continuum</groupId>
       <artifactId>continuum-test</artifactId>

Modified: continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=633681&r1=633680&r2=633681&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java (original)
+++ continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java Tue Mar  4 14:32:23 2008
@@ -344,7 +344,7 @@
 
             query.setResult( "this.id, buildDef.id" );
 
-            List result = (List) query.execute( new Integer( scheduleId ) );
+            List result = (List) query.execute( scheduleId );
 
             Map projectGroups = new HashMap();
 
@@ -431,7 +431,7 @@
 
             pm.getFetchPlan().addGroup( PROJECT_WITH_BUILDS_FETCH_GROUP );
 
-            Object objectId = pm.newObjectIdInstance( Project.class, new Integer( project.getId() ) );
+            Object objectId = pm.newObjectIdInstance( Project.class, project.getId() );
 
             project = (Project) pm.getObjectById( objectId );
 
@@ -471,7 +471,7 @@
 
             query.setFilter( "this.project.id == projectId && this.project.latestBuildId == this.id" );
 
-            List result = (List) query.execute( new Integer( projectId ) );
+            List result = (List) query.execute( projectId );
 
             result = (List) pm.detachCopyAll( result );
 
@@ -509,8 +509,8 @@
             query.setOrdering( "id descending" );
 
             Object[] params = new Object[2];
-            params[0] = new Integer( projectId );
-            params[1] = new Integer( buildDefinitionId );
+            params[0] = projectId;
+            params[1] = buildDefinitionId;
 
             List result = (List) query.executeWithArray( params );
 
@@ -554,29 +554,27 @@
 
             query.setFilter( filter );
 
-            List result = null;
+            List<BuildResult> result;
             if ( projectGroupId > 0 )
             {
-                result = (List) query.execute( new Integer( projectGroupId ) );
+                result = (List<BuildResult>) query.execute( projectGroupId );
             }
             else
             {
-                result = (List) query.execute();
+                result = (List<BuildResult>) query.execute();
             }
 
-            result = (List) pm.detachCopyAll( result );
+            result = (List<BuildResult>) pm.detachCopyAll( result );
 
             tx.commit();
 
             if ( result != null && !result.isEmpty() )
             {
-                Map builds = new HashMap();
+                Map<Integer, BuildResult> builds = new HashMap<Integer, BuildResult>();
 
-                for ( Iterator i = result.iterator(); i.hasNext(); )
+                for ( BuildResult br : result )
                 {
-                    BuildResult br = (BuildResult) i.next();
-
-                    builds.put( new Integer( br.getProject().getId() ), br );
+                    builds.put( br.getProject().getId(), br );
                 }
 
                 return builds;
@@ -737,9 +735,9 @@
 
             if ( result != null && !result.isEmpty() )
             {
-                for ( Iterator i = result.iterator(); i.hasNext(); )
+                for ( Object aResult : result )
                 {
-                    Object[] obj = (Object[]) i.next();
+                    Object[] obj = (Object[]) aResult;
 
                     builds.put( (Integer) obj[0], (Integer) obj[1] );
                 }
@@ -1335,15 +1333,11 @@
 
             if ( result.size() != 0 )
             {
-                for ( Iterator<Profile> iterator = result.iterator(); iterator.hasNext(); )
+                for ( Profile profile : result )
                 {
-                    Profile profile = iterator.next();
                     List<Installation> newEnvironmentVariables = new ArrayList<Installation>();
-                    for ( Iterator<Installation> iteInstallation = profile.getEnvironmentVariables().iterator();
-                          iteInstallation
-                              .hasNext(); )
+                    for ( Installation current : (Iterable<Installation>) profile.getEnvironmentVariables() )
                     {
-                        Installation current = iteInstallation.next();
                         if ( !StringUtils.equals( current.getName(), installation.getName() ) )
                         {
                             newEnvironmentVariables.add( current );
@@ -1430,7 +1424,7 @@
 
             query.declareParameters( "Integer projectId" );
 
-            List result = (List) query.execute( new Integer( projectId ) );
+            List result = (List) query.execute( projectId );
 
             result = (List) pm.detachCopyAll( result );
 
@@ -1514,7 +1508,7 @@
 
             query.setFilter( "this.project.id == projectId && this.buildNumber == buildNumber" );
 
-            List result = (List) query.execute( new Integer( projectId ), new Integer( buildNumber ) );
+            List result = (List) query.execute( projectId, buildNumber );
 
             result = (List) pm.detachCopyAll( result );
 
@@ -1559,8 +1553,7 @@
 
             query.setOrdering( "this.id descending" );
 
-            List<BuildResult> result =
-                (List<BuildResult>) query.execute( new Integer( projectId ), new Integer( buildDefinitionId ) );
+            List<BuildResult> result = (List<BuildResult>) query.execute( projectId, buildDefinitionId );
 
             result = (List<BuildResult>) pm.detachCopyAll( result );
 
@@ -1590,7 +1583,7 @@
 
             query.setResult( "count(this)" );
 
-            long result = (Long) query.execute( new Integer( projectId ) );
+            long result = (Long) query.execute( projectId );
 
             tx.commit();
 
@@ -1632,7 +1625,7 @@
                 query.setRange( startIndex, endIndex );
             }
 
-            List result = (List) query.execute( new Integer( projectId ) );
+            List result = (List) query.execute( projectId );
 
             result = (List) pm.detachCopyAll( result );
 
@@ -1666,7 +1659,7 @@
 
             query.setFilter( "this.project.id == projectId && this.startTime > fromDate" );
 
-            List result = (List) query.execute( new Integer( projectId ), new Long( fromDate ) );
+            List result = (List) query.execute( projectId, fromDate );
 
             result = (List) pm.detachCopyAll( result );
 
@@ -1723,11 +1716,11 @@
 
             query.setFilter( filter );
 
-            List result = null;
+            List<BuildResult> result;
 
             if ( projectGroupId > 0 )
             {
-                result = (List) query.execute( new Integer( projectGroupId ) );
+                result = (List) query.execute( projectGroupId );
             }
             else
             {
@@ -1740,13 +1733,11 @@
 
             if ( result != null && !result.isEmpty() )
             {
-                Map builds = new HashMap();
+                Map<Integer, BuildResult> builds = new HashMap<Integer, BuildResult>();
 
-                for ( Iterator i = result.iterator(); i.hasNext(); )
+                for ( BuildResult br : result )
                 {
-                    BuildResult br = (BuildResult) i.next();
-
-                    builds.put( new Integer( br.getProject().getId() ), br );
+                    builds.put( br.getProject().getId(), br );
                 }
 
                 return builds;
@@ -1787,9 +1778,9 @@
             // TODO: why do we need to do this? if not - build results are not
             // removed and a integrity constraint is violated. I assume its
             // because of the fetch groups
-            for ( Iterator i = pg.getProjects().iterator(); i.hasNext(); )
+            for ( Project p : (List<Project>) pg.getProjects() )
             {
-                removeProject( (Project) i.next() );
+                removeProject( p );
             }
             removeObject( pg );
         }

Modified: continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=633681&r1=633680&r2=633681&view=diff
==============================================================================
--- continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java (original)
+++ continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java Tue Mar  4 14:32:23 2008
@@ -40,7 +40,6 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -81,13 +80,14 @@
     protected void createDefaultProjectGroup()
         throws Exception
     {
-        ProjectGroup group;
         try
         {
-            group = getDefaultProjectGroup();
+            getDefaultProjectGroup();
         }
         catch ( ContinuumObjectNotFoundException e )
         {
+            ProjectGroup group;
+
             group = new ProjectGroup();
 
             group.setName( "Default Project Group" );
@@ -96,7 +96,7 @@
 
             group.setDescription( "Contains all projects that do not have a group of their own" );
 
-            group = store.addProjectGroup( group );
+            store.addProjectGroup( group );
         }
     }
 
@@ -158,10 +158,8 @@
 
         Properties properties = jdoFactory.getProperties();
 
-        for ( Iterator it = properties.entrySet().iterator(); it.hasNext(); )
+        for ( Map.Entry entry : properties.entrySet() )
         {
-            Map.Entry entry = (Map.Entry) it.next();
-
             System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
         }
 

Modified: continuum/trunk/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/pom.xml?rev=633681&r1=633680&r2=633681&view=diff
==============================================================================
--- continuum/trunk/pom.xml (original)
+++ continuum/trunk/pom.xml Tue Mar  4 14:32:23 2008
@@ -611,9 +611,13 @@
       <dependency>
         <groupId>jpox</groupId>
         <artifactId>jpox-enhancer</artifactId>
-        <version>1.1.7</version>
+        <version>1.1.9</version>
         <exclusions>
           <exclusion>
+            <groupId>bcel</groupId>
+            <artifactId>bcel</artifactId>
+          </exclusion>
+          <exclusion>
             <groupId>javax.sql</groupId>
             <artifactId>jdbc-stdext</artifactId>
           </exclusion>
@@ -622,7 +626,12 @@
       <dependency>
         <groupId>jpox</groupId>
         <artifactId>jpox-dbcp</artifactId>
-        <version>1.1.7</version>
+        <version>1.1.9</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.bcel</groupId>
+        <artifactId>bcel</artifactId>
+        <version>5.2</version>
       </dependency>
       <dependency>
         <groupId>log4j</groupId>
@@ -798,6 +807,11 @@
         <groupId>org.codehaus.plexus.redback</groupId>
         <artifactId>redback-data-management</artifactId>
         <version>${redback.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>commons-httpclient</groupId>
+        <artifactId>commons-httpclient</artifactId>
+        <version>3.1</version>
       </dependency>
     </dependencies>
   </dependencyManagement>