Class BundlesInstaller


  • public class BundlesInstaller
    extends Object
    Utility for installing and starting additional bundles for testing
    • Method Detail

      • isInstalled

        public boolean isInstalled​(File bundleFile)
                            throws ClientException
        Checks if a bundle is installed or not. Does not retry.
        Parameters:
        bundleFile - bundle file
        Returns:
        true if the bundle is installed
        Throws:
        ClientException - if the state of the bundle could not be determined
      • isInstalledWithSameVersion

        public boolean isInstalledWithSameVersion​(File bundleFile)
                                           throws ClientException,
                                                  IOException
        Check if the installed version matches the one of the bundle (file)
        Parameters:
        bundleFile - bundle file
        Returns:
        true if the bundle is installed and has the same version
        Throws:
        ClientException - if the installed version cannot be retrieved
        IOException - if the file version cannot be read
      • installBundles

        public void installBundles​(List<File> toInstall,
                                   boolean startBundles)
                            throws ClientException,
                                   IOException
        Install a list of bundles supplied as Files
        Parameters:
        toInstall - list ob bundles to install
        startBundles - whether to start the bundles
        Throws:
        ClientException - if an error occurs during installation
        IOException - if reading the file fails
      • uninstallBundles

        public void uninstallBundles​(List<File> toUninstall)
                              throws ClientException,
                                     IOException
        Uninstall a list of bundles supplied as Files
        Parameters:
        toUninstall - bundles to uninstall
        Throws:
        ClientException - if one of the requests failed
        IOException - if the files cannot be read from disk
      • waitBundlesInstalled

        public void waitBundlesInstalled​(List<String> symbolicNames,
                                         long timeout)
                                  throws InterruptedException,
                                         TimeoutException
        Wait for multiple bundles to be installed in the OSGi web console.
        Parameters:
        symbolicNames - the list bundles to be checked
        timeout - max total time to wait for all bundles, in ms, before throwing TimeoutException
        Throws:
        TimeoutException - if the timeout was reached before all the bundles were installed
        InterruptedException - to mark this operation as "waiting", callers should rethrow it
      • startAllBundles

        public void startAllBundles​(List<String> symbolicNames,
                                    int timeout)
                             throws InterruptedException,
                                    TimeoutException
        Start all the bundles in a {{List}}
        Parameters:
        symbolicNames - the list of bundles to start
        timeout - total max time to wait for all the bundles, in ms
        Throws:
        TimeoutException - if the timeout is reached before all the bundles are started
        InterruptedException - to mark this operation as "waiting", callers should rethrow it