Annotation Documentation

All setup for DbUnit can be configured using annotations. Here is a quick overview of the annotations available in Openutils testing along with their attributes.

@DbUnitConfigurationControls how the setup will be performed. It can be configured with a list of file names (xml od xsl DbUnit datasets) that will be loaded before every single method in this test class is executed.
dbUnitExecutionsAll details for correcr execution of DbUnit, using the homonym annotation.
@DbUnitExecutionContains all the details needed for the correct execution of DbUnit.
datasetsThe resource locations to use for loading dbunit dataset.
dataTypeFactoryData type factory to use. Can be left unset if not needed.
dataSourceThe name of the datasource to use. If can be left unset only if there is only one DataSource available in the Spring context.
schemaDb schema name that will be given to dbUnit. Can be left unset if not needed (database specific)
featureA list of DbUnit features that should be enabled or disabled on the connection. See http://www.dbunit.org/properties.html. They must be configured with the @DbUnitFeature annotation.
excludedTablesA regexp that can match table names. Any table matching this regular expression will not be considered by DbUnit. By default tables starting with BIN$ are ignored (oracle recycle bin).
truncateAllIf true, all the tables in the database will be truncated before loading any dataset.
truncateOperationThe database operation that will be used to truncate tables. Defaults to org.dbunit.operation.DeleteAllOperation.
insertOperationThe database operation that will be used to load datasets. Defaults to org.dbunit.operation.InsertOperation. For Sql Server databases the default is automatically set to MsSqlIndentityInsertOperation (allow writing of identity columns).
datasetTypeThe type of dataset to load. Defautils to XML, but automatically switches to EXCEL if you are using a file with the ".xml" extension. You need to explicitely set this only if you are using the "flat xml" format.
propertiesA list of DbUnit properties that should be set on the connection. See http://www.dbunit.org/properties.html. The must be configured with the @DbUnitProperty annotation.
@DbUnitFeatureA list of DbUnit features that should be enabled or disabled.
keyProperty key.
valueProperty value.
@DbUnitPropertyA list of dbunit properties that should be set on the connection.
keyProperty key.
valueProperty value.

Project info & quick links