Class SlingContext
java.lang.Object
org.apache.sling.testing.mock.osgi.context.OsgiContextImpl
org.apache.sling.testing.mock.sling.context.SlingContextImpl
org.apache.sling.testing.mock.sling.junit5.SlingContext
Sling Mock parameter object with resource resolver type defaulting to
ResourceResolverType.RESOURCERESOLVER_MOCK
.
Additionally you can subclass this class and provide further parameters via
SlingContextBuilder
.
-
Field Summary
Fields inherited from class org.apache.sling.testing.mock.sling.context.SlingContextImpl
contentBuilder, contentLoader, contentLoaderAutoCommit, request, resourceBuilder, resourceResolver, resourceResolverFactory, resourceResolverType, response, slingScriptHelper, uniqueRoot
Fields inherited from class org.apache.sling.testing.mock.osgi.context.OsgiContextImpl
componentContext
-
Constructor Summary
ConstructorsConstructorDescriptionInitialize Sling context.SlingContext
(@NotNull ResourceResolverType resourceResolverType) Initialize Sling context. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
This is called bySlingContextExtension
to set up context.protected void
This is called bySlingContextExtension
to tear down context.Methods inherited from class org.apache.sling.testing.mock.sling.context.SlingContextImpl
addModelsForClasses, addModelsForClasses, addModelsForPackage, addModelsForPackage, build, create, currentResource, currentResource, currentResource, load, load, newResourceResolverFactory, registerAdapter, registerAdapter, registerDefaultServices, request, requestPathInfo, resolveSlingBindingProperty, resolveSlingBindingProperty, resourceResolver, resourceResolverType, response, runMode, setRegisterSlingModelsFromClassPath, setResourceResolverFactoryActivatorProps, setResourceResolverType, setUp, slingScriptHelper, tearDown, uniqueRoot
Methods inherited from class org.apache.sling.testing.mock.osgi.context.OsgiContextImpl
bundleContext, componentContext, getService, getServices, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerService, registerService, registerService, registerService
-
Constructor Details
-
SlingContext
public SlingContext()Initialize Sling context. -
SlingContext
Initialize Sling context.- Parameters:
resourceResolverType
- Resource resolver type.
-
-
Method Details
-
setUpContext
protected void setUpContext()This is called bySlingContextExtension
to set up context. -
tearDownContext
protected void tearDownContext()This is called bySlingContextExtension
to tear down context.
-