jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: JUnit and jackrabbit
Date Fri, 30 Nov 2007 09:23:05 GMT
malsi wrote:
> I am implementing classes that access and store nodes in a repository. I
> would like to test my code using JUnit in order to see if my code is doing
> well in terms of performance and behavior (see if nodes are realy deleted or
> not, really read or not, if the right node is read, etc..)
> My questions are the following:
> Is JUnit the best way to test my code?
> Is there any documentation anywhere for using JUnit for testing an
> implementation that uses Jackrabbit ?

jackrabbit already contains unit and integration tests written as JUnits, which 
means you can do a checkout of the jackrabbit-core module and write new test 
classes along the already existing ones.

alternatively and this might probably be easier, you can start from scratch and 
use TransientRepository. This is a convenience class to quickly get a running 
jackrabbit instance.

public class Test extends TestCase {

     private TransientRepository repository;

     public void testLogin() throws RepositoryException {
         Session s = repository.login(new SimpleCredentials("user", 
         try {
         } finally {

     protected void setUp() throws Exception {
         repository = new TransientRepository();

     protected void tearDown() throws Exception {


View raw message