Class DatabaseConfig

java.lang.Object
org.dbunit.database.DatabaseConfig

public class DatabaseConfig extends Object
Configuration used by the DatabaseConnection.
Since:
2.0
Version:
$Revision$ $Date$
Author:
manuel.laflamme, gommma (gommma AT users.sourceforge.net), Last changed by: $Author$
  • Field Details

    • PROPERTY_STATEMENT_FACTORY

      public static final String PROPERTY_STATEMENT_FACTORY
      Name of the property configuring the IStatementFactory implementation to use.
      See Also:
    • PROPERTY_RESULTSET_TABLE_FACTORY

      public static final String PROPERTY_RESULTSET_TABLE_FACTORY
      Name of the property configuring the IResultSetTableFactory implementation to use.
      See Also:
    • PROPERTY_DATATYPE_FACTORY

      public static final String PROPERTY_DATATYPE_FACTORY
      Name of the property configuring the IDataTypeFactory implementation to use.
      See Also:
    • PROPERTY_ESCAPE_PATTERN

      public static final String PROPERTY_ESCAPE_PATTERN
      Name of the property configuring the pattern used to escape table and column names.
      See Also:
    • PROPERTY_TABLE_TYPE

      public static final String PROPERTY_TABLE_TYPE
      Name of the property configuring the JDBC table types considered when reading the database schema.
      See Also:
    • PROPERTY_PRIMARY_KEY_FILTER

      public static final String PROPERTY_PRIMARY_KEY_FILTER
      Name of the property configuring the IColumnFilter used to determine primary key columns.
      See Also:
    • PROPERTY_BATCH_SIZE

      public static final String PROPERTY_BATCH_SIZE
      Name of the property configuring the batch size used for batched statements.
      See Also:
    • PROPERTY_FETCH_SIZE

      public static final String PROPERTY_FETCH_SIZE
      Name of the property configuring the JDBC fetch size used for result sets.
      See Also:
    • PROPERTY_METADATA_HANDLER

      public static final String PROPERTY_METADATA_HANDLER
      Name of the property configuring the IMetadataHandler implementation to use.
      See Also:
    • PROPERTY_ALLOW_VERIFYTABLEDEFINITION_EXPECTEDTABLE_COUNT_MISMATCH

      public static final String PROPERTY_ALLOW_VERIFYTABLEDEFINITION_EXPECTEDTABLE_COUNT_MISMATCH
      Name of the property configuring whether verifying a table definition allows the expected table to have a different column count.
      See Also:
    • PROPERTY_IDENTITY_COLUMN_FILTER

      public static final String PROPERTY_IDENTITY_COLUMN_FILTER
      Name of the property configuring the IColumnFilter used to determine MS SQL identity columns.
      See Also:
    • FEATURE_CASE_SENSITIVE_TABLE_NAMES

      public static final String FEATURE_CASE_SENSITIVE_TABLE_NAMES
      Name of the feature controlling whether table names are treated as case sensitive.
      See Also:
    • FEATURE_QUALIFIED_TABLE_NAMES

      public static final String FEATURE_QUALIFIED_TABLE_NAMES
      Name of the feature controlling whether table names are qualified with the schema name.
      See Also:
    • FEATURE_BATCHED_STATEMENTS

      public static final String FEATURE_BATCHED_STATEMENTS
      Name of the feature controlling whether batched statements are used.
      See Also:
    • FEATURE_DATATYPE_WARNING

      public static final String FEATURE_DATATYPE_WARNING
      Name of the feature controlling whether unsupported data type warnings are logged.
      See Also:
    • FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES

      public static final String FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES
      Name of the feature controlling whether Oracle recycle bin tables are skipped.
      See Also:
    • FEATURE_ALLOW_EMPTY_FIELDS

      public static final String FEATURE_ALLOW_EMPTY_FIELDS
      Name of the feature controlling whether empty fields are allowed in flat XML datasets.
      See Also:
    • FEATURE_SORT_ALL_COLUMNS_WHEN_NO_PRIMARY_KEY

      public static final String FEATURE_SORT_ALL_COLUMNS_WHEN_NO_PRIMARY_KEY
      Name of the feature controlling whether all columns are used for sorting when a table has no primary key.
      See Also:
    • FEATURE_SKIP_CYCLE_CHECK

      public static final String FEATURE_SKIP_CYCLE_CHECK
      Name of the feature controlling whether DatabaseSequenceFilter skips its foreign-key dependency cycle check instead of throwing CyclicTablesDependencyException. When enabled, tables involved in a cycle are appended in their original order and the resulting order is not guaranteed to respect foreign-key dependencies among them.
      See Also:
    • ALL_PROPERTIES

      public static final DatabaseConfig.ConfigProperty[] ALL_PROPERTIES
      A list of all properties as DatabaseConfig.ConfigProperty objects. The objects contain the allowed java type and whether or not a property is nullable.
    • ALL_FEATURES

      public static final String[] ALL_FEATURES
      Deprecated.
      since 2.4.7 Use the ALL_PROPERTIES where features are listed now as well
      A list of all features as strings
  • Constructor Details

    • DatabaseConfig

      public DatabaseConfig()
      Constructs a database config with the framework's default properties and features.
  • Method Details

    • getConfigurator

      protected DatabaseConfig.Configurator getConfigurator()
      Returns the configurator of this database config.
      Returns:
      The configurator of this database config
    • setFeature

      public void setFeature(String name, boolean value)
      Deprecated.
      since 2.4.7 Use the setProperty(String, Object) also for features
      Set the value of a feature flag.
      Parameters:
      name - the feature id
      value - the feature status
    • getFeature

      public boolean getFeature(String name)
      Deprecated.
      since 2.4.7 Use the getProperty(String) where features are listed now as well
      Look up the value of a feature flag.
      Parameters:
      name - the feature id
      Returns:
      the feature status
    • setProperty

      public void setProperty(String name, Object value)
      Set the value of a property.
      Parameters:
      name - the property id
      value - the property value
    • getProperty

      public Object getProperty(String name)
      Look up the value of a property.
      Parameters:
      name - the property id
      Returns:
      the property value
    • copyPropertiesInto

      public void copyPropertiesInto(DatabaseConfig target)
      Copies every known property and feature value from this config into the given target config.
      Parameters:
      target - The config to receive this config's property and feature values.
      Since:
      3.5.0
    • checkObjectAllowed

      protected void checkObjectAllowed(String property, Object value)
      Checks whether the given value has the correct java type for the given property. If the value is not allowed for the given property an IllegalArgumentException is thrown.
      Parameters:
      property - The property to be set
      value - The value to which the property should be set
    • setPropertiesByString

      public void setPropertiesByString(Properties stringProperties) throws DatabaseUnitException
      Sets the given properties on the DatabaseConfig instance using the given String values. This is useful to set properties configured as strings by a build tool like ant or maven. If the required property type is an object it uses reflection to create an instance of the class specified as string.
      Parameters:
      stringProperties - The properties as strings. The key of the properties can be either the long or the short name.
      Throws:
      DatabaseUnitException - if a string value cannot be converted to its required property type.
    • findByName

      public static final DatabaseConfig.ConfigProperty findByName(String property)
      Searches the DatabaseConfig.ConfigProperty object for the property with the given name
      Parameters:
      property - The property for which the enumerated object should be resolved
      Returns:
      The property object or null if it was not found.
    • findByShortName

      public static final DatabaseConfig.ConfigProperty findByShortName(String propShortName)
      Searches the DatabaseConfig.ConfigProperty object for the property with the given name
      Parameters:
      propShortName - The property short name for which the enumerated object should be resolved. Example: the short name of "http://www.dbunit.org/properties/fetchSize" is fetchSize which is the last part of the fully qualified URL.
      Returns:
      The property object or null if it was not found.
    • toString

      public String toString()
      Overrides:
      toString in class Object