org.apache.sling.commons.testing.integration
Class SlingIntegrationTestClient

java.lang.Object
  extended by org.apache.sling.commons.testing.integration.SlingIntegrationTestClient

public class SlingIntegrationTestClient
extends java.lang.Object

Client functions to interact with Sling in integration tests


Constructor Summary
SlingIntegrationTestClient(org.apache.commons.httpclient.HttpClient client)
           
 
Method Summary
 java.lang.String createNode(java.lang.String url, java.util.Map<java.lang.String,java.lang.String> nodeProperties)
          Call the other createNode method with headers==null
 java.lang.String createNode(java.lang.String url, java.util.Map<java.lang.String,java.lang.String> clientNodeProperties, java.util.Map<java.lang.String,java.lang.String> requestHeaders, boolean multiPart)
          Create a node under given path, using a POST to Sling
 int delete(java.lang.String url)
          Delete a file from the Sling repository
 void mkdir(java.lang.String url)
          Create the given directory via WebDAV, if needed, under given URL
 void mkdirs(java.lang.String baseUrl, java.lang.String path)
          Create the given directory via WebDAV, including parent directories
 int upload(java.lang.String toUrl, java.io.InputStream is)
          Upload a file to the Sling repository
 void uploadToFileNode(java.lang.String url, java.io.File localFile, java.lang.String fieldName, java.lang.String typeHint)
          Upload to an file node structure, see SLING-168
 void uploadToFileNodes(java.lang.String url, java.io.File[] localFiles, java.lang.String[] fieldNames, java.lang.String[] typeHints)
          Upload multiple files to file node structures
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlingIntegrationTestClient

public SlingIntegrationTestClient(org.apache.commons.httpclient.HttpClient client)
Method Detail

upload

public int upload(java.lang.String toUrl,
                  java.io.InputStream is)
           throws java.io.IOException
Upload a file to the Sling repository

Returns:
the HTTP status code
Throws:
java.io.IOException

delete

public int delete(java.lang.String url)
           throws java.io.IOException
Delete a file from the Sling repository

Returns:
the HTTP status code
Throws:
java.io.IOException

mkdir

public void mkdir(java.lang.String url)
           throws java.io.IOException
Create the given directory via WebDAV, if needed, under given URL

Throws:
java.io.IOException

mkdirs

public void mkdirs(java.lang.String baseUrl,
                   java.lang.String path)
            throws java.io.IOException
Create the given directory via WebDAV, including parent directories

Throws:
java.io.IOException

createNode

public java.lang.String createNode(java.lang.String url,
                                   java.util.Map<java.lang.String,java.lang.String> nodeProperties)
                            throws java.io.IOException
Call the other createNode method with headers==null

Throws:
java.io.IOException

createNode

public java.lang.String createNode(java.lang.String url,
                                   java.util.Map<java.lang.String,java.lang.String> clientNodeProperties,
                                   java.util.Map<java.lang.String,java.lang.String> requestHeaders,
                                   boolean multiPart)
                            throws java.io.IOException
Create a node under given path, using a POST to Sling

Parameters:
url - under which node is created
multiPart - if true, does a multipart POST
Returns:
the URL that Sling provides to display the node
Throws:
java.io.IOException

uploadToFileNode

public void uploadToFileNode(java.lang.String url,
                             java.io.File localFile,
                             java.lang.String fieldName,
                             java.lang.String typeHint)
                      throws java.io.IOException
Upload to an file node structure, see SLING-168

Throws:
java.io.IOException

uploadToFileNodes

public void uploadToFileNodes(java.lang.String url,
                              java.io.File[] localFiles,
                              java.lang.String[] fieldNames,
                              java.lang.String[] typeHints)
                       throws java.io.IOException
Upload multiple files to file node structures

Throws:
java.io.IOException


Copyright © 2007-2009. All Rights Reserved.