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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.adobe.cq.testing.client.CQClient
CQClient.Builder, CQClient.InternalBuilder<T extends CQClient>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class com.adobe.cq.testing.client.CQClient
STATISTICS_ROOT, wcmCommands
Fields inherited from class org.apache.sling.testing.clients.SlingClient
CLIENT_CONNECTION_TIMEOUT_PROP, DEFAULT_NODE_TYPE, SUDO_COOKIE_NAME
-
Constructor Summary
ConstructorDescriptionTopologyClient
(URI serverUrl, String user, String password) TopologyClient
(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config) -
Method Summary
Modifier and TypeMethodDescriptionGet the set of connector URLs configured for the discovery servicegetConnectorUrlsWithWait
(long timeout) Get the set of connector URLs configured for the discovery service.boolean
joinTopology
(String baseUrl) Join a topology by adding the connector url to the discovery configurationboolean
joinTopology
(String baseUrl, String connectorPath) Join a topology by adding the connector url to the discovery configurationboolean
joinTopologyWithWait
(String baseUrl, long timeout) Join a topology by adding the connector url to the discovery configuration.boolean
joinTopologyWithWait
(String baseUrl, String connectorPath, long timeout) Join a topology by adding the connector url to the discovery configuration.boolean
leaveTopology
(String baseUrl) Leave a topology by removing a connector URL from the discovery configurationboolean
leaveTopology
(String baseUrl, String connectorPath) Leave a topology by removing a connector URL from the discovery configurationboolean
leaveTopologyWithWait
(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 currentboolean
leaveTopologyWithWait
(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 currentvoid
setConnectorUrls
(Set<String> connectorUrlsList) Write the discovery service configuration with a set of connector URLsvoid
setConnectorUrlsWithWait
(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 currentMethods 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 Details
-
DEFAULT_CONNECTOR_PATH
- See Also:
-
QE_TOPOLOGY_SERVLET_PATH
- See Also:
-
CONNECTOR_URLS_PATH
- See Also:
-
CLUSTER_VIEW_PATH
- See Also:
-
UTF_8
- See Also:
-
QE_SLINGSETTINGS_SERVLET_PATH
- See Also:
-
-
Constructor Details
-
TopologyClient
public TopologyClient(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config) throws org.apache.sling.testing.clients.ClientException - Throws:
org.apache.sling.testing.clients.ClientException
-
TopologyClient
public TopologyClient(URI serverUrl, String user, String password) throws org.apache.sling.testing.clients.ClientException - Throws:
org.apache.sling.testing.clients.ClientException
-
-
Method Details
-
joinTopology
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_PATH
to 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_PATH
to 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
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
- Returns:
- The Sling ID of this instance
- Throws:
org.apache.sling.testing.clients.ClientException
- if call to instance fails
-