Class SlingIntegrationTestClient


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

      • SlingIntegrationTestClient

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

      • getFolderExistsTestExtension

        public String getFolderExistsTestExtension()
      • setFolderExistsTestExtension

        public void setFolderExistsTestExtension​(String folderExistsTestExtension)
      • 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> 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
      • get

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