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
public class NotificationClient extends CQClient
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 fromCQClient
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 Modifier and Type Field Description static String
NOTIFICATION_ACTION_ACTIVATE
static String
NOTIFICATION_ACTION_DEACTIVATE
static String
NOTIFICATION_ACTION_DELETE
static String
NOTIFICATION_ACTION_PAGE_CREATED
static String
NOTIFICATION_ACTION_PAGE_DELETED
static String
NOTIFICATION_ACTION_PAGE_MODIFIED
static String
NOTIFICATION_ACTION_PAGE_ROLLED_OUT
static String
NOTIFICATION_CHANNEL_EMAIL
static String
NOTIFICATION_CHANNEL_INBOX
static String
NOTIFICATION_CONFIG_PATH
static String
NOTIFICATION_INBOX_PATH
static String
NOTIFICATION_MESSAGES_PATH
static String
NOTIFICATIONS_SUBSCRIPTIONS_PATH
-
Fields inherited from class com.adobe.cq.testing.client.CQClient
LOG, STATISTICS_ROOT, wcmCommands
-
-
Constructor Summary
Constructors Constructor Description NotificationClient(URI serverUrl, String user, String password)
NotificationClient(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.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
deleteAllNotifications()
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 messagesArrayList<String>
getAvailableNotificationAction()
Get the list of available action to be notified for.org.apache.sling.testing.clients.SlingHttpResponse
getNotificationInboxPage(int... expectedStatus)
Get the notification inbox html pageArrayList<Notification>
getNotificationMessages()
Get all the existing notification messages.ArrayList<Notification>
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
resetConfig()
Delete any existing subscription-
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
-
-
-
-
Field Detail
-
NOTIFICATION_INBOX_PATH
public static final String NOTIFICATION_INBOX_PATH
- See Also:
- Constant Field Values
-
NOTIFICATION_CHANNEL_INBOX
public static final String NOTIFICATION_CHANNEL_INBOX
- See Also:
- Constant Field Values
-
NOTIFICATION_CHANNEL_EMAIL
public static final String NOTIFICATION_CHANNEL_EMAIL
- See Also:
- Constant Field Values
-
NOTIFICATION_CONFIG_PATH
public static final String NOTIFICATION_CONFIG_PATH
- See Also:
- Constant Field Values
-
NOTIFICATIONS_SUBSCRIPTIONS_PATH
public static final String NOTIFICATIONS_SUBSCRIPTIONS_PATH
- See Also:
- Constant Field Values
-
NOTIFICATION_MESSAGES_PATH
public static final String NOTIFICATION_MESSAGES_PATH
- See Also:
- Constant Field Values
-
NOTIFICATION_ACTION_ACTIVATE
public static final String NOTIFICATION_ACTION_ACTIVATE
- See Also:
- Constant Field Values
-
NOTIFICATION_ACTION_DEACTIVATE
public static final String NOTIFICATION_ACTION_DEACTIVATE
- See Also:
- Constant Field Values
-
NOTIFICATION_ACTION_DELETE
public static final String NOTIFICATION_ACTION_DELETE
- See Also:
- Constant Field Values
-
NOTIFICATION_ACTION_PAGE_MODIFIED
public static final String NOTIFICATION_ACTION_PAGE_MODIFIED
- See Also:
- Constant Field Values
-
NOTIFICATION_ACTION_PAGE_CREATED
public static final String NOTIFICATION_ACTION_PAGE_CREATED
- See Also:
- Constant Field Values
-
NOTIFICATION_ACTION_PAGE_DELETED
public static final String NOTIFICATION_ACTION_PAGE_DELETED
- See Also:
- Constant Field Values
-
NOTIFICATION_ACTION_PAGE_ROLLED_OUT
public static final String NOTIFICATION_ACTION_PAGE_ROLLED_OUT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAvailableNotificationAction
public ArrayList<String> getAvailableNotificationAction() throws org.apache.sling.testing.clients.ClientException
Get 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.ClientException
Get 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.ClientException
Delete 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.ClientException
Delete 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
-
-