Skip to content

Introduce the concept of Extensions & Filename replacement

Compare
Choose a tag to compare
@ed0906 ed0906 released this 11 Jan 09:33
· 36 commits to main since this release

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]