public class DataSourceFactory extends Object
Use the ConfigPropertyNames.USE_DATASOURCES_PROP
property to specify a comma delimited ordered list to control which data sources to use.
This will enable integration testing to be setup to use well known combinations, to ensure coverage and makes it easier to replicate issues.
This indicates to use only the specified datasources for this test. This option can be used in test cases where only
specific sources are to be used and tested against.
This ordered list will map to the model:order mapping in the config.properties file.
Example: in the config.properties file, the models in the test and their order can be specified:
Use the ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP
property to specify a comma delimited list of DataSourceFactory.DataBaseTypes
to exclude.
This will remove all datasources of a specific database type from the list of available datasources. This option will be applied after
ConfigPropertyNames.USE_DATASOURCES_PROP
option. This is done because there are some test that will not work with certain database
types, and therefore, if the required datasources are not met, the test will be bypassed for execution.
This option gives the developer even more fine grain control of how datasources are assigned. There are cases where a specific model must be assigned to a datasource of a specific database type. To use this option,
Modifier and Type | Class and Description |
---|---|
static interface |
DataSourceFactory.DataBaseTypes
These types match the "ddl" directories for supported database types
and it also found in the datasources connection.properties defined by the DB_TYPE property
These are also the values used to specify the required database types.
|
Constructor and Description |
---|
DataSourceFactory(ConfigPropertyLoader config) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup() |
protected void |
config(DataSourceMgr dsmgr)
config is called at the start / setup of the
TransactionContainer# test. |
Properties |
getConfigProperties() |
DataSource |
getDatasource(String modelName) |
int |
getNumberAvailableDataSources() |
static void |
main(String[] args) |
public DataSourceFactory(ConfigPropertyLoader config)
public Properties getConfigProperties()
protected void config(DataSourceMgr dsmgr)
TransactionContainer#
test. This is to ensure any exclusions /
inclusions are considered for the next executed set of test.
1st, check for the usedatasource property, if exist, then only add those specific datasources
to the useDataSources, otherwise add all available.
2nd, if the exclude option is used, then remove any excluded datasources from the useDataSources.public int getNumberAvailableDataSources()
public DataSource getDatasource(String modelName) throws QueryTestFailedException
QueryTestFailedException
public void cleanup()
public static void main(String[] args)
Copyright © 2018 JBoss by Red Hat. All rights reserved.