Class SlingIntegrationTestClient
java.lang.Object
org.apache.sling.commons.testing.integration.SlingIntegrationTestClient
Client functions to interact with Sling in integration tests
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateNode(String url, Map<String, String> nodeProperties) Call the other createNode method with headers==nullcreateNode(String url, Map<String, String> clientNodeProperties, Map<String, String> requestHeaders, boolean multiPart) Create a node under given path, using a POST to SlingcreateNode(String url, NameValuePairList clientNodeProperties, Map<String, String> requestHeaders, boolean multiPart) Create a node under given path, using a POST to SlingcreateNode(String url, NameValuePairList clientNodeProperties, Map<String, String> requestHeaders, boolean multiPart, File localFile, String fieldName, String typeHint) Create a node under given path, using a POST to SlingintDelete a file from the Sling repositoryintvoidCreate the given directory via WebDAV, if needed, under given URLvoidCreate the given directory via WebDAV, including parent directoriesintvoidsetFolderExistsTestExtension(String folderExistsTestExtension) intupload(String toUrl, InputStream is) Upload a file to the Sling repositoryvoiduploadToFileNode(String url, File localFile, String fieldName, String typeHint) Upload to an file node structure, see SLING-168voiduploadToFileNodes(String url, File[] localFiles, String[] fieldNames, String[] typeHints) Upload multiple files to file node structures
-
Constructor Details
-
SlingIntegrationTestClient
public SlingIntegrationTestClient(org.apache.commons.httpclient.HttpClient client)
-
-
Method Details
-
getFolderExistsTestExtension
-
setFolderExistsTestExtension
-
upload
Upload a file to the Sling repository- Returns:
- the HTTP status code
- Throws:
IOException
-
delete
Delete a file from the Sling repository- Returns:
- the HTTP status code
- Throws:
IOException
-
mkdir
Create the given directory via WebDAV, if needed, under given URL- Throws:
IOException
-
mkdirs
Create the given directory via WebDAV, including parent directories- Throws:
IOException
-
createNode
Call the other createNode method with headers==null- Throws:
IOException
-
createNode
public String createNode(String url, Map<String, String> clientNodeProperties, Map<String, throws IOExceptionString> requestHeaders, boolean multiPart) Create a node under given path, using a POST to Sling- Parameters:
url- under which node is createdmultiPart- if true, does a multipart POST- Returns:
- the URL that Sling provides to display the node
- Throws:
IOException
-
createNode
public String createNode(String url, NameValuePairList clientNodeProperties, Map<String, String> requestHeaders, boolean multiPart) throws IOExceptionCreate a node under given path, using a POST to Sling- Parameters:
url- under which node is createdmultiPart- if true, does a multipart POST- Returns:
- the URL that Sling provides to display the node
- Throws:
IOException
-
createNode
public String createNode(String url, NameValuePairList clientNodeProperties, Map<String, String> requestHeaders, boolean multiPart, File localFile, String fieldName, String typeHint) throws IOExceptionCreate a node under given path, using a POST to Sling- Parameters:
url- under which node is createdmultiPart- if true, does a multipart POSTlocalFile- file to uploadfieldName- name of the file fieldtypeHint- typeHint of the file field- Returns:
- the URL that Sling provides to display the node
- Throws:
IOException
-
uploadToFileNode
public void uploadToFileNode(String url, File localFile, String fieldName, String typeHint) throws IOException Upload to an file node structure, see SLING-168- Throws:
IOException
-
uploadToFileNodes
public void uploadToFileNodes(String url, File[] localFiles, String[] fieldNames, String[] typeHints) throws IOException Upload multiple files to file node structures- Throws:
IOException
-
post
public int post(String url, Map<String, String> properties) throws org.apache.commons.httpclient.HttpException, IOException- Throws:
org.apache.commons.httpclient.HttpExceptionIOException
-
get
- Throws:
org.apache.commons.httpclient.HttpExceptionIOException
-