Martin Perez's weblog

Google
 
Web This weblog

Sunday, February 04, 2007

Fast unit and integration testing with Jackrabbit

When it´s time time do unit testing (always :D) and integration testing with Apache Jackrabbit, things can be a little awkward, specially if you don´t have a powerful computer. Creating a new repository and interacting with it can be very expensive operations without good hardware and by consequence the unit and integration testing time gets longer and longer.

Fortunately enough, since Jackrabbit 1.2.1 this has changed. Support has been added for H2 database engine and there is now in-memory file systems. Enabling both features definitely will add loads of vitamins to your testing phase.

Here is the needed config:

<PersistenceManager
class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager">
<param name="url" value="jdbc:h2:${wsp.home}/db"/>
<param name="driver" value="org.h2.Driver"/>
<param name="schema" value="h2"/>
<param name="schemaObjectPrefix" value="${wsp.name}_"/>
</PersistenceManager>

and

<FileSystem class="org.apache.jackrabbit.core.fs.mem.MemoryFileSystem">
<param name="path" value="${rep.home}/versions"/>
</FileSystem>

Labels: , , , , ,