continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r169215 - in /maven/continuum/trunk/continuum-core/src: main/java/org/apache/maven/continuum/ main/java/org/apache/maven/continuum/buildcontroller/ main/java/org/apache/maven/continuum/notification/mail/ main/java/org/apache/maven/continuum/store/ main/java/org/apache/maven/continuum/trigger/alarmclock/ test/java/org/apache/maven/continuum/store/
Date Mon, 09 May 2005 01:56:55 GMT
Author: dandiep
Date: Sun May  8 18:56:53 2005
New Revision: 169215

URL: http://svn.apache.org/viewcvs?rev=169215&view=rev
Log:
Move to Collection instead of Iterator on Continuum interface. CONTINUUM-107

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/notification/mail/MailContinuumNotifier.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/main/java/org/apache/maven/continuum/trigger/alarmclock/AlarmClockTrigger.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java

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=169215&r1=169214&r2=169215&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
Sun May  8 18:56:53 2005
@@ -17,7 +17,8 @@
  */
 
 import java.net.URL;
-import java.util.Iterator;
+import java.util.Collection;
+import java.util.List;
 import java.util.List;
 import java.util.Properties;
 
@@ -74,7 +75,7 @@
     ContinuumProject getProject( String projectId )
         throws ContinuumException;
 
-    Iterator getAllProjects( int start, int end )
+    Collection getAllProjects( int start, int end )
         throws ContinuumException;
 
     CheckOutScmResult getCheckOutScmResultForProject( String projectId )
@@ -87,7 +88,7 @@
     //
     // ----------------------------------------------------------------------
 
-    Iterator getProjects()
+    Collection getProjects()
         throws ContinuumStoreException;
 
     ContinuumBuild getLatestBuildForProject( String id )
@@ -100,7 +101,7 @@
     ContinuumBuild getBuild( String buildId )
         throws ContinuumException;
 
-    Iterator getBuildsForProject( String projectId )
+    Collection getBuildsForProject( String projectId )
         throws ContinuumException;
 
     ContinuumBuildResult getBuildResultForBuild( String buildId )

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=169215&r1=169214&r2=169215&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
Sun May  8 18:56:53 2005
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
@@ -46,7 +47,6 @@
 import org.apache.maven.continuum.scm.queue.CheckOutTask;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
-
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Startable;
@@ -102,7 +102,7 @@
     //
     // ----------------------------------------------------------------------
 
-    public Iterator getProjects()
+    public Collection getProjects()
         throws ContinuumStoreException
     {
         return store.getAllProjects();
@@ -326,14 +326,12 @@
         }
     }
 
-    public Iterator getAllProjects( int start, int end )
+    public Collection getAllProjects( int start, int end )
         throws ContinuumException
     {
         try
         {
-            Iterator it = store.getAllProjects();
-
-            return it;
+            return store.getAllProjects();
         }
         catch ( ContinuumStoreException ex )
         {
@@ -394,7 +392,7 @@
         }
     }
 
