Class VersioningClient

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.VersioningClient
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.http.client.HttpClient

public class VersioningClient extends CQClient
  • Constructor Details

    • VersioningClient

      public VersioningClient(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
    • VersioningClient

      public VersioningClient(URI serverUrl, String user, String password) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
  • Method Details

    • getAssetVersions

      public com.fasterxml.jackson.databind.JsonNode getAssetVersions(String assetLocation) throws org.apache.sling.testing.clients.ClientException, InterruptedException
      Returns the json node that contains all asset versions.
      Parameters:
      assetLocation - Location in repository where the asset is stored.
      Returns:
      An array of all versions specific for this asset.
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request fails
      InterruptedException - to mark this method as waiting
    • createAssetVersion

      public org.apache.sling.testing.clients.SlingHttpResponse createAssetVersion(String assetLocation, String versionLabel, String versionComment, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Creates a new snapshot for the specific asset.
      Parameters:
      assetLocation - Location in repository where the asset is stored.
      versionLabel - The snapshot label.
      versionComment - The snapshot specific comment.
      expectedStatus - list of expected status list of expected status
      Returns:
      the response
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request fails
    • restoreAssetVersion

      public org.apache.sling.testing.clients.SlingHttpResponse restoreAssetVersion(String assetLocation, String versionId, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Restores the specific version.
      Parameters:
      assetLocation - Location in repository where the asset is stored.
      versionId - The version's unique id.
      expectedStatus - list of expected status
      Returns:
      the response
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request fails
    • getPageVersions

      public com.fasterxml.jackson.databind.JsonNode getPageVersions(String pageLocation, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Returns an json node with all existent page versions.
      Parameters:
      pageLocation - Location in repository where the page is stored.
      expectedStatus - list of expected status
      Returns:
      the response
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request fails
    • getTreeVersions

      public com.fasterxml.jackson.databind.JsonNode getTreeVersions(String path, Date date, boolean preserverNVP, String node, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Returns an json node with all existent versions of a given tree.
      Parameters:
      path - Path of the tree root
      date - calendar date to restore to
      preserverNVP - if true non versionable nodes are preserved
      node - path to look for inside the tree root
      expectedStatus - list of expected status
      Returns:
      the response
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request fails
    • getChildrenPageVersions

      public com.fasterxml.jackson.databind.JsonNode getChildrenPageVersions(String parentPageLocation, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Returns a json node with all existent versions for the children pages.
      Parameters:
      parentPageLocation - parent page
      expectedStatus - list of expected http status codes
      Returns:
      the versions as json node
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request fails
    • getVersionCreationDate

      public long getVersionCreationDate(com.fasterxml.jackson.databind.JsonNode version) throws ParseException
      Returns the version creation date.
      Parameters:
      version - The Json node for the specific version.
      Returns:
      Version creation date.
      Throws:
      ParseException - if the date is not valid
    • getPageWithTimeWrap

      public org.apache.sling.testing.clients.SlingHttpResponse getPageWithTimeWrap(String pageLocation, long date, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Returns a page from a specific date.
      Parameters:
      pageLocation - The path to the requested page.
      date - The date (in miliseconds) for the requested page.
      expectedStatus - list of expected http status codes
      Returns:
      The page from the specific date.
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request fails