public final class MockOsgi extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
activate(Object target)
Deprecated.
Please use
activate(Object, BundleContext)
and shutdown the bundle context after usage. |
static boolean |
activate(Object target,
org.osgi.framework.BundleContext bundleContext)
Simulate activation of service instance.
|
static boolean |
activate(Object target,
org.osgi.framework.BundleContext bundleContext,
Dictionary<String,Object> properties)
Simulate activation of service instance.
|
static boolean |
activate(Object target,
org.osgi.framework.BundleContext bundleContext,
Map<String,Object> properties)
Simulate activation of service instance.
|
static boolean |
activate(Object target,
org.osgi.framework.BundleContext bundleContext,
Object... properties)
Simulate activation of service instance.
|
static boolean |
activate(Object target,
Dictionary<String,Object> properties)
Deprecated.
Please use
activate(Object, BundleContext, Dictionary)
and shutdown the bundle context after usage. |
static boolean |
activate(Object target,
Map<String,Object> properties)
Deprecated.
Please use
activate(Object, BundleContext, Map)
and shutdown the bundle context after usage. |
static ComponentContextBuilder |
componentContext() |
static boolean |
deactivate(Object target)
Deprecated.
Please use
deactivate(Object, BundleContext)
and shutdown the bundle context after usage. |
static boolean |
deactivate(Object target,
org.osgi.framework.BundleContext bundleContext)
Simulate deactivation of service instance.
|
static boolean |
deactivate(Object target,
org.osgi.framework.BundleContext bundleContext,
Dictionary<String,Object> properties)
Simulate deactivation of service instance.
|
static boolean |
deactivate(Object target,
org.osgi.framework.BundleContext bundleContext,
Map<String,Object> properties)
Simulate activation of service instance.
|
static boolean |
deactivate(Object target,
org.osgi.framework.BundleContext bundleContext,
Object... properties)
Simulate activation of service instance.
|
static boolean |
deactivate(Object target,
Dictionary<String,Object> properties)
Deprecated.
Please use
deactivate(Object, BundleContext, Dictionary)
and shutdown the bundle context after usage. |
static boolean |
deactivate(Object target,
Map<String,Object> properties)
Deprecated.
Please use
deactivate(Object, BundleContext, Map)
and shutdown the bundle context after usage. |
static boolean |
injectServices(Object target,
org.osgi.framework.BundleContext bundleContext)
Simulate OSGi service dependency injection.
|
static boolean |
modified(Object target,
org.osgi.framework.BundleContext bundleContext,
Dictionary<String,Object> properties)
Simulate configuration modification of service instance.
|
static boolean |
modified(Object target,
org.osgi.framework.BundleContext bundleContext,
Map<String,Object> properties)
Simulate configuration modification of service instance.
|
static boolean |
modified(Object target,
org.osgi.framework.BundleContext bundleContext,
Object... properties)
Simulate configuration modification of service instance.
|
static org.osgi.framework.BundleContext |
newBundleContext() |
static org.osgi.service.component.ComponentContext |
newComponentContext() |
static org.osgi.service.component.ComponentContext |
newComponentContext(org.osgi.framework.BundleContext bundleContext,
Dictionary<String,Object> properties) |
static org.osgi.service.component.ComponentContext |
newComponentContext(org.osgi.framework.BundleContext bundleContext,
Map<String,Object> properties) |
static org.osgi.service.component.ComponentContext |
newComponentContext(org.osgi.framework.BundleContext bundleContext,
Object... properties) |
static org.osgi.service.component.ComponentContext |
newComponentContext(Dictionary<String,Object> properties) |
static org.osgi.service.component.ComponentContext |
newComponentContext(Map<String,Object> properties) |
static org.osgi.service.component.ComponentContext |
newComponentContext(Object... properties) |
static org.osgi.service.log.LogService |
newLogService(Class<?> loggerContext) |
static void |
sendBundleEvent(org.osgi.framework.BundleContext bundleContext,
org.osgi.framework.BundleEvent bundleEvent)
Simulates a bundle event on the given bundle context (that is forwarded
to registered bundle listeners).
|
static void |
setConfigForPid(org.osgi.framework.BundleContext bundleContext,
String pid,
Map<String,Object> properties)
Set configuration via ConfigurationAdmin service in bundle context for component with given pid.
|
static void |
setConfigForPid(org.osgi.framework.BundleContext bundleContext,
String pid,
Object... properties)
Set configuration via ConfigurationAdmin service in bundle context for component with given pid.
|
static void |
shutdown(org.osgi.framework.BundleContext bundleContext)
Deactivates all bundles registered in the mocked bundle context.
|
public static org.osgi.framework.BundleContext newBundleContext()
BundleContext
instancepublic static void sendBundleEvent(org.osgi.framework.BundleContext bundleContext, org.osgi.framework.BundleEvent bundleEvent)
bundleContext
- Bundle contextbundleEvent
- Bundle eventpublic static org.osgi.service.component.ComponentContext newComponentContext()
ComponentContext
instancepublic static org.osgi.service.component.ComponentContext newComponentContext(Dictionary<String,Object> properties)
properties
- PropertiesComponentContext
instancepublic static org.osgi.service.component.ComponentContext newComponentContext(Map<String,Object> properties)
properties
- PropertiesComponentContext
instancepublic static org.osgi.service.component.ComponentContext newComponentContext(Object... properties)
properties
- PropertiesComponentContext
instancepublic static org.osgi.service.component.ComponentContext newComponentContext(org.osgi.framework.BundleContext bundleContext, Dictionary<String,Object> properties)
bundleContext
- Bundle contextproperties
- PropertiesComponentContext
instancepublic static org.osgi.service.component.ComponentContext newComponentContext(org.osgi.framework.BundleContext bundleContext, Map<String,Object> properties)
bundleContext
- Bundle contextproperties
- PropertiesComponentContext
instancepublic static org.osgi.service.component.ComponentContext newComponentContext(org.osgi.framework.BundleContext bundleContext, Object... properties)
bundleContext
- Bundle contextproperties
- PropertiesComponentContext
instancepublic static ComponentContextBuilder componentContext()
ComponentContextBuilder
to build a mocked ComponentContext
public static org.osgi.service.log.LogService newLogService(Class<?> loggerContext)
loggerContext
- Context class for loggingLogService
instancepublic static boolean injectServices(Object target, org.osgi.framework.BundleContext bundleContext)
target
- Service instancebundleContext
- Bundle context from which services are fetched to inject.@Deprecated public static boolean activate(Object target)
activate(Object, BundleContext)
and shutdown the bundle context after usage.target
- Service instance.public static boolean activate(Object target, org.osgi.framework.BundleContext bundleContext)
target
- Service instance.bundleContext
- Bundle context@Deprecated public static boolean activate(Object target, Dictionary<String,Object> properties)
activate(Object, BundleContext, Dictionary)
and shutdown the bundle context after usage.target
- Service instance.properties
- Properties@Deprecated public static boolean activate(Object target, Map<String,Object> properties)
activate(Object, BundleContext, Map)
and shutdown the bundle context after usage.target
- Service instance.properties
- Propertiespublic static boolean activate(Object target, org.osgi.framework.BundleContext bundleContext, Dictionary<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean activate(Object target, org.osgi.framework.BundleContext bundleContext, Map<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean activate(Object target, org.osgi.framework.BundleContext bundleContext, Object... properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Properties@Deprecated public static boolean deactivate(Object target)
deactivate(Object, BundleContext)
and shutdown the bundle context after usage.target
- Service instance.public static boolean deactivate(Object target, org.osgi.framework.BundleContext bundleContext)
target
- Service instance.bundleContext
- Bundle context.@Deprecated public static boolean deactivate(Object target, Dictionary<String,Object> properties)
deactivate(Object, BundleContext, Dictionary)
and shutdown the bundle context after usage.target
- Service instance.properties
- Properties@Deprecated public static boolean deactivate(Object target, Map<String,Object> properties)
deactivate(Object, BundleContext, Map)
and shutdown the bundle context after usage.target
- Service instance.properties
- Propertiespublic static boolean deactivate(Object target, org.osgi.framework.BundleContext bundleContext, Dictionary<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean deactivate(Object target, org.osgi.framework.BundleContext bundleContext, Map<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean deactivate(Object target, org.osgi.framework.BundleContext bundleContext, Object... properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean modified(Object target, org.osgi.framework.BundleContext bundleContext, Dictionary<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean modified(Object target, org.osgi.framework.BundleContext bundleContext, Map<String,Object> properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static boolean modified(Object target, org.osgi.framework.BundleContext bundleContext, Object... properties)
target
- Service instance.bundleContext
- Bundle contextproperties
- Propertiespublic static void setConfigForPid(org.osgi.framework.BundleContext bundleContext, String pid, Map<String,Object> properties)
bundleContext
- Bundle contextpid
- PIDproperties
- Configuration propertiespublic static void setConfigForPid(org.osgi.framework.BundleContext bundleContext, String pid, Object... properties)
bundleContext
- Bundle contextpid
- PIDproperties
- Configuration propertiespublic static void shutdown(org.osgi.framework.BundleContext bundleContext)
bundleContext
- Bundle contextCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.