-    public Iterator getBuildsForProject( String projectId )
+    public Collection getBuildsForProject( String projectId )
         throws ContinuumException
     {
         try
@@ -824,7 +822,7 @@
 
         getLogger().info( "Showing all projects: " );
 
-        for ( Iterator it = store.getAllProjects(); it.hasNext(); )
+        for ( Iterator it = store.getAllProjects().iterator(); it.hasNext(); )
         {
             ContinuumProject project = (ContinuumProject) it.next();
 

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=169215&r1=169214&r2=169215&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
Sun May  8 18:56:53 2005
@@ -17,7 +17,7 @@
  */
 
 import java.io.File;
-import java.util.Iterator;
+import java.util.Collection;
 
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.builder.ContinuumBuilder;
@@ -32,9 +32,7 @@
 import org.apache.maven.continuum.scm.UpdateScmResult;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
-
 import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.util.CollectionUtils;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -325,8 +323,8 @@
     public boolean isNew( ContinuumProject project )
         throws ContinuumStoreException
     {
-        Iterator it = store.getBuildsForProject( project.getId(), 0, 0 );
+        Collection builds = store.getBuildsForProject( project.getId(), 0, 0 );
 
-        return CollectionUtils.iteratorToList( it ).size() == 0;
+        return builds.size() == 0;
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java?rev=169215&r1=169214&r2=169215&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/mail/MailContinuumNotifier.java
Sun May  8 18:56:53 2005
@@ -19,6 +19,7 @@
 import java.io.StringWriter;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
@@ -33,7 +34,6 @@
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.exception.ResourceNotFoundException;
-
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.mailsender.MailMessage;
 import org.codehaus.plexus.mailsender.MailSender;
@@ -392,23 +392,24 @@
     private ContinuumBuild getPreviousBuild( ContinuumProject project, ContinuumBuild currentBuild
)
         throws ContinuumException
     {
-        Iterator it;
+        Collection builds;
 
         try
         {
-            it = store.getBuildsForProject( project.getId(), 0, 0 );
+            builds = store.getBuildsForProject( project.getId(), 0, 0 );
         }
         catch ( ContinuumStoreException ex )
         {
             throw new ContinuumException( "Error while finding the last project build.",
ex );
         }
 
-        if ( !it.hasNext() )
+        if ( builds.size() == 0 )
         {
             return null;
         }
 
-        ContinuumBuild build = (ContinuumBuild) it.next();
+        Iterator itr =  builds.iterator();
+        ContinuumBuild build = (ContinuumBuild) itr.next();
 
         if ( currentBuild != null && !build.getId().equals( currentBuild.getId()
) )
         {
@@ -417,11 +418,11 @@
                                           "first build: '" + build.getId() + "'." );
         }
 
-        if ( !it.hasNext() )
+        if ( !itr.hasNext() )
         {
             return null;
         }
 
-        return (ContinuumBuild) it.next();
+        return (ContinuumBuild) itr.next();
     }
 }

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=169215&r1=169214&r2=169215&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
Sun May  8 18:56:53 2005
@@ -16,9 +16,9 @@
  * limitations under the License.
  */
 
-import java.util.Iterator;
-import java.util.Properties;
+import java.util.Collection;
 import java.util.List;
+import java.util.Properties;
 
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumBuildResult;
@@ -63,10 +63,10 @@
     void updateProjectConfiguration( String projectId, Properties configuration )
         throws ContinuumStoreException;
 
-    Iterator getAllProjects()
+    Collection getAllProjects()
         throws ContinuumStoreException;
 
-    Iterator findProjectsByName( String nameSearchPattern )
+    Collection findProjectsByName( String nameSearchPattern )
         throws ContinuumStoreException;
 
     ContinuumProject getProject( String projectId )
@@ -94,7 +94,7 @@
     ContinuumBuild getLatestBuildForProject( String projectId )
         throws ContinuumStoreException;
 
-    Iterator getBuildsForProject( String projectId, int start, int end )
+    Collection getBuildsForProject( String projectId, int start, int end )
         throws ContinuumStoreException;
 
     ContinuumBuildResult getBuildResultForBuild( String buildId )

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=169215&r1=169214&r2=169215&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
Sun May  8 18:56:53 2005
@@ -266,14 +266,12 @@
         }
     }
 
-    public Iterator getAllProjects()
+    public Collection getAllProjects()
         throws ContinuumStoreException
     {
         try
         {
-            Collection projects = store.getContinuumProjectCollection( true, null, "name
ascending" );
-
-            return projects.iterator();
+            return store.getContinuumProjectCollection( true, null, "name ascending" );
         }
         catch ( Exception e )
         {
@@ -281,10 +279,10 @@
         }
     }
 
-    public Iterator findProjectsByName( String nameSearchPattern )
+    public Collection findProjectsByName( String nameSearchPattern )
         throws ContinuumStoreException
     {
-        Iterator it = getAllProjects();
+        Iterator it = getAllProjects().iterator();
 
         List hits = new ArrayList();
 
@@ -298,7 +296,7 @@
             }
         }
 
