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

Mircea Markus mircea.markus at jboss.com
Mon Jan 4 07:02:03 EST 2010


On Dec 29, 2009, at 11:14 AM, Vladimir Blagojevic wrote:

> The main problem remains unresolved: creating cache managers, using 
> them, and not cleaning up.
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
> Have a look at ChannelLookupTest. Are you 
> familiar with this one :)?
> 
> 
> On 09-12-24 3:18 PM, Manik Surtani wrote:
>> Guys,
>> 
>> as far as possible, please extend either SingleCacheManagerTest [1] or MultipleCacheManagersTest [2]. and use the corresponding helper methods there to create a new CacheManager.  Alternatively, if you have a unit test that needs to create its own CacheManager directly, please use TestCacheManagerFactory [3].  Do *not* use "new DefaultCacheManager()" directly since this means the framework does not have a chance to alter config settings to work within the framework, including clustering settings to make sure the test does not interfere with other tests, threadpool settings to prevent unnecessary OOMs when running the entire suite with thousands of cache managers, etc.
>> 
>> I have just fixed a bunch of offending tests [4], and updated the wiki page [5] on writing tests accordingly.  Please follow these guidelines.
>> 
>> Cheers&  Happy X'mas!
>> Manik
>> 
>> [1] http://fisheye.jboss.org/browse/Infinispan/trunk/core/src/test/java/org/infinispan/test/SingleCacheManagerTest.java?r=1216
>> [2] http://fisheye.jboss.org/browse/Infinispan/trunk/core/src/test/java/org/infinispan/test/MultipleCacheManagersTest.java?r=1216
>> [3] http://fisheye.jboss.org/browse/Infinispan/trunk/core/src/test/java/org/infinispan/test/fwk/TestCacheManagerFactory.java?r=1327
>> [4] http://fisheye.jboss.org/changelog/Infinispan/trunk?cs=1327
>> [5] http://community.jboss.org/wiki/ParallelTestSuite
>> 
>> 
>> --
>> Manik Surtani
>> manik at jboss.org
>> Lead, Infinispan
>> Lead, JBoss Cache
>> http://www.infinispan.org
>> http://www.jbosscache.org
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>> 
> 
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev





More information about the infinispan-dev mailing list