Class BundleInstaller

java.lang.Object
org.osgi.test.common.install.BundleInstaller

public class BundleInstaller extends Object
  • 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 CloseableBundleContext bundles 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

      public org.osgi.framework.Bundle installBundle(String pathToEmbeddedJar)
      Install and start a bundle embedded within the current bundle.

      Uses Bundle.findEntries(String, String, boolean) by splitting the pathToEmbeddedJar argument on the last backslash (/). The recurse argument is set to false.

      When implemented against CloseableBundleContext bundles 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

      public org.osgi.framework.Bundle installBundle(String pathToEmbeddedJar, boolean startBundle)
      Install a bundle embedded within the current bundle.

      Uses Bundle.findEntries(String, String, boolean) by splitting the pathToEmbeddedJar argument on the last backslash (/). The recurse argument is set to false.

      When implemented against CloseableBundleContext bundles 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

      public org.osgi.framework.Bundle installBundle(URL url, boolean startBundle)
      Install a bundle from a given URL.

      When implemented against CloseableBundleContext bundles 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