Class TestConfiguration

java.lang.Object
africa.absa.inception.test.TestConfiguration

@Configuration @EnableAsync @EnableCaching @EnableConfigurationProperties @EnableScheduling @EnableTransactionManagement @ComponentScan(basePackages="africa.absa.inception",lazyInit=true,excludeFilters={,}) public class TestConfiguration extends Object
The TestConfiguration class provides the base Spring configuration for the JUnit test classes that test the capabilities provided by the Inception framework.

This configuration class disables the default application data source and Camunda Process Engine bootstrapping using the component scan filters.

Author:
Marcus Portmann
  • Constructor Summary

    Constructors
    Constructor
    Description
    TestConfiguration(org.springframework.context.ApplicationContext applicationContext)
    Constructs a new TestConfiguration.
  • Method Summary

    Modifier and Type
    Method
    Description
    Initialize the in-memory application database and return a data source that can be used to interact with the database.
    org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
    applicationEntityManagerFactory(DataSource dataSource, org.springframework.transaction.PlatformTransactionManager platformTransactionManager)
    Returns the application entity manager factory bean associated with the application data source.
    org.springframework.cache.CacheManager
    Returns the cache manager.
    protected org.springframework.http.converter.json.Jackson2ObjectMapperBuilder
    Returns the Jackson2ObjectMapperBuilder bean, which configures the Jackson JSON processor package.
    com.fasterxml.jackson.databind.ObjectMapper
    Returns the Jackson2 object mapper.
    protected List<String>
    Returns the names of the packages to scan for JPA entity classes.
    Returns the Spring task executor to use for @Async method invocations.
    org.springframework.scheduling.TaskScheduler
    Returns the Spring task scheduler.
    org.springframework.web.reactive.function.client.WebClient.Builder
    Returns the WebClient.Builder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TestConfiguration

      public TestConfiguration(org.springframework.context.ApplicationContext applicationContext)
      Constructs a new TestConfiguration.
      Parameters:
      applicationContext - the Spring application context
  • Method Details

    • applicationDataSource

      @Bean @Primary public DataSource applicationDataSource()
      Initialize the in-memory application database and return a data source that can be used to interact with the database.

      This data source returned by this method must be closed after use with the close() method.

      Returns:
      the data source that can be used to interact with the in-memory database
    • applicationEntityManagerFactory

      @Bean @Primary public org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean applicationEntityManagerFactory(@Qualifier("applicationDataSource") DataSource dataSource, org.springframework.transaction.PlatformTransactionManager platformTransactionManager)
      Returns the application entity manager factory bean associated with the application data source.
      Parameters:
      dataSource - the application data source
      platformTransactionManager - the platform transaction manager
      Returns:
      the application entity manager factory bean associated with the application data source
    • cacheManager

      @Bean public org.springframework.cache.CacheManager cacheManager()
      Returns the cache manager.
      Returns:
      the cache manager
    • objectMapper

      @Bean public com.fasterxml.jackson.databind.ObjectMapper objectMapper()
      Returns the Jackson2 object mapper.
      Returns:
      the Jackson2 object mapper
    • taskExecutor

      @Bean public Executor taskExecutor()
      Returns the Spring task executor to use for @Async method invocations.
      Returns:
      the Spring task executor to use for @Async method invocations
    • taskScheduler

      @Bean public org.springframework.scheduling.TaskScheduler taskScheduler()
      Returns the Spring task scheduler.
      Returns:
      the Spring task scheduler
    • webClientBuilder

      @Bean public org.springframework.web.reactive.function.client.WebClient.Builder webClientBuilder()
      Returns the WebClient.Builder.
      Returns:
      the default WebClient.Builder
    • jackson2ObjectMapperBuilder

      protected org.springframework.http.converter.json.Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder()
      Returns the Jackson2ObjectMapperBuilder bean, which configures the Jackson JSON processor package.
      Returns:
      the Jackson2ObjectMapperBuilder bean, which configures the Jackson JSON processor package
    • packagesToScanForEntities

      protected List<String> packagesToScanForEntities()
      Returns the names of the packages to scan for JPA entity classes.
      Returns:
      the names of the packages to scan for JPA entity classes