@ConsumerType public class AemContextImpl extends SlingContextImpl
contentBuilder, contentLoader, contentLoaderAutoCommit, request, resourceBuilder, resourceResolver, resourceResolverFactory, resourceResolverType, response, slingScriptHelper, uniqueRoot
componentContext
Constructor and Description |
---|
AemContextImpl() |
Modifier and Type | Method and Description |
---|---|
@NotNull com.day.cq.dam.api.AssetManager |
assetManager() |
@NotNull com.day.cq.wcm.api.policies.ContentPolicyMapping |
contentPolicyMapping(@NotNull java.lang.String resourceType,
java.util.Map<java.lang.String,java.lang.Object> properties)
Creates a mocked content policy with the given properties and maps it to all content resources with the given
resource type.
|
@NotNull com.day.cq.wcm.api.policies.ContentPolicyMapping |
contentPolicyMapping(@NotNull java.lang.String resourceType,
java.lang.Object... properties)
Creates a mocked content policy with the given properties and maps it to all content resources with the given
resource type.
|
@NotNull ContentBuilder |
create()
Creates a
ContentBuilder object for easily creating test content. |
@Nullable com.day.cq.wcm.api.Page |
currentPage() |
@Nullable com.day.cq.wcm.api.Page |
currentPage(@Nullable com.day.cq.wcm.api.Page page)
Set current Page in request (via
ComponentContext ). |
@Nullable com.day.cq.wcm.api.Page |
currentPage(@Nullable java.lang.String pagePath)
Set current Page in request (via
ComponentContext ). |
@Nullable org.apache.sling.api.resource.Resource |
currentResource(@Nullable org.apache.sling.api.resource.Resource resource)
Set current resource in request.
|
protected @NotNull org.apache.sling.api.resource.ResourceResolverFactory |
newResourceResolverFactory()
Initialize mocked resource resolver factory.
|
@NotNull com.day.cq.wcm.api.PageManager |
pageManager() |
protected void |
registerDefaultServices()
Default services that should be available for every unit test
|
protected @Nullable java.lang.Object |
resolveSlingBindingProperty(@NotNull java.lang.String property,
@NotNull org.apache.sling.api.SlingHttpServletRequest bindingsContextRequest)
Dynamically resolve property request for current request
SlingBindings . |
protected java.util.Map<java.lang.String,java.lang.Object> |
resourceResolverFactoryActivatorPropsMergeWithAemDefault(@Nullable java.util.Map<java.lang.String,java.lang.Object> customProps)
Merges the given custom Resource Resolver Factory Activator OSGi configuration with the default configuration
applied in AEM 6.
|
protected void |
setResourceResolverType(@Nullable ResourceResolverType resourceResolverType) |
protected void |
setUp()
Setup actions before test method execution
|
protected void |
tearDown()
Teardown actions after test method execution
|
@NotNull UniqueRoot |
uniqueRoot()
Create unique root paths for unit tests (and clean them up after the test run automatically).
|
addModelsForClasses, addModelsForClasses, addModelsForPackage, addModelsForPackage, build, currentResource, currentResource, load, load, registerAdapter, registerAdapter, request, requestPathInfo, resolveSlingBindingProperty, resourceResolver, resourceResolverType, response, runMode, setRegisterSlingModelsFromClassPath, setResourceResolverFactoryActivatorProps, slingScriptHelper
bundleContext, componentContext, getService, getServices, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerService, registerService, registerService, registerService
protected void registerDefaultServices()
SlingContextImpl
registerDefaultServices
in class SlingContextImpl
protected void setResourceResolverType(@Nullable @Nullable ResourceResolverType resourceResolverType)
setResourceResolverType
in class SlingContextImpl
resourceResolverType
- Resource resolver type@NotNull protected @NotNull org.apache.sling.api.resource.ResourceResolverFactory newResourceResolverFactory()
SlingContextImpl
newResourceResolverFactory
in class SlingContextImpl
protected void setUp()
SlingContextImpl
setUp
in class SlingContextImpl
protected void tearDown()
SlingContextImpl
tearDown
in class SlingContextImpl
protected final java.util.Map<java.lang.String,java.lang.Object> resourceResolverFactoryActivatorPropsMergeWithAemDefault(@Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> customProps)
customProps
- Custom config@NotNull public @NotNull com.day.cq.wcm.api.PageManager pageManager()
@NotNull public @NotNull com.day.cq.dam.api.AssetManager assetManager()
@NotNull public @NotNull ContentBuilder create()
SlingContextImpl
ContentBuilder
object for easily creating test content.
This API was part of Sling Mocks since version 1.x.
You can use alternatively the SlingContextImpl.build()
method and use the ResourceBuilder
API.create
in class SlingContextImpl
@Nullable public @Nullable org.apache.sling.api.resource.Resource currentResource(@Nullable @Nullable org.apache.sling.api.resource.Resource resource)
SlingContextImpl
currentResource
in class SlingContextImpl
resource
- Resource@Nullable public @Nullable com.day.cq.wcm.api.Page currentPage()
ComponentContext
. If none is set the page containing the current resource.
Null if no containing page exists.@Nullable public @Nullable com.day.cq.wcm.api.Page currentPage(@Nullable @Nullable java.lang.String pagePath)
ComponentContext
).
This also sets the current resource to the content resource of the page.
You can set it to a different resources afterwards if required.pagePath
- Page path@Nullable public @Nullable com.day.cq.wcm.api.Page currentPage(@Nullable @Nullable com.day.cq.wcm.api.Page page)
ComponentContext
).
This also sets the current resource to the content resource of the page.
You can set it to a different resources afterwards if required.page
- Page@NotNull public @NotNull UniqueRoot uniqueRoot()
uniqueRoot
in class SlingContextImpl
@NotNull public @NotNull com.day.cq.wcm.api.policies.ContentPolicyMapping contentPolicyMapping(@NotNull @NotNull java.lang.String resourceType, java.util.Map<java.lang.String,java.lang.Object> properties)
resourceType
- Resource type that should be mapped to the content policyproperties
- Properties for the content policy@NotNull public @NotNull com.day.cq.wcm.api.policies.ContentPolicyMapping contentPolicyMapping(@NotNull @NotNull java.lang.String resourceType, @NotNull java.lang.Object... properties)
resourceType
- Resource type that should be mapped to the content policyproperties
- Properties for the content policy@Nullable protected @Nullable java.lang.Object resolveSlingBindingProperty(@NotNull @NotNull java.lang.String property, @NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest bindingsContextRequest)
SlingContextImpl
SlingBindings
.resolveSlingBindingProperty
in class SlingContextImpl
property
- Property keybindingsContextRequest
- Context requestCopyright © 2014–2021 wcm.io. All rights reserved.