org.apache.maven.scm
Class ScmTckTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.codehaus.plexus.PlexusTestCase
              extended by org.apache.maven.scm.ScmTestCase
                  extended by org.apache.maven.scm.ScmTckTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractRemoteInfoCommandTckTest, BlameCommandTckTest, BranchCommandTckTest, ChangeLogCommandTckTest, CheckInCommandTckTest, CheckOutCommandTckTest, DiffCommandTckTest, ListCommandTckTest, MkdirCommandTckTest, StatusCommandTckTest, TagCommandTckTest, UpdateCommandTckTest

public abstract class ScmTckTestCase
extends ScmTestCase

Base class for all TcK tests.

Basically all it does is to setup a default test enviroment common for all tck tests. The default setup includes:

  1. Delete all default locations (working copy, updating copy etc)
  2. Initialize the repository
  3. Check out the repository to the working copy

Version:
$Id: ScmTckTestCase.java 1329106 2012-04-23 07:45:33Z olamy $
Author:
Torbj�rn Eikli Sm�rgrav

Field Summary
 
Fields inherited from class org.apache.maven.scm.ScmTestCase
GMT_TIME_ZONE
 
Fields inherited from class org.codehaus.plexus.PlexusTestCase
basedir, container
 
Constructor Summary
ScmTckTestCase()
           
 
Method Summary
protected  void addToWorkingTree(File workingDirectory, File file, ScmRepository repository)
          Convenience method to add a file to the working tree at the working directory
protected  CheckInScmResult checkIn(File workingDirectory, ScmRepository repository)
          Convenience method to check in files to the repository
protected  CheckOutScmResult checkOut(File workingDirectory, ScmRepository repository)
          Convenience method to check out files from the repository
protected  List<String> getScmFileNames()
          

Get the list of file names that is supposed to be in the test repo.

protected  ScmRepository getScmRepository()
          Convenience method to get the ScmRepository for this provider
abstract  String getScmUrl()
           
abstract  void initRepo()
          

Initialize repository at the getScmUrl() location with the files in getScmFileNames()

The setup is also asserting on the existence of these files.

protected  Map<String,ScmFile> mapFilesByPath(List<ScmFile> files)
          take the files of the given list, add them to a TreeMap and use the pathName String as key for the Map.
 void removeRepo()
          This method is available to those SCM clients that need to perform a cleanup at the end of the tests.
protected  void setUp()
          
protected  void tearDown()
          Provided to allow removeRepo() to be called.
 
Methods inherited from class org.apache.maven.scm.ScmTestCase
assertCommandLine, assertFile, assertPath, assertResultIsSuccess, execute, getAssertionCopy, getDate, getDate, getDate, getModule, getRepository, getRepositoryRoot, getScmFileSet, getScmManager, getUpdatingCopy, getWorkingCopy, getWorkingDirectory, isSystemCmd, makeDirectory, makeFile, makeFile, makeScmRepository, printOutputError, setDebugExecute
 
Methods inherited from class org.codehaus.plexus.PlexusTestCase
createContainerInstance, customizeContext, customizeContext, getBasedir, getClassLoader, getConfiguration, getConfiguration, getContainer, getCustomConfiguration, getResourceAsStream, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, release
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScmTckTestCase

public ScmTckTestCase()
Method Detail

getScmUrl

public abstract String getScmUrl()
                          throws Exception
Returns:
A provider specific and valid url for the repository
Throws:
Exception - if any

getScmFileNames

protected List<String> getScmFileNames()

Get the list of file names that is supposed to be in the test repo.

Returns:
List of String objects

initRepo

public abstract void initRepo()
                       throws Exception

Initialize repository at the getScmUrl() location with the files in getScmFileNames()

The setup is also asserting on the existence of these files.
This should only be used by this class (thus do not call this method from derived classes)

Note: 'svnadmin' should be a system command.

Throws:
Exception - if any

setUp

protected void setUp()
              throws Exception

Overrides:
setUp in class ScmTestCase
Throws:
Exception

removeRepo

public void removeRepo()
                throws Exception
This method is available to those SCM clients that need to perform a cleanup at the end of the tests. It is needed when server side operations are performed, or the check out dirs are outside of the normal target directory.

Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Provided to allow removeRepo() to be called.

Overrides:
tearDown in class org.codehaus.plexus.PlexusTestCase
Throws:
Exception
See Also:
TestCase.tearDown()

getScmRepository

protected ScmRepository getScmRepository()
                                  throws Exception
Convenience method to get the ScmRepository for this provider

Throws:
Exception

checkOut

protected CheckOutScmResult checkOut(File workingDirectory,
                                     ScmRepository repository)
                              throws Exception
Convenience method to check out files from the repository

Throws:
Exception

checkIn

protected CheckInScmResult checkIn(File workingDirectory,
                                   ScmRepository repository)
                            throws Exception
Convenience method to check in files to the repository

Throws:
Exception

addToWorkingTree

protected void addToWorkingTree(File workingDirectory,
                                File file,
                                ScmRepository repository)
                         throws Exception
Convenience method to add a file to the working tree at the working directory

Throws:
Exception

mapFilesByPath

protected Map<String,ScmFile> mapFilesByPath(List<ScmFile> files)
take the files of the given list, add them to a TreeMap and use the pathName String as key for the Map. This function is useful for every TCK which has to check for the existence of more than 1 file of the returned ScmResult, regardless of their order in the list. All backslashes in the path will be replaced by forward slashes for Windows compatibility.

Parameters:
files - List with ScmFiles
Returns:
Map key=pathName, value=ScmFile


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.