dbunit:operation

Execute DbUnit's Database Operation with an external dataset file.

Mojo Attributes:

  • Requires a Maven 2.0 project to execute.
  • Requires dependency resolution of artifacts in scope: compile

Required Parameters

Name Type Description
driver String The class name of the JDBC driver to be used.
format String Dataset file format type. Valid types are: flat, xml, csv, and dtd Default value is xml.
src File DataSet file
type String Type of Database operation to perform. Supported types are UPDATE, INSERT, DELETE, DELETE_ALL, REFRESH, CLEAN_INSERT, MSSQL_INSERT, MSSQL_REFRESH, MSSQL_CLEAN_INSERT
url String The JDBC URL for the database to access, e.g. jdbc:db2:SAMPLE.

Optional Parameters

Name Type Description
dataTypeFactoryName String Set the DataType factory to add support for non-standard database vendor data types. Default value is org.dbunit.dataset.datatype.DefaultDataTypeFactory.
datatypeWarning boolean Enable or disable the warning message displayed when DbUnit encounter an unsupported data type. Default value is false.
escapePattern String escapePattern
password String Database password. If not given, it will be looked up through settings.xml's server with ${settingsKey} as key
schema String The schema name that tables can be found under.
settingsKey String Server's id in settings.xml to look up username and password. Default to ${url} if not given.
skip boolean Skip the execution when true, very handy when using together with maven.test.skip. Default value is false.
supportBatchStatement boolean Enable or disable usage of JDBC batched statement by DbUnit Default value is false.
transaction boolean When true, place the entired operation in one transaction Default value is false.
useQualifiedTableNames boolean Enable or disable multiple schemas support by prefixing table names with the schema name. Default value is false.
username String Database username. If not given, it will be looked up through settings.xml's server with ${settingsKey} as key

Parameter Details

dataTypeFactoryName

Set the DataType factory to add support for non-standard database vendor data types.

  • Type: java.lang.String
  • Required: No
  • Expression: ${dataTypeFactoryName}
  • Default: org.dbunit.dataset.datatype.DefaultDataTypeFactory

datatypeWarning Enable or disable the warning message displayed when DbUnit encounter an unsupported data type.
  • Type: boolean
  • Required: No
  • Expression: ${datatypeWarning}
  • Default: false

driver The class name of the JDBC driver to be used.
  • Type: java.lang.String
  • Required: Yes
  • Expression: ${driver}

escapePattern escapePattern
  • Type: java.lang.String
  • Required: No
  • Expression: ${escapePattern}

format Dataset file format type. Valid types are: flat, xml, csv, and dtd
  • Type: java.lang.String
  • Required: Yes
  • Expression: ${format}
  • Default: xml

password Database password. If not given, it will be looked up through settings.xml's server with ${settingsKey} as key
  • Type: java.lang.String
  • Required: No
  • Expression: ${password}

schema The schema name that tables can be found under.
  • Type: java.lang.String
  • Required: No
  • Expression: ${schema}

settingsKey Server's id in settings.xml to look up username and password. Default to ${url} if not given.
  • Type: java.lang.String
  • Required: No
  • Expression: ${settingsKey}

skip Skip the execution when true, very handy when using together with maven.test.skip.
  • Type: boolean
  • Required: No
  • Expression: ${skip}
  • Default: false

src DataSet file
  • Type: java.io.File
  • Required: Yes
  • Expression: ${src}

supportBatchStatement Enable or disable usage of JDBC batched statement by DbUnit
  • Type: boolean
  • Required: No
  • Expression: ${supportBatchStatement}
  • Default: false

transaction When true, place the entired operation in one transaction
  • Type: boolean
  • Required: No
  • Expression: transaction
  • Default: false

type Type of Database operation to perform. Supported types are UPDATE, INSERT, DELETE, DELETE_ALL, REFRESH, CLEAN_INSERT, MSSQL_INSERT, MSSQL_REFRESH, MSSQL_CLEAN_INSERT
  • Type: java.lang.String
  • Required: Yes
  • Expression: type

url The JDBC URL for the database to access, e.g. jdbc:db2:SAMPLE.
  • Type: java.lang.String
  • Required: Yes

useQualifiedTableNames Enable or disable multiple schemas support by prefixing table names with the schema name.
  • Type: boolean
  • Required: No
  • Expression: ${useQualifiedTableNames}
  • Default: false

username Database username. If not given, it will be looked up through settings.xml's server with ${settingsKey} as key
  • Type: java.lang.String
  • Required: No
  • Expression: ${username}