Package org.apache.maven.scm
Class ScmTestCase
- java.lang.Object
-
- org.apache.maven.scm.PlexusJUnit4TestCase
-
- org.apache.maven.scm.ScmTestCase
-
- Direct Known Subclasses:
ScmTckTestCase
public abstract class ScmTestCase extends PlexusJUnit4TestCase
Base class for all SCM tests. Consumers will typically extend this class while tck test would extend ScmTckTestCase.
This class basically defines default locations for the test environment and implements convenience methods.
-
-
Field Summary
Fields Modifier and Type Field Description private static booleandebugExecuteprotected static java.util.TimeZoneGMT_TIME_ZONEprivate ScmManagerscmManager-
Fields inherited from class org.apache.maven.scm.PlexusJUnit4TestCase
testName
-
-
Constructor Summary
Constructors Constructor Description ScmTestCase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassertCommandLine(java.lang.String expectedCommand, java.io.File expectedWorkingDirectory, org.codehaus.plexus.util.cli.Commandline actualCommand)protected voidassertFile(java.io.File root, java.lang.String fileName)voidassertPath(java.lang.String expectedPath, java.lang.String actualPath)protected voidassertResultIsSuccess(ScmResult result)static voidcheckSystemCmdPresence(java.lang.String scmProviderCommand)voidcustomizeContainerConfiguration(org.codehaus.plexus.ContainerConfiguration configuration)Allow custom test case implementations do augment the default container configuration before executing tests.protected voiddeleteDirectory(java.io.File directory)static voidexecute(java.io.File workingDirectory, java.lang.String executable, java.lang.String arguments)Execute the command line.protected java.io.FilegetAssertionCopy()static java.util.DategetDate(int year, int month, int day)protected static java.util.DategetDate(int year, int month, int day, int hourOfDay, int minute, int second, java.util.TimeZone tz)protected static java.util.DategetDate(int year, int month, int day, java.util.TimeZone tz)protected java.io.FilegetRepository()protected java.io.FilegetRepositoryRoot()protected ScmFileSetgetScmFileSet()protected ScmManagergetScmManager()protected java.io.FilegetUpdatingCopy()protected java.io.FilegetWorkingCopy()protected java.io.FilegetWorkingDirectory()Legacy method - same as getWorkingCopy()static booleanisSystemCmd(java.lang.String cmd)protected static voidmakeDirectory(java.io.File basedir, java.lang.String fileName)protected static voidmakeFile(java.io.File basedir, java.lang.String fileName)static voidmakeFile(java.io.File basedir, java.lang.String fileName, java.lang.String contents)protected ScmRepositorymakeScmRepository(java.lang.String scmUrl)protected voidprintOutputError(ScmResult result)protected static voidsetDebugExecute(boolean debugExecute)voidsetUp()-
Methods inherited from class org.apache.maven.scm.PlexusJUnit4TestCase
customizeComponentConfiguration, customizeContext, getBasedir, getClassLoader, getConfiguration, getConfiguration, getConfigurationName, getContainer, getCustomConfigurationName, getCustomModules, getName, getResourceAsStream, getTestConfiguration, getTestConfiguration, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, lookup, lookup, lookupMap, release, setupContainer, tearDown
-
-
-
-
Field Detail
-
GMT_TIME_ZONE
protected static final java.util.TimeZone GMT_TIME_ZONE
-
debugExecute
private static boolean debugExecute
-
scmManager
private ScmManager scmManager
-
-
Method Detail
-
setUp
public void setUp() throws java.lang.Exception- Overrides:
setUpin classPlexusJUnit4TestCase- Throws:
java.lang.Exception
-
customizeContainerConfiguration
public void customizeContainerConfiguration(org.codehaus.plexus.ContainerConfiguration configuration)
Description copied from class:PlexusJUnit4TestCaseAllow custom test case implementations do augment the default container configuration before executing tests.- Overrides:
customizeContainerConfigurationin classPlexusJUnit4TestCase
-
getRepositoryRoot
protected java.io.File getRepositoryRoot()
- Returns:
- default location of the test read/write repository
-
getRepository
protected java.io.File getRepository()
- Returns:
- location of the revisioned (read only) repository
-
getWorkingCopy
protected java.io.File getWorkingCopy()
- Returns:
- location of the working copy (always checkout)
-
getWorkingDirectory
protected java.io.File getWorkingDirectory()
Legacy method - same as getWorkingCopy()- Returns:
- location of the working copy (always checkout)
-
getAssertionCopy
protected java.io.File getAssertionCopy()
- Returns:
- default location for doing assertions on a working tree
-
getUpdatingCopy
protected java.io.File getUpdatingCopy()
- Returns:
- default location for doing update operations on a working tree
-
getScmManager
protected ScmManager getScmManager() throws java.lang.Exception
- Throws:
java.lang.Exception
-
makeScmRepository
protected ScmRepository makeScmRepository(java.lang.String scmUrl) throws java.lang.Exception
- Throws:
java.lang.Exception
-
assertPath
public void assertPath(java.lang.String expectedPath, java.lang.String actualPath) throws java.lang.Exception- Throws:
java.lang.Exception
-
assertFile
protected void assertFile(java.io.File root, java.lang.String fileName) throws java.lang.Exception- Throws:
java.lang.Exception
-
assertResultIsSuccess
protected void assertResultIsSuccess(ScmResult result)
-
printOutputError
protected void printOutputError(ScmResult result)
-
getScmFileSet
protected ScmFileSet getScmFileSet()
-
setDebugExecute
protected static void setDebugExecute(boolean debugExecute)
-
execute
public static void execute(java.io.File workingDirectory, java.lang.String executable, java.lang.String arguments) throws java.lang.ExceptionExecute the command line.- Parameters:
workingDirectory- not nullexecutable- not null, should be a system commandarguments- not null- Throws:
java.lang.Exception- if any- See Also:
CommandLineUtils.executeCommandLine(Commandline, org.codehaus.plexus.util.cli.StreamConsumer, org.codehaus.plexus.util.cli.StreamConsumer)
-
makeDirectory
protected static void makeDirectory(java.io.File basedir, java.lang.String fileName)
-
makeFile
protected static void makeFile(java.io.File basedir, java.lang.String fileName) throws java.io.IOException- Throws:
java.io.IOException
-
makeFile
public static void makeFile(java.io.File basedir, java.lang.String fileName, java.lang.String contents) throws java.io.IOException- Throws:
java.io.IOException
-
deleteDirectory
protected void deleteDirectory(java.io.File directory) throws java.io.IOException- Throws:
java.io.IOException
-
getDate
public static java.util.Date getDate(int year, int month, int day)
-
getDate
protected static java.util.Date getDate(int year, int month, int day, java.util.TimeZone tz)
-
getDate
protected static java.util.Date getDate(int year, int month, int day, int hourOfDay, int minute, int second, java.util.TimeZone tz)
-
assertCommandLine
public void assertCommandLine(java.lang.String expectedCommand, java.io.File expectedWorkingDirectory, org.codehaus.plexus.util.cli.Commandline actualCommand) throws java.io.IOException- Throws:
java.io.IOException
-
checkSystemCmdPresence
public static void checkSystemCmdPresence(java.lang.String scmProviderCommand)
-
isSystemCmd
public static boolean isSystemCmd(java.lang.String cmd)
- Parameters:
cmd- the executable to run, not null- Returns:
- true if and only if the command is on the path
-
-