Class ClientSideTeleporter
java.lang.Object
org.junit.rules.ExternalResource
org.apache.sling.junit.rules.TeleporterRule
org.apache.sling.testing.teleporter.client.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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sling.junit.rules.TeleporterRule
org.apache.sling.junit.rules.TeleporterRule.Customizer
-
Field Summary
FieldsFields inherited from class org.apache.sling.junit.rules.TeleporterRule
classUnderTest, CLIENT_CLASS, CUSTOMIZER_PATTERN, embeddedResourcePaths
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdditionalBundleHeader
(String name, String value) Set additional bundle headers on the generated test bundleorg.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description) embedClass
(Class<?> c) Indicate that a specific class must be embedded in the test bundle.void
embedClassesDirectory
(File classesDirectory) Embeds every class found in the given directoryexcludeDependencyPrefix
(String prefix) Define a prefix for class names that should not be embedded in the test bundle.int
Get HTTP connect and read timeouts, defaults to the "test ready timeout" valueincludeDependencyPrefix
(String prefix) Define a prefix for class names that can be embedded in the test bundle if theDependencyAnalyzer
thinks they should.void
setBaseUrl
(String url) protected void
setClassUnderTest
(Class<?> c) void
setDirectoryForPersistingTestBundles
(File directoryForPersistingTestBundles) void
setEnableLogging
(boolean enableLogging) void
setHttpTimeoutSeconds
(int tm) Set HTTP connect and read timeouts, defaults to the "test ready timeout" valuevoid
setPreventToUninstallBundle
(boolean preventToUninstallTestBundle) void
setServerCredentials
(String username, String password) Set the credentials to use to install our test bundle on the servervoid
setTestReadyTimeoutSeconds
(int tm) Define how long to wait for our test to be ready on the server-side, after installing the test bundlevoid
setTestServletPath
(String testServletPath) void
setWaitForServiceTimoutSeconds
(int tm) Define how long to wait to get a service reference.void
setWebConsoleReadyTimeoutSeconds
(int tm) Define how long to wait for the webconsole to be ready, before installing the test bundleMethods inherited from class org.apache.sling.junit.rules.TeleporterRule
createInstance, customize, forClass, forClass, getService, getService, isServerSide, withResources
Methods inherited from class org.junit.rules.ExternalResource
after, before
-
Field Details
-
DEFAULT_TEST_READY_TIMEOUT_SECONDS
public static final int DEFAULT_TEST_READY_TIMEOUT_SECONDS- See Also:
-
DEFAULT_TEST_SERVLET_PATH
- See Also:
-
-
Constructor Details
-
ClientSideTeleporter
public ClientSideTeleporter()
-
-
Method Details
-
setBaseUrl
-
setClassUnderTest
- Overrides:
setClassUnderTest
in classorg.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 theTeleporterRule.getService(Class)
orTeleporterRule.getService(Class, String)
methods. -
setServerCredentials
Set the credentials to use to install our test bundle on the server -
setTestServletPath
- Parameters:
testServletPath
- relative path to the Sling JUnit test servlet. If null, defaults to DEFAULT_TEST_SERVLET_PATH.
-
includeDependencyPrefix
Define a prefix for class names that can be embedded in the test bundle if theDependencyAnalyzer
thinks they should. Overridden byexcludeDependencyPrefix(java.lang.String)
if any conflicts arise. -
excludeDependencyPrefix
Define a prefix for class names that should not be embedded in the test bundle. Takes precedence overincludeDependencyPrefix(java.lang.String)
. -
embedClass
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
Set additional bundle headers on the generated test bundle -
getAdditionalBundleHeaders
-
setEnableLogging
public void setEnableLogging(boolean enableLogging) -
setPreventToUninstallBundle
public void setPreventToUninstallBundle(boolean preventToUninstallTestBundle) -
setDirectoryForPersistingTestBundles
-
embedClassesDirectory
Embeds every class found in the given directory- Throws:
IOException
ClassNotFoundException
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Specified by:
apply
in interfaceorg.junit.rules.TestRule
- Overrides:
apply
in classorg.junit.rules.ExternalResource
-