Class ExperienceFragmentsClient

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

    public class ExperienceFragmentsClient
    extends CQClient
    CQ Testing client for Experience Fragments
    • Constructor Detail

      • ExperienceFragmentsClient

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

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

      • createExperienceFragment

        public org.apache.sling.testing.clients.SlingHttpResponse createExperienceFragment​(String xfTitle,
                                                                                           String variantTitle,
                                                                                           String variantTemplate,
                                                                                           int... expectedStatus)
                                                                                    throws org.apache.sling.testing.clients.ClientException
        Create an Experience Fragment
        Parameters:
        xfTitle - title for the experience fragment
        variantTitle - title for the experience fragment variant
        variantTemplate - template for the experience fragment variant
        expectedStatus - Http status expected after creation of the experience fragment
        Returns:
        The full SlingHttpResponse for the experience fragment create request
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • createExperienceFragment

        public org.apache.sling.testing.clients.SlingHttpResponse createExperienceFragment​(String xfTitle,
                                                                                           String variantTitle,
                                                                                           ExperienceFragmentsClient.XF_TEMPLATE variantTemplate,
                                                                                           int... expectedStatus)
                                                                                    throws org.apache.sling.testing.clients.ClientException
        Create an Experience Fragment
        Parameters:
        xfTitle - title for the experience fragment
        variantTitle - title for the experience fragment variant
        variantTemplate - template for the experience fragment variant
        expectedStatus - http status expected after creation of the experience fragment
        Returns:
        The full SlingHttpResponse for the experience fragment create request
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • createXfVariant

        public org.apache.sling.testing.clients.SlingHttpResponse createXfVariant​(String parentPath,
                                                                                  String template,
                                                                                  String title,
                                                                                  int... expectedStatus)
                                                                           throws org.apache.sling.testing.clients.ClientException
        Create an Experience Fragment Variant
        Parameters:
        parentPath - the parent experience fragment path
        template - the variant template
        title - the variant title
        expectedStatus - http status expected after creation of the experience fragment variant
        Returns:
        The full SlingHttpResponse for the experience fragment variant create request
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • createXfVariant

        public org.apache.sling.testing.clients.SlingHttpResponse createXfVariant​(String parentPath,
                                                                                  ExperienceFragmentsClient.XF_TEMPLATE template,
                                                                                  String title,
                                                                                  int... expectedStatus)
                                                                           throws org.apache.sling.testing.clients.ClientException
        Create an Experience Fragment Variant
        Parameters:
        parentPath - the parent experience fragment path
        template - the variant template
        title - the variant title
        expectedStatus - http status expected after creation of the experience fragment variant
        Returns:
        The full SlingHttpResponse for the experience fragment variant create request
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • createVariationAsLiveCopy

        public org.apache.sling.testing.clients.SlingHttpResponse createVariationAsLiveCopy​(String sourceVariantPath,
                                                                                            String title,
                                                                                            String name,
                                                                                            String[] rolloutConfigs,
                                                                                            int... expectedStatus)
                                                                                     throws org.apache.sling.testing.clients.ClientException
        Create a Live Copy of an Experience Fragment Variant The new variant will be created under the same Experience Fragment
        Parameters:
        sourceVariantPath - the path of the source experience fragment variant
        title - the live copy variant's title
        name - the live copy variant's name
        rolloutConfigs - the rollout configurations for the live copy
        expectedStatus - http status expected after creation of the experience fragment variant live copy
        Returns:
        The full SlingHttpResponse for the experience fragment variant live copy create request
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • deleteExperienceFragment

        public org.apache.sling.testing.clients.SlingHttpResponse deleteExperienceFragment​(String path,
                                                                                           int... expectedStatus)
                                                                                    throws org.apache.sling.testing.clients.ClientException
        Force delete an Experience Fragment
        Parameters:
        path - the path of the Experience Fragment
        expectedStatus - http status expected after deleting the experience fragment
        Returns:
        The full SlingHttpResponse for the experience fragment delete request
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • deleteExperienceFragment

        public org.apache.sling.testing.clients.SlingHttpResponse deleteExperienceFragment​(String path,
                                                                                           boolean force,
                                                                                           int... expectedStatus)
                                                                                    throws org.apache.sling.testing.clients.ClientException
        Delete an Experience Fragment
        Parameters:
        path - the path of the Experience Fragment
        force - force delete
        expectedStatus - http status expected after deleting the experience fragment
        Returns:
        The full SlingHttpResponse for the experience fragment delete request
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • deleteXfVariant

        public org.apache.sling.testing.clients.SlingHttpResponse deleteXfVariant​(String variantPath,
                                                                                  int... expectedStatus)
                                                                           throws org.apache.sling.testing.clients.ClientException
        Delete an Experience Fragment Variant
        Parameters:
        variantPath - the path of the Experience Fragment Variant
        expectedStatus - http status expected after deleting the experience fragment variant
        Returns:
        The full SlingHttpResponse for the experience fragment variant delete request
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • getPlainHtmlRendering

        public org.apache.sling.testing.clients.SlingHttpResponse getPlainHtmlRendering​(String variantPath,
                                                                                        int... expectedStatus)
                                                                                 throws org.apache.sling.testing.clients.ClientException
        Call the Plain Html Processor for an Experience Fragment Variant
        Parameters:
        variantPath - the path for the of Experience Fragment Variant
        expectedStatus - http status expected after calling the the Plain Html Processor for the variant
        Returns:
        The full SlingHttpResponse for the experience fragment variant plain html processor request. The HTML rendition can be obtained by calling SlingHttpResponse.getContent() method
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • getSocialUrls

        public org.apache.sling.testing.clients.SlingHttpResponse getSocialUrls​(String variantPath,
                                                                                int... expectedStatus)
                                                                         throws org.apache.sling.testing.clients.ClientException
        Get the Social Urls for the a Social Experience Fragment Variant
        Parameters:
        variantPath - the path for the Social Experience Fragment Variant
        expectedStatus - http status expected after requesting the social urls for the social variant
        Returns:
        The full SlingHttpResponse after requesting the social urls for the social variant The Social Urls are in JSON format and can be obtained by calling SlingHttpResponse.getContent() method
        Throws:
        org.apache.sling.testing.clients.ClientException - if the request fails
      • getXFPropertiesPageHTHML

        public org.apache.sling.testing.clients.SlingHttpResponse getXFPropertiesPageHTHML​(String xfPath,
                                                                                           int... expectedStatus)
                                                                                    throws org.apache.sling.testing.clients.ClientException
        Throws:
        org.apache.sling.testing.clients.ClientException
      • getVariantProperitesPageHTML

        public org.apache.sling.testing.clients.SlingHttpResponse getVariantProperitesPageHTML​(String variantPath,
                                                                                               int... expectedStatus)
                                                                                        throws org.apache.sling.testing.clients.ClientException
        Throws:
        org.apache.sling.testing.clients.ClientException
      • getCurrentConfiguration

        public ExperienceFragmentsClient.ExperienceFragmentsConfiguration getCurrentConfiguration()
                                                                                           throws org.apache.sling.testing.clients.ClientException
        Get the current Configuration for Experience Fragments
        Returns:
        the current configuration
        Throws:
        org.apache.sling.testing.clients.ClientException - if the configuration cannot be retrieved
      • configurationBuilder

        public ExperienceFragmentsClient.ExperienceFragementsConfigurationBuilder configurationBuilder()
                                                                                                throws org.apache.sling.testing.clients.ClientException
        Create a new Experience Fragments configuration builder
        Returns:
        the builder
        Throws:
        org.apache.sling.testing.clients.ClientException - if the builder cannot be created
      • unpublish

        public org.apache.sling.testing.clients.SlingHttpResponse unpublish​(String pagePath,
                                                                            int... expectedStatus)
                                                                     throws org.apache.sling.testing.clients.ClientException
        Throws:
        org.apache.sling.testing.clients.ClientException
      • publishXFVariant

        public org.apache.sling.testing.clients.SlingHttpResponse publishXFVariant​(String variantPath,
                                                                                   int... expectedStatus)
                                                                            throws org.apache.sling.testing.clients.ClientException
        Throws:
        org.apache.sling.testing.clients.ClientException
      • publishXF

        public org.apache.sling.testing.clients.SlingHttpResponse publishXF​(String xfPath,
                                                                            int... expectedStatus)
                                                                     throws org.apache.sling.testing.clients.ClientException
        Throws:
        org.apache.sling.testing.clients.ClientException
      • unpublishXFVariant

        public org.apache.sling.testing.clients.SlingHttpResponse unpublishXFVariant​(String variantPath,
                                                                                     int... expectedStatus)
                                                                              throws org.apache.sling.testing.clients.ClientException
        Throws:
        org.apache.sling.testing.clients.ClientException
      • unblishXF

        public org.apache.sling.testing.clients.SlingHttpResponse unblishXF​(String xfPath,
                                                                            int... expectedStatus)
                                                                     throws org.apache.sling.testing.clients.ClientException
        Throws:
        org.apache.sling.testing.clients.ClientException
      • getParentXFPath

        public static String getParentXFPath​(String variantPath)
        Get the path of the parent Experience Fragment, given the path of the Experience Fragment Variant
        Parameters:
        variantPath - the path of the Experience Fragment Variant
        Returns:
        The path of the parent Experience Fragment