[infinispan-dev] Creating cache managers in your unit tests

Vladimir Blagojevic vblagoje at redhat.com
Fri Jan 8 06:52:04 EST 2010


On 2010-01-04, at 1:02 PM, Mircea Markus wrote:

> 
> As long as the CM are created through TestCacheManagersFactory, this should will soon not be an issue: https://jira.jboss.org/jira/browse/ISPN-314

It still is an issue when tests do not kill cache managers, is it not! However, we can still leverage the fact that we use TestCacheManagersFactory throughout.  

We can track all DefaultCacheManager(s) we create from TestCacheManagersFactory. We can use hashmap keyed by test class name and a value which is a list of all created DefaultCacheManager (in all test methods of a test class). Since lifecycle of DefaultCacheManager never spans across test classes we can find these cache manager and reclaim them in AbstractInfinispanTest @afterClass method.





More information about the infinispan-dev mailing list