Class TestDataSourceConfigurer

java.lang.Object
com.foreach.across.test.support.config.TestDataSourceConfigurer
All Implemented Interfaces:
AcrossContextConfigurer, org.springframework.beans.factory.Aware, org.springframework.context.EnvironmentAware

@Order(-2147483648) @Configuration @PropertySource("classpath:across-test.properties") @PropertySource(value="file:${user.home}/dev-configs/across-test.properties",ignoreResourceNotFound=true) public class TestDataSourceConfigurer extends Object implements org.springframework.context.EnvironmentAware, AcrossContextConfigurer
Adds support for test datasource detection to an AcrossContext. DevelopmentModeCondition datasources can be configured in the ${user.home}/dev-configs/across-test.properties with properties of the form:
  • acrossTest.datasource.NAME.driver
  • acrossTest.datasource.NAME.url
  • acrossTest.datasource.NAME.username
  • acrossTest.datasource.NAME.password
Which datasource to use is determined by the value of the acrossTest.datasource property, that should be set to the NAME of the datasource.

If no specific datasource is set, this configuration will ensure that a HSQL memory database is used. If the AcrossContext already has a datasource configured, it will kept.

To use this in IntelliJ, go the across-bamboo-specs repository, and run:

     docker-compose -f docker-dbs.yml up 
 
Since:
1.1.2
Author:
Arne Vandamme
  • Constructor Details

    • TestDataSourceConfigurer

      public TestDataSourceConfigurer()
  • Method Details

    • setEnvironment

      public void setEnvironment(@NotNull @NotNull org.springframework.core.env.Environment environment)
      Specified by:
      setEnvironment in interface org.springframework.context.EnvironmentAware
    • setDataSourceName

      public void setDataSourceName(String dataSourceName)
    • configure

      public void configure(AcrossContext context)
      Specified by:
      configure in interface AcrossContextConfigurer
    • testDataSource

      @Bean @Lazy public DataSource testDataSource()