Klasse 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.junit.SlingContext
- Alle implementierten Schnittstellen:
org.junit.rules.TestRule
@ProviderType
public final class SlingContext
extends SlingContextImpl
implements org.junit.rules.TestRule
JUnit rule for setting up and tearing down Sling context objects for unit tests.
You can use
SlingContextBuilder alternatively to the constructors on this class - it offers
more options and fine-grained control about setting up the test context.-
Feldübersicht
Von Klasse geerbte Felder org.apache.sling.testing.mock.sling.context.SlingContextImpl
contentBuilder, contentLoader, contentLoaderAutoCommit, request, resourceBuilder, resourceResolver, resourceResolverFactory, resourceResolverType, response, slingScriptHelper, uniqueRootVon Klasse geerbte Felder org.apache.sling.testing.mock.osgi.context.OsgiContextImpl
componentContext -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungInitialize Sling context with default resource resolver type:MockSling.DEFAULT_RESOURCERESOLVER_TYPE.SlingContext(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<T> afterSetUpCallback) Initialize Sling context with default resource resolver type:MockSling.DEFAULT_RESOURCERESOLVER_TYPE.SlingContext(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<T> afterSetUpCallback, @NotNull ResourceResolverType resourceResolverType) Initialize Sling context with resource resolver type.SlingContext(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<U> afterSetUpCallback, @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<V> beforeTearDownCallback) Initialize Sling context with default resource resolver type:MockSling.DEFAULT_RESOURCERESOLVER_TYPE.SlingContext(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<U> afterSetUpCallback, @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<V> beforeTearDownCallback, @NotNull ResourceResolverType resourceResolverType) Initialize Sling context with resource resolver type.SlingContext(@NotNull ResourceResolverType resourceResolverType) Initialize Sling context with resource resolver type. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungorg.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description) Von Klasse geerbte Methoden 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, uniqueRootVon Klasse geerbte Methoden org.apache.sling.testing.mock.osgi.context.OsgiContextImpl
bundleContext, componentContext, getService, getServices, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerInjectActivateService, registerService, registerService, registerService, registerService
-
Konstruktordetails
-
SlingContext
public SlingContext()Initialize Sling context with default resource resolver type:MockSling.DEFAULT_RESOURCERESOLVER_TYPE. -
SlingContext
Initialize Sling context with resource resolver type.- Parameter:
resourceResolverType- Resource resolver type.
-
SlingContext
public SlingContext(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<T> afterSetUpCallback) Initialize Sling context with default resource resolver type:MockSling.DEFAULT_RESOURCERESOLVER_TYPE.- Typparameter:
T- context type- Parameter:
afterSetUpCallback- Allows the application to register an own callback function that is called after the built-in setup rules are executed.
-
SlingContext
public SlingContext(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<T> afterSetUpCallback, @NotNull @NotNull ResourceResolverType resourceResolverType) Initialize Sling context with resource resolver type.- Typparameter:
T- context type- Parameter:
afterSetUpCallback- Allows the application to register an own callback function that is called after the built-in setup rules are executed.resourceResolverType- Resource resolver type.
-
SlingContext
public SlingContext(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<U> afterSetUpCallback, @NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<V> beforeTearDownCallback) Initialize Sling context with default resource resolver type:MockSling.DEFAULT_RESOURCERESOLVER_TYPE.- Typparameter:
U- context typeV- context type- Parameter:
afterSetUpCallback- Allows the application to register an own callback function that is called after the built-in setup rules are executed.beforeTearDownCallback- Allows the application to register an own callback function that is called before the built-in teardown rules are executed.
-
SlingContext
public SlingContext(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<U> afterSetUpCallback, @NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<V> beforeTearDownCallback, @NotNull @NotNull ResourceResolverType resourceResolverType) Initialize Sling context with resource resolver type.- Typparameter:
U- context typeV- context type- Parameter:
afterSetUpCallback- Allows the application to register an own callback function that is called after the built-in setup rules are executed.beforeTearDownCallback- Allows the application to register an own callback function that is called before the built-in teardown rules are executed.resourceResolverType- Resource resolver type.
-
-
Methodendetails
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Angegeben von:
applyin Schnittstelleorg.junit.rules.TestRule
-