com.scit.sling.test
Class MockResourceFactory

java.lang.Object
  extended by com.scit.sling.test.MockResourceFactory

public class MockResourceFactory
extends Object

Factory for creating MockResource/MockResourceResolver.


Field Summary
static org.joda.time.format.DateTimeFormatter DATE_TIME_FORMAT
           
 
Constructor Summary
MockResourceFactory()
           
 
Method Summary
static MockResourceResolver buildMockRepository(ResourceNode baseNode)
          Build a MockResourceResolver with all MockResource and MockValueMap setup from a ResourceNode that has possibly been loaded from loadRepositoryFromJson(String, InputStream) or built manually
static MockResourceResolver buildMockRepositoryJson(String basePath, InputStream in)
          Helper factory method that does:
ResourceNode root = loadRepositoryFromJson(basePath, in);
return buildMockRepository(root);
static ResourceNode loadRepositoryFromJson(String basePath, InputStream in)
          Build a MockResourceResolver with all MockResource and MockValueMap.
The format of the JSON input is compatible with the Apache Sling json representations of the JCR, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_TIME_FORMAT

public static final org.joda.time.format.DateTimeFormatter DATE_TIME_FORMAT
Constructor Detail

MockResourceFactory

public MockResourceFactory()
Method Detail

buildMockRepositoryJson

public static MockResourceResolver buildMockRepositoryJson(String basePath,
                                                           InputStream in)
                                                    throws org.codehaus.jackson.JsonParseException,
                                                           IOException
Helper factory method that does:
ResourceNode root = loadRepositoryFromJson(basePath, in);
return buildMockRepository(root);

Parameters:
basePath - the parent path of this node (blank if it's meant to be the root)
in - the input stream to load the JSON representation
Returns:
Throws:
org.codehaus.jackson.JsonParseException
IOException

buildMockRepository

public static MockResourceResolver buildMockRepository(ResourceNode baseNode)
Build a MockResourceResolver with all MockResource and MockValueMap setup from a ResourceNode that has possibly been loaded from loadRepositoryFromJson(String, InputStream) or built manually

Parameters:
baseNode -
Returns:

loadRepositoryFromJson

public static ResourceNode loadRepositoryFromJson(String basePath,
                                                  InputStream in)
                                           throws org.codehaus.jackson.JsonParseException,
                                                  IOException
Build a MockResourceResolver with all MockResource and MockValueMap.
The format of the JSON input is compatible with the Apache Sling json representations of the JCR, i.e.
curl -s -u admin:admin http://localhost:8080/content/path/to/node.infinity.json

Parameters:
basePath - the parent path of this node (blank if it's meant to be the root)
in - the input stream to load the JSON representation
Returns:
Throws:
org.codehaus.jackson.JsonParseException
IOException


Copyright © 2013 Southern Cross IT. All rights reserved.