Class BundleInstaller
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEmbeddedLocation describes a Location of a File inside a Bundle. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.osgi.framework.BundleContextorg.osgi.framework.BundleinstallBundle(String pathToEmbeddedJar) Install and start a bundle embedded within the current bundle.org.osgi.framework.BundleinstallBundle(String pathToEmbeddedJar, boolean startBundle) Install a bundle embedded within the current bundle.org.osgi.framework.BundleinstallBundle(URL url, boolean startBundle) Install a bundle from a given URL.org.osgi.framework.BundleinstallBundle(BundleInstaller.EmbeddedLocation location, boolean startBundle) Install a bundle from a given EmbeddedLocation.
-
Constructor Details
-
BundleInstaller
public BundleInstaller(org.osgi.framework.BundleContext bundleContext)
-
-
Method Details
-
getBundleContext
public org.osgi.framework.BundleContext getBundleContext()- Returns:
- The bundle context that this instance is attached to.
-
installBundle
public org.osgi.framework.Bundle installBundle(BundleInstaller.EmbeddedLocation location, boolean startBundle) Install a bundle from a given EmbeddedLocation.When implemented against
CloseableBundleContextbundles installed in this fashion are uninstalled automatically at the end of the test method.- Parameters:
location- of the jar resource.startBundle- if true, start the bundle- Returns:
- installed bundle
- Throws:
AssertionError- if no bundle is found
-
installBundle
Install and start a bundle embedded within the current bundle.Uses
Bundle.findEntries(String, String, boolean)by splitting thepathToEmbeddedJarargument on the last backslash (/). Therecurseargument is set to false.When implemented against
CloseableBundleContextbundles installed in this fashion are uninstalled automatically at the end of the test method.- Parameters:
pathToEmbeddedJar- The entry path to the jar resource.- Returns:
- installed and started bundle
- Throws:
AssertionError- if no bundle is found
-
installBundle
Install a bundle embedded within the current bundle.Uses
Bundle.findEntries(String, String, boolean)by splitting thepathToEmbeddedJarargument on the last backslash (/). Therecurseargument is set to false.When implemented against
CloseableBundleContextbundles installed in this fashion are uninstalled automatically at the end of the test method.- Parameters:
pathToEmbeddedJar- The entry path to the jar resource.startBundle- if true, start the bundle- Returns:
- installed bundle
- Throws:
AssertionError- if no bundle is found
-
installBundle
Install a bundle from a given URL.When implemented against
CloseableBundleContextbundles installed in this fashion are uninstalled automatically at the end of the test method.- Parameters:
url- to the jar resource.startBundle- if true, start the bundle- Returns:
- installed bundle
- Throws:
AssertionError- if no bundle is found
-