Package com.adobe.cq.testing.client
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
-
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 inherited from class com.adobe.cq.testing.client.CQClient
LOG, 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
ConstructorDescriptionVersioningClient
(URI serverUrl, String user, String password) VersioningClient
(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.sling.testing.clients.SlingHttpResponse
createAssetVersion
(String assetLocation, String versionLabel, String versionComment, int... expectedStatus) Creates a new snapshot for the specific asset.com.fasterxml.jackson.databind.JsonNode
getAssetVersions
(String assetLocation) Returns the json node that contains all asset versions.com.fasterxml.jackson.databind.JsonNode
getChildrenPageVersions
(String parentPageLocation, int... expectedStatus) Returns a json node with all existent versions for the children pages.com.fasterxml.jackson.databind.JsonNode
getPageVersions
(String pageLocation, int... expectedStatus) Returns an json node with all existent page versions.org.apache.sling.testing.clients.SlingHttpResponse
getPageWithTimeWrap
(String pageLocation, long date, int... expectedStatus) Returns a page from a specific date.com.fasterxml.jackson.databind.JsonNode
getTreeVersions
(String path, Date date, boolean preserverNVP, String node, int... expectedStatus) Returns an json node with all existent versions of a given tree.long
getVersionCreationDate
(com.fasterxml.jackson.databind.JsonNode version) Returns the version creation date.org.apache.sling.testing.clients.SlingHttpResponse
restoreAssetVersion
(String assetLocation, String versionId, int... expectedStatus) Restores the specific version.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
-
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 failsInterruptedException
- 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 rootdate
- calendar date to restore topreserverNVP
- if true non versionable nodes are preservednode
- path to look for inside the tree rootexpectedStatus
- 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 pageexpectedStatus
- 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
-