public abstract class TeleporterRule
extends org.junit.rules.ExternalResource
Modifier and Type | Class and Description |
---|---|
static interface |
TeleporterRule.Customizer
Customizer is used client-side to setup the server URL and other parameters
|
Modifier and Type | Field and Description |
---|---|
protected Class<?> |
classUnderTest |
static String |
CLIENT_CLASS
Name of the implementation class to use when running on the client side
|
static String |
CUSTOMIZER_PATTERN
Class name pattern for Customizers
|
protected List<String> |
embeddedResourcePaths |
Modifier | Constructor and Description |
---|---|
protected |
TeleporterRule()
Meant to be instantiated via
forClass(java.lang.Class<?>) |
Modifier and Type | Method and Description |
---|---|
protected static <T> T |
createInstance(Class<T> objectClass,
String className) |
protected void |
customize()
Use a Customizer, if one was defined, to customize this Rule
|
static TeleporterRule |
forClass(Class<?> classUnderTest)
Build a TeleporterRule for the given class, with no client setup options.
|
static TeleporterRule |
forClass(Class<?> classUnderTest,
String clientSetupOptions)
Build a TeleporterRule for the given class, with optional clientSetupOptions.
|
<T> T |
getService(Class<T> serviceClass)
If running on the server side, get an OSGi service
|
<T> T |
getService(Class<T> serviceClass,
String ldapFilter)
If running on the server side, get an OSGi service specified by an LDAP service filter
|
static boolean |
isServerSide()
True if running on the server-side.
|
protected void |
setClassUnderTest(Class<?> c) |
TeleporterRule |
withResources(String... paths)
Tell the concrete teleporter to embed resources, based on their path, in the test bundle.
|
protected Class<?> classUnderTest
public static final String CLIENT_CLASS
public static final String CUSTOMIZER_PATTERN
protected TeleporterRule()
forClass(java.lang.Class<?>)
protected void setClassUnderTest(Class<?> c)
public static boolean isServerSide()
true
if running server-side, false
otherwisepublic static TeleporterRule forClass(Class<?> classUnderTest)
classUnderTest
- the class under testpublic static TeleporterRule forClass(Class<?> classUnderTest, String clientSetupOptions)
classUnderTest
- the class under testclientSetupOptions
- If supplied, the part of that string before the first colon is used as the class name of a Customizer (or
shorthand for that if it contains no dots). The rest of the string is then passed to the Customizer so that
it can be used to define options (which server to run the test on, etc)protected void customize()
public final <T> T getService(Class<T> serviceClass)
T
- the service typeserviceClass
- the classnull
public <T> T getService(Class<T> serviceClass, String ldapFilter)
T
- the service typeserviceClass
- the classldapFilter
- a filter to select the servicenull
public TeleporterRule withResources(String... paths)
paths
- 0..N resource paths to add to the current rule. A path that ends with a / causes all resources found under it to be
recursively embedded as well.Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.