Class CQWorkflowClient

  • All Implemented Interfaces:
    Closeable, AutoCloseable, org.apache.http.client.HttpClient

    public class CQWorkflowClient
    extends WorkflowClient
    Extends the Granite Workflow client with CQ Specific Workflow methods
    • Constructor Detail

      • CQWorkflowClient

        public CQWorkflowClient​(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
      • CQWorkflowClient

        public CQWorkflowClient​(URI serverUrl,
                                String user,
                                String password)
                         throws org.apache.sling.testing.clients.ClientException
        Throws:
        org.apache.sling.testing.clients.ClientException
    • Method Detail

      • createNewModelPage

        public org.apache.sling.testing.clients.SlingHttpResponse createNewModelPage​(String modelName,
                                                                                     String modelTitle,
                                                                                     int... expectedStatusRange)
                                                                              throws org.apache.sling.testing.clients.ClientException
        Creates a new Model page in the default directory "/etc/workflow/models/".
        Parameters:
        modelName - name of the model
        modelTitle - title to be given to this model
        expectedStatusRange - expected HTTP status
        Returns:
        the response
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • saveModel

        public org.apache.sling.testing.clients.SlingHttpResponse saveModel​(String modelPath,
                                                                            int... expectedStatus)
                                                                     throws org.apache.sling.testing.clients.ClientException
        Saves a model.
        Parameters:
        modelPath - Name of the model to save
        expectedStatus - list of expected http status codes
        Returns:
        the response
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • createWorkflowLauncher

        public void createWorkflowLauncher​(String workflowId,
                                           String path,
                                           String nodeType,
                                           EventType eventType)
                                    throws org.apache.sling.testing.clients.ClientException
        Adds a new workflow launcher. This method only allows some parameters.
        Parameters:
        workflowId - the workflow URI
        path - the path it binds to
        nodeType - the node type it affects
        eventType - the event type to the node
        Throws:
        org.apache.sling.testing.clients.ClientException - if the call to the backend fails
      • editWorkflowLauncher

        public void editWorkflowLauncher​(String launcherId,
                                         String propName,
                                         String value)
                                  throws org.apache.sling.testing.clients.ClientException

        Edit one property of an existing workflow launcher identified by the launcher configuration name

        The rest of the properties on the workflow launcher stay the same

        Parameters:
        launcherId - the launcher configuration string
        propName - The name of the property about to be changed
        value - The value of the property about to be changed
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • editWorkflowLauncher

        public void editWorkflowLauncher​(String launcherId,
                                         Map<String,​String> propMap)
                                  throws org.apache.sling.testing.clients.ClientException

        Edit an existing workflow launcher identified by the launcher configuration name with a set of properties to change

        The rest of the properties on the workflow launcher stay the same

        Parameters:
        launcherId - the launcher configuration string
        propMap - A map with properties names and values to be changed on the workflow
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • getWorkflowLauncher

        public Map<String,​String> getWorkflowLauncher​(String launcherId)
                                                     throws org.apache.sling.testing.clients.ClientException
        Returns a Map with properties of the workflow launcher
        Parameters:
        launcherId - the URI of the launcher
        Returns:
        a Map with properties
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • enableDisableWorkflowLauncher

        public void enableDisableWorkflowLauncher​(String launcherId,
                                                  boolean enabled)
                                           throws org.apache.sling.testing.clients.ClientException
        Enables or disables the workflow launcher
        Parameters:
        launcherId - the id of the launcher
        enabled - "true" to enable, "false" to disable
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • isWorkflowTransient

        public boolean isWorkflowTransient​(String workflowModel)
                                    throws org.apache.sling.testing.clients.ClientException
        Finds out if the Transient feature flag is enabled for a workflow.
        Parameters:
        workflowModel - the path of the workflow model. These are stored at /etc/workflow/models/. The model path to be provided can be relative (or absolute) to this path
        Returns:
        True if the workflow is transient in nature, False otherwise.
        Throws:
        org.apache.sling.testing.clients.ClientException - if it fails to find the specified workflow model.