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, 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 enviroment and implements convenience methods.
  Version:
    $Id: ScmTestCase.java 687713 2008-08-21 11:12:33Z vsiveton $
  Author:
    Jason van Zyl

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static TimeZone` | `GMT_TIME_ZONE`

    - ### Fields inherited from class org.codehaus.plexus.PlexusTestCase

      `basedir, container`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScmTestCase()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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)` TODO This method is bogus.
    `protected void` | `assertResultIsSuccess(ScmResult result)`
    `static void` | `execute(File workingDirectory, String executable, String arguments)` Execute the command line
    `protected 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 String` | `getModule()`
    `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 static void` | `setDebugExecute(boolean debugExecute)`
    `protected void` | `setUp()`

    - ### Methods inherited from class org.codehaus.plexus.PlexusTestCase

      `createContainerInstance, customizeContext, customizeContext, getBasedir, getClassLoader, getConfiguration, getConfiguration, getContainer, getCustomConfiguration, getResourceAsStream, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, release, tearDown`

    - ### Methods inherited from class junit.framework.TestCase

      `countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString`

    - ### Methods inherited from class junit.framework.Assert

      `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, fail, fail, failNotEquals, failNotSame, failSame`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### GMT_TIME_ZONE

          protected static final TimeZone GMT_TIME_ZONE

  - ### Constructor Detail

    - #### ScmTestCase

          public ScmTestCase()

  - ### Method Detail

    - #### setUp

          protected void setUp()
                        throws Exception

      Overrides:
        `setUp` in class `org.codehaus.plexus.PlexusTestCase`
      Throws:
        `Exception`

    - #### getModule

          protected String getModule()

    - #### 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

      TODO This method is bogus. ActualPatch is not used and if used, it breaks some unit tests.
      Throws:
        `Exception`

    - #### assertFile

          protected void assertFile(File root,
                        String fileName)
                             throws Exception

      Throws:
        `Exception`

    - #### assertResultIsSuccess

          protected void assertResultIsSuccess(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 null
        `executable` - not null, should be a system command
        `arguments` - 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`

    - #### getDate

          public static Date getDate(int year,
                     int month,
                     int day)

    - #### getDate

          protected static Date getDate(int year,
                     int month,
                     int day,
                     TimeZone tz)

    - #### 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)

    - #### isSystemCmd

          public static boolean isSystemCmd(String cmd)

      Parameters:
        `cmd` - the executable to run, not null.
      Returns:
        `true`

Copyright © 2003–2015. All rights reserved.