Package com.adobe.cq.testing.client
Class CommerceClient
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.FormClient
com.adobe.cq.testing.client.CommerceClient
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.http.client.HttpClient
The base client for all commerce-related tests. It provides a core set of commonly used commerce
functions such as getting carts and orders, etc.
It extends from
It extends from
FormClient which in turn provides a core set
of commonly used website, page and form functionality.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.adobe.cq.testing.client.CQClient
CQClient.InternalBuilder<T extends CQClient> -
Field Summary
FieldsFields inherited from class com.adobe.cq.testing.client.CQClient
LOG, STATISTICS_ROOT, wcmCommandsFields inherited from class org.apache.sling.testing.clients.SlingClient
CLIENT_CONNECTION_TIMEOUT_PROP, DEFAULT_NODE_TYPE, SUDO_COOKIE_NAME -
Constructor Summary
ConstructorsConstructorDescriptionCommerceClient(URI serverUrl, String user, String password) CommerceClient(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.sling.testing.clients.SlingHttpResponseaddAttribute(String managementPath, String categoryPath, String title, String attrName, String attrUnit, int... expectedStatus) Adds an attributeorg.apache.sling.testing.clients.SlingHttpResponseaddCategory(String managementPath, String parentCategoryPath, String title, int... expectedStatus) Adds a categoryorg.apache.sling.testing.clients.SlingHttpResponseaddProduct(String parent, String title, double price) Create a new product.org.apache.sling.testing.clients.SlingHttpResponseaddProduct(String parent, String title, double price, String description, String sku, String color, String size) Create a new product.org.apache.sling.testing.clients.SlingHttpResponseaddProductAsset(String product, String asset) Add an asset to a product.org.apache.sling.testing.clients.SlingHttpResponseaddProductVariant(String parentProduct, String title, double price, String description, String sku, String color, String size) Add a product variant.org.apache.sling.testing.clients.SlingHttpResponseaddReferences(String managementPath, String collectionPath, String[] referencePaths, int... expectedStatus) Adds one or multiple references to a collectionorg.apache.sling.testing.clients.SlingHttpResponseaddRootCategory(String managementPath, String classificationPath, String title, int... expectedStatus) Adds a root categoryorg.apache.sling.testing.clients.SlingHttpResponseaddSQL2QueryFilter(String blueprintPath, String query) Set the product filter of a blueprint or blueprint section using a JCR-SQL2 query.org.apache.sling.testing.clients.SlingHttpResponseaddTagFilter(String blueprintPath, String productFolder, String tag) Set the product filter of a blueprint or blueprint section using a product base path and a tag.org.apache.sling.testing.clients.SlingHttpResponseaddTagToProduct(String tagPath, String productPath) Assign a tag to a product.org.apache.sling.testing.clients.SlingHttpResponseaddToCart(String managementPath, String productPath, String listPath, boolean delete, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) Add a product to the cartorg.apache.sling.testing.clients.SlingHttpResponseaddToSmartList(String managementPath, String productPath, String listName, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) Adds an entry to a smartlist.org.apache.sling.testing.clients.SlingHttpResponseaddXPathQueryFilter(String blueprintPath, String query) Set the product filter of a blueprint or blueprint section using an XPath query.voidclearCommerceContext(String homePath) Clear out the commerce context from the user's home directory.org.apache.sling.testing.clients.SlingHttpResponseclearShoppingCart(String page) Clears the shopping cart using the ContextHub.org.apache.sling.testing.clients.SlingHttpResponseconfigureProductComponent(String productPagePath, String productPath) Update the product component on a page to point to the given product and generate the product hierarchy.org.apache.sling.testing.clients.SlingHttpResponsecreateBlueprint(String title, String description, String parentPath, String catalogTemplate, String sectionTemplate, String productTemplate, boolean proxyPages) Create a new blueprint.org.apache.sling.testing.clients.SlingHttpResponsecreateBlueprintSection(String name, String description, String parentPath, boolean proxyPages) Create a new blueprint section.org.apache.sling.testing.clients.SlingHttpResponsecreateCatalog(String source, String dest, String label, String title, int... expectedStatus) Creates a catalog from a blueprintorg.apache.sling.testing.clients.SlingHttpResponsecreateClassification(String managementPath, String parentPath, String title, int... expectedStatus) Creates a classificationorg.apache.sling.testing.clients.SlingHttpResponsecreateCollection(String managementPath, String parentPath, String title, String type, String[] referencePaths, int... expectedStatus) Creates a collectionorg.apache.sling.testing.clients.SlingHttpResponsecreateCollection(String managementPath, String parentPath, String title, String type, String search, String searchType, String[] referencePaths, int... expectedStatus) Creates a collectionorg.apache.sling.testing.clients.SlingHttpResponsecreateSmartList(String managementPath, String title, boolean defaultList, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) Creates a smartlistorg.apache.sling.testing.clients.SlingHttpResponsedeleteProductAsset(String productAssetPath) Deletes an asset from a product.org.apache.sling.testing.clients.SlingHttpResponsedeleteSmartListEntry(String managementPath, String productPath, String listName, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) Deletes an entry form a smartlistorg.apache.sling.testing.clients.SlingHttpResponsedoCommerceGet(String path, String cookieText) org.apache.sling.testing.clients.SlingHttpResponseExecute a commerce-oriented POST request.org.apache.sling.testing.clients.SlingHttpResponseeditSmartList(String managementPath, String listPath, String redirect, String title, String description, List<org.apache.http.Header> headers, int... expectedStatus) Edits the properties of a smartlistcom.fasterxml.jackson.databind.JsonNodeReturn the user's shopping cart.getCommerceCookieText(org.apache.http.HttpResponse resp) Return the cookie values concatenated into a single string.com.fasterxml.jackson.databind.JsonNodeRetrieves the committed orders.booleanisProductPage(String productPage) Check if a product page is a regular product page based on its resource type.booleanisProxyPage(String productPage) Check if a product page is a proxy product page based on its resource type.org.apache.sling.testing.clients.SlingHttpResponsemanageSmartListsDefault(String managementPath, String title, String[] defaultList, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) Manage the default setting of a smartlistorg.apache.sling.testing.clients.SlingHttpResponsemanageSmartListsDelete(String managementPath, String title, String[] delete, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) Delete one or multiple smartlistsorg.apache.sling.testing.clients.SlingHttpResponsemodifyQuantitySmartListEntry(String managementPath, String productPath, String listPath, String redirect, String quantity, List<org.apache.http.Header> headers, int... expectedStatus) Modifies the quantity of an entry on a smartlistorg.apache.sling.testing.clients.SlingHttpResponseremoveCategory(String managementPath, String categoryPath, int... expectedStatus) Removes a categoryorg.apache.sling.testing.clients.SlingHttpResponseremoveClassification(String managementPath, String classificationPath, int... expectedStatus) Removes a classificationorg.apache.sling.testing.clients.SlingHttpResponseremoveCollection(String managementPath, String collectionPath, int... expectedStatus) Removes a collectionorg.apache.sling.testing.clients.SlingHttpResponseremoveReferences(String managementPath, String collectionPath, String[] referencePaths, int... expectedStatus) Removes one or multiple references from a collectionorg.apache.sling.testing.clients.SlingHttpResponserolloutSection(String source, String dest, boolean force, int... expectedStatus) Rolls out a sectionorg.apache.sling.testing.clients.SlingHttpResponsesetCommerceProvider(String url, String commerceProvider) Adds or updates the cq:commerceProvider property to a JCR node at a given url.org.apache.sling.testing.clients.SlingHttpResponseupdateCategory(String managementPath, String categoryPath, String title, int... expectedStatus) Update the attributes of a categoryorg.apache.sling.testing.clients.SlingHttpResponseupdateCollection(String managementPath, String collectionPath, String title, String[] referencePaths, int... expectedStatus) Updates the properties of a collectionorg.apache.sling.testing.clients.SlingHttpResponseupdateProductAsset(String productAssetPath, String newAsset) Update an existing asset of a product.Methods inherited from class com.adobe.cq.testing.client.FormClient
doFormPostMethods 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, uploadFileCQStyleMethods 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, waitUntilExistsMethods 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 Details
-
PRODUCT_PAGE_RESOURCE_TYPE
- See Also:
-
PROXY_PRODUCT_PAGE_RESOURCE_TYPE
- See Also:
-
-
Constructor Details
-
CommerceClient
public CommerceClient(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
-
CommerceClient
public CommerceClient(URI serverUrl, String user, String password) throws org.apache.sling.testing.clients.ClientException - Throws:
org.apache.sling.testing.clients.ClientException
-
-
Method Details
-
doCommercePost
public org.apache.sling.testing.clients.SlingHttpResponse doCommercePost(String path, String cookieText, Map<String, String> parameters) throws org.apache.sling.testing.clients.ClientExceptionExecute a commerce-oriented POST request. Similar to adminAuthor.doPost(), but allows for the setting of a session cookie.- Parameters:
path- request pathcookieText- cookie to be addedparameters- list of parameters- Returns:
- the http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
doCommerceGet
public org.apache.sling.testing.clients.SlingHttpResponse doCommerceGet(String path, String cookieText) throws org.apache.sling.testing.clients.ClientException - Throws:
org.apache.sling.testing.clients.ClientException
-
getCart
public com.fasterxml.jackson.databind.JsonNode getCart(String homePath) throws org.apache.sling.testing.clients.ClientException Return the user's shopping cart. NOTE: carts are no longer stored in the users' homes. See getCookieText() to get the cart.- Parameters:
homePath- home path- Returns:
- the cart as json node
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
getOrders
public com.fasterxml.jackson.databind.JsonNode getOrders() throws org.apache.sling.testing.clients.ClientExceptionRetrieves the committed orders.- Returns:
- the orders as a json node
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
getCommerceCookieText
Return the cookie values concatenated into a single string. The cart and order details will be contained in the result.- Parameters:
resp- http response- Returns:
- the cookie text
-
clearCommerceContext
public void clearCommerceContext(String homePath) throws org.apache.sling.testing.clients.ClientException Clear out the commerce context from the user's home directory.- Parameters:
homePath- home path- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
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 blueprintdest- destination path to the cataloglabel- label of the catalogtitle- title of the catalogexpectedStatus- expected HTTP response status code- Returns:
- the sling 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 blueprintdest- destination path to the catalogforce- whether the rollout should be forcedexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
createClassification
public org.apache.sling.testing.clients.SlingHttpResponse createClassification(String managementPath, String parentPath, String title, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Creates a classification- Parameters:
managementPath- path to which the request should be sentparentPath- path to the parent nodetitle- name of the classificationexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
removeClassification
public org.apache.sling.testing.clients.SlingHttpResponse removeClassification(String managementPath, String classificationPath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Removes a classification- Parameters:
managementPath- path to which the request should be sentclassificationPath- path to the classificationexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
addRootCategory
public org.apache.sling.testing.clients.SlingHttpResponse addRootCategory(String managementPath, String classificationPath, String title, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Adds a root category- Parameters:
managementPath- path to which the request should be sentclassificationPath- path to the classificationtitle- name of the categoryexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
addCategory
public org.apache.sling.testing.clients.SlingHttpResponse addCategory(String managementPath, String parentCategoryPath, String title, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Adds a category- Parameters:
managementPath- path to which the request should be sentparentCategoryPath- path to the parent categorytitle- name of the categoryexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
removeCategory
public org.apache.sling.testing.clients.SlingHttpResponse removeCategory(String managementPath, String categoryPath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Removes a category- Parameters:
managementPath- path to which the request should be sentcategoryPath- path to the categoryexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
updateCategory
public org.apache.sling.testing.clients.SlingHttpResponse updateCategory(String managementPath, String categoryPath, String title, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Update the attributes of a category- Parameters:
managementPath- path to which the request should be sentcategoryPath- path to the categorytitle- name of the categoryexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
addAttribute
public org.apache.sling.testing.clients.SlingHttpResponse addAttribute(String managementPath, String categoryPath, String title, String attrName, String attrUnit, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Adds an attribute- Parameters:
managementPath- path to which the request should be sentcategoryPath- path to the categorytitle- attribute titleattrName- attribute nameattrUnit- attribute unitexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
createCollection
public org.apache.sling.testing.clients.SlingHttpResponse createCollection(String managementPath, String parentPath, String title, String type, String search, String searchType, String[] referencePaths, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Creates a collection- Parameters:
managementPath- path to which the request should be sentparentPath- path to the parent nodetitle- name of the collectiontype- type of the collectionsearch- searchsearchType- search type of the collectionreferencePaths- reference pathsexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
createCollection
public org.apache.sling.testing.clients.SlingHttpResponse createCollection(String managementPath, String parentPath, String title, String type, String[] referencePaths, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Creates a collection- Parameters:
managementPath- path to which the request should be sentparentPath- path to the parent nodetitle- title of the collectiontype- type of the collectionreferencePaths- reference pathsexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
updateCollection
public org.apache.sling.testing.clients.SlingHttpResponse updateCollection(String managementPath, String collectionPath, String title, String[] referencePaths, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Updates the properties of a collection- Parameters:
managementPath- path to which the request should be sentcollectionPath- path to the collectiontitle- name of the collectionreferencePaths- reference pathsexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
removeCollection
public org.apache.sling.testing.clients.SlingHttpResponse removeCollection(String managementPath, String collectionPath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Removes a collection- Parameters:
managementPath- path to which the request should be sentcollectionPath- path to the collectionexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
addReferences
public org.apache.sling.testing.clients.SlingHttpResponse addReferences(String managementPath, String collectionPath, String[] referencePaths, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Adds one or multiple references to a collection- Parameters:
managementPath- path to which the request should be sentcollectionPath- path to the collectionreferencePaths- list of HTTP headersexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
removeReferences
public org.apache.sling.testing.clients.SlingHttpResponse removeReferences(String managementPath, String collectionPath, String[] referencePaths, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Removes one or multiple references from a collection- Parameters:
managementPath- path to which the request should be sentcollectionPath- path tp the collectionreferencePaths- list of HTTP headersexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
createSmartList
public org.apache.sling.testing.clients.SlingHttpResponse createSmartList(String managementPath, String title, boolean defaultList, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Creates a smartlist- Parameters:
managementPath- path to which the request should be senttitle- name of the smartlistdefaultList- should the created list be a default list?redirect- redirection pathheaders- list of HTTP headersexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
manageSmartListsDelete
public org.apache.sling.testing.clients.SlingHttpResponse manageSmartListsDelete(String managementPath, String title, String[] delete, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Delete one or multiple smartlists- Parameters:
managementPath- path to which the request should be senttitle- name of the smartlistdelete- one or multiple smartlists to deleteredirect- redirection pathheaders- list of HTTP headersexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
manageSmartListsDefault
public org.apache.sling.testing.clients.SlingHttpResponse manageSmartListsDefault(String managementPath, String title, String[] defaultList, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Manage the default setting of a smartlist- Parameters:
managementPath- path to which the request should be senttitle- name of the smartlistdefaultList- one or multiple smartlists that should be a default listredirect- redirection pathheaders- list of HTTP headersexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
editSmartList
public org.apache.sling.testing.clients.SlingHttpResponse editSmartList(String managementPath, String listPath, String redirect, String title, String description, List<org.apache.http.Header> headers, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Edits the properties of a smartlist- Parameters:
managementPath- path to which the request should be sentlistPath- path to the smartlistredirect- redirection pathtitle- name of the smartlistdescription- description of the smartlistheaders- list of HTTP headersexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
addToSmartList
public org.apache.sling.testing.clients.SlingHttpResponse addToSmartList(String managementPath, String productPath, String listName, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Adds an entry to a smartlist.- Parameters:
managementPath- path to which the request should be sentproductPath- path to the productlistName- name of the smartlistredirect- redirection pathheaders- list of HTTP headersexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
deleteSmartListEntry
public org.apache.sling.testing.clients.SlingHttpResponse deleteSmartListEntry(String managementPath, String productPath, String listName, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Deletes an entry form a smartlist- Parameters:
managementPath- path to which the request should be sentproductPath- path to the productlistName- name of the smartlistredirect- redirection pathheaders- list of HTTP headersexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
modifyQuantitySmartListEntry
public org.apache.sling.testing.clients.SlingHttpResponse modifyQuantitySmartListEntry(String managementPath, String productPath, String listPath, String redirect, String quantity, List<org.apache.http.Header> headers, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Modifies the quantity of an entry on a smartlist- Parameters:
managementPath- path to which the request should be sentproductPath- path to the productlistPath- path to the smartlistredirect- redirection pathquantity- new quantityheaders- list of HTTP headersexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
addToCart
public org.apache.sling.testing.clients.SlingHttpResponse addToCart(String managementPath, String productPath, String listPath, boolean delete, String redirect, List<org.apache.http.Header> headers, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Add a product to the cart- Parameters:
managementPath- path to which the request should be sentproductPath- path to the productlistPath- path to the smartlistdelete- should the product be deleted from its smartlist?redirect- redirection pathheaders- list of HTTP headersexpectedStatus- expected HTTP response status code- Returns:
- the sling http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request could not be executed
-
configureProductComponent
public org.apache.sling.testing.clients.SlingHttpResponse configureProductComponent(String productPagePath, String productPath) throws org.apache.sling.testing.clients.ClientException Update the product component on a page to point to the given product and generate the product hierarchy.- Parameters:
productPagePath- Path to product pageproductPath- Path to the product- Returns:
- the http response
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
addProduct
public org.apache.sling.testing.clients.SlingHttpResponse addProduct(String parent, String title, double price) throws org.apache.sling.testing.clients.ClientException Create a new product.- Parameters:
parent- Parent foldertitle- Nameprice- Price- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
addProduct
public org.apache.sling.testing.clients.SlingHttpResponse addProduct(String parent, String title, double price, String description, String sku, String color, String size) throws org.apache.sling.testing.clients.ClientException Create a new product.- Parameters:
parent- Parent foldertitle- Nameprice- Pricedescription- Descriptionsku- SKU identifiercolor- Colorsize- Size- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
addTagToProduct
public org.apache.sling.testing.clients.SlingHttpResponse addTagToProduct(String tagPath, String productPath) throws org.apache.sling.testing.clients.ClientException Assign a tag to a product.- Parameters:
tagPath- Path to the tag.productPath- Path to the product.- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
addProductAsset
public org.apache.sling.testing.clients.SlingHttpResponse addProductAsset(String product, String asset) throws org.apache.sling.testing.clients.ClientException Add an asset to a product.- Parameters:
product- Path to productasset- Path to asset- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
updateProductAsset
public org.apache.sling.testing.clients.SlingHttpResponse updateProductAsset(String productAssetPath, String newAsset) throws org.apache.sling.testing.clients.ClientException Update an existing asset of a product.- Parameters:
productAssetPath- Path to the product's asset (e.g. ProductPath + "/assets/asset0")newAsset- Path to new asset- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
deleteProductAsset
public org.apache.sling.testing.clients.SlingHttpResponse deleteProductAsset(String productAssetPath) throws org.apache.sling.testing.clients.ClientException Deletes an asset from a product.- Parameters:
productAssetPath- Path to the product's asset (e.g. ProductPath + "/assets/asset0")- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
addProductVariant
public org.apache.sling.testing.clients.SlingHttpResponse addProductVariant(String parentProduct, String title, double price, String description, String sku, String color, String size) throws org.apache.sling.testing.clients.ClientException Add a product variant.- Parameters:
parentProduct- Path of parent producttitle- Titleprice- Pricedescription- Descriptionsku- SKU identifiercolor- Colorsize- Size- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
createBlueprint
public org.apache.sling.testing.clients.SlingHttpResponse createBlueprint(String title, String description, String parentPath, String catalogTemplate, String sectionTemplate, String productTemplate, boolean proxyPages) throws org.apache.sling.testing.clients.ClientException Create a new blueprint.- Parameters:
title- Titledescription- DescriptionparentPath- Path under which the blueprint should be createdcatalogTemplate- Path to catalog page templatesectionTemplate- Path to section page templateproductTemplate- Path to product page templateproxyPages- Whether proxy pages should be generated- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
createBlueprintSection
public org.apache.sling.testing.clients.SlingHttpResponse createBlueprintSection(String name, String description, String parentPath, boolean proxyPages) throws org.apache.sling.testing.clients.ClientException Create a new blueprint section.- Parameters:
name- Namedescription- DescriptionparentPath- Path of the parent blueprint or blueprint sectionproxyPages- Whether proxy pages should be generated- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
isProductPage
public boolean isProductPage(String productPage) throws org.apache.sling.testing.clients.ClientException Check if a product page is a regular product page based on its resource type.- Parameters:
productPage- Path to product page- Returns:
- true if the page is a product page
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
isProxyPage
public boolean isProxyPage(String productPage) throws org.apache.sling.testing.clients.ClientException Check if a product page is a proxy product page based on its resource type.- Parameters:
productPage- Path to product page- Returns:
- true if the page is a proxy
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
addTagFilter
public org.apache.sling.testing.clients.SlingHttpResponse addTagFilter(String blueprintPath, String productFolder, String tag) throws org.apache.sling.testing.clients.ClientException Set the product filter of a blueprint or blueprint section using a product base path and a tag.- Parameters:
blueprintPath- Blueprint or blueprint section pathproductFolder- Product Foldertag- Tag- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
addSQL2QueryFilter
public org.apache.sling.testing.clients.SlingHttpResponse addSQL2QueryFilter(String blueprintPath, String query) throws org.apache.sling.testing.clients.ClientException Set the product filter of a blueprint or blueprint section using a JCR-SQL2 query.- Parameters:
blueprintPath- Blueprint or blueprint section pathquery- JCQ-SQL2 query- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
addXPathQueryFilter
public org.apache.sling.testing.clients.SlingHttpResponse addXPathQueryFilter(String blueprintPath, String query) throws org.apache.sling.testing.clients.ClientException Set the product filter of a blueprint or blueprint section using an XPath query.- Parameters:
blueprintPath- Blueprint or blueprint section pathquery- XPath query- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
clearShoppingCart
public org.apache.sling.testing.clients.SlingHttpResponse clearShoppingCart(String page) throws org.apache.sling.testing.clients.ClientException Clears the shopping cart using the ContextHub. Works only on the client side.- Parameters:
page- Content page that can be used to call the ContextHub- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-
setCommerceProvider
public org.apache.sling.testing.clients.SlingHttpResponse setCommerceProvider(String url, String commerceProvider) throws org.apache.sling.testing.clients.ClientException Adds or updates the cq:commerceProvider property to a JCR node at a given url.- Parameters:
url- URL of the nodecommerceProvider- commerce provider identifier- Returns:
- SlingHttpResponse object
- Throws:
org.apache.sling.testing.clients.ClientException- if the request fails
-