Package com.adobe.cq.testing.client
Class TopologyClient
- java.lang.Object
-
- org.apache.sling.testing.clients.AbstractSlingClient
-
- org.apache.sling.testing.clients.SlingClient
-
- com.adobe.cq.testing.client.CQClient
-
- com.adobe.cq.testing.client.TopologyClient
-
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.http.client.HttpClient
public class TopologyClient extends CQClient
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adobe.cq.testing.client.CQClient
CQClient.Builder, CQClient.InternalBuilder<T extends CQClient>
-
-
Field Summary
Fields Modifier and Type Field Description static StringCLUSTER_VIEW_PATHstatic StringCONNECTOR_URLS_PATHstatic StringDEFAULT_CONNECTOR_PATHstatic StringQE_SLINGSETTINGS_SERVLET_PATHstatic StringQE_TOPOLOGY_SERVLET_PATHstatic StringUTF_8-
Fields inherited from class com.adobe.cq.testing.client.CQClient
STATISTICS_ROOT, wcmCommands
-
-
Constructor Summary
Constructors Constructor Description TopologyClient(URI serverUrl, String user, String password)TopologyClient(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>getConnectorUrls()Get the set of connector URLs configured for the discovery serviceSet<String>getConnectorUrlsWithWait(long timeout)Get the set of connector URLs configured for the discovery service.StringgetSlingId()booleanjoinTopology(String baseUrl)Join a topology by adding the connector url to the discovery configurationbooleanjoinTopology(String baseUrl, String connectorPath)Join a topology by adding the connector url to the discovery configurationbooleanjoinTopologyWithWait(String baseUrl, long timeout)Join a topology by adding the connector url to the discovery configuration.booleanjoinTopologyWithWait(String baseUrl, String connectorPath, long timeout)Join a topology by adding the connector url to the discovery configuration.booleanleaveTopology(String baseUrl)Leave a topology by removing a connector URL from the discovery configurationbooleanleaveTopology(String baseUrl, String connectorPath)Leave a topology by removing a connector URL from the discovery configurationbooleanleaveTopologyWithWait(String baseUrl, long timeout)Leave a topology by removing a connector URL from the discovery configuration This method waits and retries until the topology is currentbooleanleaveTopologyWithWait(String baseUrl, String connectorPath, long timeout)Leave a topology by removing a connector URL from the discovery configuration This method waits and retries until the topology is currentvoidsetConnectorUrls(Set<String> connectorUrlsList)Write the discovery service configuration with a set of connector URLsvoidsetConnectorUrlsWithWait(Set<String> connectorUrlsList, long timeout)Write the discovery service configuration with a set of connector URLs The method retries until the configuration was saved and the topology is current-
Methods inherited from class com.adobe.cq.testing.client.CQClient
copyLanguages, copyPage, createPage, createPageWithRetry, createVersion, deletePage, deletePageWithRetry, getAuthorSitesPage, lockPage, movePage, movePage, pageExists, pageExistsWithRetry, pageExistsWithRetry, resetPageStatistics, restoreTree, restoreVersion, rolloutPage, searchAndReplaceInPages, searchInPages, setPageProperties, setPageProperty, setPagePropertyImage, unlockPage, uploadFileCQStyle
-
Methods inherited from class org.apache.sling.testing.clients.SlingClient
createFolder, createNode, createNodeRecursive, deletePath, doGetJson, endImpersonation, exists, getJsonNode, getJsonNode, getNodeNameFromPath, getParentPath, getUser, getUUId, getUUID, impersonate, importContent, importContent, importJson, move, setPropertiesString, setPropertyString, setPropertyStringArray, upload, waitExists, waitUntilExists
-
Methods inherited from class org.apache.sling.testing.clients.AbstractSlingClient
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, getValue, getValues, hasValue
-
-
-
-
Field Detail
-
DEFAULT_CONNECTOR_PATH
public static final String DEFAULT_CONNECTOR_PATH
- See Also:
- Constant Field Values
-
QE_TOPOLOGY_SERVLET_PATH
public static final String QE_TOPOLOGY_SERVLET_PATH
- See Also:
- Constant Field Values
-
CONNECTOR_URLS_PATH
public static final String CONNECTOR_URLS_PATH
- See Also:
- Constant Field Values
-
CLUSTER_VIEW_PATH
public static final String CLUSTER_VIEW_PATH
- See Also:
- Constant Field Values
-
UTF_8
public static final String UTF_8
- See Also:
- Constant Field Values
-
QE_SLINGSETTINGS_SERVLET_PATH
public static final String QE_SLINGSETTINGS_SERVLET_PATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
joinTopology
public boolean joinTopology(String baseUrl) throws org.apache.sling.testing.clients.ClientException
Join a topology by adding the connector url to the discovery configuration- Parameters:
baseUrl- The base url of the instance about to be joined; uses theDEFAULT_CONNECTOR_PATHto build the full connector URL- Returns:
- true if the topology was joined, false otherwise
- Throws:
org.apache.sling.testing.clients.ClientException- if the request failed
-
joinTopology
public boolean joinTopology(String baseUrl, String connectorPath) throws org.apache.sling.testing.clients.ClientException
Join a topology by adding the connector url to the discovery configuration- Parameters:
baseUrl- The full connector URL to be added to the discovery configurationconnectorPath- path to the connector- Returns:
- true if the topology was joined, false otherwise
- Throws:
org.apache.sling.testing.clients.ClientException- if the request failed
-
joinTopologyWithWait
public boolean joinTopologyWithWait(String baseUrl, String connectorPath, long timeout) throws org.apache.sling.testing.clients.ClientException, InterruptedException
Join a topology by adding the connector url to the discovery configuration. This method waits and retries until the topology is current- Parameters:
baseUrl- base urlconnectorPath- connector pathtimeout- time (in milliseconds) to wait before throwing an exception- Returns:
- true
- Throws:
org.apache.sling.testing.clients.ClientException- if the topology could not be joinedInterruptedException- if interrupted while waiting for the server
-
joinTopologyWithWait
public boolean joinTopologyWithWait(String baseUrl, long timeout) throws org.apache.sling.testing.clients.ClientException, InterruptedException
Join a topology by adding the connector url to the discovery configuration. This method waits and retries until the topology is current- Parameters:
baseUrl- base urltimeout- time (in milliseconds) to wait before throwing an exception- Returns:
- true
- Throws:
org.apache.sling.testing.clients.ClientException- if the topology could not be joinedInterruptedException- if interrupted while waiting for the server
-
leaveTopology
public boolean leaveTopology(String baseUrl) throws org.apache.sling.testing.clients.ClientException
Leave a topology by removing a connector URL from the discovery configuration- Parameters:
baseUrl- the base URL of the instance about to be left; uses theDEFAULT_CONNECTOR_PATHto build the full connector URL- Returns:
- true if topology was left, false otherwise
- Throws:
org.apache.sling.testing.clients.ClientException- in case of error
-
leaveTopology
public boolean leaveTopology(String baseUrl, String connectorPath) throws org.apache.sling.testing.clients.ClientException
Leave a topology by removing a connector URL from the discovery configuration- Parameters:
baseUrl- the full connector URL to be removedconnectorPath- path to the connector- Returns:
- true if topology was left, false otherwise
- Throws:
org.apache.sling.testing.clients.ClientException- if the request failed
-
leaveTopologyWithWait
public boolean leaveTopologyWithWait(String baseUrl, String connectorPath, long timeout) throws org.apache.sling.testing.clients.ClientException, InterruptedException
Leave a topology by removing a connector URL from the discovery configuration This method waits and retries until the topology is current- Parameters:
baseUrl- base urlconnectorPath- connector pathtimeout- time (in milliseconds) to wait before throwing an exception- Returns:
- true
- Throws:
org.apache.sling.testing.clients.ClientException- if it could not leave the topologyInterruptedException- if interrupted while waiting for the server
-
leaveTopologyWithWait
public boolean leaveTopologyWithWait(String baseUrl, long timeout) throws org.apache.sling.testing.clients.ClientException, InterruptedException
Leave a topology by removing a connector URL from the discovery configuration This method waits and retries until the topology is current- Parameters:
baseUrl- base urltimeout- time (in milliseconds) to wait before throwing an exception- Returns:
- true
- Throws:
org.apache.sling.testing.clients.ClientException- if it could not leave the topologyInterruptedException- if interrupted while waiting for the server
-
getConnectorUrls
public Set<String> getConnectorUrls() throws org.apache.sling.testing.clients.ClientException
Get the set of connector URLs configured for the discovery service- Returns:
- the set of URLs
- Throws:
org.apache.sling.testing.clients.ClientException- if the request failed
-
getConnectorUrlsWithWait
public Set<String> getConnectorUrlsWithWait(long timeout) throws org.apache.sling.testing.clients.ClientException, InterruptedException
Get the set of connector URLs configured for the discovery service. The method retries to get the list until the configuration is saved and the topology is current- Parameters:
timeout- time to wait (in milliseconds) before giving up- Returns:
- set of connector URLs
- Throws:
org.apache.sling.testing.clients.ClientException- if the topology could not be joinedInterruptedException- if interrupted while waiting for the server
-
setConnectorUrls
public void setConnectorUrls(Set<String> connectorUrlsList) throws org.apache.sling.testing.clients.ClientException
Write the discovery service configuration with a set of connector URLs- Parameters:
connectorUrlsList- the set of connector URLs to be written- Throws:
org.apache.sling.testing.clients.ClientException- if the request failed
-
setConnectorUrlsWithWait
public void setConnectorUrlsWithWait(Set<String> connectorUrlsList, long timeout) throws org.apache.sling.testing.clients.ClientException, InterruptedException
Write the discovery service configuration with a set of connector URLs The method retries until the configuration was saved and the topology is current- Parameters:
connectorUrlsList- list of connector urlstimeout- time (in milliseconds) to wait before throwing an exception- Throws:
org.apache.sling.testing.clients.ClientException- if the request failedInterruptedException- to mark this method as "waiting"
-
getSlingId
public String getSlingId() throws org.apache.sling.testing.clients.ClientException
- Returns:
- The Sling ID of this instance
- Throws:
org.apache.sling.testing.clients.ClientException- if call to instance fails
-
-