public final class MockOsgi extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
activate(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext)
Simulate activation of service instance.
|
static boolean |
activate(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable Dictionary<String,Object> properties)
Simulate activation of service instance.
|
static boolean |
activate(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable Map<String,Object> properties)
Simulate activation of service instance.
|
static boolean |
activate(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
Object... properties)
Simulate activation of service instance.
|
static @NotNull ComponentContextBuilder |
componentContext() |
static boolean |
deactivate(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext)
Simulate deactivation of service instance.
|
static boolean |
deactivate(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable Dictionary<String,Object> properties)
Simulate deactivation of service instance.
|
static boolean |
deactivate(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable Map<String,Object> properties)
Simulate activation of service instance.
|
static boolean |
deactivate(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
Object... properties)
Simulate activation of service instance.
|
static boolean |
injectServices(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext)
Simulate OSGi service dependency injection.
|
static boolean |
injectServices(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable Map<String,Object> properties)
Simulate OSGi service dependency injection.
|
static boolean |
modified(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable Dictionary<String,Object> properties)
Simulate configuration modification of service instance.
|
static boolean |
modified(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable Map<String,Object> properties)
Simulate configuration modification of service instance.
|
static boolean |
modified(@NotNull Object target,
@NotNull org.osgi.framework.BundleContext bundleContext,
Object... properties)
Simulate configuration modification of service 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 Dictionary<String,Object> properties) |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(@NotNull org.osgi.framework.BundleContext bundleContext,
@Nullable Map<String,Object> properties) |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(@NotNull org.osgi.framework.BundleContext bundleContext,
Object... properties) |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(@Nullable Dictionary<String,Object> properties) |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(@Nullable Map<String,Object> properties) |
static @NotNull org.osgi.service.component.ComponentContext |
newComponentContext(Object... properties) |
static @NotNull org.osgi.service.log.LogService |
newLogService(@NotNull Class<?> loggerContext) |
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 String pid,
@Nullable Map<String,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 String pid,
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 Dictionary<String,Object> properties)
properties
- PropertiesComponentContext
instance@NotNull public static @NotNull org.osgi.service.component.ComponentContext newComponentContext(@Nullable @Nullable Map<String,Object> properties)
properties
- PropertiesComponentContext
instance@NotNull public static @NotNull org.osgi.service.component.ComponentContext newComponentContext(@NotNull Object... properties)
properties
- PropertiesComponentContext
instance@NotNull public static @NotNull org.osgi.service.component.ComponentContext newComponentContext(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable Dictionary<String,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 Map<String,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 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 Class<?> loggerContext)
loggerContext
- Context class for loggingLogService
instancepublic static boolean injectServices(@NotNull @NotNull 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 Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable Map<String,Object> properties)
target
- Service instancebundleContext
- Bundle context from which services are fetched to inject.properties
- Service properties (used to resolve dynamic reference properties)public static boolean activate(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
target
- Service instance.bundleContext
- Bundle contextpublic static boolean activate(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable Dictionary<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean activate(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable Map<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean activate(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull Object... properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean deactivate(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
target
- Service instance.bundleContext
- Bundle context.public static boolean deactivate(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable Dictionary<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean deactivate(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable Map<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean deactivate(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull Object... properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean modified(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable Dictionary<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean modified(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @Nullable @Nullable Map<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean modified(@NotNull @NotNull Object target, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull Object... properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static void setConfigForPid(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull @NotNull String pid, @Nullable @Nullable Map<String,Object> properties)
bundleContext
- Bundle contextpid
- PIDproperties
- Configuration propertiespublic static void setConfigForPid(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext, @NotNull @NotNull String pid, @NotNull Object... properties)
bundleContext
- Bundle contextpid
- PIDproperties
- Configuration propertiespublic static void shutdown(@NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
bundleContext
- Bundle contextCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.