Spock specification for AEM testing that includes a Sling context for mock repository operations and a simulated OSGi environment for registering services and adapters.
Fields inherited from class | Fields |
---|---|
class Specification |
_ |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
assertNodeExists(String path) Assert that a node exists for the given path. |
|
void |
assertNodeExists(String path, String primaryNodeTypeName) Assert that a node exists for the given path and node type. |
|
void |
assertNodeExists(String path, Map<String, Object> properties) Assert that a node exists for the given path and property map. |
|
void |
assertNodeExists(String path, String primaryNodeTypeName, Map<String, Object> properties) Assert that a node exists for the given path, node type, and property map. |
|
void |
assertPageExists(String path) Assert that a page exists for the given path. |
|
void |
assertPageExists(String path, Map<String, Object> properties) Assert that a page exists for the given path and contains the given properties. |
|
def |
cleanupSpec() Remove Groovy metaclasses and test content. |
|
Node |
getNode(String path) Get the Node for a path. |
|
NodeBuilder |
getNodeBuilder() @return JCR node builder |
|
Page |
getPage(String path) Get the Page for a path. |
|
PageBuilder |
getPageBuilder() @return CQ page builder |
|
PageManager |
getPageManager() @return CQ page manager |
|
RequestBuilder |
getRequestBuilder() Get a request builder. |
|
Resource |
getResource(String path) Get the Resource for a path. |
|
ResourceResolver |
getResourceResolver() @return admin resource resolver |
|
ResponseBuilder |
getResponseBuilder() Get a response builder. |
|
Session |
getSession() @return admin session |
|
SlingContextProvider |
getSlingContext() |
|
void |
removeAllNodes() Remove all non-system nodes to cleanup any test data. |
|
def |
setup() Refresh the shared resource resolver before each test run. |
|
def |
setupSpec() Create an administrative JCR session with content builders, register Sling adapters, and instantiate a mock resource resolver. |
Assert that a node exists for the given path.
path
- node pathAssert that a node exists for the given path and node type.
path
- node pathprimaryNodeTypeName
- primary node type nameAssert that a node exists for the given path and property map.
path
- node pathproperties
- map of property names and values to verify for the nodeAssert that a node exists for the given path, node type, and property map.
path
- node pathprimaryNodeTypeName
- primary node type nameproperties
- map of property names and values to verify for the nodeAssert that a page exists for the given path.
path
- page pathAssert that a page exists for the given path and contains the given properties.
path
- page pathproperties
- map of property names and values to verify for the pageRemove Groovy metaclasses and test content.
Get the Node for a path.
path
- valid JCR Node path
Get the Page for a path.
path
- valid Page path
Get a request builder. If the path is not specified as an argument to the build()
closure, the root resource will be bound to the request.
Get the Resource for a path.
path
- valid Resource path
Get a response builder.
Remove all non-system nodes to cleanup any test data. This method would typically be called from a test fixture method to cleanup content before the entire specification has been executed.
Refresh the shared resource resolver before each test run.
Create an administrative JCR session with content builders, register Sling adapters, and instantiate a mock resource resolver.