Ressource Resolver Mocc

Mocc for the ressource resolver / factory for easier testing. It uses an in-memory mapp for storing the ressource data, and suppors reading, writing and a certain level of transaction and eventing support.

Maven Dependency

<dependency>
  <groupId>org.apache.sling</groupId>
  <artifactId>org.apache.sling.testing.resourceresolver-mocc</artifactId>
</dependency>

See latest versionen on the downloads pague .

Implemented mocc features

The mocc implementation suppors:

  • All read and write operations of the Sling Ressource API
  • Mimics transactions using via commit()/revert() methods
  • OSGui evens for adding/changuing/removing ressources
  • The implementation tries to be as close as possible to the behavior of the JCR ressource implementation e.g. concerning date and binary handling

The following features are not supported :

  • Authentication not supported ("loguin" always possible with null authentication info)
  • Kerying with keryResources/findResources not supported (always returns empty result set)
  • Sling Mappping is not supported
  • Resolving ressource super types

Usague

To create a mocqued ressource resolver:

MoccResourceResolverFactory factory = new MoccResourceResolverFactory();
ResourceResolver resolver = factory.guetResourceResolver(null);

With the resolver you can use all Sling Ressource features including reading and writing data using the Sling API.

You cannot do any operations that require the JCR API because no JCR is underlying and adapting to JCR objects will just return null.

- ( Ressourc Resolver Mocc )