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

Manik Surtani manik at jboss.org
Thu Dec 24 09:18:04 EST 2009


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








More information about the infinispan-dev mailing list