Class AbstractInstance
- java.lang.Object
-
- org.apache.sling.testing.junit.rules.instance.AbstractInstance
-
- All Implemented Interfaces:
BuilderCustomizer
,Instance
,org.junit.rules.TestRule
- Direct Known Subclasses:
ExistingInstance
public abstract class AbstractInstance extends Object implements Instance
-
-
Constructor Summary
Constructors Constructor Description AbstractInstance()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends org.apache.sling.testing.clients.SlingClient.InternalBuilder>
Tcustomize(T builder)
Customizes the builder and returns it.org.apache.sling.testing.clients.SlingClient
getAdminClient()
Return a new client pointing to the instance corresponding to this {{AbstractInstance}}, with the admin user and password, if it was not previously created, or the existing client if it has been created before SeeInstanceSetup.INSTANCE_CONFIG_ADMINUSER
andInstanceSetup.INSTANCE_CONFIG_ADMINPASSWORD
<T extends org.apache.sling.testing.clients.SlingClient>
TgetAdminClient(Class<T> clientClass)
Return a new client pointing to the instance corresponding to this {{AbstractInstance}}, with the admin user and password, if it was not previously created, or the existing client if it has been created before SeeInstanceSetup.INSTANCE_CONFIG_ADMINUSER
andInstanceSetup.INSTANCE_CONFIG_ADMINPASSWORD
protected <B extends org.apache.sling.testing.clients.SlingClient.InternalBuilder,T extends org.apache.sling.testing.clients.SlingClient>
BgetBuilder(Class<T> clientClass, URI url, String user, String password)
<T extends org.apache.sling.testing.clients.SlingClient>
TgetClient(Class<T> clientClass, String user, String pass)
Return a new client pointing to the instance corresponding to this {{AbstractInstance}} if it was never created with this username and password, or the existing client if it has been created beforeorg.apache.sling.testing.clients.SlingClient
newAdminClient(BuilderCustomizer... customizers)
Return a new client pointing to the instance corresponding to this {{AbstractInstance}}, replacing the internally-cached client with this username and password SeeInstanceSetup.INSTANCE_CONFIG_ADMINUSER
andInstanceSetup.INSTANCE_CONFIG_ADMINPASSWORD
<T extends org.apache.sling.testing.clients.SlingClient>
TnewClient(Class<T> clientClass, String user, String pass, BuilderCustomizer... customizers)
Return a new client pointing to the instance corresponding to this {{AbstractInstance}}, replacing the internally-cached client with this username and password-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sling.testing.junit.rules.instance.Instance
getConfiguration, orDefault, withRunMode
-
-
-
-
Method Detail
-
customize
public <T extends org.apache.sling.testing.clients.SlingClient.InternalBuilder> T customize(T builder)
Customizes the builder and returns it. Default implementation does nothing to the builder. This should be overridden in subclasses, if needed. This method will be called internally before building a client.- Specified by:
customize
in interfaceBuilderCustomizer
- Parameters:
builder
- the builder to customize- Returns:
- the builder after customization.
-
newClient
public <T extends org.apache.sling.testing.clients.SlingClient> T newClient(Class<T> clientClass, String user, String pass, BuilderCustomizer... customizers)
Return a new client pointing to the instance corresponding to this {{AbstractInstance}}, replacing the internally-cached client with this username and password- Specified by:
newClient
in interfaceInstance
- Type Parameters:
T
- the type of the returned client- Parameters:
clientClass
- the class of the returned clientuser
- the username used in the clientpass
- the password used in the clientcustomizers
- array of customizers for this client- Returns:
- a new client extending {{SlingClient}}
-
getBuilder
protected <B extends org.apache.sling.testing.clients.SlingClient.InternalBuilder,T extends org.apache.sling.testing.clients.SlingClient> B getBuilder(Class<T> clientClass, URI url, String user, String password)
-
newAdminClient
public org.apache.sling.testing.clients.SlingClient newAdminClient(BuilderCustomizer... customizers)
Return a new client pointing to the instance corresponding to this {{AbstractInstance}}, replacing the internally-cached client with this username and password SeeInstanceSetup.INSTANCE_CONFIG_ADMINUSER
andInstanceSetup.INSTANCE_CONFIG_ADMINPASSWORD
- Specified by:
newAdminClient
in interfaceInstance
- Parameters:
customizers
- array of customizers for this client- Returns:
- a new {{SlingClient}}
-
getClient
public <T extends org.apache.sling.testing.clients.SlingClient> T getClient(Class<T> clientClass, String user, String pass)
Return a new client pointing to the instance corresponding to this {{AbstractInstance}} if it was never created with this username and password, or the existing client if it has been created before
-
getAdminClient
public org.apache.sling.testing.clients.SlingClient getAdminClient()
Return a new client pointing to the instance corresponding to this {{AbstractInstance}}, with the admin user and password, if it was not previously created, or the existing client if it has been created before SeeInstanceSetup.INSTANCE_CONFIG_ADMINUSER
andInstanceSetup.INSTANCE_CONFIG_ADMINPASSWORD
- Specified by:
getAdminClient
in interfaceInstance
- Returns:
- a new {{SlingClient}}
-
getAdminClient
public <T extends org.apache.sling.testing.clients.SlingClient> T getAdminClient(Class<T> clientClass)
Return a new client pointing to the instance corresponding to this {{AbstractInstance}}, with the admin user and password, if it was not previously created, or the existing client if it has been created before SeeInstanceSetup.INSTANCE_CONFIG_ADMINUSER
andInstanceSetup.INSTANCE_CONFIG_ADMINPASSWORD
- Specified by:
getAdminClient
in interfaceInstance
- Type Parameters:
T
- the class of the returned client- Parameters:
clientClass
- the class of the returned client- Returns:
- a new client extending on {{SlingClient}}
-
-