Annotation Type DBUnit


  • @Target({METHOD,TYPE})
    @Retention(RUNTIME)
    @Documented
    @Inherited
    public @interface DBUnit
    Created by rafael-pestano on 30/08/2016. This annotation configures DBUnit properties (http://dbunit.sourceforge.net/properties.html) for a given dataset executor. It can be used at class or method level.
    • Element Detail

      • executor

        String executor
        Returns:
        executor id for which the properties will be setup.
        Default:
        "default"
      • cacheConnection

        boolean cacheConnection
        Returns:
        if true database connection will be reused among tests otherwise the connection will be closed after each test
        Default:
        true
      • cacheTableNames

        boolean cacheTableNames
        Default:
        true
      • leakHunter

        boolean leakHunter
        Returns:
        if true will activate connection leak detection.
        Default:
        false
      • qualifiedTableNames

        boolean qualifiedTableNames
        Returns:
        value which configures DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES. Defaults to false.
        Default:
        false
      • batchedStatements

        boolean batchedStatements
        Returns:
        value which configures DatabaseConfig.FEATURE_BATCHED_STATEMENTS
        Default:
        false
      • caseSensitiveTableNames

        boolean caseSensitiveTableNames
        Enable or disable case sensitive table names. If enabled, Dbunit handles all table names in a case sensitive way.
        Returns:
        boolean value which configures case-sensitive table names (also columns)
        Since:
        0.15.0
        Default:
        false
      • raiseExceptionOnCleanUp

        boolean raiseExceptionOnCleanUp
        If enabled an exception will be raised when cleanBefore or cleanAfter fails. If disabled then only a warn message is logged. Default is false
        Returns:
        boolean value which configures case-sensitive table names (also columns)
        Since:
        1.16.0
        Default:
        false
      • disableSequenceFiltering

        boolean disableSequenceFiltering
        If enabled then the sequenceFiltering will be disabled even if it is enabled at @DataSet level
        Returns:
        boolean indicating the sequence filtering should be disabled or not.
        Since:
        1.20.0
        Default:
        false
      • alwaysCleanBefore

        boolean alwaysCleanBefore
        If enabled then cleanBefore will be enabled even if it is disabled at @DataSet level
        Returns:
        boolean indicating cleanBefore should always be performed or not.
        Since:
        1.30.0
        Default:
        false
      • alwaysCleanAfter

        boolean alwaysCleanAfter
        If enabled then cleanAfter will be enabled even if it is disabled at @DataSet level
        Returns:
        boolean indicating cleanAfter should always be performed or not.
        Since:
        1.30.0
        Default:
        false
      • expectedDbType

        RiderDataSource.DBType expectedDbType
        In the process of initialization, if the actual database type is different from the expected database type, exception will be thrown unless the expected database type is RiderDataSource.DBType.UNKNOWN.

        Default is RiderDataSource.DBType.UNKNOWN.

        Returns:
        the expected database type.
        Since:
        1.16.0
        Default:
        com.github.database.rider.core.connection.RiderDataSource.DBType.UNKNOWN
      • dataTypeFactoryClass

        Class<? extends org.dbunit.dataset.datatype.IDataTypeFactory> dataTypeFactoryClass
        Returns:
        value which configures DatabaseConfig.PROPERTY_DATATYPE_FACTORY
        Default:
        org.dbunit.dataset.datatype.IDataTypeFactory.class
      • metaDataHandler

        Class<? extends org.dbunit.database.IMetadataHandler> metaDataHandler
        Returns:
        value which configures DatabaseConfig.PROPERTY_METADATA_HANDLER
        Default:
        org.dbunit.database.IMetadataHandler.class
      • replacers

        Class<? extends Replacer>[] replacers
        Returns:
        implementations of Replacer, which are merged with default replacers
        Default:
        {}
      • caseInsensitiveStrategy

        Orthography caseInsensitiveStrategy
        Specifies the orthography/letter-case strategy if caseSensitiveTableNames() is set to false (case-insensitive mode). If caseSensitiveTableNames()=false, then this property is ignored and has no effect. Defaults to Orthography.UPPERCASE.
        This is a database-rider internal property and not related to dbunit.
        Returns:
        The Orthography constant
        Since:
        1.2.0
        Default:
        com.github.database.rider.core.api.configuration.Orthography.UPPERCASE
      • mergeDataSets

        boolean mergeDataSets
        Returns:
        Enable or disable dataset merging. If enabled then datasets declared at class/test level AND method will be merged into one dataset to seed database. Note that only array properties of @DataSet annotation like 'value' and 'executeStatementsBefore' will be merged.
        Default:
        false
      • mergingStrategy

        DataSetMergingStrategy mergingStrategy
        When dataset merging strategy is set to CLASS then we first load class level datasets and later method level datasets Default is method
        Default:
        com.github.database.rider.core.api.configuration.DataSetMergingStrategy.METHOD
      • columnSensing

        boolean columnSensing
        If enabled, when loading datasets, reads in the whole XML into a buffer and dynamically adds new columns as they appear. This way, it's not necessary to define all possible columns on the first line.
        Returns:
        Enables or disables column sensing. Defaults to false.
        Default:
        false
      • allowEmptyFields

        boolean allowEmptyFields
        Allow to call INSERT/UPDATE with empty strings ('').
        Returns:
        value which configures DatabaseConfig.FEATURE_ALLOW_EMPTY_FIELDS. Defaults to false.
        Default:
        false
      • fetchSize

        int fetchSize
        Returns:
        value which configures DatabaseConfig.PROPERTY_FETCH_SIZE. Defaults to 100
        Default:
        100
      • batchSize

        int batchSize
        Returns:
        value which configures DatabaseConfig.PROPERTY_BATCH_SIZE. Defaults to 100
        Default:
        100
      • escapePattern

        String escapePattern
        Allows schema, table and column names escaping. The property value is an escape pattern where the ? is replaced by the name. For example, the pattern "[?]" is expanded as "[MY_TABLE]" for a table named "MY_TABLE". The most common escape pattern is "\"?\"" which surrounds the table name with quotes (for the above example it would result in "\"MY_TABLE\""). As a fallback if no questionmark is in the given String and its length is one it is used to surround the table name on the left and right side. For example the escape pattern "\"" will have the same effect as the escape pattern "\"?\"".
        Returns:
        value which configures DatabaseConfig.PROPERTY_ESCAPE_PATTERN. Defaults to none
        Default:
        ""
      • tableType

        String[] tableType
        Returns:
        value which configures DatabaseConfig.PROPERTY_TABLE_TYPE (http://www.dbunit.org/properties/tableType)
        Since:
        1.17.0
        Default:
        {"TABLE"}
      • disablePKCheckFor

        String[] disablePKCheckFor
        Returns:
        list of table names to disable primary key check while creating the dataset.
        Since:
        1.21.0
        Default:
        {}
      • driver

        String driver
        Returns:
        driver class name. Used for declarative connections. Don't needed for drivers that implement jdbc 4.
        Since:
        0.15.0
        Default:
        ""
      • url

        String url
        Returns:
        Database url. Used for declarative connections.
        Since:
        0.15.0
        Default:
        ""
      • user

        String user
        Returns:
        Username owner of database connection. Used for declarative connection.
        Since:
        0.15.0
        Default:
        ""
      • password

        String password
        Returns:
        Password of owner of database connection. Used for declarative connection.
        Since:
        0.15.0
        Default:
        ""
      • schema

        String schema
        Returns:
        Schema for the database connection.
        Since:
        1.11.0
        Default:
        ""