Package com.adobe.cq.testing.client
Class JsonClient
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.JsonClient
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.http.client.HttpClient
The base client for all json related tests. It provides a core set of commonly used json
functions e.g. pages / versions / references...
It extends from
It extends from
CQClient
which in turn provides a core set of
commonly used website and page functionality.-
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
ConstructorDescriptionJsonClient
(URI serverUrl, String user, String password) JsonClient
(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config) -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.JsonNode
getLanguages
(String sitePath, boolean deep) Get list of available languages for a page.com.fasterxml.jackson.databind.JsonNode
getMoveReferences
(String pagePath, int... expectedStatus) Queries the list of page references for a given page, as it is used to display in the move dialog.com.fasterxml.jackson.databind.JsonNode
getPageReferences
(String[] pagePaths) Get all references used and its status in a given page
In case path is not valid, an empty pages array will be returnedcom.fasterxml.jackson.databind.JsonNode
Get children for a given page.com.fasterxml.jackson.databind.JsonNode
getUserGeneratedPages
(String ugcBasePath, int limit, int start, String predicate, String view) Get user generated pages in theuser generated content
(ucg) space, currently under/content/usergenerated
.com.fasterxml.jackson.databind.JsonNode
getVersions
(String pagePath, boolean showChildren, int... expectedStatus) Get versions for a given pagecom.fasterxml.jackson.databind.JsonNode
getVersionTree
(String pagePath, String node, Date date, int... expectedStatus) Get version tree for a given page.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
-
JsonClient
public JsonClient(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
-
JsonClient
public JsonClient(URI serverUrl, String user, String password) throws org.apache.sling.testing.clients.ClientException - Throws:
org.apache.sling.testing.clients.ClientException
-
-
Method Details
-
getPages
public com.fasterxml.jackson.databind.JsonNode getPages(String parentPath) throws org.apache.sling.testing.clients.ClientException Get children for a given page.- Parameters:
parentPath
- parent page to get children from- Returns:
- the root
JsonNode
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
getPageReferences
public com.fasterxml.jackson.databind.JsonNode getPageReferences(String[] pagePaths) throws org.apache.sling.testing.clients.ClientException Get all references used and its status in a given page
In case path is not valid, an empty pages array will be returned- Parameters:
pagePaths
- the page path to get the references for- Returns:
- the root
JsonNode
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
getMoveReferences
public com.fasterxml.jackson.databind.JsonNode getMoveReferences(String pagePath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Queries the list of page references for a given page, as it is used to display in the move dialog.- Parameters:
pagePath
- the page path to get the references forexpectedStatus
- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- the root
JsonNode
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
getLanguages
public com.fasterxml.jackson.databind.JsonNode getLanguages(String sitePath, boolean deep) throws org.apache.sling.testing.clients.ClientException Get list of available languages for a page.
In case path is not valid, an empty rows array will be returned- Parameters:
sitePath
- the page path to get the languages fordeep
- true if languages' subpages should be part of json- Returns:
- the root
JsonNode
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
getVersions
public com.fasterxml.jackson.databind.JsonNode getVersions(String pagePath, boolean showChildren, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Get versions for a given page- Parameters:
pagePath
- the page path to get the versions forshowChildren
- true if versions of the children should be includedexpectedStatus
- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- the root
JsonNode
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
getVersionTree
public com.fasterxml.jackson.databind.JsonNode getVersionTree(String pagePath, String node, Date date, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Get version tree for a given page.- Parameters:
pagePath
- the page path to get the version tree fornode
- the relative path to nodedate
- the date which versions should be shown e.g. 2010-01-01T12:00:00+01:00expectedStatus
- list of expected http status codes- Returns:
- the root
JsonNode
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
getUserGeneratedPages
public com.fasterxml.jackson.databind.JsonNode getUserGeneratedPages(String ugcBasePath, int limit, int start, String predicate, String view) throws org.apache.sling.testing.clients.ClientException Get user generated pages in theuser generated content
(ucg) space, currently under/content/usergenerated
.
In case path is not valid, an empty pages array will be returned- Parameters:
ugcBasePath
- The base path to start listinglimit
- limits the number of nodes below ugcBasePath to be returnedstart
- defines the start node below ugcBasePathpredicate
- Predicate used to filter hierarchy nodes in the siteadmin e.g. siteadmin (nt:hierarchy- node, not hidden, no fileview
- filter: dependent from module- Returns:
- a
JsonNode
mapping to the requested content node. - Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-