Package com.adobe.cq.testing.junit.rules
Class EmptyPage
- java.lang.Object
-
- org.junit.rules.ExternalResource
-
- com.adobe.cq.testing.junit.rules.EmptyPage
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class EmptyPage extends org.junit.rules.ExternalResource
Create a new page. This rule can be sub-classed to specify the parent page of the newly created page. Subclasses can also specify which client to use or which server to target when a new page is created.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
after()
protected void
before()
protected CQClient
getClient()
The client to use to create and delete this page.String
getName()
The node name of this page.String
getParentPath()
The path of the parent of this page.String
getPath()
The absolute path of this page.String
getTitle()
The title of this page.protected String
initialName()
The initial page name to be used when creating the page This implementation returns "testpage_[randomUUID]" You can override this with dynamic names for each threadprotected String
initialParentPath()
The initial parent path to be used when creating the page This implementation returns "/content" You can override this with dynamic names for each threads
-
-
-
Constructor Detail
-
EmptyPage
public EmptyPage(Supplier<org.apache.sling.testing.clients.SlingClient> clientSupplier)
- Parameters:
clientSupplier
- {code}Supplier{code} that returns an http client pointing to a remote test instance
-
-
Method Detail
-
before
protected void before() throws org.apache.sling.testing.clients.ClientException, InterruptedException
- Overrides:
before
in classorg.junit.rules.ExternalResource
- Throws:
org.apache.sling.testing.clients.ClientException
InterruptedException
-
after
protected void after()
- Overrides:
after
in classorg.junit.rules.ExternalResource
-
initialParentPath
protected String initialParentPath()
The initial parent path to be used when creating the page This implementation returns "/content" You can override this with dynamic names for each threads- Returns:
- the parent path used to create the page
-
initialName
protected String initialName()
The initial page name to be used when creating the page This implementation returns "testpage_[randomUUID]" You can override this with dynamic names for each thread- Returns:
- the page name used to create the page
-
getClient
protected CQClient getClient() throws org.apache.sling.testing.clients.ClientException
The client to use to create and delete this page. The default implementation creates aCQClient
. The default implementation also uses the default admin user.- Returns:
- The client to use to create and delete this page.
- Throws:
org.apache.sling.testing.clients.ClientException
- if the client cannot be retrieved
-
getTitle
public String getTitle()
The title of this page. The default implementation returns the value"Test Page"
.- Returns:
- The title of this page.
-
getName
public String getName()
The node name of this page. The default implementation returns the value ofinitialName()
.- Returns:
- The node name of this page.
-
getParentPath
public String getParentPath()
The path of the parent of this page. The default implementation returns the valueinitialParentPath()
- Returns:
- The parent path of this page. The path must be absolute and must not end with a slash.
-
getPath
public final String getPath()
The absolute path of this page.- Returns:
- The absolute path of the page.
-
-