Class SlingIntegrationTestClient

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

public class SlingIntegrationTestClient extends Object
Client functions to interact with Sling in integration tests
  • Constructor Details

    • SlingIntegrationTestClient

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

    • getFolderExistsTestExtension

      public String getFolderExistsTestExtension()
    • setFolderExistsTestExtension

      public void setFolderExistsTestExtension(String folderExistsTestExtension)
    • upload

      public int upload(String toUrl, InputStream is) throws IOException
      Upload a file to the Sling repository
      Returns:
      the HTTP status code
      Throws:
      IOException
    • delete

      public int delete(String url) throws IOException
      Delete a file from the Sling repository
      Returns:
      the HTTP status code
      Throws:
      IOException
    • mkdir

      public void mkdir(String url) throws IOException
      Create the given directory via WebDAV, if needed, under given URL
      Throws:
      IOException
    • mkdirs

      public void mkdirs(String baseUrl, String path) throws IOException
      Create the given directory via WebDAV, including parent directories
      Throws:
      IOException
    • createNode

      public String createNode(String url, Map<String,String> nodeProperties) throws IOException
      Call the other createNode method with headers==null
      Throws:
      IOException
    • createNode

      public String createNode(String url, Map<String,String> clientNodeProperties, Map<String,String> requestHeaders, boolean multiPart) throws 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:
      IOException
    • createNode

      public String createNode(String url, NameValuePairList clientNodeProperties, Map<String,String> requestHeaders, boolean multiPart) throws 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:
      IOException
    • createNode

      public String createNode(String url, NameValuePairList clientNodeProperties, Map<String,String> requestHeaders, boolean multiPart, File localFile, String fieldName, String typeHint) throws 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
      localFile - file to upload
      fieldName - name of the file field
      typeHint - 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.HttpException
      IOException
    • get

      public int get(String url) throws org.apache.commons.httpclient.HttpException, IOException
      Throws:
      org.apache.commons.httpclient.HttpException
      IOException