Package org.apache.maven.scm
Class ScmTckTestCase
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- org.codehaus.plexus.PlexusTestCase
-
- org.apache.maven.scm.ScmTestCase
-
- 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:- Delete all default locations (working copy, updating copy etc)
- Initialize the repository
- Check out the repository to the working copy
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>
scmFileNames
private ScmRepository
scmRepository
-
Fields inherited from class org.apache.maven.scm.ScmTestCase
GMT_TIME_ZONE
-
-
Constructor Summary
Constructors Constructor Description ScmTckTestCase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addToWorkingTree(java.io.File workingDirectory, java.io.File file, ScmRepository repository)
Convenience method to add a file to the working tree at the working directoryprotected CheckInScmResult
checkIn(java.io.File workingDirectory, ScmRepository repository)
Convenience method to check in files to the repositoryprotected CheckOutScmResult
checkOut(java.io.File workingDirectory, ScmRepository repository)
Convenience method to check out files from the repositoryprotected EditScmResult
edit(java.io.File basedir, java.lang.String includes, java.lang.String excludes, ScmRepository repository)
protected java.util.List<java.lang.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 providerabstract java.lang.String
getScmUrl()
abstract void
initRepo()
Initialize repository at thegetScmUrl()
location with the files ingetScmFileNames()
protected java.util.Map<java.lang.String,ScmFile>
mapFilesByPath(java.util.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, deleteDirectory, execute, getAssertionCopy, getDate, getDate, getDate, getModule, getRepository, getRepositoryRoot, getScmFileSet, getScmManager, getSecDispatcher, getUpdatingCopy, getWorkingCopy, getWorkingDirectory, isSystemCmd, makeDirectory, makeFile, makeFile, makeScmRepository, printOutputError, setDebugExecute
-
Methods inherited from class org.codehaus.plexus.PlexusTestCase
customizeComponentConfiguration, customizeContainerConfiguration, customizeContext, getBasedir, getClassLoader, getConfiguration, getConfiguration, getConfigurationName, getContainer, getCustomConfigurationName, getResourceAsStream, getTestConfiguration, getTestConfiguration, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, lookup, lookup, release, setupContainer
-
Methods inherited from class junit.framework.TestCase
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
-
-
-
-
Field Detail
-
scmRepository
private ScmRepository scmRepository
-
scmFileNames
private java.util.List<java.lang.String> scmFileNames
-
-
Method Detail
-
getScmUrl
public abstract java.lang.String getScmUrl() throws java.lang.Exception
- Returns:
- A provider specific and valid url for the repository
- Throws:
java.lang.Exception
- if any
-
getScmFileNames
protected java.util.List<java.lang.String> getScmFileNames()
Get the list of file names that is supposed to be in the test repo.- /pom.xml
- /readme.txt
- /src/main/java/Application.java
- /src/test/java/Test.java
- Returns:
List
ofString
objects
-
initRepo
public abstract void initRepo() throws java.lang.Exception
Initialize repository at thegetScmUrl()
location with the files ingetScmFileNames()
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:
java.lang.Exception
- if any
-
setUp
protected void setUp() throws java.lang.Exception
- Overrides:
setUp
in classScmTestCase
- Throws:
java.lang.Exception
-
removeRepo
public void removeRepo() throws java.lang.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:
java.lang.Exception
-
tearDown
protected void tearDown() throws java.lang.Exception
Provided to allow removeRepo() to be called.- Overrides:
tearDown
in classorg.codehaus.plexus.PlexusTestCase
- Throws:
java.lang.Exception
- See Also:
TestCase.tearDown()
-
getScmRepository
protected ScmRepository getScmRepository() throws java.lang.Exception
Convenience method to get the ScmRepository for this provider- Throws:
java.lang.Exception
-
checkOut
protected CheckOutScmResult checkOut(java.io.File workingDirectory, ScmRepository repository) throws java.lang.Exception
Convenience method to check out files from the repository- Throws:
java.lang.Exception
-
checkIn
protected CheckInScmResult checkIn(java.io.File workingDirectory, ScmRepository repository) throws java.lang.Exception
Convenience method to check in files to the repository- Throws:
java.lang.Exception
-
addToWorkingTree
protected void addToWorkingTree(java.io.File workingDirectory, java.io.File file, ScmRepository repository) throws java.lang.Exception
Convenience method to add a file to the working tree at the working directory- Throws:
java.lang.Exception
-
mapFilesByPath
protected java.util.Map<java.lang.String,ScmFile> mapFilesByPath(java.util.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 withScmFile
s- Returns:
- Map key=pathName, value=ScmFile
-
edit
protected EditScmResult edit(java.io.File basedir, java.lang.String includes, java.lang.String excludes, ScmRepository repository) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-