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.- Author:
- Jason van Zyl
-
-
Field Summary
Fields Modifier and Type Field Description protected static TimeZone
GMT_TIME_ZONE
-
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 void
assertCommandLine(String expectedCommand, File expectedWorkingDirectory, org.codehaus.plexus.util.cli.Commandline actualCommand)
protected void
assertFile(File root, String fileName)
void
assertPath(String expectedPath, String actualPath)
protected void
assertResultIsSuccess(ScmResult result)
static void
checkScmPresence(String scmProviderCommand)
void
customizeContainerConfiguration(org.codehaus.plexus.ContainerConfiguration configuration)
Allow custom test case implementations do augment the default container configuration before executing tests.protected void
deleteDirectory(File directory)
static void
execute(File workingDirectory, String executable, String arguments)
Execute the command lineprotected File
getAssertionCopy()
static Date
getDate(int year, int month, int day)
protected static Date
getDate(int year, int month, int day, int hourOfDay, int minute, int second, TimeZone tz)
protected static Date
getDate(int year, int month, int day, TimeZone tz)
protected File
getRepository()
protected File
getRepositoryRoot()
protected ScmFileSet
getScmFileSet()
protected ScmManager
getScmManager()
protected File
getUpdatingCopy()
protected File
getWorkingCopy()
protected File
getWorkingDirectory()
Legacy method - same as getWorkingCopy()static boolean
isSystemCmd(String cmd)
protected static void
makeDirectory(File basedir, String fileName)
protected static void
makeFile(File basedir, String fileName)
static void
makeFile(File basedir, String fileName, String contents)
protected ScmRepository
makeScmRepository(String scmUrl)
protected void
printOutputError(ScmResult result)
protected static void
setDebugExecute(boolean debugExecute)
void
setUp()
-
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 TimeZone GMT_TIME_ZONE
-
-
Constructor Detail
-
ScmTestCase
public ScmTestCase()
-
-
Method Detail
-
setUp
public void setUp() throws Exception
- Overrides:
setUp
in classPlexusJUnit4TestCase
- Throws:
Exception
-
customizeContainerConfiguration
public void customizeContainerConfiguration(org.codehaus.plexus.ContainerConfiguration configuration)
Description copied from class:PlexusJUnit4TestCase
Allow custom test case implementations do augment the default container configuration before executing tests.- Overrides:
customizeContainerConfiguration
in classPlexusJUnit4TestCase
-
getRepositoryRoot
protected File getRepositoryRoot()
- Returns:
- default location of the test read/write repository
-
getRepository
protected File getRepository()
- Returns:
- Location of the revisioned (read only) repository
-
getWorkingCopy
protected File getWorkingCopy()
- Returns:
- location of the working copy (always checkout)
-
getWorkingDirectory
protected File getWorkingDirectory()
Legacy method - same as getWorkingCopy()- Returns:
- location of the working copy (always checkout)
-
getAssertionCopy
protected File getAssertionCopy()
- Returns:
- default location for doing assertions on a working tree
-
getUpdatingCopy
protected File getUpdatingCopy()
- Returns:
- default location for doing update operations on a working tree
-
getScmManager
protected ScmManager getScmManager() throws Exception
- Throws:
Exception
-
makeScmRepository
protected ScmRepository makeScmRepository(String scmUrl) throws Exception
- Throws:
Exception
-
assertPath
public void assertPath(String expectedPath, String actualPath) throws Exception
- Throws:
Exception
-
assertFile
protected void assertFile(File root, String fileName) throws Exception
- Throws:
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(File workingDirectory, String executable, String arguments) throws Exception
Execute the command line- Parameters:
workingDirectory
- not nullexecutable
- not null, should be a system commandarguments
- not null- Throws:
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(File basedir, String fileName)
-
makeFile
protected static void makeFile(File basedir, String fileName) throws IOException
- Throws:
IOException
-
makeFile
public static void makeFile(File basedir, String fileName, String contents) throws IOException
- Throws:
IOException
-
deleteDirectory
protected void deleteDirectory(File directory) throws IOException
- Throws:
IOException
-
getDate
protected static Date getDate(int year, int month, int day, int hourOfDay, int minute, int second, TimeZone tz)
-
assertCommandLine
public void assertCommandLine(String expectedCommand, File expectedWorkingDirectory, org.codehaus.plexus.util.cli.Commandline actualCommand) throws IOException
- Throws:
IOException
-
checkScmPresence
public static void checkScmPresence(String scmProviderCommand)
-
isSystemCmd
public static boolean isSystemCmd(String cmd)
- Parameters:
cmd
- the executable to run, not null.- Returns:
- true if and only if the command is on the path
-
-