Package org.dbunit.database
Class DatabaseConfig
java.lang.Object
org.dbunit.database.DatabaseConfig
Configuration used by the
DatabaseConnection.- Since:
- 2.0
- Version:
- $Revision$ $Date$
- Author:
- manuel.laflamme, gommma (gommma AT users.sourceforge.net), Last changed by: $Author$
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDescriptor for a single named, typed, nullableDatabaseConfigproperty.protected static classSets parameters stored in theDatabaseConfigon specific java objects likeStatement. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]Deprecated.static final DatabaseConfig.ConfigProperty[]A list of all properties asDatabaseConfig.ConfigPropertyobjects.static final StringName of the feature controlling whether empty fields are allowed in flat XML datasets.static final StringName of the feature controlling whether batched statements are used.static final StringName of the feature controlling whether table names are treated as case sensitive.static final StringName of the feature controlling whether unsupported data type warnings are logged.static final StringName of the feature controlling whether table names are qualified with the schema name.static final StringName of the feature controlling whetherDatabaseSequenceFilterskips its foreign-key dependency cycle check instead of throwingCyclicTablesDependencyException.static final StringName of the feature controlling whether Oracle recycle bin tables are skipped.static final StringName of the feature controlling whether all columns are used for sorting when a table has no primary key.static final StringName of the property configuring whether verifying a table definition allows the expected table to have a different column count.static final StringName of the property configuring the batch size used for batched statements.static final StringName of the property configuring theIDataTypeFactoryimplementation to use.static final StringName of the property configuring the pattern used to escape table and column names.static final StringName of the property configuring the JDBC fetch size used for result sets.static final StringName of the property configuring theIColumnFilterused to determine MS SQL identity columns.static final StringName of the property configuring theIMetadataHandlerimplementation to use.static final StringName of the property configuring theIColumnFilterused to determine primary key columns.static final StringName of the property configuring theIResultSetTableFactoryimplementation to use.static final StringName of the property configuring theIStatementFactoryimplementation to use.static final StringName of the property configuring the JDBC table types considered when reading the database schema. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a database config with the framework's default properties and features. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckObjectAllowed(String property, Object value) Checks whether the given value has the correct java type for the given property.voidcopyPropertiesInto(DatabaseConfig target) Copies every known property and feature value from this config into the given target config.static final DatabaseConfig.ConfigPropertyfindByName(String property) Searches theDatabaseConfig.ConfigPropertyobject for the property with the given namestatic final DatabaseConfig.ConfigPropertyfindByShortName(String propShortName) Searches theDatabaseConfig.ConfigPropertyobject for the property with the given nameprotected DatabaseConfig.ConfiguratorReturns the configurator of this database config.booleangetFeature(String name) Deprecated.since 2.4.7 Use thegetProperty(String)where features are listed now as wellgetProperty(String name) Look up the value of a property.voidsetFeature(String name, boolean value) Deprecated.since 2.4.7 Use thesetProperty(String, Object)also for featuresvoidsetPropertiesByString(Properties stringProperties) Sets the given properties on theDatabaseConfiginstance using the given String values.voidsetProperty(String name, Object value) Set the value of a property.toString()
-
Field Details
-
PROPERTY_STATEMENT_FACTORY
Name of the property configuring theIStatementFactoryimplementation to use.- See Also:
-
PROPERTY_RESULTSET_TABLE_FACTORY
Name of the property configuring theIResultSetTableFactoryimplementation to use.- See Also:
-
PROPERTY_DATATYPE_FACTORY
Name of the property configuring theIDataTypeFactoryimplementation to use.- See Also:
-
PROPERTY_ESCAPE_PATTERN
Name of the property configuring the pattern used to escape table and column names.- See Also:
-
PROPERTY_TABLE_TYPE
Name of the property configuring the JDBC table types considered when reading the database schema.- See Also:
-
PROPERTY_PRIMARY_KEY_FILTER
Name of the property configuring theIColumnFilterused to determine primary key columns.- See Also:
-
PROPERTY_BATCH_SIZE
Name of the property configuring the batch size used for batched statements.- See Also:
-
PROPERTY_FETCH_SIZE
Name of the property configuring the JDBC fetch size used for result sets.- See Also:
-
PROPERTY_METADATA_HANDLER
Name of the property configuring theIMetadataHandlerimplementation to use.- See Also:
-
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
Name of the property configuring theIColumnFilterused to determine MS SQL identity columns.- See Also:
-
FEATURE_CASE_SENSITIVE_TABLE_NAMES
Name of the feature controlling whether table names are treated as case sensitive.- See Also:
-
FEATURE_QUALIFIED_TABLE_NAMES
Name of the feature controlling whether table names are qualified with the schema name.- See Also:
-
FEATURE_BATCHED_STATEMENTS
Name of the feature controlling whether batched statements are used.- See Also:
-
FEATURE_DATATYPE_WARNING
Name of the feature controlling whether unsupported data type warnings are logged.- See Also:
-
FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES
Name of the feature controlling whether Oracle recycle bin tables are skipped.- See Also:
-
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
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
Name of the feature controlling whetherDatabaseSequenceFilterskips its foreign-key dependency cycle check instead of throwingCyclicTablesDependencyException. 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
A list of all properties asDatabaseConfig.ConfigPropertyobjects. The objects contain the allowed java type and whether or not a property is nullable. -
ALL_FEATURES
Deprecated.since 2.4.7 Use theALL_PROPERTIESwhere features are listed now as wellA 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
Returns the configurator of this database config.- Returns:
- The configurator of this database config
-
setFeature
Deprecated.since 2.4.7 Use thesetProperty(String, Object)also for featuresSet the value of a feature flag.- Parameters:
name- the feature idvalue- the feature status
-
getFeature
Deprecated.since 2.4.7 Use thegetProperty(String)where features are listed now as wellLook up the value of a feature flag.- Parameters:
name- the feature id- Returns:
- the feature status
-
setProperty
Set the value of a property.- Parameters:
name- the property idvalue- the property value
-
getProperty
Look up the value of a property.- Parameters:
name- the property id- Returns:
- the property value
-
copyPropertiesInto
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
Checks whether the given value has the correct java type for the given property. If the value is not allowed for the given property anIllegalArgumentExceptionis thrown.- Parameters:
property- The property to be setvalue- The value to which the property should be set
-
setPropertiesByString
Sets the given properties on theDatabaseConfiginstance 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
Searches theDatabaseConfig.ConfigPropertyobject for the property with the given name- Parameters:
property- The property for which the enumerated object should be resolved- Returns:
- The property object or
nullif it was not found.
-
findByShortName
Searches theDatabaseConfig.ConfigPropertyobject 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" isfetchSizewhich is the last part of the fully qualified URL.- Returns:
- The property object or
nullif it was not found.
-
toString
-
ALL_PROPERTIESwhere features are listed now as well