jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <ju...@zitting.name>
Subject Re: contrib/jcr-ext proposal
Date Mon, 07 Feb 2005 13:57:06 GMT
Hi all,

Marcel Reutegger wrote about o.a.j.ext.inmemory:
> that would be a cool thing to have... how about writing a 
> org.apache.jackrabbit.core.fs.FileSystem implementation working in 
> memory?

The idea is interesting, and could actually be worth looking into, but 
my goals are a bit different.

My idea about the inmemory implementation is more targeted to simpler 
cases. What I'm thinking about is a dummy repository that could be 
instantiated, populated, used and discarded during a single unit test 
case without noticeable delays or extensive extra dependencies.

For example, I'd like to be able to write the following test code:

     private Repository originalRepository;
     private Repository decoratedRepository;

     protected void setUp() {
         InputStream systemview = ...; // XML export of initial contents
         originalRepository = new MemoryRepository(systemview);
         decoratedRepository = ...; // create a decorator layer
     }

     public void testSomeDecorator() {
         assert(...); // some decoration of the initial repository
     }

Using a full-blown repository implementation like Jackrabbit adds 
unnecessary and even harmful dependencies (existing XML configuration, 
repository directory, etc.) to the test code. And on the other hand it 
is hard to model an entire repository using plain mock objects.

A simple inmemory implementation can also be used for simple 
proof-of-concept demos and prototypes where the configuration and other 
setup required by full repositories may be unnecessarily large.

And of course, such a naive implementation would also be a good first 
example to people who want to learn the inner workings of a content 
repository. For example it took me quite a while to get a picture of how 
Jackrabbit works under the hood.

Best regards,

Jukka Zitting

Mime
View raw message