Class MockBundle
- java.lang.Object
-
- org.apache.sling.testing.mock.osgi.MockBundle
-
- All Implemented Interfaces:
Comparable<org.osgi.framework.Bundle>,org.osgi.framework.Bundle
public final class MockBundle extends Object implements org.osgi.framework.Bundle
MockBundleimplementation.
-
-
Constructor Summary
Constructors Constructor Description MockBundle(org.osgi.framework.BundleContext bundleContext)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <A> Aadapt(Class<A> type)intcompareTo(org.osgi.framework.Bundle o)Enumeration<URL>findEntries(String path, String filePattern, boolean recurse)org.osgi.framework.BundleContextgetBundleContext()longgetBundleId()FilegetDataFile(String filename)URLgetEntry(String name)Enumeration<String>getEntryPaths(String path)Dictionary<String,String>getHeaders()Dictionary<String,String>getHeaders(String locale)longgetLastModified()StringgetLocation()org.osgi.framework.ServiceReference<?>[]getRegisteredServices()URLgetResource(String name)Enumeration<URL>getResources(String name)org.osgi.framework.ServiceReference<?>[]getServicesInUse()Map<X509Certificate,List<X509Certificate>>getSignerCertificates(int signersType)intgetState()StringgetSymbolicName()org.osgi.framework.VersiongetVersion()booleanhasPermission(Object permission)Class<?>loadClass(String name)voidsetHeaders(Map<String,String> value)Set headers for mock bundlevoidsetLastModified(long lastModified)Set the last modified value for the mock bundlevoidsetSymbolicName(String value)Set symbolic name for mock bundlevoidstart()voidstart(int options)voidstop()voidstop(int options)voiduninstall()voidupdate()voidupdate(InputStream inputStream)
-
-
-
Method Detail
-
getBundleId
public long getBundleId()
- Specified by:
getBundleIdin interfaceorg.osgi.framework.Bundle
-
getBundleContext
public org.osgi.framework.BundleContext getBundleContext()
- Specified by:
getBundleContextin interfaceorg.osgi.framework.Bundle
-
getEntry
public URL getEntry(String name)
- Specified by:
getEntryin interfaceorg.osgi.framework.Bundle
-
getState
public int getState()
- Specified by:
getStatein interfaceorg.osgi.framework.Bundle
-
getHeaders
public Dictionary<String,String> getHeaders()
- Specified by:
getHeadersin interfaceorg.osgi.framework.Bundle
-
getHeaders
public Dictionary<String,String> getHeaders(String locale)
- Specified by:
getHeadersin interfaceorg.osgi.framework.Bundle
-
setHeaders
public void setHeaders(Map<String,String> value)
Set headers for mock bundle- Parameters:
value- Header map
-
getSymbolicName
public String getSymbolicName()
- Specified by:
getSymbolicNamein interfaceorg.osgi.framework.Bundle
-
setSymbolicName
public void setSymbolicName(String value)
Set symbolic name for mock bundle- Parameters:
value- Symbolic name
-
getLastModified
public long getLastModified()
- Specified by:
getLastModifiedin interfaceorg.osgi.framework.Bundle
-
setLastModified
public void setLastModified(long lastModified)
Set the last modified value for the mock bundle- Parameters:
lastModified- last modified
-
getEntryPaths
public Enumeration<String> getEntryPaths(String path)
- Specified by:
getEntryPathsin interfaceorg.osgi.framework.Bundle
-
getLocation
public String getLocation()
- Specified by:
getLocationin interfaceorg.osgi.framework.Bundle
-
findEntries
public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse)
- Specified by:
findEntriesin interfaceorg.osgi.framework.Bundle
-
getRegisteredServices
public org.osgi.framework.ServiceReference<?>[] getRegisteredServices()
- Specified by:
getRegisteredServicesin interfaceorg.osgi.framework.Bundle
-
getResource
public URL getResource(String name)
- Specified by:
getResourcein interfaceorg.osgi.framework.Bundle
-
getResources
public Enumeration<URL> getResources(String name)
- Specified by:
getResourcesin interfaceorg.osgi.framework.Bundle
-
getServicesInUse
public org.osgi.framework.ServiceReference<?>[] getServicesInUse()
- Specified by:
getServicesInUsein interfaceorg.osgi.framework.Bundle
-
hasPermission
public boolean hasPermission(Object permission)
- Specified by:
hasPermissionin interfaceorg.osgi.framework.Bundle
-
loadClass
public Class<?> loadClass(String name)
- Specified by:
loadClassin interfaceorg.osgi.framework.Bundle
-
start
public void start()
- Specified by:
startin interfaceorg.osgi.framework.Bundle
-
stop
public void stop()
- Specified by:
stopin interfaceorg.osgi.framework.Bundle
-
uninstall
public void uninstall()
- Specified by:
uninstallin interfaceorg.osgi.framework.Bundle
-
update
public void update()
- Specified by:
updatein interfaceorg.osgi.framework.Bundle
-
update
public void update(InputStream inputStream)
- Specified by:
updatein interfaceorg.osgi.framework.Bundle
-
start
public void start(int options)
- Specified by:
startin interfaceorg.osgi.framework.Bundle
-
stop
public void stop(int options)
- Specified by:
stopin interfaceorg.osgi.framework.Bundle
-
getSignerCertificates
public Map<X509Certificate,List<X509Certificate>> getSignerCertificates(int signersType)
- Specified by:
getSignerCertificatesin interfaceorg.osgi.framework.Bundle
-
getVersion
public org.osgi.framework.Version getVersion()
- Specified by:
getVersionin interfaceorg.osgi.framework.Bundle
-
compareTo
public int compareTo(org.osgi.framework.Bundle o)
- Specified by:
compareToin interfaceComparable<org.osgi.framework.Bundle>
-
adapt
public <A> A adapt(Class<A> type)
- Specified by:
adaptin interfaceorg.osgi.framework.Bundle
-
-