Class WCMCommands

java.lang.Object
com.adobe.cq.testing.util.WCMCommands

public class WCMCommands extends Object
Utility class that has separate methods for each available WCM Command.

WCM Commands are requests sent to /bin/wcmcommand, with a list of of parameters. one of the parameters must be named "cmd" and contains the actual command string.

Currently available commands are:
  • createPage: Creates a CQ Page
  • Field Details

  • Constructor Details

    • WCMCommands

      public WCMCommands(org.apache.sling.testing.clients.SlingClient client)
  • Method Details

    • createPage

      public org.apache.sling.testing.clients.SlingHttpResponse createPage(String pageLabel, String pageTitle, String parentPath, String templatePath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • deletePage

      public org.apache.sling.testing.clients.SlingHttpResponse deletePage(String[] pagePaths, boolean force, boolean shallow, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • copyPage

      public org.apache.sling.testing.clients.SlingHttpResponse copyPage(String[] srcPaths, String destName, String destParentPath, String before, boolean shallow, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • movePage

      public org.apache.sling.testing.clients.SlingHttpResponse movePage(String[] srcPaths, String destName, String destParentPath, String before, boolean shallow, boolean integrity, String[] adjusts, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • movePage

      public org.apache.sling.testing.clients.SlingHttpResponse movePage(String[] srcPaths, String destName, String destParentPath, String before, boolean shallow, boolean integrity, String[] adjusts, String[] publishes, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • copyLanguages

      public org.apache.sling.testing.clients.SlingHttpResponse copyLanguages(String sitePath, List<org.apache.http.message.BasicNameValuePair> relPaths, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • createVersion

      public org.apache.sling.testing.clients.SlingHttpResponse createVersion(String pagePath, String comment, String label, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • restoreVersion

      public org.apache.sling.testing.clients.SlingHttpResponse restoreVersion(String[] versionIds, String pagePath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • restoreTree

      public org.apache.sling.testing.clients.SlingHttpResponse restoreTree(String path, Date date, boolean preserveNVP, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • lockPage

      public org.apache.sling.testing.clients.SlingHttpResponse lockPage(String path, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Lock a page
      Parameters:
      path - Path of the page to lock
      expectedStatus - list of expected http status codes
      Returns:
      the http response
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request fails
    • unlockPage

      public org.apache.sling.testing.clients.SlingHttpResponse unlockPage(String path, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Unlock a page
      Parameters:
      path - Path of the page to unlock
      expectedStatus - list of expected http status codes
      Returns:
      the http response
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request fails
    • createLiveCopy

      public org.apache.sling.testing.clients.SlingHttpResponse createLiveCopy(String label, String title, String destPath, String srcPath, boolean shallow, String[] rolloutConfigs, String[] missingPages, boolean excludeSubPages, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Create liveCopy
      Parameters:
      label - label of the liveCopy
      title - title of the liveCopy
      destPath - destination path for the liveCopy
      srcPath - source path of the liveCopy
      shallow - if set to true subpages are excluded
      rolloutConfigs - rollout configuration
      missingPages - pages which are not rolled out yet
      excludeSubPages - if set to true subpages of missing pages are excluded
      expectedStatus - list of expected http status codes
      Returns:
      the http response
      Throws:
      org.apache.sling.testing.clients.ClientException - if livecopy cannot be created
    • createSite

      public org.apache.sling.testing.clients.SlingHttpResponse createSite(String label, String title, String destPath, boolean isLiveCopy, String[] languages, String[] chapterPages, String bluePrintPath, String[] rolloutConfigs, String siteOwner, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Creates an new site
      Parameters:
      label - Label of the new site
      title - Title of the new site
      destPath - Location where the new site gets created
      isLiveCopy - If the new site works as a liveCopy
      languages - What languages to copy
      chapterPages - What chapters to copy
      bluePrintPath - Whats the blueprint used
      rolloutConfigs - Whats the rollout configuration for the liveCopy
      siteOwner - Who is the site owner
      expectedStatus - list of expected http status codes
      Returns:
      the http response
      Throws:
      org.apache.sling.testing.clients.ClientException - if site cannot be created
    • moderateComment

      public org.apache.sling.testing.clients.SlingHttpResponse moderateComment(String commentPath, boolean approve, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • markCommentAsSpam

      public org.apache.sling.testing.clients.SlingHttpResponse markCommentAsSpam(String commentPath, boolean spam, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • deleteComment

      public org.apache.sling.testing.clients.SlingHttpResponse deleteComment(String commentPath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • rollout

      public org.apache.sling.testing.clients.SlingHttpResponse rollout(String[] sourcePaths, String[] targetPaths, String[] paragraphPaths, String type, boolean reset, boolean useBackgroundJob, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      type deep, delete, page (=deep)
      Parameters:
      sourcePaths - the blue print paths
      targetPaths - the live copy paths
      paragraphPaths - the paragraph paths
      type - the type of rollout - deep / shallow
      reset - whether to reset or not the job
      useBackgroundJob - if true use a background job, otherwise do not use a background job
      expectedStatus - list of expected http status codes
      Returns:
      the response
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request fails
    • createLaunch

      public org.apache.sling.testing.clients.SlingHttpResponse createLaunch(String title, String srcPath, Calendar liveDate, boolean ignoreSubPages, boolean isLiveCopy, String template, String[] sourceRolloutConfigs, String[] promoteRolloutConfigs, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Creates a new launch copy.
      Parameters:
      title - Title of the new launch section
      srcPath - the root page to be copied from
      liveDate - the date the launch section should go live
      ignoreSubPages - if sub pages should be copied with
      isLiveCopy - if the launch section is connected to the source via live copy
      template - a template if the launch should be created with a different template, null otherwise
      sourceRolloutConfigs - Rollout configs used for the launch live copy
      promoteRolloutConfigs - Rollout configs used on launch promotion
      expectedStatus - list of expected http status codes
      Returns:
      the http response
      Throws:
      org.apache.sling.testing.clients.ClientException - if anything goes wrong
    • createLaunch

      public org.apache.sling.testing.clients.SlingHttpResponse createLaunch(String title, ArrayList<String> srcPathList, Calendar liveDate, ArrayList<Boolean> ignoreSubPagesList, boolean isLiveCopy, String template, String[] sourceRolloutConfigs, String[] promoteRolloutConfigs) throws org.apache.sling.testing.clients.ClientException
      Creates a new launch copy.
      Parameters:
      title - Title of the new launch section
      srcPathList - list of the root page to be copied from
      liveDate - the date the launch section should go live
      ignoreSubPagesList - list specifying if sub pages should be copied with
      isLiveCopy - if the launch section is connected to the source via live copy
      template - a template if the launch should be created with a different template, null otherwise
      sourceRolloutConfigs - Rollout configs used for the launch live copy
      promoteRolloutConfigs - Rollout configs used on launch promotion
      Returns:
      the http response
      Throws:
      org.apache.sling.testing.clients.ClientException - if anything goes wrong
    • editLaunch

      public org.apache.sling.testing.clients.SlingHttpResponse editLaunch(String launchPath, ArrayList<String> srcPathList, ArrayList<Boolean> ignoreSubPagesList) throws org.apache.sling.testing.clients.ClientException
      Throws:
      org.apache.sling.testing.clients.ClientException
    • deleteLaunch

      public org.apache.sling.testing.clients.SlingHttpResponse deleteLaunch(String path, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Deletes a launch section
      Parameters:
      path - complete path to the launch sections root page handle
      expectedStatus - list of expected http status codes
      Returns:
      the sling http response
      Throws:
      org.apache.sling.testing.clients.ClientException - If anything goes wrong
    • cloneLaunch

      public org.apache.sling.testing.clients.SlingHttpResponse cloneLaunch(String orgPath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Clones an existing launch section
      Parameters:
      orgPath - path to the root page of launch section to copy
      expectedStatus - list of expected http status codes
      Returns:
      the sling http response
      Throws:
      org.apache.sling.testing.clients.ClientException - if anything goes wrong
    • promoteLaunch

      public org.apache.sling.testing.clients.SlingHttpResponse promoteLaunch(String path, boolean promoteSubPages, String target, String workflowPackage, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Promotes a launch section
      Parameters:
      path - path to the root page of the launch section to promote
      promoteSubPages - true if sub pages should be promoted as well
      target - the path to a target launch or null to promote to production
      workflowPackage - path to the workflow package or null
      expectedStatus - list of expected http status codes
      Returns:
      the http response
      Throws:
      org.apache.sling.testing.clients.ClientException - If anything goes wrong
    • createCatalog

      public org.apache.sling.testing.clients.SlingHttpResponse createCatalog(String source, String dest, String label, String title, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Creates a catalog from a blueprint
      Parameters:
      source - path to the blueprint
      dest - destination path to the catalog
      label - label of the catalog
      title - title of the catalog
      expectedStatus - expected HTTP response status codes
      Returns:
      the http response
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request could not be executed
    • rolloutSection

      public org.apache.sling.testing.clients.SlingHttpResponse rolloutSection(String source, String dest, boolean force, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
      Rolls out a section
      Parameters:
      source - path to blueprint
      dest - destination path to the catalog
      force - whether the rollout should be forced
      expectedStatus - expected HTTP response status code
      Returns:
      the http response
      Throws:
      org.apache.sling.testing.clients.ClientException - if the request could not be executed