|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.test.BaseRiceTestCase org.kuali.rice.test.RiceTestCase
public abstract class RiceTestCase
Useful superclass for all Rice test cases. Handles setup of test utilities and a test environment. Configures the Spring test environment providing a template method for custom context files in test mode. Also provides a template method for running custom transactional setUp. Tear down handles automatic tear down of objects created inside the test environment.
Field Summary | |
---|---|
protected static String |
DEFAULT_TEST_HARNESS_SPRING_BEANS
|
protected static String |
failedSuiteTestName
|
protected static org.apache.log4j.Logger |
LOG
|
protected List<Lifecycle> |
perTestLifeCycles
|
protected static boolean |
SUITE_LIFE_CYCLES_FAILED
|
protected static boolean |
SUITE_LIFE_CYCLES_RAN
|
protected List<Lifecycle> |
suiteLifeCycles
|
Fields inherited from class org.kuali.rice.test.BaseRiceTestCase |
---|
log, method |
Constructor Summary | |
---|---|
RiceTestCase()
|
Method Summary | |
---|---|
protected void |
configureLogging()
configures logging using custom properties file if specified, or the default one. |
protected String |
dumpMemory()
|
protected String |
getBaseDir()
Returns the basedir for the module under which the tests are currently executing. |
protected List<String> |
getConfigLocations()
Subclasses may override this method to customize the location(s) of the Rice configuration. |
protected String |
getFullTestName()
|
protected Lifecycle |
getLoadApplicationLifecycle()
This should return a Lifecycle that can be used to load the application being tested. |
protected abstract String |
getModuleName()
same as the module directory in the project. |
protected String |
getModuleTestConfigLocation()
|
protected List<Lifecycle> |
getPerTestLifecycles()
|
protected String |
getRiceMasterDefaultConfigFile()
|
protected List<Lifecycle> |
getSuiteLifecycles()
Returns the List of Lifecycles to start when the unit test suite is started |
protected Config |
getTestHarnessConfig()
|
protected List<String> |
getTestHarnessSpringBeansLocation()
Returns the location of the test harness spring beans context file. |
SpringResourceLoader |
getTestHarnessSpringResourceLoader()
|
protected String |
getUserDir()
the absolute path on the file system to the root folder of the maven module containing a child of this class e.g. |
protected void |
loadPerTestData()
A method that can be overridden to load test data on a test-by-test basis |
protected void |
loadSuiteTestData()
A method that can be overridden to load test data for the unit test Suite. |
protected void |
logAfterRun()
|
protected void |
logBeforeRun()
|
protected void |
report(String report)
|
protected void |
setBaseDirSystemProperty(String moduleBaseDir)
maven will set this property and find resources from the config based on it. |
protected void |
setClearTables(boolean clearTables)
|
protected void |
setModuleName(String moduleName)
|
void |
setUp()
|
protected void |
setUpInternal()
Internal setUp() implementation which is invoked by the main setUp() and wrapped with exception handling |
protected void |
startLifecycles(List<Lifecycle> lifecycles)
Executes the start() method of each of the lifecycles in the given list. |
protected void |
startSuiteDataLoaderLifecycles()
This block is walking up the class hierarchy of the current unit test looking for PerSuiteUnitTestData annotations. |
protected void |
stopLifecycles(List<Lifecycle> lifecycles)
Executes the stop() method of each of the lifecyles in the given list. |
void |
tearDown()
|
Methods inherited from class org.kuali.rice.test.BaseRiceTestCase |
---|
getName, getPerTestDataLoaderLifecycle, resetLogLevels, setLogLevel, setName, setTestMethod |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.log4j.Logger LOG
protected static final String DEFAULT_TEST_HARNESS_SPRING_BEANS
protected static boolean SUITE_LIFE_CYCLES_RAN
protected static boolean SUITE_LIFE_CYCLES_FAILED
protected static String failedSuiteTestName
protected List<Lifecycle> perTestLifeCycles
protected List<Lifecycle> suiteLifeCycles
Constructor Detail |
---|
public RiceTestCase()
Method Detail |
---|
public void setUp() throws Exception
setUp
in class BaseRiceTestCase
Exception
protected void setUpInternal() throws Exception
Subclasses should override this method if they want to add set up steps that should occur in the standard set up process, wrapped by exception handling.
Exception
protected void startSuiteDataLoaderLifecycles() throws Exception
Exception
- if a PerSuiteDataLoaderLifecycle is unable to be startedprotected void setBaseDirSystemProperty(String moduleBaseDir)
protected String getUserDir()
the user.dir property can be set on the CLI or IDE run configuration e.g. -Duser.dir=/some/dir
protected String getBaseDir()
protected void setModuleName(String moduleName)
public void tearDown() throws Exception
tearDown
in class BaseRiceTestCase
Exception
protected void logBeforeRun()
protected void logAfterRun()
protected String getFullTestName()
protected void configureLogging() throws IOException
To configure a custom logging file, set a JVM system property on using -D. For example -Dalt.log4j.config.location=file:/home/me/kuali/test/dev/log4j.properties
The above option can also be set in the run configuration for the unit test in the IDE. To avoid log4j using files called log4j.properties that are defined in the classpath, add the following system property: -Dlog4j.defaultInitOverride=true
IOException
protected void startLifecycles(List<Lifecycle> lifecycles) throws Exception
Exception
protected void stopLifecycles(List<Lifecycle> lifecycles) throws Exception
Exception
protected List<Lifecycle> getSuiteLifecycles()
protected Lifecycle getLoadApplicationLifecycle()
protected List<Lifecycle> getPerTestLifecycles()
protected void loadSuiteTestData() throws Exception
Exception
protected void loadPerTestData() throws Exception
Exception
protected void report(String report)
protected String dumpMemory()
public SpringResourceLoader getTestHarnessSpringResourceLoader()
protected List<String> getTestHarnessSpringBeansLocation()
protected Config getTestHarnessConfig() throws Exception
Exception
protected List<String> getConfigLocations()
protected String getModuleTestConfigLocation()
protected String getRiceMasterDefaultConfigFile()
protected abstract String getModuleName()
protected void setClearTables(boolean clearTables)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |