nl.toolforge.karma.core.test
Class LocalCVSInitializer

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bynl.toolforge.karma.core.test.BaseTest
              extended bynl.toolforge.karma.core.test.LocalCVSInitializer
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
CommandTestHelper

public class LocalCVSInitializer
extends BaseTest

Initializes tests that need a local CVS repository. This local repository can be found as a zip-file and/or tar file in the resources/test directory of this packages' sources. It contains a CVS repository with predefined modules that can be used for testing purposes. If the CVS repository cannot be found (i.e. the user has not prepared his/her local environment with the CVSROOT), and you don't want your CVS stuff to be tested, make sure you ignore these testcases in your test-configuration.

Note the dependency of this class with Location and CVSRepository.

When performing operations on managed files, a randomize function is used to be able to repeatedly perform tests. Filenames and modulenames in the repository could be named like bla_036548290.56437.

Version:
$Id:
Author:
D.A. Smedes

Field Summary
protected static java.lang.String DEFAULT_MODULE_1
          The name of the a test module in the test repository
protected static java.util.Random randomizer
          Can be used to access random ints.
 
Constructor Summary
LocalCVSInitializer()
           
 
Method Summary
 Module checkoutDefaultModule1()
          Checks out DEFAULT_MODULE_1, which can then be used to test against.
 Module checkoutDefaultModuleWithVersion()
           
protected  java.lang.String getTestFileName()
          Creates a randomly named test filename in the module directory (TestModule) for the test cvs repository.
protected  CVSRepository getTestLocation()
          Gets the CVSRepository that can be used for junit testing.
protected  Runner getTestRunner()
          Initializes a Runner for test purposes.
protected  Runner getTestRunner(CommandResponse response)
          Initializes a Runner for test purposes, with an optional CommandResponse.
 void setUp()
           
 void tearDown()
          Deletes the temporary directory.
 void testNothing()
          When this class is run (it is a test class), it won't bother you with 'no tests found'.
 
Methods inherited from class nl.toolforge.karma.core.test.BaseTest
getClassLoader, getWorkingContext
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_MODULE_1

protected static final java.lang.String DEFAULT_MODULE_1
The name of the a test module in the test repository

See Also:
Constant Field Values

randomizer

protected static java.util.Random randomizer
Can be used to access random ints.

Constructor Detail

LocalCVSInitializer

public LocalCVSInitializer()
Method Detail

setUp

public void setUp()
           throws InitializationException
Overrides:
setUp in class BaseTest
Throws:
InitializationException

tearDown

public void tearDown()
Deletes the temporary directory.

Overrides:
tearDown in class BaseTest

getTestLocation

protected CVSRepository getTestLocation()
Gets the CVSRepository that can be used for junit testing.


getTestFileName

protected java.lang.String getTestFileName()
                                    throws InitializationException
Creates a randomly named test filename in the module directory (TestModule) for the test cvs repository. Names are of the form test_<random-int>.

Throws:
InitializationException

checkoutDefaultModule1

public final Module checkoutDefaultModule1()

Checks out DEFAULT_MODULE_1, which can then be used to test against.


checkoutDefaultModuleWithVersion

public final Module checkoutDefaultModuleWithVersion()

getTestRunner

protected final Runner getTestRunner()
                              throws CVSException,
                                     AuthenticationException
Initializes a Runner for test purposes.

Returns:
A Runner instance.
Throws:
CVSException - When initializing the runner failed.
AuthenticationException

getTestRunner

protected final Runner getTestRunner(CommandResponse response)
                              throws CVSException,
                                     AuthenticationException
Initializes a Runner for test purposes, with an optional CommandResponse.

Parameters:
response -
Returns:
Throws:
CVSException - When initializing the runner failed.
AuthenticationException

testNothing

public void testNothing()
When this class is run (it is a test class), it won't bother you with 'no tests found'.



Copyright © 2002-2004 Toolforge. All Rights Reserved.