public class ReplicationClient extends CQClient
Modifier and Type | Class and Description |
---|---|
static class |
ReplicationClient.EmptyReplicationQueuePoller |
CQClient.Builder, CQClient.InternalBuilder<T extends CQClient>
Modifier and Type | Field and Description |
---|---|
static String |
AUTHOR_GROUP_PATH |
static String |
PUBLISH_REPLICATION_DEFAULT_AGENT |
static String |
PUBLISH_REVERSE_REPLICATION_DEFAULT_AGENT |
LOG, STATISTICS_ROOT, wcmCommands
Constructor and Description |
---|
ReplicationClient(org.apache.http.impl.client.CloseableHttpClient http,
org.apache.sling.testing.clients.SlingClientConfig config) |
ReplicationClient(URI serverUrl,
String user,
String password) |
Modifier and Type | Method and Description |
---|---|
org.apache.sling.testing.clients.SlingHttpResponse |
activate(String nodePath,
int... expectedStatus)
Activates (publish) a node.
|
org.apache.sling.testing.clients.SlingHttpResponse |
activateLater(String nodePath,
long timeMilliseconds,
int... expectedStatus)
Activates a page after a period of time.
|
org.codehaus.jackson.JsonNode |
adaptReplicationAgent(String agentPath,
org.apache.http.message.BasicNameValuePair... properties)
Adapts an existing agent's properties
|
org.codehaus.jackson.JsonNode |
createReplicationAgent(String name,
String title,
String parentPath,
String template,
org.apache.http.message.BasicNameValuePair... properties)
Creates a replication agent, if not already present
|
org.apache.sling.testing.clients.SlingHttpResponse |
deactivate(String pagePath,
int... expectedStatus)
Deactivates (un-publish) a node.
|
org.apache.sling.testing.clients.SlingHttpResponse |
deactivateLater(String nodePath,
long timeMilliseconds,
int... expectedStatus)
Deactivates a page after a period of time.
|
boolean |
findInLog(String agentLocation,
String[] patterns,
Date startTime)
Returns true if the specific at least one pattern was found in the log or
false otherwise.
|
org.codehaus.jackson.JsonNode |
getAgentReplicationQueue(String agentPath)
Returns the agent replication queue.
|
org.codehaus.jackson.JsonNode |
getPublishReplicationQueue()
Returns the default replication agent queue.
|
org.codehaus.jackson.JsonNode |
getReverseReplicationQueue()
Returns the reverse replication agent queue.
|
boolean |
isConnectionSuccessful(String agentLocation) |
void |
waitAgentReplicationQueueIsEmpty(String agentPath)
Waits until the queue of the requested agent is empty
|
void |
waitPublishReplicationQueueIsEmpty() |
void |
waitReversePublishReplicationQueueIsEmpty() |
copyLanguages, copyPage, createPage, createPageWithRetry, createVersion, deletePage, deletePageWithRetry, lockPage, movePage, movePage, resetPageStatistics, restoreTree, restoreVersion, rolloutPage, searchAndReplaceInPages, searchInPages, setPageProperties, setPageProperty, setPagePropertyImage, unlockPage, uploadAsset, uploadFileCQStyle
createFolder, createNode, createNodeRecursive, deletePath, doGetJson, exists, getJsonNode, getJsonNode, getNodeNameFromPath, getParentPath, getUUId, getUUID, importContent, importContent, importJson, move, setPropertiesString, setPropertyString, setPropertyStringArray, upload, waitExists, waitUntilExists
adaptTo, addValue, close, doDelete, doGet, doGet, doGet, doHead, doPatch, doPost, doPost, doPut, doRawRequest, doRequest, doStreamGet, doStreamPost, doStreamRequest, execute, execute, execute, execute, execute, execute, execute, execute, getClientId, getConnectionManager, getCookieStore, getCredentialsProvider, getParams, getPassword, getPath, getPath, getUrl, getUrl, getUrl, getUser, getValue, getValues, hasValue
public static final String AUTHOR_GROUP_PATH
public static final String PUBLISH_REPLICATION_DEFAULT_AGENT
public static final String PUBLISH_REVERSE_REPLICATION_DEFAULT_AGENT
public ReplicationClient(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config) throws org.apache.sling.testing.clients.ClientException
org.apache.sling.testing.clients.ClientException
public org.apache.sling.testing.clients.SlingHttpResponse activate(String nodePath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
nodePath
- path of the node to activateexpectedStatus
- list of expected HTTP status to be returned, if not set, 200 is assumed.org.apache.sling.testing.clients.ClientException
- if something fails during the request/response cyclepublic org.apache.sling.testing.clients.SlingHttpResponse deactivate(String pagePath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
pagePath
- path of the node to deactivateexpectedStatus
- list of expected HTTP status to be returned, if not set, 200 is assumed.org.apache.sling.testing.clients.ClientException
- if something fails during the request/response cyclepublic org.apache.sling.testing.clients.SlingHttpResponse activateLater(String nodePath, long timeMilliseconds, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
nodePath
- The path to the node which is activatedtimeMilliseconds
- The time interval, in milliseconds, from current timestamp, after which the node will be activatedexpectedStatus
- list of expected statusesorg.apache.sling.testing.clients.ClientException
- if the request failspublic org.apache.sling.testing.clients.SlingHttpResponse deactivateLater(String nodePath, long timeMilliseconds, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
nodePath
- The path to the node which is deactivatedtimeMilliseconds
- The time interval, in milliseconds, from current timestamp, after which the node will be deactivatedexpectedStatus
- list of expected statusesorg.apache.sling.testing.clients.ClientException
- if the request failspublic org.codehaus.jackson.JsonNode createReplicationAgent(String name, String title, String parentPath, String template, org.apache.http.message.BasicNameValuePair... properties) throws org.apache.sling.testing.clients.ClientException, InterruptedException
name
- name of the agenttitle
- title of the agent (page)parentPath
- where to create the agent. Typical paths for CQ are
/etc/replication/agents.author/
and /etc/replication/agents.publish/
template
- template of the agent. Typical value is /libs/cq/replication/templates/agent
properties
- list of properties to be set on the agentorg.apache.sling.testing.clients.ClientException
- if the request failsInterruptedException
- to mark this method as waitingpublic org.codehaus.jackson.JsonNode adaptReplicationAgent(String agentPath, org.apache.http.message.BasicNameValuePair... properties) throws org.apache.sling.testing.clients.ClientException, InterruptedException
agentPath
- the path of the agentproperties
- list of properties to be set on the agentorg.apache.sling.testing.clients.ClientException
- if the request failsInterruptedException
- to mark this method as waitingpublic org.codehaus.jackson.JsonNode getAgentReplicationQueue(String agentPath) throws org.apache.sling.testing.clients.ClientException, InterruptedException
agentPath
- The location in jcr where the agent is stored.org.apache.sling.testing.clients.ClientException
- if the request failsInterruptedException
- to mark this method as waitingpublic org.codehaus.jackson.JsonNode getPublishReplicationQueue() throws org.apache.sling.testing.clients.ClientException, InterruptedException
org.apache.sling.testing.clients.ClientException
- if the request failsInterruptedException
- to mark this method as waitingpublic org.codehaus.jackson.JsonNode getReverseReplicationQueue() throws org.apache.sling.testing.clients.ClientException, InterruptedException
org.apache.sling.testing.clients.ClientException
- if the request failsInterruptedException
- to mark this method as waitingpublic void waitAgentReplicationQueueIsEmpty(String agentPath) throws InterruptedException, org.apache.sling.testing.clients.ClientException
agentPath
- path to the agentorg.apache.sling.testing.clients.ClientException
- if the queue is not empty after the default timeout (2 min) expiresInterruptedException
- to mark this method as waitingpublic void waitPublishReplicationQueueIsEmpty() throws InterruptedException, org.apache.sling.testing.clients.ClientException
InterruptedException
org.apache.sling.testing.clients.ClientException
public void waitReversePublishReplicationQueueIsEmpty() throws InterruptedException, org.apache.sling.testing.clients.ClientException
InterruptedException
org.apache.sling.testing.clients.ClientException
public boolean isConnectionSuccessful(String agentLocation) throws org.apache.sling.testing.clients.ClientException
org.apache.sling.testing.clients.ClientException
public boolean findInLog(String agentLocation, String[] patterns, Date startTime) throws org.apache.sling.testing.clients.ClientException
agentLocation
- agent pathpatterns
- list of patternsstartTime
- start timeorg.apache.sling.testing.clients.ClientException
- if the request failsCopyright © 2018. All rights reserved.