maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-scm/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib AbstractCvsScmTest.java
Date Thu, 30 Dec 2004 02:41:23 GMT
brett       2004/12/29 18:41:23

  Modified:    maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/changelog
                        SvnChangeLogCommandTest.java
               maven-scm-api/src/main/java/org/apache/maven/scm
                        ScmTestCase.java
               maven-scm-api/src/test/java/org/apache/maven/scm/command/changelog
                        ChangeLogEntryTest.java
               maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib
                        AbstractCvsScmTest.java
  Log:
  refactor date creation into ScmTestCase
  
  Revision  Changes    Path
  1.6       +3 -12     maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommandTest.java
  
  Index: SvnChangeLogCommandTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommandTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SvnChangeLogCommandTest.java	24 Dec 2004 03:41:11 -0000	1.5
  +++ SvnChangeLogCommandTest.java	30 Dec 2004 02:41:23 -0000	1.6
  @@ -36,17 +36,8 @@
       public void testCommandLine()
           throws Exception
       {
  -        Calendar cal = Calendar.getInstance();
  -
  -        cal.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
  -
  -        cal.set(2003, 8, 10, 0, 0, 0);
  -
  -        Date startDate = cal.getTime();
  -
  -        cal.set(2003, 9, 10, 0, 0, 0);
  -
  -        Date endDate = cal.getTime();
  +        Date startDate = getDate( 2003, 8, 10, GMT_TIME_ZONE );
  +        Date endDate = getDate( 2003, 9, 10, GMT_TIME_ZONE );
   
           testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, startDate, endDate,
                            "svn log --non-interactive -v -r \"{2003/09/10 GMT}:{2003/10/10
GMT}\" http://foo.com/svn/trunk" );
  
  
  
  1.11      +27 -1     maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/ScmTestCase.java
  
  Index: ScmTestCase.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/ScmTestCase.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ScmTestCase.java	24 Dec 2004 03:04:47 -0000	1.10
  +++ ScmTestCase.java	30 Dec 2004 02:41:23 -0000	1.11
  @@ -29,6 +29,9 @@
   import java.io.File;
   import java.io.FileWriter;
   import java.io.IOException;
  +import java.util.Date;
  +import java.util.Calendar;
  +import java.util.TimeZone;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -37,6 +40,8 @@
   public abstract class ScmTestCase
       extends PlexusTestCase
   {
  +    protected static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone( "GMT" );
  +
       private static boolean debugExecute;
   
       public ScmTestCase()
  @@ -207,5 +212,26 @@
           writer.write( contents );
   
           writer.close();
  +    }
  +
  +    protected Date getDate( int year, int month, int day )
  +    {
  +        Calendar cal = Calendar.getInstance();
  +
  +        cal.set( year, month, day, 0, 0, 0 );
  +        cal.set( Calendar.MILLISECOND, 0 );
  +
  +        return cal.getTime();
  +    }
  +
  +    protected Date getDate( int year, int month, int day, TimeZone tz )
  +    {
  +        Calendar cal = Calendar.getInstance();
  +
  +        cal.setTimeZone( tz );
  +        cal.set( year, month, day, 0, 0, 0 );
  +        cal.set( Calendar.MILLISECOND, 0 );
  +
  +        return cal.getTime();
       }
   }
  
  
  
  1.4       +5 -10     maven-scm/maven-scm-api/src/test/java/org/apache/maven/scm/command/changelog/ChangeLogEntryTest.java
  
  Index: ChangeLogEntryTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-api/src/test/java/org/apache/maven/scm/command/changelog/ChangeLogEntryTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ChangeLogEntryTest.java	24 Dec 2004 03:04:47 -0000	1.3
  +++ ChangeLogEntryTest.java	30 Dec 2004 02:41:23 -0000	1.4
  @@ -19,6 +19,7 @@
   import junit.framework.TestCase;
   import org.apache.maven.scm.command.changelog.ChangeLogEntry;
   import org.apache.maven.scm.command.changelog.ChangeLogFile;
  +import org.apache.maven.scm.ScmTestCase;
   
   import java.util.Calendar;
   import java.util.Date;
  @@ -30,7 +31,7 @@
    * @version $Id$
    */
   public class ChangeLogEntryTest
  -    extends TestCase
  +    extends ScmTestCase
   {
       /** the {@link ChangeLogEntry} used for testing */
       private ChangeLogEntry instance;
  @@ -131,10 +132,7 @@
        */
       public void testGetDate()
       {
  -        Calendar cal = Calendar.getInstance();
  -        cal.set( 2002, 3, 1, 0, 0, 0 );
  -        cal.set( Calendar.MILLISECOND, 0 );
  -        assertEquals( "Date value not retrieved correctly", cal.getTime(), instance.getDate()
);
  +        assertEquals( "Date value not retrieved correctly", getDate( 2002, 3, 1 ), instance.getDate()
);
       }
   
       /**
  @@ -154,10 +152,7 @@
       public void testSetDateFromString()
       {
           instance.setDate( "2002/03/04 00:00:00" );
  -        Calendar cal = Calendar.getInstance();
  -        cal.set( 2002, 2, 4, 0, 0, 0 );
  -        cal.set( Calendar.MILLISECOND, 0 );
  -        assertEquals( "Date value not set correctly from a string", cal.getTime(), instance.getDate()
);
  +        assertEquals( "Date value not set correctly from a string", getDate( 2002, 2, 4
), instance.getDate() );
       }
   
       /**
  
  
  
  1.5       +1 -10     maven-scm/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/AbstractCvsScmTest.java
  
  Index: AbstractCvsScmTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/AbstractCvsScmTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractCvsScmTest.java	24 Dec 2004 03:04:46 -0000	1.4
  +++ AbstractCvsScmTest.java	30 Dec 2004 02:41:23 -0000	1.5
  @@ -54,15 +54,6 @@
       // Utility methods
       // ----------------------------------------------------------------------
   
  -    protected Date getDate( int year, int month, int day )
  -    {
  -        Calendar cal = Calendar.getInstance();
  -
  -        cal.set( year, month, day );
  -
  -        return cal.getTime();
  -    }
  -
       protected void executeCVS( File workingDirectory, String arguments )
       	throws Exception
       {
  
  
  

Mime
View raw message