Package com.adobe.cq.testing.client
Class TemplateEditorManagerClient
- 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.TemplateEditorManagerClient
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.http.client.HttpClient
public final class TemplateEditorManagerClient extends CQClient
Client to create and update the page template. To create a default template usecreateDefaultTemplate(String configPath, String title, String Description)
To create a template with give type usecreateTemplate(String configPath, String templateType, String title, String Description)
To create Default Container on top level of a template usecreateTopLevelDefaultContainer(String templatePath, String name)
To create a Default container in a template usecreateDefaultContainer(String templatePath, String location, String name)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adobe.cq.testing.client.CQClient
CQClient.Builder, CQClient.InternalBuilder<T extends CQClient>
-
-
Field Summary
-
Fields inherited from class com.adobe.cq.testing.client.CQClient
LOG, STATISTICS_ROOT, wcmCommands
-
-
Constructor Summary
Constructors Constructor Description TemplateEditorManagerClient(URI serverUrl, String user, String password)
TemplateEditorManagerClient(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
createDefaultContainer(String templatePath, String location, String nameHint)
Creates default layout container (responsivegrid) on the provided location of the provided templateString
createDefaultTemplate(String configPath, String title, String description)
Creates a default page template of type HTML5String
createTemplate(String configPath, String templateType, String title, String description)
Creates a page template with given template typeString
createTopLevelDefaultContainer(String templatePath, String nameHint)
Creates a default layout container (responsivegrid) on structure top level of the provided templatevoid
disable(String templatePath)
Disables an existing templatevoid
enable(String templatePath)
Enables a existing templateString
importPolicy(String configPath, String jsonString)
Update the policy of an existing CQConfig with the provides policyString
setComponentPolicy(String componentPath, String policyPath)
Set the policy mapping for a component.void
setStructureComponentLock(String componentPath, boolean isLocked)
Lock / unlock a component in the structure tree of a templatevoid
unlockStructureComponent(String componentPath)
Unlock a component in the structure tree of a template-
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
-
-
-
-
Constructor Detail
-
TemplateEditorManagerClient
public TemplateEditorManagerClient(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
-
createDefaultTemplate
public String createDefaultTemplate(String configPath, String title, String description) throws org.apache.sling.testing.clients.ClientException, IOException
Creates a default page template of type HTML5- Parameters:
configPath
- path of config to be used to create a page templatetitle
- title of the templatedescription
- description of the template- Returns:
- created template path
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failsIOException
- if json parsing fails
-
createTemplate
public String createTemplate(String configPath, String templateType, String title, String description) throws org.apache.sling.testing.clients.ClientException, IOException
Creates a page template with given template type- Parameters:
configPath
- path of config to be used to create a page templatetemplateType
- type of the templatetitle
- title of the templatedescription
- description of the template- Returns:
- created template path
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failsIOException
- if json parsing fails
-
createDefaultContainer
public String createDefaultContainer(String templatePath, String location, String nameHint) throws org.apache.sling.testing.clients.ClientException
Creates default layout container (responsivegrid) on the provided location of the provided template- Parameters:
templatePath
- : path of the template the layout container should be created, i.e. /conf/myConfig/settings/wcm/templates/myTemplatelocation
- : the location the layout container should be created, i.e. /structure/jcr:content/root/nameHint
- : name hint for the layout container or null to create one- Returns:
- path of the created layout container
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request fails
-
createTopLevelDefaultContainer
public String createTopLevelDefaultContainer(String templatePath, String nameHint) throws org.apache.sling.testing.clients.ClientException
Creates a default layout container (responsivegrid) on structure top level of the provided template- Parameters:
templatePath
- : path of the template the layout container should be created, i.e. /conf/myConfig/settings/wcm/templates/myTemplatenameHint
- : name hint for the layout container or null to create one- Returns:
- path of the created layout container
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request fails
-
enable
public void enable(String templatePath) throws org.apache.sling.testing.clients.ClientException
Enables a existing template- Parameters:
templatePath
- path of the template to be enabled- Throws:
org.apache.sling.testing.clients.ClientException
- if the request fails
-
disable
public void disable(String templatePath) throws org.apache.sling.testing.clients.ClientException
Disables an existing template- Parameters:
templatePath
- path of the template to be disabled- Throws:
org.apache.sling.testing.clients.ClientException
- if the request fails
-
importPolicy
public String importPolicy(String configPath, String jsonString) throws org.apache.sling.testing.clients.ClientException
Update the policy of an existing CQConfig with the provides policy- Parameters:
configPath
- path of the config which needs to be updatedjsonString
- policy to be updated in json format- Returns:
- updated config path
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request fails
-
unlockStructureComponent
public void unlockStructureComponent(String componentPath) throws org.apache.sling.testing.clients.ClientException
Unlock a component in the structure tree of a template- Parameters:
componentPath
- : path of the component to be unlocked- Throws:
org.apache.sling.testing.clients.ClientException
- if the request fails
-
setStructureComponentLock
public void setStructureComponentLock(String componentPath, boolean isLocked) throws org.apache.sling.testing.clients.ClientException
Lock / unlock a component in the structure tree of a template- Parameters:
componentPath
- : path of the component to be locked / unlockedisLocked
- : true to lock the component, false to unlock the component- Throws:
org.apache.sling.testing.clients.ClientException
- if the request fails
-
setComponentPolicy
public String setComponentPolicy(String componentPath, String policyPath) throws org.apache.sling.testing.clients.ClientException
Set the policy mapping for a component. Note: The componentPath is the path to the component in the template structure tree except for components in a unlocked layout container, here the component path is the path to the layout container component in the template structure tree plus the component resource type, i.e. for a foundation text component in unlocked main layout container: /conf/myConfig/settings/wcm/templates/myTemplate/structure/jcr:content/root/responsivegrid/wcm/foundation/components/text- Parameters:
componentPath
- : the path of the component for which the policy should be setpolicyPath
- : the path of the policy to be set for the component, i.e. wcm/foundation/components/responsivegrid/default- Returns:
- path of the created/updated component policy
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request fails
-
-