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 CvsScmTestUtils.java AbstractCvsScmTest.java
Date Thu, 30 Dec 2004 03:39:52 GMT
brett       2004/12/29 19:39:52

  Modified:    maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/command/checkout
                        CvsCheckoutCommandTest.java
               maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/command/update
                        CvsUpdateCommandTest.java
               maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib
                        AbstractCvsScmTest.java
  Added:       maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/command/checkout
                        CvsCheckOutCommandTckTest.java
               maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib
                        CvsScmTestUtils.java
  Log:
  TCK test for CVS
  
  Revision  Changes    Path
  1.7       +3 -3      maven-scm/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/command/checkout/CvsCheckoutCommandTest.java
  
  Index: CvsCheckoutCommandTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/command/checkout/CvsCheckoutCommandTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CvsCheckoutCommandTest.java	24 Dec 2004 03:04:46 -0000	1.6
  +++ CvsCheckoutCommandTest.java	30 Dec 2004 03:39:52 -0000	1.7
  @@ -43,7 +43,7 @@
       {
           ScmManager scmManager = getScmManager();
   
  -        CheckOutScmResult result = scmManager.checkOut( getScmUrl(), getScmFileSet(), null
);
  +        CheckOutScmResult result = scmManager.checkOut( getScmRepository(), getScmFileSet(),
null );
   
           if ( !result.isSuccess() )
           {
  @@ -68,7 +68,7 @@
       {
           ScmManager scmManager = getScmManager();
   
  -        CheckOutScmResult result = scmManager.checkOut( getScmUrl(), getScmFileSet(), "1.107.4"
);
  +        CheckOutScmResult result = scmManager.checkOut( getScmRepository(), getScmFileSet(),
"1.107.4" );
   
           if ( !result.isSuccess() )
           {
  
  
  
  1.1                  maven-scm/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/command/checkout/CvsCheckOutCommandTckTest.java
  
  Index: CvsCheckOutCommandTckTest.java
  ===================================================================
  package org.apache.maven.scm.provider.cvslib.command.checkout;
  
  /*
   * Copyright 2003-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import org.apache.maven.scm.tck.command.checkout.CheckOutCommandTckTest;
  import org.apache.maven.scm.provider.cvslib.CvsScmTestUtils;
  
  /**
   * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
   * @version $Id: CvsCheckOutCommandTckTest.java,v 1.1 2004/12/30 03:39:52 brett Exp $
   */
  public class CvsCheckOutCommandTckTest
      extends CheckOutCommandTckTest
  {
      public String getScmUrl()
      {
          return CvsScmTestUtils.getScmUrl( getRepositoryRoot(), getModule() );
      }
  
      protected String getModule()
      {
          return "test-repo/checkout";
      }
  
      public void initRepo()
          throws Exception
      {
          // TODO: should have an assertion directory?
          CvsScmTestUtils.initRepo( "src/test/tck-repository/", getRepositoryRoot(), getWorkingDirectory()
);
      }
  }
  
  
  
  1.8       +7 -21     maven-scm/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/command/update/CvsUpdateCommandTest.java
  
  Index: CvsUpdateCommandTest.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/command/update/CvsUpdateCommandTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CvsUpdateCommandTest.java	24 Dec 2004 03:04:46 -0000	1.7
  +++ CvsUpdateCommandTest.java	30 Dec 2004 03:39:52 -0000	1.8
  @@ -22,6 +22,7 @@
   import org.apache.maven.scm.command.update.UpdateScmResult;
   import org.apache.maven.scm.manager.ScmManager;
   import org.apache.maven.scm.provider.cvslib.AbstractCvsScmTest;
  +import org.apache.maven.scm.provider.cvslib.CvsScmTestUtils;
   import org.apache.maven.scm.repository.ScmRepository;
   import org.codehaus.plexus.util.FileUtils;
   
  @@ -47,28 +48,13 @@
       {
           super.setUp();
   
  -        // Copy the repository to target
  -        File src = getTestFile( "src/test/repository/" );
  -
           repository = getTestFile( "target/update-test/repository" );
   
           workingDirectory = getTestFile( "target/update-test/working-directory" );
   
           assertionDirectory = getTestFile( "target/update-test/assertion-directory" );
   
  -        FileUtils.deleteDirectory( repository );
  -
  -        assertTrue( repository.mkdirs() );
  -
  -        FileUtils.deleteDirectory( workingDirectory );
  -
  -        assertTrue( workingDirectory.mkdirs() );
  -
  -        FileUtils.deleteDirectory( assertionDirectory );
  -
  -        assertTrue( assertionDirectory.mkdirs() );
  -
  -        FileUtils.copyDirectoryStructure( src, repository );
  +        CvsScmTestUtils.initRepo( repository, workingDirectory, assertionDirectory );
       }
   
       protected String getModule()
  @@ -87,13 +73,13 @@
           String arguments = "-d " + repository.getAbsolutePath() + " " +
                              "co -d " + workingDirectory.getName() + " " + getModule();
   
  -        executeCVS( workingDirectory.getParentFile(), arguments );
  +        CvsScmTestUtils.executeCVS( workingDirectory.getParentFile(), arguments );
   
           // Check out the repo to a assertion directory where the command will be used
           arguments = "-d " + repository.getAbsolutePath() + " " +
                       "co -d " + assertionDirectory.getName() + " " + getModule();
   
  -        executeCVS( assertionDirectory.getParentFile(), arguments );
  +        CvsScmTestUtils.executeCVS( assertionDirectory.getParentFile(), arguments );
   
           // A new check out should return 0 updated files.
           ScmRepository scmRepository = scmManager.makeScmRepository( scmUrl );
  @@ -140,12 +126,12 @@
   
           arguments = "-d " + repository.getAbsolutePath() + " add New.txt";
   
  -        executeCVS( workingDirectory, arguments );
  +        CvsScmTestUtils.executeCVS( workingDirectory, arguments );
   
           // Committing
           arguments = "-d " + repository.getAbsolutePath() + " commit -m .";
   
  -        executeCVS( workingDirectory, arguments );
  +        CvsScmTestUtils.executeCVS( workingDirectory, arguments );
   
           // Check the updated files
           result = scmManager.update( scmRepository, new ScmFileSet( assertionDirectory ),
null );
  
  
  
  1.6       +4 -17     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractCvsScmTest.java	30 Dec 2004 02:41:23 -0000	1.5
  +++ AbstractCvsScmTest.java	30 Dec 2004 03:39:52 -0000	1.6
  @@ -25,6 +25,7 @@
   import java.util.Date;
   
   /**
  + * @todo refactor into non-existence
    * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
    * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
    * @version $Id$
  @@ -40,23 +41,9 @@
           FileUtils.mkdir( getWorkingDirectory().getAbsolutePath() );
       }
   
  -    // ----------------------------------------------------------------------
  -    // Implementation of the abstract ScmTestCase methods
  -    // ----------------------------------------------------------------------
  -
  -    protected ScmRepository getScmUrl()
  -    	throws Exception
  -    {
  -        return makeScmRepository( "scm:cvs|local|" + getRepository() + "|" + getModule()
);
  -    }
  -
  -    // ----------------------------------------------------------------------
  -    // Utility methods
  -    // ----------------------------------------------------------------------
  -
  -    protected void executeCVS( File workingDirectory, String arguments )
  +    protected ScmRepository getScmRepository()
       	throws Exception
       {
  -        execute( workingDirectory, "cvs", arguments );
  +        return makeScmRepository( CvsScmTestUtils.getScmUrl( getRepository(), getModule()
) );
       }
   }
  
  
  
  1.1                  maven-scm/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/CvsScmTestUtils.java
  
  Index: CvsScmTestUtils.java
  ===================================================================
  package org.apache.maven.scm.provider.cvslib;
  
  /*
   * Copyright 2003-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import junit.framework.Assert;
  import org.apache.maven.scm.ScmTestCase;
  import org.codehaus.plexus.util.FileUtils;
  import org.codehaus.plexus.util.StringUtils;
  import org.codehaus.plexus.util.cli.CommandLineUtils;
  import org.codehaus.plexus.util.cli.Commandline;
  import org.codehaus.plexus.PlexusTestCase;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.IOException;
  
  /**
   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
   * @version $Id: CvsScmTestUtils.java,v 1.1 2004/12/30 03:39:52 brett Exp $
   */
  public final class CvsScmTestUtils
  {
      private CvsScmTestUtils()
      {
      }
  
      public static String getScmUrl( File repository, String module )
      {
          return "scm:cvs|local|" + repository + "|" + module;
      }
  
      public static void executeCVS( File workingDirectory, String arguments )
      	throws Exception
      {
          ScmTestCase.execute( workingDirectory, "cvs", arguments );
      }
  
      public static void initRepo( File repository, File workingDirectory, File assertionDirectory
)
          throws IOException
      {
          initRepo( "src/test/repository/", repository, workingDirectory );
  
          FileUtils.deleteDirectory( assertionDirectory );
  
          Assert.assertTrue( assertionDirectory.mkdirs() );
      }
  
      public static void initRepo( String source, File repository, File workingDirectory )
          throws IOException
      {
          // Copy the repository to target
          File src = PlexusTestCase.getTestFile( source );
  
          FileUtils.deleteDirectory( repository );
  
          Assert.assertTrue( repository.mkdirs() );
  
          FileUtils.copyDirectoryStructure( src, repository );
  
          FileUtils.deleteDirectory( workingDirectory );
  
          Assert.assertTrue( workingDirectory.mkdirs() );
      }
  }
  
  
  

Mime
View raw message