Class CommunityClient
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.CommunityClient
- 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, wcmCommandsFields inherited from class org.apache.sling.testing.clients.SlingClient
CLIENT_CONNECTION_TIMEOUT_PROP, DEFAULT_NODE_TYPE, SUDO_COOKIE_NAME -
Constructor Summary
ConstructorsConstructorDescriptionCommunityClient(URI serverUrl, String user, String password) CommunityClient(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.sling.testing.clients.SlingHttpResponseaddCommentsComponent(String pagePath, int... expectedStatus) Adds a Comment component to a page.org.apache.sling.testing.clients.SlingHttpResponseconfigureCommentComponent(String commentPath, String defaultMessage, boolean isModerated, boolean allowReplies, boolean displayAsTree, boolean closed, int... expectedStatus) Configures the Comment component.com.fasterxml.jackson.databind.JsonNodecreateComment(String commentPath, String comment, String user, String url, String email, int... expectedStatus) Adds a single comment to a Comments component.org.apache.sling.testing.clients.SlingHttpResponsedeleteComment(String commentPath, int... expectedStatus) Delete commentorg.apache.sling.testing.clients.SlingHttpResponseeditComment(String command, String commentPath, int... expectedStatus) Edit the comment: approve | deny | markCommentAsSpam | deleteCommentcom.fasterxml.jackson.databind.JsonNodegetComments(String ugcBasePath, int limit, int start, String predicate, String view) List all comments in theuser generated contentspace, currently under/content/usergenerated.org.apache.sling.testing.clients.SlingHttpResponsemarkCommentAsSpam(String commentPath, boolean isSpam, int... expectedStatus) Mark comment as spamorg.apache.sling.testing.clients.SlingHttpResponsemoderateComment(String commentPath, boolean approve, int... expectedStatus) Moderate comment: approve \ denyMethods 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, uploadFileCQStyleMethods 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, waitUntilExistsMethods 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
-
CommunityClient
public CommunityClient(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
-
CommunityClient
-
-
Method Details
-
addCommentsComponent
public org.apache.sling.testing.clients.SlingHttpResponse addCommentsComponent(String pagePath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Adds a Comment component to a page.- Parameters:
pagePath- path to the page where the comment component will be created.expectedStatus- list of allowed HTTP Status to be returned. If not set, http status 201 (CREATED) is assumed.- Returns:
- Sling response
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
configureCommentComponent
public org.apache.sling.testing.clients.SlingHttpResponse configureCommentComponent(String commentPath, String defaultMessage, boolean isModerated, boolean allowReplies, boolean displayAsTree, boolean closed, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Configures the Comment component.- Parameters:
commentPath- path to the comment componentdefaultMessage- the topic for the commentsisModerated- true if comments are moderatedallowReplies- true if replies are alloweddisplayAsTree- true if the comments are displayed as treeclosed- true if topic is closed (no posting of comments possible anymore)expectedStatus- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- Sling response
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
moderateComment
public org.apache.sling.testing.clients.SlingHttpResponse moderateComment(String commentPath, boolean approve, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Moderate comment: approve \ deny- Parameters:
commentPath- the path to the commentapprove- true if comment should be approved, false if comment should be deniedexpectedStatus- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- Sling response
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
markCommentAsSpam
public org.apache.sling.testing.clients.SlingHttpResponse markCommentAsSpam(String commentPath, boolean isSpam, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Mark comment as spam- Parameters:
commentPath- the path to the commentisSpam- true if comment should be marked as spam, false if notexpectedStatus- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- Sling response
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
editComment
public org.apache.sling.testing.clients.SlingHttpResponse editComment(String command, String commentPath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Edit the comment: approve | deny | markCommentAsSpam | deleteComment- Parameters:
command- available commands: approve | deny | markCommentAsSpam | deleteCommentcommentPath- the path to the commentexpectedStatus- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- Sling response
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
createComment
public com.fasterxml.jackson.databind.JsonNode createComment(String commentPath, String comment, String user, String url, String email, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Adds a single comment to a Comments component.- Parameters:
commentPath- path to the comment componentcomment- the comment textuser- the user writing the commenturl- the users urlemail- the users emailexpectedStatus- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- a
JsonNodemapping to the requested content node. - Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
getComments
public com.fasterxml.jackson.databind.JsonNode getComments(String ugcBasePath, int limit, int start, String predicate, String view) throws org.apache.sling.testing.clients.ClientException List all comments in theuser generated contentspace, currently under/content/usergenerated.- 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. siteadminview- filter: null | approved | denied | spam | notspam- Returns:
- a
JsonNodemapping to the requested content node. - Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
deleteComment
public org.apache.sling.testing.clients.SlingHttpResponse deleteComment(String commentPath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Delete comment- Parameters:
commentPath- The page where the comments areexpectedStatus- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- Sling response
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-