Package com.adobe.cq.testing.client
Class PackageManagerClient
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.PackageManagerClient
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.http.client.HttpClient
The PackageManagerClient encapsulates operations on content packages just like
those available in the /crx/packmgr/index.jsp
application. It
also uses the same API to invoke them (HTTP requests).
Provides methods to create a new empty package or upload one from the local disk
To manipulate an existing package, usePackageManagerClient.Package
, which can be obtained
using getPackage(String path)
.-
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
Fields inherited from class org.apache.sling.testing.clients.SlingClient
CLIENT_CONNECTION_TIMEOUT_PROP, DEFAULT_NODE_TYPE, SUDO_COOKIE_NAME
-
Constructor Summary
ConstructorDescriptionPackageManagerClient
(URI serverUrl, String user, String password) PackageManagerClient
(org.apache.http.impl.client.CloseableHttpClient http, org.apache.sling.testing.clients.SlingClientConfig config) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.sling.testing.clients.SlingHttpResponse
buildPackage
(String packageName, String packageVersion, String groupName, int... expectedStatus) Builds the specific package.createPackage
(String name, String version, String group) org.apache.sling.testing.clients.SlingHttpResponse
createPackage
(String packageName, String packageVersion, String groupName, int... expectedStatus) Creates a new package.org.apache.sling.testing.clients.SlingHttpResponse
deletePackage
(String packageName, String packageVersion, String groupName, int... expectedStatus) Deletes a package.getPackage
(String path) getPackageContentResponse
(String packageName, String packageVersion, String groupName) Returns the HTTP response for the package content request.getPackageCoverageResponse
(String packageName, String packageVersion, String groupName) Returns the HTTP response for the package content request.org.apache.sling.testing.clients.SlingHttpResponse
installPackage
(String packageName, String packageVersion, String groupName, int... expectedStatus) Installs the specific package.boolean
isPackageCreated
(String packageName, String packageVersion, String groupName) Checks if the package is created.org.apache.sling.testing.clients.SlingHttpResponse
renamePackages
(String oldName, String oldVersion, String oldGroup, String newName, String newVersion, String newGroup, int... expectedStatus) Renames a package.org.apache.sling.testing.clients.SlingHttpResponse
rewrapPackage
(String packageName, String packageVersion, String groupName, int... expectedStatus) Re-wraps the specific package.org.apache.sling.testing.clients.SlingHttpResponse
testInstallPackage
(String packageName, String packageVersion, String groupName, int... expectedStatus) Test installation for the specific package.org.apache.sling.testing.clients.SlingHttpResponse
uninstallPackage
(String packageName, String packageVersion, String groupName, int... expectedStatus) Uninstall the specific package.org.apache.sling.testing.clients.SlingHttpResponse
updateThumbnail
(String packageName, String packageVersion, String groupName, String resourcePath, String fileName, int... expectedStatus) Updates the thumbnail for a specific package.uploadPackage
(InputStream is, String fileName) org.apache.sling.testing.clients.SlingHttpResponse
uploadPackage
(String resourcePath, String fileName, int... expectedStatus) Uploads a package.org.apache.sling.testing.clients.SlingHttpResponse
uploadPictureAsScreenshot
(String packageName, String packageVersion, String groupName, String resourcePath, String fileName, int... expectedStatus) Uploads a screenshot for a package.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 Details
-
PackageManagerClient
public PackageManagerClient(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
-
PackageManagerClient
public PackageManagerClient(URI serverUrl, String user, String password) throws org.apache.sling.testing.clients.ClientException - Throws:
org.apache.sling.testing.clients.ClientException
-
-
Method Details
-
createPackage
public PackageManagerClient.Package createPackage(String name, String version, String group) throws org.apache.sling.testing.clients.ClientException - Throws:
org.apache.sling.testing.clients.ClientException
-
getPackage
public PackageManagerClient.Package getPackage(String path) throws org.apache.sling.testing.clients.ClientException - Throws:
org.apache.sling.testing.clients.ClientException
-
uploadPackage
public PackageManagerClient.Package uploadPackage(InputStream is, String fileName) throws org.apache.sling.testing.clients.ClientException - Throws:
org.apache.sling.testing.clients.ClientException
-
createPackage
public org.apache.sling.testing.clients.SlingHttpResponse createPackage(String packageName, String packageVersion, String groupName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Creates a new package.- Parameters:
packageName
- name of the package.packageVersion
- version of the package.groupName
- name of the group where the package will be created.expectedStatus
- list of accepted statuses- Returns:
- the response of post
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
deletePackage
public org.apache.sling.testing.clients.SlingHttpResponse deletePackage(String packageName, String packageVersion, String groupName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Deletes a package.- Parameters:
packageName
- Name of the package.packageVersion
- Package version.groupName
- Package group name.expectedStatus
- list of accepted statuses- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
renamePackages
public org.apache.sling.testing.clients.SlingHttpResponse renamePackages(String oldName, String oldVersion, String oldGroup, String newName, String newVersion, String newGroup, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Renames a package.- Parameters:
oldName
- The old package name.oldVersion
- The old package version.oldGroup
- The old package group.newName
- The The new name for the package.newVersion
- The new version for the package.newGroup
- The new group for the packageexpectedStatus
- list of accepted statuses- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
isPackageCreated
public boolean isPackageCreated(String packageName, String packageVersion, String groupName) throws org.apache.sling.testing.clients.ClientException Checks if the package is created.- Parameters:
packageName
- Name of the package.packageVersion
- Name of the version.groupName
- Name of the group.- Returns:
- True if the package is created or false otherwise.
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
buildPackage
public org.apache.sling.testing.clients.SlingHttpResponse buildPackage(String packageName, String packageVersion, String groupName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Builds the specific package.- Parameters:
packageName
- Name of the package.packageVersion
- Version for the package.groupName
- Group name for the package.expectedStatus
- list of accepted statuses- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
rewrapPackage
public org.apache.sling.testing.clients.SlingHttpResponse rewrapPackage(String packageName, String packageVersion, String groupName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Re-wraps the specific package.- Parameters:
packageName
- Name of the package.packageVersion
- Version for the package.groupName
- Group name for the package.expectedStatus
- List of expected statuses- Returns:
- The response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
installPackage
public org.apache.sling.testing.clients.SlingHttpResponse installPackage(String packageName, String packageVersion, String groupName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Installs the specific package.- Parameters:
packageName
- Name of the package.packageVersion
- Version for the package.groupName
- Group name for the package.expectedStatus
- List of expected statuses- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
uninstallPackage
public org.apache.sling.testing.clients.SlingHttpResponse uninstallPackage(String packageName, String packageVersion, String groupName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Uninstall the specific package.- Parameters:
packageName
- Name of the package.packageVersion
- Version for the package.groupName
- Group name for the package.expectedStatus
- list of expected status- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
testInstallPackage
public org.apache.sling.testing.clients.SlingHttpResponse testInstallPackage(String packageName, String packageVersion, String groupName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Test installation for the specific package.- Parameters:
packageName
- Name of the package.packageVersion
- Version for the package.groupName
- Group name for the package.expectedStatus
- list of expected statuses- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
uploadPackage
public org.apache.sling.testing.clients.SlingHttpResponse uploadPackage(String resourcePath, String fileName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Uploads a package.- Parameters:
resourcePath
- File's path.fileName
- Name of the file.expectedStatus
- list of expected statuses- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
getPackageContentResponse
public String getPackageContentResponse(String packageName, String packageVersion, String groupName) throws org.apache.sling.testing.clients.ClientException Returns the HTTP response for the package content request.- Parameters:
packageName
- name of the packagepackageVersion
- version of the packagegroupName
- group of the package- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
getPackageCoverageResponse
public String getPackageCoverageResponse(String packageName, String packageVersion, String groupName) throws org.apache.sling.testing.clients.ClientException Returns the HTTP response for the package content request.- Parameters:
packageName
- name of the packagepackageVersion
- version of the packagegroupName
- group of the package- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
updateThumbnail
public org.apache.sling.testing.clients.SlingHttpResponse updateThumbnail(String packageName, String packageVersion, String groupName, String resourcePath, String fileName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Updates the thumbnail for a specific package.- Parameters:
packageName
- Name of the packagepackageVersion
- Version of the packagegroupName
- Name of the groupresourcePath
- Path to the thumbnailfileName
- Name of the thumbnailexpectedStatus
- list of expected statuses- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
uploadPictureAsScreenshot
public org.apache.sling.testing.clients.SlingHttpResponse uploadPictureAsScreenshot(String packageName, String packageVersion, String groupName, String resourcePath, String fileName, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Uploads a screenshot for a package.- Parameters:
packageName
- name of the packagepackageVersion
- version of the packagegroupName
- group of the packageresourcePath
- path to the thumbnailfileName
- name of the thumbnailexpectedStatus
- list of expected statuses- Returns:
- the response
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-