Package org.dbunit.util.fileloader
Class AbstractDataFileLoader
java.lang.Object
org.dbunit.util.fileloader.AbstractDataFileLoader
- All Implemented Interfaces:
DataFileLoader
- Direct Known Subclasses:
CsvDataFileLoader,FlatXmlDataFileLoader,FullXmlDataFileLoader,XlsDataFileLoader
Base class with common implementation for dbUnit data file loaders.
- Since:
- 2.4.8
- Version:
- $Revision$ $Date$
- Author:
- Jeff Jensen jeffjensen AT users.sourceforge.net, Last changed by: $Author$
-
Constructor Summary
ConstructorsConstructorDescriptionCreate new instance.Create new instance with replacement objects.AbstractDataFileLoader(Map ro, Map rs) Create new instance with replacement objects and replacement substrings. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the specified replacement objects to existing ones for use withReplacementDataSet.voidAdd the specified replacement substrings to existing ones for use withReplacementDataSet.Load the specified String filename from the classpath into a dbUnit dataset.protected ReplacementDataSetAdd the replacements in the maps (objects and substrings) to the specified dataset.voidRemove all existing replacement objects, resetting to none so no object replacements occur.voidRemove all existing replacement substring objects, resetting to none so no substring replacements occur.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dbunit.util.fileloader.DataFileLoader
loadDataSet
-
Constructor Details
-
AbstractDataFileLoader
public AbstractDataFileLoader()Create new instance. -
AbstractDataFileLoader
Create new instance with replacement objects.- Parameters:
replacementObjects- The replacement objects for use withReplacementDataSet.
-
AbstractDataFileLoader
Create new instance with replacement objects and replacement substrings.- Parameters:
ro- The replacement objects for use withReplacementDataSet.rs- The replacement substrings for use withReplacementDataSet.
-
-
Method Details
-
load
Load the specified String filename from the classpath into a dbUnit dataset. If filename == null or "", then returns an emptyDefaultDataSet. The type of dbUnit dataset created is delegated to the implementing subclass.- Specified by:
loadin interfaceDataFileLoader- Returns:
- The dbUnit dataset of the specified file.
- Throws:
DatabaseUnitRuntimeException- DataSetException wrapped in a DatabaseUnitRuntimeException when file load errors occur.
-
processReplacementTokens
Add the replacements in the maps (objects and substrings) to the specified dataset.- Parameters:
ds- The dataset to wrap with aReplacementDataSetand process replacement tokens on.- Returns:
- The specified dataset decorated with
ReplacementDataSetand processed with the tokens in the replacement maps. - Since:
- 2.4.8
-
addReplacementObjects
Add the specified replacement objects to existing ones for use withReplacementDataSet.- Specified by:
addReplacementObjectsin interfaceDataFileLoader- Parameters:
ro- The replacement objects to include.
-
addReplacementSubstrings
Add the specified replacement substrings to existing ones for use withReplacementDataSet.- Specified by:
addReplacementSubstringsin interfaceDataFileLoader- Parameters:
rs- The replacement substrings to include.
-
removeAllReplacementObjects
public void removeAllReplacementObjects()Remove all existing replacement objects, resetting to none so no object replacements occur.- Specified by:
removeAllReplacementObjectsin interfaceDataFileLoader
-
removeAllReplacementSubstrings
public void removeAllReplacementSubstrings()Remove all existing replacement substring objects, resetting to none so no substring replacements occur.- Specified by:
removeAllReplacementSubstringsin interfaceDataFileLoader
-