public class SlingContextImpl
extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl
SlingContext JUnit
rule.| Modifier and Type | Field and Description |
|---|---|
protected ContentBuilder |
contentBuilder |
protected ContentLoader |
contentLoader |
protected MockModelAdapterFactory |
modelAdapterFactory |
protected MockSlingHttpServletRequest |
request |
protected org.apache.sling.api.resource.ResourceResolver |
resourceResolver |
protected org.apache.sling.api.resource.ResourceResolverFactory |
resourceResolverFactory |
protected ResourceResolverType |
resourceResolverType |
protected MockSlingHttpServletResponse |
response |
protected org.apache.sling.api.scripting.SlingScriptHelper |
slingScriptHelper |
| Constructor and Description |
|---|
SlingContextImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addModelsForPackage(String packageName)
Scan classpaths for given package name (and sub packages) to scan for and
register all classes with @Model annotation.
|
ContentBuilder |
create() |
org.apache.sling.api.resource.Resource |
currentResource() |
org.apache.sling.api.resource.Resource |
currentResource(org.apache.sling.api.resource.Resource resource)
Set current resource in request.
|
org.apache.sling.api.resource.Resource |
currentResource(String resourcePath)
Set current resource in request.
|
ContentLoader |
load() |
protected org.apache.sling.api.resource.ResourceResolverFactory |
newResourceResolverFactory()
Initialize mocked resource resolver factory.
|
protected void |
registerDefaultServices()
Default services that should be available for every unit test
|
MockSlingHttpServletRequest |
request() |
MockRequestPathInfo |
requestPathInfo() |
org.apache.sling.api.resource.ResourceResolver |
resourceResolver() |
ResourceResolverType |
resourceResolverType() |
MockSlingHttpServletResponse |
response() |
void |
runMode(String... runModes)
Set current run mode(s).
|
protected void |
setResourceResolverType(ResourceResolverType resourceResolverType) |
protected void |
setUp()
Setup actions before test method execution
|
org.apache.sling.api.scripting.SlingScriptHelper |
slingScriptHelper() |
protected void |
tearDown()
Teardown actions after test method execution
|
protected org.apache.sling.api.resource.ResourceResolverFactory resourceResolverFactory
protected MockModelAdapterFactory modelAdapterFactory
protected ResourceResolverType resourceResolverType
protected org.apache.sling.api.resource.ResourceResolver resourceResolver
protected MockSlingHttpServletRequest request
protected MockSlingHttpServletResponse response
protected org.apache.sling.api.scripting.SlingScriptHelper slingScriptHelper
protected ContentLoader contentLoader
protected ContentBuilder contentBuilder
protected void setResourceResolverType(ResourceResolverType resourceResolverType)
resourceResolverType - Resource resolver typeprotected void setUp()
setUp in class org.apache.sling.testing.mock.osgi.context.OsgiContextImplprotected org.apache.sling.api.resource.ResourceResolverFactory newResourceResolverFactory()
protected void registerDefaultServices()
protected void tearDown()
tearDown in class org.apache.sling.testing.mock.osgi.context.OsgiContextImplpublic final ResourceResolverType resourceResolverType()
public final org.apache.sling.api.resource.ResourceResolver resourceResolver()
public final MockSlingHttpServletRequest request()
public final MockRequestPathInfo requestPathInfo()
public final MockSlingHttpServletResponse response()
public final org.apache.sling.api.scripting.SlingScriptHelper slingScriptHelper()
public ContentLoader load()
public ContentBuilder create()
public final org.apache.sling.api.resource.Resource currentResource()
public final org.apache.sling.api.resource.Resource currentResource(String resourcePath)
resourcePath - Resource pathpublic final org.apache.sling.api.resource.Resource currentResource(org.apache.sling.api.resource.Resource resource)
resource - Resourcepublic final void addModelsForPackage(String packageName)
packageName - Java package namepublic final void runMode(String... runModes)
runModes - Run mode(s).Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.