Class SlingTestBase

  • All Implemented Interfaces:
    SlingInstance

    public class SlingTestBase
    extends Object
    implements SlingInstance
    Base class for running tests against a Sling instance, takes care of starting Sling and waiting for it to be ready.
    • Constructor Detail

      • SlingTestBase

        public SlingTestBase()
      • SlingTestBase

        public SlingTestBase​(SlingInstanceState slingTestState,
                             Properties systemProperties)
        Get configuration but do not start server yet, that's done on demand
    • Method Detail

      • uninstallAdditionalBundlesIfNecessary

        public void uninstallAdditionalBundlesIfNecessary()
        Automatically by the SlingRemoteTestRunner since package version 1.1.0.
      • waitForQuietPeriod

        protected void waitForQuietPeriod()
                                   throws InterruptedException
        Wait for the configured duration as a quite period to let the server settle down after doing the startup and install additional bundles work.
        Throws:
        InterruptedException
      • installAdditionalBundles

        protected void installAdditionalBundles()
      • uninstallAdditionalBundles

        protected void uninstallAdditionalBundles()
      • getSlingClient

        public org.apache.sling.testing.clients.SlingClient getSlingClient()
        Description copied from interface: SlingInstance
        Returns a SlingClient for this server
        Specified by:
        getSlingClient in interface SlingInstance
      • getOsgiConsoleClient

        public org.apache.sling.testing.clients.osgi.OsgiConsoleClient getOsgiConsoleClient()
      • blockIfRequested

        protected void blockIfRequested()
        Optionally block here so that the runnable jar stays up - we can then run tests against it from another VM.
      • waitForServerReady

        protected void waitForServerReady()
                                   throws Exception
        Check a number of server URLs for readyness
        Throws:
        Exception
      • getBundlesToInstall

        protected List<File> getBundlesToInstall()
        Get the list of additional bundles to install, as specified by the system property ADDITONAL_BUNDLES_PATH
        Returns:
        the list of Files pointing to the Bundle JARs or the empty list in case no additional bundles should be installed (never null).
      • getBundlesToInstall

        protected List<File> getBundlesToInstall​(String additionalBundlesPath)
        Get the list of additional bundles to install, as specified by additionalBundlesPath parameter
      • isServerStartedByThisClass

        public boolean isServerStartedByThisClass()