-        return hits.iterator();
+        return hits;
     }
 
     public ContinuumProject getProject( String projectId )
@@ -501,14 +499,12 @@
         }
     }
 
-    public Iterator getBuildsForProject( String projectId, int start, int end )
+    public Collection getBuildsForProject( String projectId, int start, int end )
         throws ContinuumStoreException
     {
         try
         {
-            Collection builds = store.getContinuumBuildCollection( true, "this.project.id
== \"" + projectId + "\"", "startTime descending" );
-
-            return builds.iterator();
+            return store.getContinuumBuildCollection( true, "this.project.id == \"" + projectId
+ "\"", "startTime descending" );
         }
         catch ( Exception e )
         {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/trigger/alarmclock/AlarmClockTrigger.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/trigger/alarmclock/AlarmClockTrigger.java?rev=169215&r1=169214&r2=169215&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/trigger/alarmclock/AlarmClockTrigger.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/trigger/alarmclock/AlarmClockTrigger.java
Sun May  8 18:56:53 2005
@@ -90,7 +90,7 @@
 
         try
         {
-            it = getContinuum().getAllProjects( 0, 0 );
+            it = getContinuum().getAllProjects( 0, 0 ).iterator();
         }
         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=169215&r1=169214&r2=169215&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
Sun May  8 18:56:53 2005
@@ -17,6 +17,7 @@
  */
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -32,10 +33,8 @@
 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.PlexusTestCase;
 import org.codehaus.plexus.jdo.JdoFactory;
-import org.codehaus.plexus.util.CollectionUtils;
 import org.codehaus.plexus.util.FileUtils;
 
 /**
@@ -310,7 +309,7 @@
 
         Map projects = new HashMap();
 
-        for ( Iterator it = store.getAllProjects(); it.hasNext(); )
+        for ( Iterator it = store.getAllProjects().iterator(); it.hasNext(); )
         {
             ContinuumProject project = (ContinuumProject) it.next();
 
@@ -417,15 +416,13 @@
 
         String buildId = store.createBuild( projectId, false );
 
-        Iterator it = store.getBuildsForProject( projectId, 0, 0 );
-
-        assertNotNull( "The iterator with all builds was null.", it );
+        Collection builds = store.getBuildsForProject( projectId, 0, 0 );
 
-        List builds = CollectionUtils.iteratorToList( it );
+        assertNotNull( "The collection with all builds was null.", builds );
 
         assertEquals( "Expected the build set to contain a single build.", 1, builds.size()
);
 
-        ContinuumBuild build = (ContinuumBuild) builds.get( 0 );
+        ContinuumBuild build = (ContinuumBuild) builds.iterator().next();
 
         assertNotNull( build );
 
@@ -490,21 +487,18 @@
         //
         // ----------------------------------------------------------------------
 
-        Iterator builds = store.getBuildsForProject( projectId, 0, 0 );
-
-        List actualBuilds = CollectionUtils.iteratorToList( builds );
+        Collection actualBuilds = store.getBuildsForProject( projectId, 0, 0 );
 
         assertEquals( "builds.size", expectedBuilds.size(), actualBuilds.size() );
 
-        Iterator it;
-
-        int i;
+        Iterator expectedIt = expectedBuilds.iterator();
+        Iterator actualIt = actualBuilds.iterator();
 
-        for ( it = expectedBuilds.iterator(), i = 0; it.hasNext(); i++ )
+        for ( int i = 0; expectedIt.hasNext(); i++ )
         {
-            String expectedBuildId = (String) it.next();
+            String expectedBuildId = (String) expectedIt.next();
 
-            String actualBuildId = ((ContinuumBuild) actualBuilds.get( i )).getId();
+            String actualBuildId = ((ContinuumBuild) actualIt.next()).getId();
 
             assertEquals( "builds[" + i + "]", expectedBuildId, actualBuildId );
         }



Mime
View raw message