public final class MockOsgi
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
activate(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext)
Simulates activation of a DS component instance.
|
static boolean |
activate(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Dictionary<java.lang.String,java.lang.Object> properties)
Simulates activation of a DS component instance.
|
static boolean |
activate(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
Simulates activation of a DS component instance.
|
static boolean |
activate(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
java.lang.Object... properties)
Simulates activation of a DS component instance.
|
static <T> T |
activateInjectServices(@NotNull java.lang.Class<T> targetClass,
@NotNull org.osgi.framework.BundleContext bundleContext)
Simulates OSGi DS dependency injection and activation.
|
static <T> T |
activateInjectServices(@NotNull java.lang.Class<T> targetClass,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
Simulates OSGi DS dependency injection and activation.
|
static <T> T |
activateInjectServices(@NotNull java.lang.Class<T> targetClass,
@NotNull org.osgi.framework.BundleContext bundleContext,
java.lang.Object... properties)
Simulates OSGi DS dependency injection and activation.
|
static @NotNull ComponentContextBuilder |
componentContext() |
static boolean |
deactivate(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext)
Simulates deactivation of a DS component instance.
|
static boolean |
deactivate(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Dictionary<java.lang.String,java.lang.Object> properties)
Simulates deactivation of a DS component instance.
|
static boolean |
deactivate(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
Simulates deactivation of a DS component instance.
|
static boolean |
deactivate(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
java.lang.Object... properties)
Simulates deactivation of a DS component instance.
|
static boolean |
injectServices(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext)
Simulates OSGi DS dependency injection.
|
static boolean |
injectServices(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
Simulates OSGi DS dependency injection.
|
static boolean |
modified(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Dictionary<java.lang.String,java.lang.Object> properties)
Simulates configuration modification of a DS component instance.
|
static boolean |
modified(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
Simulates configuration modification of a DS component instance.
|
static boolean |
modified(@NotNull java.lang.Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
java.lang.Object... properties)
Simulates configuration modification of a DS component instance.
|
static @NotNull org.osgi.framework.BundleContext |
newBundleContext() |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext() |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Dictionary<java.lang.String,java.lang.Object> properties) |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Map<java.lang.String,java.lang.Object> properties) |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(@NotNull org.osgi.framework.BundleContext bundleContext,
java.lang.Object... properties) |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(@Nullable java.util.Dictionary<java.lang.String,java.lang.Object> properties) |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(@Nullable java.util.Map<java.lang.String,java.lang.Object> properties) |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(java.lang.Object... properties) |
static @NotNull org.osgi.service.log.LogService |
newLogService(@NotNull java.lang.Class<?> loggerContext) |
static <T> T |
registerInjectActivateService(@NotNull java.lang.Class<T> dsComponentClass,
@NotNull org.osgi.framework.BundleContext bundleContext)
Injects dependencies, activates and registers a DS component in the mocked OSGi environment.
|
static <T> T |
registerInjectActivateService(@NotNull java.lang.Class<T> dsComponentClass,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
Injects dependencies, activates and registers a DS component in the mocked OSGi environment.
|
static <T> T |
registerInjectActivateService(@NotNull java.lang.Class<T> dsComponentClass,
@NotNull org.osgi.framework.BundleContext bundleContext,
java.lang.Object... properties)
Injects dependencies, activates and registers a DS component in the mocked OSGi environment.
|
static <T> void |
registerInjectActivateService(T component,
@NotNull org.osgi.framework.BundleContext bundleContext)
Injects dependencies, activates and registers a DS component in the mocked OSGi environment.
|
static <T> void |
registerInjectActivateService(T component,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
Injects dependencies, activates and registers a DS component in the mocked OSGi environment.
|
static <T> void |
registerInjectActivateService(T component,
@NotNull org.osgi.framework.BundleContext bundleContext,
java.lang.Object... properties)
Injects dependencies, activates and registers a DS component in the mocked OSGi environment.
|
static void |
sendBundleEvent(@NotNull org.osgi.framework.BundleContext bundleContext,
@NotNull org.osgi.framework.BundleEvent bundleEvent)
Simulates a bundle event on the given bundle context (that is forwarded
to registered bundle listeners).
|
static void |
setConfigForPid(@NotNull org.osgi.framework.BundleContext bundleContext,
@NotNull java.lang.String pid,
@Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
Set configuration via ConfigurationAdmin service in bundle context for component with given pid.
|
static void |
setConfigForPid(@NotNull org.osgi.framework.BundleContext bundleContext,
@NotNull java.lang.String pid,
java.lang.Object... properties)
Set configuration via ConfigurationAdmin service in bundle context for component with given pid.
|
static void |
shutdown(@NotNull org.osgi.framework.BundleContext bundleContext)
Deactivates all bundles registered in the mocked bundle context.
|
@NotNull public static @NotNull org.osgi.framework.BundleContext newBundleContext()
BundleContext
instancepublic static void sendBundleEvent(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull @NotNull org.osgi.framework.BundleEvent bundleEvent)
bundleContext
- Bundle contextbundleEvent
- Bundle event@NotNull public static @NotNull org.osgi.service.component.ComponentContext newComponentContext()
ComponentContext
instance@NotNull public static @NotNull org.osgi.service.component.ComponentContext newComponentContext(@Nullable @Nullable java.util.Dictionary<java.lang.String,java.lang.Object> properties)
properties
- PropertiesComponentContext
instance@NotNull public static @NotNull org.osgi.service.component.ComponentContext newComponentContext(@Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
properties
- PropertiesComponentContext
instance@NotNull public static @NotNull org.osgi.service.component.ComponentContext newComponentContext(@NotNull java.lang.Object... properties)
properties
- PropertiesComponentContext
instance@NotNull public static @NotNull org.osgi.service.component.ComponentContext newComponentContext(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Dictionary<java.lang.String,java.lang.Object> properties)
bundleContext
- Bundle contextproperties
- PropertiesComponentContext
instance@NotNull public static @NotNull org.osgi.service.component.ComponentContext newComponentContext(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
bundleContext
- Bundle contextproperties
- PropertiesComponentContext
instance@NotNull public static @NotNull org.osgi.service.component.ComponentContext newComponentContext(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull java.lang.Object... properties)
bundleContext
- Bundle contextproperties
- PropertiesComponentContext
instance@NotNull public static @NotNull ComponentContextBuilder componentContext()
ComponentContextBuilder
to build a mocked ComponentContext
@NotNull public static @NotNull org.osgi.service.log.LogService newLogService(@NotNull @NotNull java.lang.Class<?> loggerContext)
loggerContext
- Context class for loggingLogService
instancepublic static boolean injectServices(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
target
- Service instancebundleContext
- Bundle context from which services are fetched to inject.public static boolean injectServices(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
target
- Service instancebundleContext
- Bundle context from which services are fetched to inject.properties
- Service properties (used to resolve dynamic reference properties)@NotNull public static <T> T activateInjectServices(@NotNull @NotNull java.lang.Class<T> targetClass, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
T
- Target class typetargetClass
- Component/service classbundleContext
- Bundle context from which services are fetched to inject.@NotNull public static <T> T activateInjectServices(@NotNull @NotNull java.lang.Class<T> targetClass, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
T
- Target class typetargetClass
- Component/service classbundleContext
- Bundle context from which services are fetched to inject.properties
- Service properties (used to resolve dynamic reference properties)@NotNull public static <T> T activateInjectServices(@NotNull @NotNull java.lang.Class<T> targetClass, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull java.lang.Object... properties)
T
- Target class typetargetClass
- Component/service classbundleContext
- Bundle context from which services are fetched to inject.properties
- Service properties (used to resolve dynamic reference properties)@NotNull public static final <T> void registerInjectActivateService(@NotNull T component, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
T
- DS Component typecomponent
- a DS component instancebundleContext
- Bundle context from which services are fetched to inject and which is used for registering new services@NotNull public static final <T> void registerInjectActivateService(@NotNull T component, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
T
- DS Component typecomponent
- a DS component instancebundleContext
- Bundle context from which services are fetched to inject and which is used for registering new servicesproperties
- component properties (optional)@NotNull public static final <T> void registerInjectActivateService(@NotNull T component, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull java.lang.Object... properties)
T
- DS Component typecomponent
- a DS component instancebundleContext
- Bundle context from which services are fetched to inject and which is used for registering new services.properties
- component properties (optional)@NotNull public static final <T> T registerInjectActivateService(@NotNull @NotNull java.lang.Class<T> dsComponentClass, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
T
- DS component typedsComponentClass
- DS component classbundleContext
- Bundle context from which services are fetched to inject and which is used for registering new services@NotNull public static final <T> T registerInjectActivateService(@NotNull @NotNull java.lang.Class<T> dsComponentClass, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
T
- DS component typedsComponentClass
- DS component classbundleContext
- Bundle context from which services are fetched to inject and which is used for registering new servicesproperties
- component properties (optional)@NotNull public static final <T> T registerInjectActivateService(@NotNull @NotNull java.lang.Class<T> dsComponentClass, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull java.lang.Object... properties)
T
- DS component typedsComponentClass
- DS component classbundleContext
- Bundle context from which services are fetched to inject and which is used for registering new servicesproperties
- component properties (optional)public static boolean activate(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
target
- DS component instancebundleContext
- Bundle contextpublic static boolean activate(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Dictionary<java.lang.String,java.lang.Object> properties)
target
- DS component instancebundleContext
- Bundle contextproperties
- Propertiespublic static boolean activate(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
target
- DS component instancebundleContext
- Bundle contextproperties
- Propertiespublic static boolean activate(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull java.lang.Object... properties)
target
- DS component instancebundleContext
- Bundle contextproperties
- Propertiespublic static boolean deactivate(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
target
- Service instance.bundleContext
- Bundle context.public static boolean deactivate(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Dictionary<java.lang.String,java.lang.Object> properties)
target
- DS component instancebundleContext
- Bundle contextproperties
- Propertiespublic static boolean deactivate(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
target
- DS component instancebundleContext
- Bundle contextproperties
- Propertiespublic static boolean deactivate(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull java.lang.Object... properties)
target
- DS component instancebundleContext
- Bundle contextproperties
- Propertiespublic static boolean modified(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Dictionary<java.lang.String,java.lang.Object> properties)
target
- DS component instancebundleContext
- Bundle contextproperties
- Propertiespublic static boolean modified(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
target
- DS component instancebundleContext
- Bundle contextproperties
- Propertiespublic static boolean modified(@NotNull @NotNull java.lang.Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull java.lang.Object... properties)
target
- DS component instancebundleContext
- Bundle contextproperties
- Propertiespublic static void setConfigForPid(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull @NotNull java.lang.String pid, @Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> properties)
bundleContext
- Bundle contextpid
- PIDproperties
- Configuration propertiespublic static void setConfigForPid(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull @NotNull java.lang.String pid, @NotNull java.lang.Object... properties)
bundleContext
- Bundle contextpid
- PIDproperties
- Configuration propertiespublic static void shutdown(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
bundleContext
- Bundle contextCopyright © 2014–2021 wcm.io. All rights reserved.