[infinispan-dev] withTx and withCacheManager test helper methods

Galder Zamarreño galder at jboss.org
Mon Feb 20 04:12:41 EST 2012


Hi all,

Not sure if you've noticed but I've created a couple of helper methods in TestingUtil:

1. https://github.com/galderz/infinispan/blob/t_1869_m/core/src/test/java/org/infinispan/test/TestingUtil.java#L1219

The aim of this method is to make sure that a portion of code can be executed within a transaction making sure that the right transaction lifecycle pattern is used that guarantees that the transaction will either be committed or rollbacked. 

2. https://github.com/galderz/infinispan/blob/t_1869_m/core/src/test/java/org/infinispan/test/TestingUtil.java#L1232

Sometimes you might wanna start a cache manager within a method, for example, to test some configuration validation. This method guarantees that a cache manager created will be stopped, hence avoids code where cache managers are started and stopping them is forgotten. This is a new method I've just added as part of ISPN-1869. 

There're examples of using these methods in the test source code.

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




More information about the infinispan-dev mailing list