com.scit.sling.test
Class MockResourceFactory
java.lang.Object
com.scit.sling.test.MockResourceFactory
public class MockResourceFactory
- extends Object
Factory for creating MockResource
/MockResourceResolver
.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DATE_TIME_FORMAT
public static final org.joda.time.format.DateTimeFormatter DATE_TIME_FORMAT
MockResourceFactory
public MockResourceFactory()
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.