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

Galder Zamarreno galder at redhat.com
Mon Jan 4 06:46:25 EST 2010


Hmmmm, if you refering to tests extending AbstractInfinispanTest?

SingleCacheManagerTest and MultipleCacheManagersTest extend 
AbstractInfinispanTest, so I think it'd be better if you extended those 
rather extend AbstractInfinispanTest because they provide richer 
functionality to your test, including clearing the cache, killing cache 
managers...etc.

Even though it's not necessary any more, I think naming your test 
methods as test* helps readers easily differentiate test methods from 
helper methods.

On 12/29/2009 10:14 AM, Vladimir Blagojevic wrote:
> The main problem remains unresolved: creating cache managers, using
> them, and not cleaning up. 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

-- 
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache



More information about the infinispan-dev mailing list