We have our own data source that extends BasicDataSource. We redefined the getConnection method, which does a couple of things inside it. When we start webapp outside of testing, when we call the service from the controller, it will capture a new connection and use this connection until the service is completed. All is well. However, inside the integration test, the connection seems to be captured before the test even calls the controller. Stream lower
Normal start: call controller β call dispatcher call method β ββconnection is grabbed β service method is executed and returns to the controller
Integration test: the connection is captured β the call controller from the test β the controller control method call β the service method is executed and returns to the controller
Needless to say, this gives us problems, since proper connection is very important for our application. Thoughts?
Edit: Serious problems still occur. We have reached a point at which we need to avoid creating integration tests or do a manual connection switch (which defeats half the test point)
DataSource.groovy
dataSource { pooled = true dialect="org.hibernate.dialect.OracleDialect" properties { maxActive = 50 maxIdle = 10 initialSize = 10 minEvictableIdleTimeMillis = 1800000 timeBetweenEvictionRunsMillis = 1800000 maxWait = 10000 testWhileIdle = true numTestsPerEvictionRun = 3 testOnBorrow = true } } hibernate { cache.use_second_level_cache = true cache.use_query_cache = true cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider' }
source share