Package org.apache.maven.scm
Class ScmTestCase
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.codehaus.plexus.PlexusTestCase
org.apache.maven.scm.ScmTestCase
- All Implemented Interfaces:
junit.framework.Test
- Direct Known Subclasses:
AbstractCvsScmTest,CvsUpdateCommandTest,ScmTckTestCase
public abstract class ScmTestCase
extends org.codehaus.plexus.PlexusTestCase
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static booleanprotected static final TimeZoneprivate ScmManagerprivate org.sonatype.plexus.components.sec.dispatcher.SecDispatcher -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidassertCommandLine(String expectedCommand, File expectedWorkingDirectory, org.codehaus.plexus.util.cli.Commandline actualCommand) protected voidassertFile(File root, String fileName) voidassertPath(String expectedPath, String actualPath) protected voidassertResultIsSuccess(ScmResult result) protected voiddeleteDirectory(File directory) static voidExecute the command lineprotected Filestatic DategetDate(int year, int month, int day) protected static Dateprotected static Dateprotected Fileprotected Fileprotected ScmFileSetprotected ScmManagerorg.sonatype.plexus.components.sec.dispatcher.SecDispatcherIf you wish to use this component, make sure to configure your TCK implementation to include plexus component configuration as doc at https://issues.apache.org/jira/browse/MNG-4384protected Fileprotected Fileprotected FileLegacy method - same as getWorkingCopy()static booleanisSystemCmd(String cmd) protected static voidmakeDirectory(File basedir, String fileName) protected static voidstatic voidprotected ScmRepositorymakeScmRepository(String scmUrl) protected voidprintOutputError(ScmResult result) static voidprintSystemCmdUnavail(String cmd, String testName) protected static voidsetDebugExecute(boolean debugExecute) protected voidsetUp()Methods inherited from class org.codehaus.plexus.PlexusTestCase
customizeContainerConfiguration, customizeContext, getBasedir, getClassLoader, getConfigurationName, getContainer, getCustomConfigurationName, getResourceAsStream, getTestConfiguration, getTestConfiguration, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, lookup, lookup, release, setupContainer, tearDown, teardownContainerMethods 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 Details
-
GMT_TIME_ZONE
-
debugExecute
private static boolean debugExecute -
scmManager
-
secDispatcher
private org.sonatype.plexus.components.sec.dispatcher.SecDispatcher secDispatcher
-
-
Constructor Details
-
ScmTestCase
public ScmTestCase()
-
-
Method Details
-
setUp
- Overrides:
setUpin classorg.codehaus.plexus.PlexusTestCase- Throws:
Exception
-
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
-
getSecDispatcher
public org.sonatype.plexus.components.sec.dispatcher.SecDispatcher getSecDispatcher() throws ExceptionIf you wish to use this component, make sure to configure your TCK implementation to include plexus component configuration as doc at https://issues.apache.org/jira/browse/MNG-4384- Returns:
- SecDispatcher
- Throws:
Exception
-
makeScmRepository
- Throws:
Exception
-
assertPath
- Throws:
Exception
-
assertFile
- Throws:
Exception
-
assertResultIsSuccess
-
printOutputError
-
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:
-
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
-
isSystemCmd
- Parameters:
cmd- the executable to run, not null.- Returns:
- true if and only if the command is on the path
-