Class MSMClient

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

    public class MSMClient
    extends CQClient
    The base client for all Multi Site Manager (MSM) related tests. It provides a core set of commonly used MSM functions e.g. creating a blueprint / site / live copy. The MSM enables you to create a site (called a live copy) based on another site (called a blueprint) and to actively manage the relationships between the blueprint and the live copy.
    It extends from CQClient which in turn provides a core set of commonly used website and page functionality.
    • Constructor Detail

      • MSMClient

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

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

      • createBluePrint

        public org.apache.sling.testing.clients.SlingHttpResponse createBluePrint​(String name,
                                                                                  String title,
                                                                                  String sitePath,
                                                                                  int... expectedStatus)
                                                                           throws org.apache.sling.testing.clients.ClientException
        Creates a blueprint.
        The blueprint makes it possible to define structure and content centrally. The structure and content of the blueprint can then be used in the live copy
        Parameters:
        name - the label/name of the blueprint
        title - the title of the blueprint
        sitePath - the path to an existing branch (site)
        expectedStatus - list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.
        Returns:
        Sling response
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • deleteBluePrint

        public org.apache.sling.testing.clients.SlingHttpResponse deleteBluePrint​(String blueprintPath,
                                                                                  int... expectedStatus)
                                                                           throws org.apache.sling.testing.clients.ClientException
        Delete a blueprint.
        The blueprint makes it possible to define structure and content centrally. The structure and content of the blueprint can then be used in the live copy
        Parameters:
        blueprintPath - the path to the blueprint
        expectedStatus - list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.
        Returns:
        Sling response
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • createSite

        public org.apache.sling.testing.clients.SlingHttpResponse createSite​(String label,
                                                                             String title,
                                                                             String destPath,
                                                                             boolean isLiveCopy,
                                                                             String[] languages,
                                                                             String[] chapterPaths,
                                                                             String blueprintPath,
                                                                             String[] rolloutConfigs,
                                                                             String siteOwner,
                                                                             int... expectedStatus)
                                                                      throws org.apache.sling.testing.clients.ClientException
        Creates an new site. A site can be considered as 1:1 copy of an existing branch or page. Every site can be defined as live copy which manage the relationships between the blueprint and the live copy.
        Parameters:
        label - the label/name of the new site
        title - the title of the new site
        destPath - the location where the new site gets created
        isLiveCopy - true if the new site works as a live copy
        languages - the languages labels to copy
        chapterPaths - the chapters' pages to copy taken from first language of site
        blueprintPath - the path to the blueprint
        rolloutConfigs - the rollout configuration for the live copy
        siteOwner - the site owner for the new site
        expectedStatus - list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.
        Returns:
        Sling response
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • 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
        Creates a live copy. A live copy can be created from an existing branch or page or a site that is a live copy by using a blueprint.
        Parameters:
        label - the label/name of the new site
        title - the title of the new site
        destPath - the location where the new site gets created
        srcPath - the source path of the liveCopy
        shallow - if set to true subpages are excluded
        rolloutConfigs - the rollout configuration for the live copy
        missingPages - pages which are not rolled out yet (missing) but should be part of the rollout
        excludeSubPages - true if subpages of missing pages are excluded (subpages of missing pages are not par of rollout)
        expectedStatus - list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.
        Returns:
        Sling response
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • editRelationship

        public org.apache.sling.testing.clients.SlingHttpResponse editRelationship​(String target,
                                                                                   String sourcePath,
                                                                                   boolean deep,
                                                                                   String[] rolloutConfigs,
                                                                                   int... expectedStatus)
                                                                            throws org.apache.sling.testing.clients.ClientException
        Edit the LiveRelationship at a given Path
        Parameters:
        target - the LiveCopy to edit
        sourcePath - the blueprint path
        deep - if the LiveCopy is deep
        rolloutConfigs - the RolloutConfigs to take for LiveCopy
        expectedStatus - list of allowed HTTP Status to be returned. If not set, http status 200 (OK) is assumed.
        Returns:
        Sling response
        Throws:
        org.apache.sling.testing.clients.ClientException - If something fails during request/response cycle
      • createRolloutConfig

        public String createRolloutConfig​(String name,
                                          String above,
                                          String trigger,
                                          String... liveActions)
                                   throws org.apache.sling.testing.clients.ClientException
        Create a new RolloutConfiguration with given Trigger and given LiveActions
        Parameters:
        name - to give for the RolloutConfig
        above - optional, Page name the RolloutConfig to be next to the new
        trigger - Trigger to be used for the RolloutConfig
        liveActions - names of the LiveActions to be contained in the RolloutConfig @return the Path to the newly created RolloutConfig
        Returns:
        the path to the rollout config
        Throws:
        org.apache.sling.testing.clients.ClientException - in case of Errors during RolloutConfiguration creation