Introduce the concept of Extensions & Filename replacement
Extensions
Builds on Table Defaults & Overrides to streamline how they work.
These are configured by default but can be overridden using Beans
@Bean
@ConditionalOnMissingBean
fun extensions(
resourceLoader: ResourceLoader,
defaults: List<TableDefaults>,
config: DatabaseConfig
): Extensions {
val dbDefaults = Defaults(defaults, !(config.getProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES) as Boolean))
return Extensions(
listOf(
// Resolves all known templates and ignores unknowns for further processing
TemplatedCellMappingExtension,
// Replaces all [null]s will null
NullCellMappingExtension,
// Resolves all file replacements
ResourceBasedValueCellMappingExtension(resourceLoader),
// Resolves all remaining templates and uses global defaults for any missing values in the form [.*]
DefaultTemplatedCellMappingExtension(dbDefaults)
),
dbDefaults
)
}
File name replacement
You can now have a column value of [file:{somefilename.xyz}]
and Db Unit will use the File Loader to load the content of the file
e.g. [file:xyz.txt]