Package com.adobe.cq.testing.client
Class ExperienceFragmentsClient
- 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.ExperienceFragmentsClient
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.http.client.HttpClient
public class ExperienceFragmentsClient extends CQClient
CQ Testing client for Experience Fragments
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExperienceFragmentsClient.ContentFragmentComponent
Content Fragment componentstatic interface
ExperienceFragmentsClient.ContentFragmentVariantCompoents
static class
ExperienceFragmentsClient.ConvertToXFAction
Convert a component to an Experience Fragmentstatic class
ExperienceFragmentsClient.ExperienceFragementsConfigurationBuilder
Experience Fragments configuration builder as it can be done from the UIstatic class
ExperienceFragmentsClient.ExperienceFragment
Representation of the Experience Fragment NOTE: All properties are cached.class
ExperienceFragmentsClient.ExperienceFragmentBuilder
An Experience Fragment builderstatic class
ExperienceFragmentsClient.ExperienceFragmentsConfiguration
Representation the configuration of the Experience Fragments Feature, as it can be done from the UI NOTE: All properties are cached.static class
ExperienceFragmentsClient.ExperienceFragmentVariant
Representation of the Experience Fragment Variant NOTE: All properties are cached.static class
ExperienceFragmentsClient.ExperienceFragmentVariantBuilder
An Experience Fragment Variant builderstatic class
ExperienceFragmentsClient.FacebookVariantComponents
Class that enable consumers to configure variant components from the Facebook templatestatic class
ExperienceFragmentsClient.ImageComponent
Image componentstatic interface
ExperienceFragmentsClient.ImageVariantComponents
static class
ExperienceFragmentsClient.PinterestVariantComponents
Class that enable consumers to configure variant components from the Pinterest templatestatic class
ExperienceFragmentsClient.POSVariantComponents
Class that enable consumers to configure variant components from the POS templatestatic class
ExperienceFragmentsClient.TextComponent
Test componentstatic interface
ExperienceFragmentsClient.TextVariantComponents
static class
ExperienceFragmentsClient.VariantComponents
Base class for classes mapped to predefined templates that enable consumers to configure variant components from that templatestatic class
ExperienceFragmentsClient.XF_TAG
Experience Fragments predefined tagsstatic class
ExperienceFragmentsClient.XF_TEMPLATE
Experience Fragments predefined templatesstatic interface
ExperienceFragmentsClient.XFTag
Interface with methods that all predefined XF tags from the XF_TAG must implementstatic interface
ExperienceFragmentsClient.XFTemplate
Interface with methods that all predefined XF templates from the XF_TEMPLATE must implement-
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
DEFAULT_XF_PARENT_PATH
static String
TITLE_PROP
-
Fields inherited from class com.adobe.cq.testing.client.CQClient
LOG, STATISTICS_ROOT, wcmCommands
-
-
Constructor Summary
Constructors Constructor Description ExperienceFragmentsClient(URI serverUrl, String user, String password)
ExperienceFragmentsClient(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 ExperienceFragmentsClient.ExperienceFragementsConfigurationBuilder
configurationBuilder()
Create a new Experience Fragments configuration builderExperienceFragmentsClient.ConvertToXFAction
convertToXF()
Initiate a Convert to Experience Fragmentorg.apache.sling.testing.clients.SlingHttpResponse
createExperienceFragment(String xfTitle, String variantTitle, ExperienceFragmentsClient.XF_TEMPLATE variantTemplate, int... expectedStatus)
Create an Experience Fragmentorg.apache.sling.testing.clients.SlingHttpResponse
createExperienceFragment(String xfTitle, String variantTitle, String variantTemplate, int... expectedStatus)
Create an Experience Fragmentorg.apache.sling.testing.clients.SlingHttpResponse
createVariationAsLiveCopy(String sourceVariantPath, String title, String name, String[] rolloutConfigs, int... expectedStatus)
Create a Live Copy of an Experience Fragment Variant The new variant will be created under the same Experience Fragmentorg.apache.sling.testing.clients.SlingHttpResponse
createXfVariant(String parentPath, ExperienceFragmentsClient.XF_TEMPLATE template, String title, int... expectedStatus)
Create an Experience Fragment Variantorg.apache.sling.testing.clients.SlingHttpResponse
createXfVariant(String parentPath, String template, String title, int... expectedStatus)
Create an Experience Fragment Variantorg.apache.sling.testing.clients.SlingHttpResponse
deleteExperienceFragment(String path, boolean force, int... expectedStatus)
Delete an Experience Fragmentorg.apache.sling.testing.clients.SlingHttpResponse
deleteExperienceFragment(String path, int... expectedStatus)
Force delete an Experience Fragmentorg.apache.sling.testing.clients.SlingHttpResponse
deleteXfVariant(String variantPath, int... expectedStatus)
Delete an Experience Fragment VariantExperienceFragmentsClient.ExperienceFragmentBuilder
experienceFragmentBuilder(String xfTitle, String variantTitle, ExperienceFragmentsClient.XF_TEMPLATE variantTemplate)
ExperienceFragmentsClient.ExperienceFragmentBuilder
experienceFragmentBuilder(String xfTitle, String variantTitle, String variantTemplate)
<T extends ExperienceFragmentsClient.VariantComponents>
TgetComponents(String variantPath, ExperienceFragmentsClient.XF_TEMPLATE template)
AExperienceFragmentsClient.VariantComponents
subclass object that can be used to configure the variant components defined in the templateExperienceFragmentsClient.ExperienceFragmentsConfiguration
getCurrentConfiguration()
Get the current Configuration for Experience FragmentsExperienceFragmentsClient.ExperienceFragment
getExperienceFragment(String xfPath)
Get the Experience Fragment as an object ofExperienceFragmentsClient.ExperienceFragment
classstatic String
getParentXFPath(String variantPath)
Get the path of the parent Experience Fragment, given the path of the Experience Fragment Variantorg.apache.sling.testing.clients.SlingHttpResponse
getPlainHtmlRendering(String variantPath, int... expectedStatus)
Call the Plain Html Processor for an Experience Fragment Variantorg.apache.sling.testing.clients.SlingHttpResponse
getSocialUrls(String variantPath, int... expectedStatus)
Get the Social Urls for the a Social Experience Fragment Variantorg.apache.sling.testing.clients.SlingHttpResponse
getVariantProperitesPageHTML(String variantPath, int... expectedStatus)
org.apache.sling.testing.clients.SlingHttpResponse
getXFPropertiesPageHTHML(String xfPath, int... expectedStatus)
ExperienceFragmentsClient.ExperienceFragmentVariant
getXFVariant(String variantPath)
Get the Experience Fragment Variant as an object ofExperienceFragmentsClient.ExperienceFragmentVariant
classorg.apache.sling.testing.clients.SlingHttpResponse
publishXF(String xfPath, int... expectedStatus)
org.apache.sling.testing.clients.SlingHttpResponse
publishXFVariant(String variantPath, int... expectedStatus)
org.apache.sling.testing.clients.SlingHttpResponse
unblishXF(String xfPath, int... expectedStatus)
org.apache.sling.testing.clients.SlingHttpResponse
unpublish(String pagePath, int... expectedStatus)
org.apache.sling.testing.clients.SlingHttpResponse
unpublishXFVariant(String variantPath, int... expectedStatus)
ExperienceFragmentsClient.ExperienceFragmentVariantBuilder
xfVariantBuilder(String parentPath, ExperienceFragmentsClient.XF_TEMPLATE template, String title)
ExperienceFragmentsClient.ExperienceFragmentVariantBuilder
xfVariantBuilder(String parentPath, String template, String title)
-
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
-
DEFAULT_XF_PARENT_PATH
public static final String DEFAULT_XF_PARENT_PATH
- See Also:
- Constant Field Values
-
TITLE_PROP
public static final String TITLE_PROP
- See Also:
- Constant Field Values
-
-
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
-
-
Method Detail
-
experienceFragmentBuilder
public ExperienceFragmentsClient.ExperienceFragmentBuilder experienceFragmentBuilder(String xfTitle, String variantTitle, String variantTemplate)
- Parameters:
xfTitle
- title for the experience fragmentvariantTitle
- title for the experience fragment variantvariantTemplate
- template for the experience fragment variant- Returns:
- a new
ExperienceFragmentsClient.ExperienceFragmentBuilder
-
experienceFragmentBuilder
public ExperienceFragmentsClient.ExperienceFragmentBuilder experienceFragmentBuilder(String xfTitle, String variantTitle, ExperienceFragmentsClient.XF_TEMPLATE variantTemplate)
- Parameters:
xfTitle
- title for the experience fragmentvariantTitle
- title for the experience fragment variantvariantTemplate
- template for the experience fragment variant- Returns:
- a new
ExperienceFragmentsClient.ExperienceFragmentBuilder
-
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 fragmentvariantTitle
- title for the experience fragment variantvariantTemplate
- template for the experience fragment variantexpectedStatus
- 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 fragmentvariantTitle
- title for the experience fragment variantvariantTemplate
- template for the experience fragment variantexpectedStatus
- 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
-
xfVariantBuilder
public ExperienceFragmentsClient.ExperienceFragmentVariantBuilder xfVariantBuilder(String parentPath, String template, String title)
- Parameters:
parentPath
- the parent experience fragment pathtemplate
- the variant templatetitle
- the variant title- Returns:
- a new
ExperienceFragmentsClient.ExperienceFragmentVariantBuilder
-
xfVariantBuilder
public ExperienceFragmentsClient.ExperienceFragmentVariantBuilder xfVariantBuilder(String parentPath, ExperienceFragmentsClient.XF_TEMPLATE template, String title)
- Parameters:
parentPath
- the parent experience fragment pathtemplate
- the variant templatetitle
- the variant title- Returns:
- a new
ExperienceFragmentsClient.ExperienceFragmentVariantBuilder
-
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 pathtemplate
- the variant templatetitle
- the variant titleexpectedStatus
- 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 pathtemplate
- the variant templatetitle
- the variant titleexpectedStatus
- 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 varianttitle
- the live copy variant's titlename
- the live copy variant's namerolloutConfigs
- the rollout configurations for the live copyexpectedStatus
- 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 FragmentexpectedStatus
- 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 Fragmentforce
- force deleteexpectedStatus
- 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 VariantexpectedStatus
- 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
-
getExperienceFragment
public ExperienceFragmentsClient.ExperienceFragment getExperienceFragment(String xfPath) throws org.apache.sling.testing.clients.ClientException
Get the Experience Fragment as an object ofExperienceFragmentsClient.ExperienceFragment
class- Parameters:
xfPath
- the path of the Experience Fragment- Returns:
- an object of
ExperienceFragmentsClient.ExperienceFragment
class - Throws:
org.apache.sling.testing.clients.ClientException
- if the request fails
-
getXFVariant
public ExperienceFragmentsClient.ExperienceFragmentVariant getXFVariant(String variantPath) throws org.apache.sling.testing.clients.ClientException
Get the Experience Fragment Variant as an object ofExperienceFragmentsClient.ExperienceFragmentVariant
class- Parameters:
variantPath
- the path of the Experience Fragment Variant- Returns:
- an object of
ExperienceFragmentsClient.ExperienceFragmentVariant
class - 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 VariantexpectedStatus
- 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 callingSlingHttpResponse.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 VariantexpectedStatus
- 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 callingSlingHttpResponse.getContent()
method - Throws:
org.apache.sling.testing.clients.ClientException
- if the request fails
-
convertToXF
public ExperienceFragmentsClient.ConvertToXFAction convertToXF()
Initiate a Convert to Experience Fragment- Returns:
- a new instance of
ExperienceFragmentsClient.ConvertToXFAction
-
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
-
getComponents
public <T extends ExperienceFragmentsClient.VariantComponents> T getComponents(String variantPath, ExperienceFragmentsClient.XF_TEMPLATE template) throws Exception
AExperienceFragmentsClient.VariantComponents
subclass object that can be used to configure the variant components defined in the template- Type Parameters:
T
- The subclass ofExperienceFragmentsClient.VariantComponents
to which the result should be casted to- Parameters:
variantPath
- the path of the Experience Fragment Varianttemplate
- the template of the Experience Fragment Variant- Returns:
- A
ExperienceFragmentsClient.VariantComponents
subclass object that can be used to configure the variant components defined in the template - Throws:
Exception
- if the components can not be retrieved
-
-