Package com.adobe.cq.testing.client
Class WorkflowClient
- 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.WorkflowClient
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.http.client.HttpClient
- Direct Known Subclasses:
CQWorkflowClient
public class WorkflowClient extends CQClient
Implements the Workflow REST API calls
ModelID = handle to the model Node
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WorkflowClient.Status
Enumeration of the different Workflow Statuses-
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
MANAGE_WF_ENGINE_PATH
Request Path to manage workflow enginestatic String
MANAGE_WF_INBOX_PATH
Request Path to manage users workflow inboxstatic String
MANAGE_WF_INSTANCES_PATH
Request Path to manage workflow instancesstatic String
MANAGE_WF_MODELS_PATH
Request Path to manage workflow modelsstatic String
MODEL_DESCR_TYPE_JSON
Defines what type of model definition gets passed, currently only JSON format is implementedstatic String
MODEL_LIST_TYPE_ID
Type of model list to return, model id = model node handlestatic String
MODEL_LIST_TYPE_URI
Type of models list to return, uri = root context + model idstatic String
PAYLOAD_TYPE_JCR
Type of payload referencing used when starting a workflow, in this case a JCR Pathstatic String
PAYLOAD_TYPE_URL
Type of payload referencing used when starting a workflow, in this case a URL Path-
Fields inherited from class com.adobe.cq.testing.client.CQClient
LOG, STATISTICS_ROOT, wcmCommands
-
-
Constructor Summary
Constructors Constructor Description WorkflowClient(URI serverUrl, String user, String password)
WorkflowClient(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.sling.testing.clients.SlingHttpResponse
abortWorkflow(String instanceId, int... expectedStatus)
Aborts/Terminates a running workflow instance.org.apache.sling.testing.clients.SlingHttpResponse
advanceWorkItem(String workItemId, String routeId, int... expectedStatus)
Advances a workflow item trough the next step.org.apache.sling.testing.clients.SlingHttpResponse
approveAndAdvanceWorkItem(WorkItem workItem, String routeId, int... expectedStatus)
Approves a workflow item and advanced to another node.org.apache.sling.testing.clients.SlingHttpResponse
approveComment(String workItemId, String routeId, int... expectedStatus)
List<org.apache.sling.testing.clients.SlingHttpResponse>
chooseRouteAndAdvance(String workflowInstancePath, int chooseRoute)
Choose the route and advance with itorg.apache.sling.testing.clients.SlingHttpResponse
delegateWorkItem(String workItemId, String delegatee, int... expectedStatus)
Delegates a workflow item to an other user Handled by: granite\bundles\workflow\console\src\main\java\com\adobe\granite \workflow\console\servlet\InboxServlet.javaorg.apache.sling.testing.clients.SlingHttpResponse
deleteModel(String modelId, int... expectedStatus)
Deletes a workflow model definition.String
deployModel(String modelSourcePath, String modelType, int... expectedStatus)
Creates a new workflow model in the repository by sending a model definition.
Handled by:
granite\bundles\workflow\console\src\main\java\com\adobe\granite\workflow \console\servlet\ModelsServlet.javaString
deployModel(String modelSourcePath, String modelType, List<org.apache.http.NameValuePair> replaces, int... expectedStatus)
same asdeployModel(String, String, int...)
, but with a list of strings to replace in the modelMap<String,InboxItem>
getInboxItems(int... expectedStatus)
Returns the list of work item that are currently in the inbox of this client's user.WorkflowEngine
getWorkflowEngineInfo(int... expectedStatus)
Gets the workflow engine info from "/etc/workflow".
Handled by:
granite\bundles\workflow\content\src\main\content\jcr_root \libs\cq\workflow\components\engine\json.jspWorkflowInstance
getWorkflowInstance(String instanceURI, int... expectedStatus)
Returns all the information about a workflow instance in JSON format.List<HistoryItem>
getWorkflowInstanceHistory(String instanceURI, int... expectedStatus)
Retrieve the workflow history of a specific workflow instanceList<WorkflowInstance>
getWorkflowInstances()
List<WorkflowInstance>
getWorkflowInstances(WorkflowClient.Status wfStatus)
List<WorkflowInstance>
getWorkflowInstances(WorkflowClient.Status wfStatus, String model, String payload, org.joda.time.DateTime startTimeLimit, org.joda.time.DateTime endTimeLimit)
List<WorkflowInstance>
getWorkflowInstances(WorkflowClient.Status wfStatus, org.joda.time.DateTime startTimeLimit, org.joda.time.DateTime endTimeLimit)
List<URI>
getWorkflowInstanceURLs(WorkflowClient.Status wfStatus, int... expectedStatus)
Returns a list of workflow instance URI's that are visible for the user.WorkflowModel
getWorkflowModel(String modelId, String version, int... expectedStatus)
Returns the model definition (metadata, nodes, transitions,title ,description etc) in a wrapper class.String
getWorkflowModelAsJSON(String modelId, String version, int... expectedStatus)
Returns the model definition (metadata, nodes, transitions,title ,description etc) handled by: \granite\bundles\workflow\console\src\main\java\com\adobe\granite \workflow\console\servlet\ModelServlet.javaArrayList<String>
getWorkflowModels(String listType, int... expectedStatus)
Returns a list of all available workflow models for this user.List<String>
getWorkItemBackRouteIds(String uri, int... expectedStatus)
WorkItem
getWorkItemByURI(String uri, int... expectedStatus)
Returns all available information about a work item.boolean
isWorkflowEngineActive()
Checks if the workflow engine is in an active state (actually its the workflow OSGi service that gets tested).static Date
parseJSONDate(String date)
Turns a string date returned by JSON into a Date object.org.apache.sling.testing.clients.SlingHttpResponse
setWorkflowInstanceStatus(String instanceURI, WorkflowClient.Status status, int... expectedStatus)
Set the status of an running workflow instance.String
startWorkflow(String modelId, String payload, int... expectedStatus)
Convenience function for the most common case , using JCR path to reference the payload.String
startWorkflow(String modelId, String payloadType, String payload, Map<String,String> metaData, String title, String comment, int... expectedStatus)
Starts a new workflow using the given model id, with the payload specified.org.apache.sling.testing.clients.SlingHttpResponse
startWorkflowEngine(int... expectedStatus)
Starts the Workflow Engine, equals to starting the Workflow service.org.apache.sling.testing.clients.SlingHttpResponse
stepBackWorkItem(String workItemId, String backrouteId, int... expectedStatus)
Advances a workflow item back to a previous step.org.apache.sling.testing.clients.SlingHttpResponse
stopWorkflowEngine(int... expectedStatus)
Stops the Workflow Engine, equals to stopping the Workflow service.org.apache.sling.testing.clients.SlingHttpResponse
updateModel(String modelSourcePath, String modelType, String modelId, int... expectedStatus)
updates an existing workflow model in the repository by sending a updated model definition.
Handled by:
granite\bundles\workflow\console\src\main\java\com\adobe\granite\workflow \console\servlet\ModelServlet.javaorg.apache.sling.testing.clients.SlingHttpResponse
updateWfInstanceComment(String instanceURI, String comment, int... expectedStatus)
Convenience functions to update/set the comment in the workflow instance metadata.org.apache.sling.testing.clients.SlingHttpResponse
updateWfInstanceMetaData(String instanceURI, Map<String,String> metaData, int... expectedStatus)
Sends an update request to a workflow instance to update/add metadataorg.apache.sling.testing.clients.SlingHttpResponse
updateWfInstanceTitle(String instanceURI, String title, int... expectedStatus)
Convenience function to set edit/set the title of a workflow instance in its meta data.-
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
-
MANAGE_WF_INSTANCES_PATH
public static final String MANAGE_WF_INSTANCES_PATH
Request Path to manage workflow instances- See Also:
- Constant Field Values
-
MANAGE_WF_MODELS_PATH
public static final String MANAGE_WF_MODELS_PATH
Request Path to manage workflow models- See Also:
- Constant Field Values
-
MANAGE_WF_INBOX_PATH
public static final String MANAGE_WF_INBOX_PATH
Request Path to manage users workflow inbox- See Also:
- Constant Field Values
-
MANAGE_WF_ENGINE_PATH
public static final String MANAGE_WF_ENGINE_PATH
Request Path to manage workflow engine- See Also:
- Constant Field Values
-
MODEL_LIST_TYPE_ID
public static final String MODEL_LIST_TYPE_ID
Type of model list to return, model id = model node handle- See Also:
- Constant Field Values
-
MODEL_LIST_TYPE_URI
public static final String MODEL_LIST_TYPE_URI
Type of models list to return, uri = root context + model id- See Also:
- Constant Field Values
-
MODEL_DESCR_TYPE_JSON
public static final String MODEL_DESCR_TYPE_JSON
Defines what type of model definition gets passed, currently only JSON format is implemented- See Also:
- Constant Field Values
-
PAYLOAD_TYPE_JCR
public static final String PAYLOAD_TYPE_JCR
Type of payload referencing used when starting a workflow, in this case a JCR Path- See Also:
- Constant Field Values
-
PAYLOAD_TYPE_URL
public static final String PAYLOAD_TYPE_URL
Type of payload referencing used when starting a workflow, in this case a URL Path- See Also:
- Constant Field Values
-
-
Method Detail
-
deployModel
public String deployModel(String modelSourcePath, String modelType, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException, IOException
Creates a new workflow model in the repository by sending a model definition.
Handled by:
granite\bundles\workflow\console\src\main\java\com\adobe\granite\workflow \console\servlet\ModelsServlet.java- Parameters:
modelSourcePath
- path to modelmodelType
- if null or MODEL_DESCR_TYPE_JSON, the model description should be in JSON format.expectedStatus
- list of allowed HTTP Status to be returned. if not set, http status 201 (CREATED) is assumed.- Returns:
- the path to the newly created model, equals to the models ID
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycleIOException
- if access to to the JSON resource fails
-
deployModel
public String deployModel(String modelSourcePath, String modelType, List<org.apache.http.NameValuePair> replaces, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException, IOException
same asdeployModel(String, String, int...)
, but with a list of strings to replace in the model- Parameters:
modelSourcePath
- resource path of the modelmodelType
- model typereplaces
- list of strings pairs to replaceexpectedStatus
- expected status of the http response- Returns:
- model id
- Throws:
org.apache.sling.testing.clients.ClientException
- of the request failedIOException
- if the model cannot be read
-
advanceWorkItem
public org.apache.sling.testing.clients.SlingHttpResponse advanceWorkItem(String workItemId, String routeId, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Advances a workflow item trough the next step. Handled by: granite\bundles\workflow\console\src\main\java\com\adobe\granite \workflow\console\servlet\InboxServlet.java- Parameters:
workItemId
- the work item to advancerouteId
- the route it should takeexpectedStatus
- The HTTP status that should be returned, otherwise 200 is assumed.- Returns:
- The request executor if access to response is needed.
- Throws:
org.apache.sling.testing.clients.ClientException
- if HTTP request fails for any reason.
-
chooseRouteAndAdvance
public List<org.apache.sling.testing.clients.SlingHttpResponse> chooseRouteAndAdvance(String workflowInstancePath, int chooseRoute) throws org.apache.sling.testing.clients.ClientException
Choose the route and advance with it- Parameters:
workflowInstancePath
- the source of the workflow instancechooseRoute
- based on the model at the expected step, the route that should be used (0, 1, 2, etc..)- Returns:
- The request executor as list if access to response is needed for each of the workitems (in case more than one was found).
- Throws:
org.apache.sling.testing.clients.ClientException
- if HTTP request fails for any reason.
-
stepBackWorkItem
public org.apache.sling.testing.clients.SlingHttpResponse stepBackWorkItem(String workItemId, String backrouteId, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Advances a workflow item back to a previous step. Handled by: granite\bundles\workflow\console\src\main\java\com\adobe\granite \workflow\console\servlet\InboxServlet.java- Parameters:
workItemId
- the work item to advancebackrouteId
- the route it should takeexpectedStatus
- The HTTP status that should be returned, otherwise 200 is assumed.- Returns:
- The request executor if access to response is needed.
- Throws:
org.apache.sling.testing.clients.ClientException
- if HTTP request fails for any reason.
-
delegateWorkItem
public org.apache.sling.testing.clients.SlingHttpResponse delegateWorkItem(String workItemId, String delegatee, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Delegates a workflow item to an other user Handled by: granite\bundles\workflow\console\src\main\java\com\adobe\granite \workflow\console\servlet\InboxServlet.java- Parameters:
workItemId
- the work item to delegatedelegatee
- the user/group this work item gets delegated toexpectedStatus
- The HTTP status that should be returned, otherwise 200 is assumed.- Returns:
- The request executor if access to response is needed.
- Throws:
org.apache.sling.testing.clients.ClientException
- if HTTP request fails for any reason.
-
approveAndAdvanceWorkItem
public org.apache.sling.testing.clients.SlingHttpResponse approveAndAdvanceWorkItem(WorkItem workItem, String routeId, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Approves a workflow item and advanced to another node. Handled by: granite\bundles\workflow\console\src\main\java\com\adobe\granite \workflow\console\servlet\InboxServlet.java- Parameters:
workItem
- the work item to delegaterouteId
- the user/group this work item gets delegated toexpectedStatus
- The HTTP status that should be returned, otherwise 200 is assumed.- Returns:
- The request executor if access to response is needed.
- Throws:
org.apache.sling.testing.clients.ClientException
- if HTTP request fails for any reason.
-
approveComment
public org.apache.sling.testing.clients.SlingHttpResponse approveComment(String workItemId, String routeId, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
- Throws:
org.apache.sling.testing.clients.ClientException
-
getInboxItems
public Map<String,InboxItem> getInboxItems(int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Returns the list of work item that are currently in the inbox of this client's user. The returned map is using the work items uri as key. handled by: granite\bundles\workflow\console\src\main\java\com\adobe\granite \workflow\console\servlet\InboxServlet.java- Parameters:
expectedStatus
- The HTTP status that should returned, othewise 200 is assumed.- Returns:
- A map where key ist the uri of the stored work item
- Throws:
org.apache.sling.testing.clients.ClientException
- if requesting the JSON fails
-
getWorkItemByURI
public WorkItem getWorkItemByURI(String uri, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Returns all available information about a work item.- Parameters:
uri
- the URI pointing to the work item nodeexpectedStatus
- the HTTP status that should be returned, otherwise 200 is assumed- Returns:
- the Work item wrapper
- Throws:
org.apache.sling.testing.clients.ClientException
- if requesting the JSON fails for any reason
-
getWorkItemBackRouteIds
public List<String> getWorkItemBackRouteIds(String uri, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
- Throws:
org.apache.sling.testing.clients.ClientException
-
deleteModel
public org.apache.sling.testing.clients.SlingHttpResponse deleteModel(String modelId, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Deletes a workflow model definition. Note that the model node does not get removed. It only gets a property set in its Metadata sub node named 'deleted' with a value of true.
In order to solve firewall/proxy issues aPOST
that contains aX-HTTP-Method-Override
header entry with valueDELETE
is sent instead of the properHTTP DELETE
.
Handled by:
granite\bundles\workflow\console\src\main\java\com\adobe\granite\workflow \console\servlet\ModelServlet.java- Parameters:
modelId
- the id of the model to deleteexpectedStatus
- HTTP status to be returned, otherwise 20 (NO CONTENT) is assumed- Returns:
- the request executor containing the response object and content.
- Throws:
org.apache.sling.testing.clients.ClientException
- if POST request fails for any reason
-
abortWorkflow
public org.apache.sling.testing.clients.SlingHttpResponse abortWorkflow(String instanceId, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Aborts/Terminates a running workflow instance.- Parameters:
instanceId
- instanceId (nodepath) of the running workflow instanceexpectedStatus
- if not set it defaults to 200- Returns:
- the request executor containing the repsone object and content
- Throws:
org.apache.sling.testing.clients.ClientException
- if POST fails for any reasons
-
updateModel
public org.apache.sling.testing.clients.SlingHttpResponse updateModel(String modelSourcePath, String modelType, String modelId, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException, IOException
updates an existing workflow model in the repository by sending a updated model definition.
Handled by:
granite\bundles\workflow\console\src\main\java\com\adobe\granite\workflow \console\servlet\ModelServlet.java- Parameters:
modelSourcePath
- path to modelmodelType
- if null or MODEL_DESCR_TYPE_JSON, the model description should bE in JSON format.modelId
- the model to be updatedexpectedStatus
- list of allowed HTTP Status to be returned. if not set, http status 200 (ok) is assumed.- Returns:
- The request executor used to send the request
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycleIOException
- if access to to the JSON resource fails
-
getWorkflowEngineInfo
public WorkflowEngine getWorkflowEngineInfo(int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Gets the workflow engine info from "/etc/workflow".
Handled by:
granite\bundles\workflow\content\src\main\content\jcr_root \libs\cq\workflow\components\engine\json.jsp- Parameters:
expectedStatus
- The HTTP Status to be returned otherwise 200 is assumed- Returns:
- the Workflow Engine wrapper
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request for the JSON data fails.
-
stopWorkflowEngine
public org.apache.sling.testing.clients.SlingHttpResponse stopWorkflowEngine(int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Stops the Workflow Engine, equals to stopping the Workflow service. Handled by: granite\bundles\workflow\console\src\main\java\com\adobe\granite\workflow \console\servlet\EngineServlet.java- Parameters:
expectedStatus
- The HTTP Status to be returned otherwise 200 is assumed- Returns:
- returns the request executor, if more info from the response is required.
- Throws:
org.apache.sling.testing.clients.ClientException
- if the POST request fails.
-
startWorkflowEngine
public org.apache.sling.testing.clients.SlingHttpResponse startWorkflowEngine(int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Starts the Workflow Engine, equals to starting the Workflow service. Handled by: granite\bundles\workflow\console\src\main\java\com\adobe\granite\workflow \console\servlet\EngineServlet.java- Parameters:
expectedStatus
- The HTTP Status to be returned otherwise 200 is assumed- Returns:
- returns the request executor, if more info from the response is required.
- Throws:
org.apache.sling.testing.clients.ClientException
- if the POST request fails.
-
isWorkflowEngineActive
public boolean isWorkflowEngineActive() throws org.apache.sling.testing.clients.ClientException
Checks if the workflow engine is in an active state (actually its the workflow OSGi service that gets tested).- Returns:
- true if the Workflow Engine is active otherwise false.
- Throws:
org.apache.sling.testing.clients.ClientException
- if requesting Workflow Info fails
-
startWorkflow
public String startWorkflow(String modelId, String payload, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Convenience function for the most common case , using JCR path to reference the payload.- Parameters:
modelId
- the workflow model id to be used.payload
- the payload JCR path to be set.expectedStatus
- The HTTP Status to be returned otherwise 201 is assumed- Returns:
- the id of the new workflowInstance
- Throws:
org.apache.sling.testing.clients.ClientException
- if the POST request fails
-
startWorkflow
public String startWorkflow(String modelId, String payloadType, String payload, Map<String,String> metaData, String title, String comment, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Starts a new workflow using the given model id, with the payload specified. Handled by: granite\bundles\workflow\console\src\main\java\com\adobe\granite\workflow \console\servlet\InstancesServlet.java- Parameters:
modelId
- The workflow model Id to be used.payloadType
- The type of payload referencing, eitherPAYLOAD_TYPE_JCR
orPAYLOAD_TYPE_URL
. if set to null , {#PAYLOAD_TYPE_JCR} is used as defaultmetaData
- any meta data that needs to be passed when starting the workflowtitle
- title to be set for this workflow instancecomment
- comment to be set when starting the workflowexpectedStatus
- The HTTP Status to be returned otherwise 201 is assumedpayload
- the JCR path(s) or URL(s) pointing to the server resource that act as payload. each payload entry will start a new workflow instance- Returns:
- the id of the new workflowInstance
- Throws:
org.apache.sling.testing.clients.ClientException
- if the POST request fails
-
updateWfInstanceComment
public org.apache.sling.testing.clients.SlingHttpResponse updateWfInstanceComment(String instanceURI, String comment, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Convenience functions to update/set the comment in the workflow instance metadata.- Parameters:
instanceURI
- the workflow instance to be updatedcomment
- the comment of the workflow instance to be setexpectedStatus
- The HTTP Status to be returned otherwise 200 is assumed- Returns:
- the request executor containing the response object and content.
- Throws:
org.apache.sling.testing.clients.ClientException
- if the POST request fails.
-
updateWfInstanceTitle
public org.apache.sling.testing.clients.SlingHttpResponse updateWfInstanceTitle(String instanceURI, String title, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Convenience function to set edit/set the title of a workflow instance in its meta data.- Parameters:
instanceURI
- the workflow instance to be updatedtitle
- the title of the workflow instance to be setexpectedStatus
- The HTTP Status to be returned otherwise 200 is assumed- Returns:
- the request executor containing the response object and content.
- Throws:
org.apache.sling.testing.clients.ClientException
- if the POST request fails.
-
updateWfInstanceMetaData
public org.apache.sling.testing.clients.SlingHttpResponse updateWfInstanceMetaData(String instanceURI, Map<String,String> metaData, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Sends an update request to a workflow instance to update/add metadata- Parameters:
instanceURI
- the workflow instance to be updatedmetaData
- the metadata to be added /updatedexpectedStatus
- The HTTP Status to be returned otherwise 200 is assumed- Returns:
- the request executor containing the response object and content.
- Throws:
org.apache.sling.testing.clients.ClientException
- if the POST request fails.
-
getWorkflowInstanceURLs
public List<URI> getWorkflowInstanceURLs(WorkflowClient.Status wfStatus, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Returns a list of workflow instance URI's that are visible for the user. Can be filtered by the instance status.
Handled by :
granite\bundles\workflow\content\src\main\content\jcr_root\libs\cq\ workflow\components\instances\json.jsp- Parameters:
wfStatus
- Only returns workflows that are in one of the possible States (WorkflowClient.Status.RUNNING
,WorkflowClient.Status.ABORTED
,WorkflowClient.Status.COMPLETED
orWorkflowClient.Status.SUSPENDED
), or, if set to null, returns all workflow instances.expectedStatus
- HTTP Status to check for or, if not set, 200 is assumed- Returns:
- A String List containing all workflow instance handles
visible to this user according to the filter set in
wfStatus
. - Throws:
org.apache.sling.testing.clients.ClientException
- if the call to the backend requesting the JSON fails
-
getWorkflowModels
public ArrayList<String> getWorkflowModels(String listType, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Returns a list of all available workflow models for this user. Handled by: granite\bundles\workflow\content\src\main\content\jcr_root\libs\cq\ workflow\components\models\json.jsp- Parameters:
listType
- if set to MODEL_LIST_TYPE_ID , a list of model ID's gets returned (model ID = model Handle) if set to null or MODEL_LIST_TYPE_URI, a list of model URI's gets returned (URI = context path + model ID)expectedStatus
- HTTP Status to check for or, if not set, 200 is assumed- Returns:
- A String array containing a list of all workflow model visible to this user
- Throws:
org.apache.sling.testing.clients.ClientException
- if requesting the JSON fails for any reason
-
getWorkflowModelAsJSON
public String getWorkflowModelAsJSON(String modelId, String version, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Returns the model definition (metadata, nodes, transitions,title ,description etc) handled by: \granite\bundles\workflow\console\src\main\java\com\adobe\granite \workflow\console\servlet\ModelServlet.java- Parameters:
modelId
- the model id to requestversion
- the version to retrieve. Either 'HEAD' or null to get the latest version or in the format major.minor e.g. '1.2'.expectedStatus
- the expected HTTP Status, if not set 200 is assumed- Returns:
- the requested version of the model definition in JSON format
- Throws:
org.apache.sling.testing.clients.ClientException
- If requesting the JSON fails for any reason
-
getWorkflowModel
public WorkflowModel getWorkflowModel(String modelId, String version, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Returns the model definition (metadata, nodes, transitions,title ,description etc) in a wrapper class. handled by: \granite\bundles\workflow\console\src\main\java\com\adobe\granite \workflow\console\servlet\ModelServlet.java- Parameters:
modelId
- the model id to requestversion
- the version to retrieve. Either 'HEAD' or null to get the latest version or in the format major.minor e.g. '1.2'.expectedStatus
- the expected HTTP Status, if not set 200 is assumed- Returns:
- the requested version of the model definition in JSON format
- Throws:
org.apache.sling.testing.clients.ClientException
- If requesting the JSON fails for any reason
-
getWorkflowInstance
public WorkflowInstance getWorkflowInstance(String instanceURI, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Returns all the information about a workflow instance in JSON format. Handled by: granite\bundles\workflow\content\src\main\content\jcr_root\libs\cq\ workflow\components\instance\json.jsp- Parameters:
instanceURI
- the path to the workflow instanceexpectedStatus
- the expected HTTP status, otherwise 200 is assumed- Returns:
- A WorkflowInstance that wraps the JSON response.
- Throws:
org.apache.sling.testing.clients.ClientException
- if requesting the JSON fails
-
getWorkflowInstances
public List<WorkflowInstance> getWorkflowInstances(WorkflowClient.Status wfStatus, String model, String payload, org.joda.time.DateTime startTimeLimit, org.joda.time.DateTime endTimeLimit) throws org.apache.sling.testing.clients.ClientException
- Throws:
org.apache.sling.testing.clients.ClientException
-
getWorkflowInstances
public List<WorkflowInstance> getWorkflowInstances(WorkflowClient.Status wfStatus) throws org.apache.sling.testing.clients.ClientException
- Throws:
org.apache.sling.testing.clients.ClientException
-
getWorkflowInstances
public List<WorkflowInstance> getWorkflowInstances(WorkflowClient.Status wfStatus, org.joda.time.DateTime startTimeLimit, org.joda.time.DateTime endTimeLimit) throws org.apache.sling.testing.clients.ClientException
- Throws:
org.apache.sling.testing.clients.ClientException
-
getWorkflowInstances
public List<WorkflowInstance> getWorkflowInstances() throws org.apache.sling.testing.clients.ClientException
- Throws:
org.apache.sling.testing.clients.ClientException
-
getWorkflowInstanceHistory
public List<HistoryItem> getWorkflowInstanceHistory(String instanceURI, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Retrieve the workflow history of a specific workflow instance- Parameters:
instanceURI
- the workflow instance uriexpectedStatus
- provide the status code that is expected, default is 200 OK.- Returns:
- the history items as a list
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
setWorkflowInstanceStatus
public org.apache.sling.testing.clients.SlingHttpResponse setWorkflowInstanceStatus(String instanceURI, WorkflowClient.Status status, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Set the status of an running workflow instance. handled by: granite\bundles\workflow\console\src\main\java\com\adobe\granite \workflow\console\servlet\InstanceServlet.java- Parameters:
instanceURI
- path to the instance urlstatus
- status to be set, eitherWorkflowClient.Status.ABORTED
,WorkflowClient.Status.RUNNING
orWorkflowClient.Status.SUSPENDED
expectedStatus
- Expected HTTP status, otherwise 200 is assumed- Returns:
- the request executor if more info from response is required.
- Throws:
org.apache.sling.testing.clients.ClientException
- if POST request has problems
-
-