Package africa.absa.inception.test
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
ConstructorsConstructorDescriptionTestConfiguration(org.springframework.context.ApplicationContext applicationContext) Constructs a new TestConfiguration. -
Method Summary
Modifier and TypeMethodDescriptionInitialize the in-memory application database and return a data source that can be used to interact with the database.org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBeanapplicationEntityManagerFactory(DataSource dataSource, org.springframework.transaction.PlatformTransactionManager platformTransactionManager) Returns the application entity manager factory bean associated with the application data source.org.springframework.cache.CacheManagerReturns the cache manager.protected org.springframework.http.converter.json.Jackson2ObjectMapperBuilderReturns the Jackson2ObjectMapperBuilder bean, which configures the Jackson JSON processor package.com.fasterxml.jackson.databind.ObjectMapperReturns the Jackson2 object mapper.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.TaskSchedulerReturns the Spring task scheduler.org.springframework.web.reactive.function.client.WebClient.BuilderReturns the WebClient.Builder.
-
Constructor Details
-
TestConfiguration
public TestConfiguration(org.springframework.context.ApplicationContext applicationContext) Constructs a new TestConfiguration.- Parameters:
applicationContext- the Spring application context
-
-
Method Details
-
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 sourceplatformTransactionManager- 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
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
Returns the names of the packages to scan for JPA entity classes.- Returns:
- the names of the packages to scan for JPA entity classes
-