Package io.wcm.testing.mock.aem.junit5
Class AemContextBuilder
- java.lang.Object
-
- io.wcm.testing.mock.aem.junit5.AemContextBuilder
-
@ProviderType public final class AemContextBuilder extends java.lang.ObjectBuilder class for creatingAemContextinstances with different sets of parameters.
-
-
Constructor Summary
Constructors Constructor Description AemContextBuilder()Create builder with default resource resolver type.AemContextBuilder(@NotNull org.apache.sling.testing.mock.sling.ResourceResolverType resourceResolverType)Create builder with given resource resolver type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull AemContextBuilderafterSetUp(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... afterSetUpCallback)@NotNull AemContextBuilderafterTearDown(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... afterTearDownCallback)@NotNull AemContextBuilderbeforeSetUp(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... beforeSetUpCallback)@NotNull AemContextBuilderbeforeTearDown(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... beforeTearDownCallback)@NotNull AemContextbuild()@NotNull AemContextBuilderplugin(@NotNull org.apache.sling.testing.mock.osgi.context.ContextPlugin<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... plugin)@NotNull AemContextBuilderregisterSlingModelsFromClassPath(boolean value)Automatic registering of all Sling Models found in the classpath on startup (active by default).@NotNull AemContextBuilderresourceResolverFactoryActivatorProps(@NotNull java.util.Map<java.lang.String,java.lang.Object> props)Allows to override OSGi configuration parameters for the Resource Resolver Factory Activator service.@NotNull AemContextBuilderresourceResolverType(@NotNull org.apache.sling.testing.mock.sling.ResourceResolverType type)
-
-
-
Constructor Detail
-
AemContextBuilder
public AemContextBuilder()
Create builder with default resource resolver type.
-
AemContextBuilder
public AemContextBuilder(@NotNull @NotNull org.apache.sling.testing.mock.sling.ResourceResolverType resourceResolverType)Create builder with given resource resolver type.- Parameters:
resourceResolverType- Resource resolver type.
-
-
Method Detail
-
resourceResolverType
@NotNull public @NotNull AemContextBuilder resourceResolverType(@NotNull @NotNull org.apache.sling.testing.mock.sling.ResourceResolverType type)
- Parameters:
type- Resource resolver type.- Returns:
- this
-
plugin
@SafeVarargs @NotNull public final @NotNull AemContextBuilder plugin(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextPlugin<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... plugin)
- Parameters:
plugin- Context plugin which listens to context lifecycle events.- Returns:
- this
-
beforeSetUp
@SafeVarargs @NotNull public final @NotNull AemContextBuilder beforeSetUp(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... beforeSetUpCallback)
- Parameters:
beforeSetUpCallback- Allows the application to register an own callback function that is called before the built-in setup rules are executed.- Returns:
- this
-
afterSetUp
@SafeVarargs @NotNull public final @NotNull AemContextBuilder afterSetUp(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... afterSetUpCallback)
- Parameters:
afterSetUpCallback- Allows the application to register an own callback function that is called after the built-in setup rules are executed.- Returns:
- this
-
beforeTearDown
@SafeVarargs @NotNull public final @NotNull AemContextBuilder beforeTearDown(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... beforeTearDownCallback)
- Parameters:
beforeTearDownCallback- Allows the application to register an own callback function that is called before the built-in teardown rules are executed.- Returns:
- this
-
afterTearDown
@SafeVarargs @NotNull public final @NotNull AemContextBuilder afterTearDown(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... afterTearDownCallback)
- Parameters:
afterTearDownCallback- Allows the application to register an own callback function that is after before the built-in teardown rules are executed.- Returns:
- this
-
resourceResolverFactoryActivatorProps
@NotNull public @NotNull AemContextBuilder resourceResolverFactoryActivatorProps(@NotNull @NotNull java.util.Map<java.lang.String,java.lang.Object> props)
Allows to override OSGi configuration parameters for the Resource Resolver Factory Activator service.- Parameters:
props- Configuration properties- Returns:
- this
-
registerSlingModelsFromClassPath
@NotNull public @NotNull AemContextBuilder registerSlingModelsFromClassPath(boolean value)
Automatic registering of all Sling Models found in the classpath on startup (active by default).- Parameters:
value- If set to false Sling Models are not registered automatically from the classpath on startup.- Returns:
- this
-
build
@NotNull public @NotNull AemContext build()
- Returns:
- Build
AemContextinstance.
-
-