Class OsgiContextBuilder
- java.lang.Object
-
- org.apache.sling.testing.mock.osgi.junit5.OsgiContextBuilder
-
@ProviderType public final class OsgiContextBuilder extends Object
Builder class for creatingOsgiContext
instances with different sets of parameters.
-
-
Constructor Summary
Constructors Constructor Description OsgiContextBuilder()
Create builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends OsgiContextImpl>
OsgiContextBuilderafterSetUp(@NotNull ContextCallback<T> @NotNull ... afterSetUpCallback)
<T extends OsgiContextImpl>
OsgiContextBuilderafterTearDown(@NotNull ContextCallback<T> @NotNull ... afterTearDownCallback)
<T extends OsgiContextImpl>
OsgiContextBuilderbeforeSetUp(@NotNull ContextCallback<T> @NotNull ... beforeSetUpCallback)
<T extends OsgiContextImpl>
OsgiContextBuilderbeforeTearDown(@NotNull ContextCallback<T> @NotNull ... beforeTearDownCallback)
@NotNull OsgiContext
build()
<T extends OsgiContextImpl>
OsgiContextBuilderplugin(@NotNull ContextPlugin<T> @NotNull ... plugin)
-
-
-
Method Detail
-
plugin
@SafeVarargs public final <T extends OsgiContextImpl> OsgiContextBuilder plugin(@NotNull @NotNull ContextPlugin<T> @NotNull ... plugin)
- Type Parameters:
T
- context type- Parameters:
plugin
- Context plugin which listens to context lifecycle events.- Returns:
- this
-
beforeSetUp
@SafeVarargs public final <T extends OsgiContextImpl> OsgiContextBuilder beforeSetUp(@NotNull @NotNull ContextCallback<T> @NotNull ... beforeSetUpCallback)
- Type Parameters:
T
- context type- 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 public final <T extends OsgiContextImpl> OsgiContextBuilder afterSetUp(@NotNull @NotNull ContextCallback<T> @NotNull ... afterSetUpCallback)
- Type Parameters:
T
- context type- 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 public final <T extends OsgiContextImpl> OsgiContextBuilder beforeTearDown(@NotNull @NotNull ContextCallback<T> @NotNull ... beforeTearDownCallback)
- Type Parameters:
T
- context type- 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 public final <T extends OsgiContextImpl> OsgiContextBuilder afterTearDown(@NotNull @NotNull ContextCallback<T> @NotNull ... afterTearDownCallback)
- Type Parameters:
T
- context type- Parameters:
afterTearDownCallback
- Allows the application to register an own callback function that is after before the built-in teardown rules are executed.- Returns:
- this
-
build
@NotNull public @NotNull OsgiContext build()
- Returns:
- Build
OsgiContext
instance.
-
-