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
  • Field Details

  • 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

      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 the DEFAULT_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 configuration
      connectorPath - 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 url
      connectorPath - connector path
      timeout - time (in milliseconds) to wait before throwing an exception
      Returns:
      true
      Throws:
      org.apache.sling.testing.clients.ClientException - if the topology could not be joined
      InterruptedException - 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 url
      timeout - time (in milliseconds) to wait before throwing an exception
      Returns:
      true
      Throws:
      org.apache.sling.testing.clients.ClientException - if the topology could not be joined
      InterruptedException - 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 the DEFAULT_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 removed
      connectorPath - 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 url
      connectorPath - connector path
      timeout - time (in milliseconds) to wait before throwing an exception
      Returns:
      true
      Throws:
      org.apache.sling.testing.clients.ClientException - if it could not leave the topology
      InterruptedException - 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 url
      timeout - time (in milliseconds) to wait before throwing an exception
      Returns:
      true
      Throws:
      org.apache.sling.testing.clients.ClientException - if it could not leave the topology
      InterruptedException - 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 joined
      InterruptedException - 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 urls
      timeout - time (in milliseconds) to wait before throwing an exception
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request failed
      InterruptedException - 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