public class StubBundleContext extends Object implements org.osgi.framework.BundleContext
WARNING: if you static mock FrameworkUtil.createFilter(String)
, you
are going to have a bad time.
Constructor and Description |
---|
StubBundleContext() |
Modifier and Type | Method and Description |
---|---|
void |
addBundleListener(org.osgi.framework.BundleListener listener) |
void |
addFrameworkListener(org.osgi.framework.FrameworkListener listener) |
void |
addServiceListener(org.osgi.framework.ServiceListener listener) |
void |
addServiceListener(org.osgi.framework.ServiceListener listener,
String filter) |
org.osgi.framework.Filter |
createFilter(String filter) |
org.osgi.framework.ServiceReference[] |
getAllServiceReferences(String clazz,
String filter) |
Collection<com.redhat.thermostat.testutils.StubBundleContext.ServiceInformation> |
getAllServices() |
org.osgi.framework.Bundle |
getBundle() |
org.osgi.framework.Bundle |
getBundle(long id) |
org.osgi.framework.Bundle |
getBundle(String location) |
org.osgi.framework.Bundle[] |
getBundles() |
File |
getDataFile(String filename) |
int |
getExportedServiceCount(org.osgi.framework.ServiceRegistration registration) |
String |
getProperty(String key) |
Object |
getService(org.osgi.framework.ServiceReference reference) |
Collection<org.osgi.framework.ServiceListener> |
getServiceListeners() |
org.osgi.framework.ServiceReference |
getServiceReference(Class clazz) |
org.osgi.framework.ServiceReference |
getServiceReference(String clazz) |
Collection |
getServiceReferences(Class clazz,
String filter) |
org.osgi.framework.ServiceReference[] |
getServiceReferences(String clazz,
String filter) |
org.osgi.framework.Bundle |
installBundle(String location) |
org.osgi.framework.Bundle |
installBundle(String location,
InputStream input) |
boolean |
isServiceRegistered(String serviceName,
Class<?> implementationClass) |
boolean |
isServiceRegistered(String serviceName,
Class<?> implementationClass,
Dictionary<String,?> props) |
org.osgi.framework.ServiceRegistration |
registerService(Class clazz,
Object service,
Dictionary properties) |
org.osgi.framework.ServiceRegistration |
registerService(String[] clazzes,
Object service,
Dictionary properties) |
org.osgi.framework.ServiceRegistration |
registerService(String className,
Object service,
Dictionary properties) |
void |
removeBundleListener(org.osgi.framework.BundleListener listener) |
void |
removeFrameworkListener(org.osgi.framework.FrameworkListener listener) |
void |
removeService(com.redhat.thermostat.testutils.StubBundleContext.ServiceInformation info) |
void |
removeServiceListener(org.osgi.framework.ServiceListener listener) |
void |
setBundle(org.osgi.framework.Bundle bundle)
Set the context bundle
|
void |
setBundle(int i,
org.osgi.framework.Bundle bundle)
Set the bundle associated with an id
|
void |
setProperty(String key,
String value) |
boolean |
ungetService(org.osgi.framework.ServiceReference reference) |
public String getProperty(String key)
getProperty
in interface org.osgi.framework.BundleContext
public org.osgi.framework.Bundle getBundle()
getBundle
in interface org.osgi.framework.BundleContext
getBundle
in interface org.osgi.framework.BundleReference
public org.osgi.framework.Bundle installBundle(String location, InputStream input) throws org.osgi.framework.BundleException
installBundle
in interface org.osgi.framework.BundleContext
org.osgi.framework.BundleException
public org.osgi.framework.Bundle installBundle(String location) throws org.osgi.framework.BundleException
installBundle
in interface org.osgi.framework.BundleContext
org.osgi.framework.BundleException
public org.osgi.framework.Bundle getBundle(long id)
getBundle
in interface org.osgi.framework.BundleContext
public org.osgi.framework.Bundle getBundle(String location)
getBundle
in interface org.osgi.framework.BundleContext
public org.osgi.framework.Bundle[] getBundles()
getBundles
in interface org.osgi.framework.BundleContext
public void addServiceListener(org.osgi.framework.ServiceListener listener, String filter) throws org.osgi.framework.InvalidSyntaxException
addServiceListener
in interface org.osgi.framework.BundleContext
org.osgi.framework.InvalidSyntaxException
public void addServiceListener(org.osgi.framework.ServiceListener listener)
addServiceListener
in interface org.osgi.framework.BundleContext
public void removeServiceListener(org.osgi.framework.ServiceListener listener)
removeServiceListener
in interface org.osgi.framework.BundleContext
public void addBundleListener(org.osgi.framework.BundleListener listener)
addBundleListener
in interface org.osgi.framework.BundleContext
public void removeBundleListener(org.osgi.framework.BundleListener listener)
removeBundleListener
in interface org.osgi.framework.BundleContext
public void addFrameworkListener(org.osgi.framework.FrameworkListener listener)
addFrameworkListener
in interface org.osgi.framework.BundleContext
public void removeFrameworkListener(org.osgi.framework.FrameworkListener listener)
removeFrameworkListener
in interface org.osgi.framework.BundleContext
public org.osgi.framework.ServiceRegistration registerService(Class clazz, Object service, Dictionary properties)
registerService
in interface org.osgi.framework.BundleContext
public org.osgi.framework.ServiceRegistration registerService(String className, Object service, Dictionary properties)
registerService
in interface org.osgi.framework.BundleContext
public org.osgi.framework.ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
registerService
in interface org.osgi.framework.BundleContext
public org.osgi.framework.ServiceReference getServiceReference(Class clazz)
getServiceReference
in interface org.osgi.framework.BundleContext
public org.osgi.framework.ServiceReference getServiceReference(String clazz)
getServiceReference
in interface org.osgi.framework.BundleContext
public Collection getServiceReferences(Class clazz, String filter) throws org.osgi.framework.InvalidSyntaxException
getServiceReferences
in interface org.osgi.framework.BundleContext
org.osgi.framework.InvalidSyntaxException
public org.osgi.framework.ServiceReference[] getServiceReferences(String clazz, String filter) throws org.osgi.framework.InvalidSyntaxException
getServiceReferences
in interface org.osgi.framework.BundleContext
org.osgi.framework.InvalidSyntaxException
public org.osgi.framework.ServiceReference[] getAllServiceReferences(String clazz, String filter) throws org.osgi.framework.InvalidSyntaxException
getAllServiceReferences
in interface org.osgi.framework.BundleContext
org.osgi.framework.InvalidSyntaxException
public org.osgi.framework.Filter createFilter(String filter) throws org.osgi.framework.InvalidSyntaxException
createFilter
in interface org.osgi.framework.BundleContext
org.osgi.framework.InvalidSyntaxException
public Object getService(org.osgi.framework.ServiceReference reference)
getService
in interface org.osgi.framework.BundleContext
public boolean ungetService(org.osgi.framework.ServiceReference reference)
ungetService
in interface org.osgi.framework.BundleContext
public File getDataFile(String filename)
getDataFile
in interface org.osgi.framework.BundleContext
public void setBundle(org.osgi.framework.Bundle bundle)
public void setBundle(int i, org.osgi.framework.Bundle bundle)
public boolean isServiceRegistered(String serviceName, Class<?> implementationClass)
public boolean isServiceRegistered(String serviceName, Class<?> implementationClass, Dictionary<String,?> props)
public Collection<com.redhat.thermostat.testutils.StubBundleContext.ServiceInformation> getAllServices()
public Collection<org.osgi.framework.ServiceListener> getServiceListeners()
public void removeService(com.redhat.thermostat.testutils.StubBundleContext.ServiceInformation info)
public int getExportedServiceCount(org.osgi.framework.ServiceRegistration registration)
Copyright © 2013. All rights reserved.