Class BundlesInstaller


  • public class BundlesInstaller
    extends java.lang.Object
    Utility for installing and starting additional bundles for testing
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ACTIVE_STATE  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void installBundles​(java.util.List<java.io.File> toInstall, boolean startBundles)
      Install a list of bundles supplied as Files
      boolean isInstalled​(java.io.File bundleFile)
      Checks if a bundle is installed or not.
      boolean isInstalledWithSameVersion​(java.io.File bundleFile)
      Check if the installed version matches the one of the bundle (file)
      void startAllBundles​(java.util.List<java.lang.String> symbolicNames, int timeout)
      Start all the bundles in a {{List}}
      void uninstallBundles​(java.util.List<java.io.File> toUninstall)
      Uninstall a list of bundles supplied as Files
      void waitBundlesInstalled​(java.util.List<java.lang.String> symbolicNames, long timeout)
      Wait for multiple bundles to be installed in the OSGi web console.
      boolean waitForBundlesInstalled​(java.util.List<java.lang.String> symbolicNames, int timeoutSeconds)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isInstalled

        public boolean isInstalled​(java.io.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​(java.io.File bundleFile)
                                           throws ClientException,
                                                  java.io.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
        java.io.IOException - if the file version cannot be read
      • installBundles

        public void installBundles​(java.util.List<java.io.File> toInstall,
                                   boolean startBundles)
                            throws ClientException,
                                   java.io.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
        java.io.IOException - if reading the file fails
      • uninstallBundles

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

        @Deprecated
        public boolean waitForBundlesInstalled​(java.util.List<java.lang.String> symbolicNames,
                                               int timeoutSeconds)
                                        throws ClientException,
                                               java.lang.InterruptedException
        Wait for all bundles specified in symbolicNames list to be installed in the OSGi web console.
        Parameters:
        symbolicNames - the list of names for the bundles
        timeoutSeconds - how many seconds to wait
        Returns:
        true if all the bundles were installed
        Throws:
        ClientException - if something went wrong
        java.lang.InterruptedException - if interrupted
      • waitBundlesInstalled

        public void waitBundlesInstalled​(java.util.List<java.lang.String> symbolicNames,
                                         long timeout)
                                  throws java.lang.InterruptedException,
                                         java.util.concurrent.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:
        java.util.concurrent.TimeoutException - if the timeout was reached before all the bundles were installed
        java.lang.InterruptedException - to mark this operation as "waiting", callers should rethrow it
      • startAllBundles

        public void startAllBundles​(java.util.List<java.lang.String> symbolicNames,
                                    int timeout)
                             throws java.lang.InterruptedException,
                                    java.util.concurrent.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:
        java.util.concurrent.TimeoutException - if the timeout is reached before all the bundles are started
        java.lang.InterruptedException - to mark this operation as "waiting", callers should rethrow it