Package com.adobe.cq.testing.client
Class NotificationClient
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.NotificationClient
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.http.client.HttpClient
The base client for all notifications related tests. It provides a core set of commonly used notification
functions e.g. list / approve / delete
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
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
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
ConstructorsConstructorDescriptionNotificationClient
(URI serverUrl, String user, String password) NotificationClient
(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.sling.testing.clients.SlingHttpResponse
approveNotification
(Notification notification, int... expectedStatus) Approve a notification message (mark it as read)org.apache.sling.testing.clients.SlingHttpResponse
configNotifications
(String channel, String[] actions, String packages, int... expectedStatus) Set a notification subscriptionvoid
Delete all the notification messagesorg.apache.sling.testing.clients.SlingHttpResponse
deleteNotification
(Notification notification, int... expectedStatus) Delete a notification messagevoid
deleteNotifications
(ArrayList<Notification> notifications, int... expectedStatus) Delete a list notification messagesGet the list of available action to be notified for.org.apache.sling.testing.clients.SlingHttpResponse
getNotificationInboxPage
(int... expectedStatus) Get the notification inbox html pageGet all the existing notification messages.getNotificationMessages
(int start, int limit) Get all the existing notification messages.org.apache.sling.testing.clients.SlingHttpResponse
performAction
(Notification notification, String action, int... expectedStatus) Do an action on a notification message (delete/approve)void
Delete any existing subscriptionMethods 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
-
Field Details
-
NOTIFICATION_INBOX_PATH
- See Also:
-
NOTIFICATION_CHANNEL_INBOX
- See Also:
-
NOTIFICATION_CHANNEL_EMAIL
- See Also:
-
NOTIFICATION_CONFIG_PATH
- See Also:
-
NOTIFICATIONS_SUBSCRIPTIONS_PATH
- See Also:
-
NOTIFICATION_MESSAGES_PATH
- See Also:
-
NOTIFICATION_ACTION_ACTIVATE
- See Also:
-
NOTIFICATION_ACTION_DEACTIVATE
- See Also:
-
NOTIFICATION_ACTION_DELETE
- See Also:
-
NOTIFICATION_ACTION_PAGE_MODIFIED
- See Also:
-
NOTIFICATION_ACTION_PAGE_CREATED
- See Also:
-
NOTIFICATION_ACTION_PAGE_DELETED
- See Also:
-
NOTIFICATION_ACTION_PAGE_ROLLED_OUT
- See Also:
-
-
Constructor Details
-
NotificationClient
public NotificationClient(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
-
NotificationClient
-
-
Method Details
-
getAvailableNotificationAction
public ArrayList<String> getAvailableNotificationAction() throws org.apache.sling.testing.clients.ClientExceptionGet the list of available action to be notified for. For now this list is hardcoded in a javascript library file which is loaded by the UI- Returns:
- The list of available actions. Null is none is found
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
getNotificationMessages
public ArrayList<Notification> getNotificationMessages() throws org.apache.sling.testing.clients.ClientExceptionGet all the existing notification messages.- Returns:
- List of the existing notification messages
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
getNotificationMessages
public ArrayList<Notification> getNotificationMessages(int start, int limit) throws org.apache.sling.testing.clients.ClientException Get all the existing notification messages.- Parameters:
start
- first notificationlimit
- max notifications- Returns:
- List of the existing notification messages
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
resetConfig
public void resetConfig() throws org.apache.sling.testing.clients.ClientExceptionDelete any existing subscription- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
configNotifications
public org.apache.sling.testing.clients.SlingHttpResponse configNotifications(String channel, String[] actions, String packages, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Set a notification subscription- Parameters:
channel
- The type of notification (for now only "inbox")actions
- The list of actions to be notified forpackages
- The paths to surveyexpectedStatus
- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- Response of the HTTP request
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
getNotificationInboxPage
public org.apache.sling.testing.clients.SlingHttpResponse getNotificationInboxPage(int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Get the notification inbox html page- Parameters:
expectedStatus
- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- Response of the HTTP request
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
approveNotification
public org.apache.sling.testing.clients.SlingHttpResponse approveNotification(Notification notification, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Approve a notification message (mark it as read)- Parameters:
notification
- The notification message to approveexpectedStatus
- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- Response of the HTTP request
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
deleteNotification
public org.apache.sling.testing.clients.SlingHttpResponse deleteNotification(Notification notification, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Delete a notification message- Parameters:
notification
- The notification message to deleteexpectedStatus
- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- Response of the HTTP request
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
deleteNotifications
public void deleteNotifications(ArrayList<Notification> notifications, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Delete a list notification messages- Parameters:
notifications
- The notification messages to deleteexpectedStatus
- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
deleteAllNotifications
public void deleteAllNotifications() throws org.apache.sling.testing.clients.ClientExceptionDelete all the notification messages- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
performAction
public org.apache.sling.testing.clients.SlingHttpResponse performAction(Notification notification, String action, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Do an action on a notification message (delete/approve)- Parameters:
notification
- The notification message to apply the action toaction
- Action to perform (for now delete/approve)expectedStatus
- list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.- Returns:
- Response of the HTTP request
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-