public class ComponentClient extends CQClient
CQClient.Builder, CQClient.InternalBuilder<T extends CQClient>| Modifier and Type | Field and Description |
|---|---|
static String |
ORDER_AFTER_PREFIX |
static String |
ORDER_BEFORE_PREFIX |
static String |
ORDER_FIRST |
static String |
ORDER_LAST |
LOG, STATISTICS_ROOT, wcmCommands| Constructor and Description |
|---|
ComponentClient(org.apache.http.impl.client.CloseableHttpClient http,
org.apache.sling.testing.clients.SlingClientConfig config) |
ComponentClient(URI serverUrl,
String user,
String password) |
| Modifier and Type | Method and Description |
|---|---|
<T extends AbstractComponent> |
addComponent(Class<T> componentClass,
String pagePath,
int... expectedStatus)
Adds a new, empty component to a CQ page.
|
<T extends AbstractComponent> |
addComponent(Class<T> componentClass,
String pagePath,
String order,
int... expectedStatus)
Adds a new, empty component to a CQ page.
|
<T extends AbstractComponent> |
addComponent(Class<T> componentClass,
String pagePath,
String location,
String nameHint,
String order,
int... expectedStatus)
Adds a new, empty component to a CQ page.
|
void |
deleteComponent(AbstractComponent delComp)
Deletes a component.
|
void |
deleteComponent(String componentPath)
Deletes a component.
|
Class<? extends AbstractComponent> |
getCompClassByResourceType(String resourceType)
Returns the component wrapper class, that has been registered with this resourceType or
null if no such resourceType is known.
|
<T extends AbstractComponent> |
getComponent(String componentPath)
Initializes an
AbstractComponent subclass
against an existing foundation component node. |
<T extends AbstractComponent> |
getComponent(String componentPath,
Class<T> compClass)
Initializes an
AbstractComponent subclass
against an existing foundation component node. |
void |
registerComponent(String resourceType,
Class<? extends AbstractComponent> c)
Use this method to register additional component wrappers with the client.
|
copyLanguages, copyPage, createPage, createPageWithRetry, createVersion, deletePage, deletePageWithRetry, lockPage, movePage, movePage, resetPageStatistics, restoreTree, restoreVersion, rolloutPage, searchAndReplaceInPages, searchInPages, setPageProperties, setPageProperty, setPagePropertyImage, unlockPage, uploadAsset, uploadFileCQStylecreateFolder, createNode, createNodeRecursive, deletePath, doGetJson, exists, getJsonNode, getJsonNode, getNodeNameFromPath, getParentPath, getUUId, getUUID, importContent, importContent, importJson, move, setPropertiesString, setPropertyString, setPropertyStringArray, upload, waitExists, waitUntilExistsadaptTo, 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, getUser, getValue, getValues, hasValuepublic static final String ORDER_FIRST
public static final String ORDER_LAST
public static final String ORDER_BEFORE_PREFIX
public static final String ORDER_AFTER_PREFIX
public ComponentClient(org.apache.http.impl.client.CloseableHttpClient http,
org.apache.sling.testing.clients.SlingClientConfig config)
throws org.apache.sling.testing.clients.ClientException
org.apache.sling.testing.clients.ClientExceptionpublic <T extends AbstractComponent> T addComponent(Class<T> componentClass, String pagePath, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException, InterruptedException
AbstractComponent.DEFAULT_LOCATION
inside the page.T - A subclass of AbstractComponentcomponentClass - the AbstractComponent
subclass to be createdpagePath - path to the page where the component gets addedexpectedStatus - list of expected HTTP Status to be returned, if not set, 200 is assumed.componentClassorg.apache.sling.testing.clients.ClientException - if the request failsInterruptedException - to mark this method as waitingpublic <T extends AbstractComponent> T addComponent(Class<T> componentClass, String pagePath, String order, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException, InterruptedException
AbstractComponent.DEFAULT_LOCATION
inside the page.T - A subclass of AbstractComponentcomponentClass - the AbstractComponent
subclass to be createdpagePath - path to the page where the component gets addedorder - Defines where the component should be added in relation to its siblings. Possible values
are first, last, before [nodeName], after [nodeName].expectedStatus - list of expected HTTP Status to be returned, if not set, 200 is assumed.componentClassorg.apache.sling.testing.clients.ClientException - if the request failsInterruptedException - to mark this method as waitingpublic <T extends AbstractComponent> T addComponent(Class<T> componentClass, String pagePath, String location, String nameHint, String order, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException, InterruptedException
T - A subclass of AbstractComponentcomponentClass - the AbstractComponent subclass to be
createdpagePath - path to the page where the component gets addedlocation - relative path inside the page where the component gets addednameHint - proposed node for the new component node. Might get altered if the name if there is
already
a node with the same name on the same level. AbstractComponent.getName()
returns the name as is it is really set.order - Defines where the component should be added in relation to its siblings. Possible values
are first, last, before [nodeName], after [nodeName].expectedStatus - list of expected HTTP Status to be returned, if not set, 200 is assumed.componentClassorg.apache.sling.testing.clients.ClientException - if the request failsInterruptedException - to mark this method as waitingpublic <T extends AbstractComponent> T getComponent(String componentPath, Class<T> compClass) throws org.apache.sling.testing.clients.ClientException
AbstractComponent subclass
against an existing foundation component node.T - A subclass of AbstractComponentcomponentPath - complete path to the the repository node that forms the root node of a
component. Must contain a property named sling:resourceType referencing
a valid component.compClass - The component wrapper class to be initializedcomponentClassorg.apache.sling.testing.clients.ClientException - if the request failspublic <T extends AbstractComponent> T getComponent(String componentPath) throws org.apache.sling.testing.clients.ClientException
AbstractComponent subclass
against an existing foundation component node. t looks for the sling:resourceType property an tries to find a
matching component wrapper that has been registered with the ComponentClient (see registerComponent(String, Class))T - A subclass of AbstractComponentcomponentPath - complete path to the the repository node that forms the root node of a
component. Must contain a property named sling:resourceType referencing
a valid component.componentClassorg.apache.sling.testing.clients.ClientException - if the request failspublic void registerComponent(String resourceType, Class<? extends AbstractComponent> c)
getComponent(String)
to return the correct wrapper for a given component path, and by the
AbstractComponent.getNext() and
AbstractComponent.getPrevious()
to return the next/previous componentresourceType - the resource type to registerc - the corresponding component wrapper classpublic Class<? extends AbstractComponent> getCompClassByResourceType(String resourceType)
registerComponent(String, Class)}.resourceType - resource type to look uppublic void deleteComponent(AbstractComponent delComp) throws org.apache.sling.testing.clients.ClientException
delComp - The component to deleteorg.apache.sling.testing.clients.ClientException - If the delete request failspublic void deleteComponent(String componentPath) throws org.apache.sling.testing.clients.ClientException
componentPath - the path to the components nodeorg.apache.sling.testing.clients.ClientException - If the delete request failsCopyright © 2018. All rights reserved.