Package org.apache.maven.scm
Class ScmTestCase
java.lang.Object
org.apache.maven.scm.PlexusJUnit4TestSupport
org.apache.maven.scm.ScmTestCase
- Direct Known Subclasses:
ScmTckTestCase
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.
This class basically defines default locations for the test environment and implements convenience methods.
- Author:
- Jason van Zyl
-
Field Summary
FieldsFields inherited from class org.apache.maven.scm.PlexusJUnit4TestSupport
testName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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) protected 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 the command lineprotected File
static Date
getDate
(int year, int month, int day) protected static Date
protected static Date
protected File
protected File
protected ScmFileSet
protected ScmManager
protected File
protected File
protected File
Legacy method - same as getWorkingCopy()static boolean
isSystemCmd
(String cmd) protected static void
makeDirectory
(File basedir, String fileName) protected static void
static void
protected ScmRepository
makeScmRepository
(String scmUrl) protected void
printOutputError
(ScmResult result) static void
printSystemCmdUnavail
(String cmd, String testName) protected static void
setDebugExecute
(boolean debugExecute) void
setUp()
Methods inherited from class org.apache.maven.scm.PlexusJUnit4TestSupport
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 Details
-
GMT_TIME_ZONE
-
-
Constructor Details
-
ScmTestCase
public ScmTestCase()
-
-
Method Details
-
setUp
- Overrides:
setUp
in classPlexusJUnit4TestSupport
- Throws:
Exception
-
customizeContainerConfiguration
protected void customizeContainerConfiguration(org.codehaus.plexus.ContainerConfiguration configuration) Description copied from class:PlexusJUnit4TestSupport
Allow custom test case implementations do augment the default container configuration before executing tests.- Overrides:
customizeContainerConfiguration
in classPlexusJUnit4TestSupport
-
getRepositoryRoot
- Returns:
- default location of the test read/write repository
-
getRepository
- Returns:
- Location of the revisioned (read only) repository
-
getWorkingCopy
- Returns:
- location of the working copy (always checkout)
-
getWorkingDirectory
Legacy method - same as getWorkingCopy()- Returns:
- location of the working copy (always checkout)
-
getAssertionCopy
- Returns:
- default location for doing assertions on a working tree
-
getUpdatingCopy
- Returns:
- default location for doing update operations on a working tree
-
getScmManager
- Throws:
Exception
-
makeScmRepository
- Throws:
Exception
-
assertPath
- Throws:
Exception
-
assertFile
- Throws:
Exception
-
assertResultIsSuccess
-
printOutputError
-
getScmFileSet
-
setDebugExecute
-
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
-
makeFile
- Throws:
IOException
-
makeFile
- Throws:
IOException
-
deleteDirectory
- Throws:
IOException
-
getDate
-
getDate
-
getDate
-
assertCommandLine
public void assertCommandLine(String expectedCommand, File expectedWorkingDirectory, org.codehaus.plexus.util.cli.Commandline actualCommand) throws IOException - Throws:
IOException
-
checkScmPresence
-
isSystemCmd
- Parameters:
cmd
- the executable to run, not null.- Returns:
- true if and only if the command is on the path
-