Class ClientSideTeleporter

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    public class ClientSideTeleporter
    extends org.apache.sling.junit.rules.TeleporterRule
    Client-side TeleporterRule. Packages the test to run in a test bundle, installs the bundle, executes the test via the JUnit servlet, collects the results and uninstalls the bundle.
    • Constructor Detail

      • ClientSideTeleporter

        public ClientSideTeleporter()
    • Method Detail

      • setBaseUrl

        public void setBaseUrl​(String url)
      • setClassUnderTest

        protected void setClassUnderTest​(Class<?> c)
        Overrides:
        setClassUnderTest in class org.apache.sling.junit.rules.TeleporterRule
      • setTestReadyTimeoutSeconds

        public void setTestReadyTimeoutSeconds​(int tm)
        Define how long to wait for our test to be ready on the server-side, after installing the test bundle
      • setWebConsoleReadyTimeoutSeconds

        public void setWebConsoleReadyTimeoutSeconds​(int tm)
        Define how long to wait for the webconsole to be ready, before installing the test bundle
      • setHttpTimeoutSeconds

        public void setHttpTimeoutSeconds​(int tm)
        Set HTTP connect and read timeouts, defaults to the "test ready timeout" value
      • getHttpTimeoutSeconds

        public int getHttpTimeoutSeconds()
        Get HTTP connect and read timeouts, defaults to the "test ready timeout" value
      • setWaitForServiceTimoutSeconds

        public void setWaitForServiceTimoutSeconds​(int tm)
        Define how long to wait to get a service reference. This applies only on the server-side when using the TeleporterRule.getService(Class) or TeleporterRule.getService(Class, String) methods.
      • setServerCredentials

        public void setServerCredentials​(String username,
                                         String password)
        Set the credentials to use to install our test bundle on the server
      • setTestServletPath

        public void setTestServletPath​(String testServletPath)
        Parameters:
        testServletPath - relative path to the Sling JUnit test servlet. If null, defaults to DEFAULT_TEST_SERVLET_PATH.
      • embedClass

        public ClientSideTeleporter embedClass​(Class<?> c)
        Indicate that a specific class must be embedded in the test bundle. In theory our DependencyAnalyzer should find which classes need to be embedded, but if that does not work this method can be used as a workaround.
      • addAdditionalBundleHeader

        public void addAdditionalBundleHeader​(String name,
                                              String value)
        Set additional bundle headers on the generated test bundle
      • getAdditionalBundleHeaders

        public Map<String,​String> getAdditionalBundleHeaders()
      • setEnableLogging

        public void setEnableLogging​(boolean enableLogging)
      • setPreventToUninstallBundle

        public void setPreventToUninstallBundle​(boolean preventToUninstallTestBundle)
      • setDirectoryForPersistingTestBundles

        public void setDirectoryForPersistingTestBundles​(File directoryForPersistingTestBundles)
      • apply

        public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base,
                                                       org.junit.runner.Description description)
        Specified by:
        apply in interface org.junit.rules.TestRule
        Overrides:
        apply in class org.junit.rules.ExternalResource