public class OsgiContextImpl extends Object
OsgiContext
JUnit rule.Modifier and Type | Field and Description |
---|---|
protected org.osgi.service.component.ComponentContext |
componentContext |
Constructor and Description |
---|
OsgiContextImpl() |
Modifier and Type | Method and Description |
---|---|
org.osgi.framework.BundleContext |
bundleContext() |
org.osgi.service.component.ComponentContext |
componentContext() |
<ServiceType> |
getService(Class<ServiceType> serviceType)
Lookup a single service
|
<ServiceType> |
getServices(Class<ServiceType> serviceType,
String filter)
Lookup one or several services
|
<T> T |
registerInjectActivateService(T service)
Injects dependencies, activates and registers a service in the mocked
OSGi environment.
|
<T> T |
registerInjectActivateService(T service,
Map<String,Object> properties)
Injects dependencies, activates and registers a service in the mocked
OSGi environment.
|
<T> T |
registerInjectActivateService(T service,
Object... properties)
Injects dependencies, activates and registers a service in the mocked
OSGi environment.
|
<T> T |
registerService(Class<T> serviceClass,
T service)
Registers a service in the mocked OSGi environment.
|
<T> T |
registerService(Class<T> serviceClass,
T service,
Map<String,Object> properties)
Registers a service in the mocked OSGi environment.
|
<T> T |
registerService(Class<T> serviceClass,
T service,
Object... properties)
Registers a service in the mocked OSGi environment.
|
<T> T |
registerService(T service)
Registers a service in the mocked OSGi environment.
|
protected void |
setUp()
Setup actions before test method execution
|
protected void |
tearDown()
Teardown actions after test method execution
|
protected org.osgi.service.component.ComponentContext componentContext
protected void setUp()
protected void tearDown()
public final org.osgi.service.component.ComponentContext componentContext()
public final org.osgi.framework.BundleContext bundleContext()
public final <T> T registerService(T service)
T
- Service typeservice
- Service instancepublic final <T> T registerService(Class<T> serviceClass, T service)
T
- Service typeserviceClass
- Service classservice
- Service instancepublic final <T> T registerService(Class<T> serviceClass, T service, Map<String,Object> properties)
T
- Service typeserviceClass
- Service classservice
- Service instanceproperties
- Service properties (optional)public final <T> T registerService(Class<T> serviceClass, T service, Object... properties)
T
- Service typeserviceClass
- Service classservice
- Service instanceproperties
- Service properties (optional)public final <T> T registerInjectActivateService(T service)
T
- Service typeservice
- Service instancepublic final <T> T registerInjectActivateService(T service, Map<String,Object> properties)
T
- Service typeservice
- Service instanceproperties
- Service properties (optional)public final <T> T registerInjectActivateService(T service, Object... properties)
T
- Service typeservice
- Service instanceproperties
- Service properties (optional)public final <ServiceType> ServiceType getService(Class<ServiceType> serviceType)
ServiceType
- Service typeserviceType
- The type (interface) of the service.public final <ServiceType> ServiceType[] getServices(Class<ServiceType> serviceType, String filter)
ServiceType
- Service typeserviceType
- The type (interface) of the service.filter
- An optional filter (LDAP-like, see OSGi spec)RuntimeException
- If the filter
string is not a valid OSGi service filter string.Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.