org.apache.sling.launchpad.webapp.integrationtest
Class AbstractAuthenticatedTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.sling.commons.testing.integration.HttpTestBase
              extended by org.apache.sling.launchpad.webapp.integrationtest.AbstractAuthenticatedTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractAccessManagerTest, AbstractUserManagerTest, NamespaceMappingTest, PostServletUpdateTest

public abstract class AbstractAuthenticatedTest
extends HttpTestBase

This class consists of utility methods for writing tests which use authentication.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.sling.commons.testing.integration.HttpTestBase
HttpTestBase.TestNode
 
Field Summary
 
Fields inherited from class org.apache.sling.commons.testing.integration.HttpTestBase
CONTENT_TYPE_CSS, CONTENT_TYPE_DONTCARE, CONTENT_TYPE_HTML, CONTENT_TYPE_JS, CONTENT_TYPE_JSON, CONTENT_TYPE_PLAIN, CONTENT_TYPE_XML, DEFAULT_EXT, EXECUTE_RESOURCE_TYPE, HTTP_BASE_URL, httpClient, READY_TIMEOUT_SECONDS, SERVLET_CONTEXT, SLING_POST_SERVLET_CREATE_SUFFIX, SLING_RESOURCE_TYPE, TEST_PATH, testClient, urlsToDelete, WEBDAV_BASE_URL
 
Constructor Summary
AbstractAuthenticatedTest()
           
 
Method Summary
protected  void assertAuthenticatedAdminPostStatus(String url, int expectedStatusCode, List<org.apache.commons.httpclient.NameValuePair> postParams, String assertMessage)
          Execute a POST request and check status
protected  void assertAuthenticatedHttpStatus(org.apache.commons.httpclient.Credentials creds, String urlString, int expectedStatusCode, String assertMessage)
          Verify that given URL returns expectedStatusCode
protected  void assertAuthenticatedPostStatus(org.apache.commons.httpclient.Credentials creds, String url, int expectedStatusCode, List<org.apache.commons.httpclient.NameValuePair> postParams, String assertMessage)
          Execute a POST request and check status
protected  String createTestGroup()
           
protected  String createTestUser()
           
protected  String getAuthenticatedContent(org.apache.commons.httpclient.Credentials creds, String url, String expectedContentType, List<org.apache.commons.httpclient.NameValuePair> params, int expectedStatusCode)
          retrieve the contents of given URL and assert its content type
protected  String getAuthenticatedPostContent(org.apache.commons.httpclient.Credentials creds, String url, String expectedContentType, List<org.apache.commons.httpclient.NameValuePair> postParams, int expectedStatusCode)
          retrieve the contents of given URL and assert its content type
 
Methods inherited from class org.apache.sling.commons.testing.integration.HttpTestBase
assertHttpStatus, assertHttpStatus, assertJavascript, assertJavascript, assertPostStatus, executeScript, executeScript, getContent, getContent, getContent, getResponseBodyAsStream, removeEndingSlash, setUp, slingServerReady, tearDown, uploadTestScript, waitForSlingStartup
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractAuthenticatedTest

public AbstractAuthenticatedTest()
Method Detail

assertAuthenticatedAdminPostStatus

protected void assertAuthenticatedAdminPostStatus(String url,
                                                  int expectedStatusCode,
                                                  List<org.apache.commons.httpclient.NameValuePair> postParams,
                                                  String assertMessage)
                                           throws IOException
Execute a POST request and check status

Throws:
IOException

assertAuthenticatedPostStatus

protected void assertAuthenticatedPostStatus(org.apache.commons.httpclient.Credentials creds,
                                             String url,
                                             int expectedStatusCode,
                                             List<org.apache.commons.httpclient.NameValuePair> postParams,
                                             String assertMessage)
                                      throws IOException
Execute a POST request and check status

Throws:
IOException

assertAuthenticatedHttpStatus

protected void assertAuthenticatedHttpStatus(org.apache.commons.httpclient.Credentials creds,
                                             String urlString,
                                             int expectedStatusCode,
                                             String assertMessage)
                                      throws IOException
Verify that given URL returns expectedStatusCode

Throws:
IOException

getAuthenticatedContent

protected String getAuthenticatedContent(org.apache.commons.httpclient.Credentials creds,
                                         String url,
                                         String expectedContentType,
                                         List<org.apache.commons.httpclient.NameValuePair> params,
                                         int expectedStatusCode)
                                  throws IOException
retrieve the contents of given URL and assert its content type

Parameters:
expectedContentType - use CONTENT_TYPE_DONTCARE if must not be checked
Throws:
IOException
org.apache.commons.httpclient.HttpException

getAuthenticatedPostContent

protected String getAuthenticatedPostContent(org.apache.commons.httpclient.Credentials creds,
                                             String url,
                                             String expectedContentType,
                                             List<org.apache.commons.httpclient.NameValuePair> postParams,
                                             int expectedStatusCode)
                                      throws IOException
retrieve the contents of given URL and assert its content type

Parameters:
expectedContentType - use CONTENT_TYPE_DONTCARE if must not be checked
Throws:
IOException
org.apache.commons.httpclient.HttpException

createTestUser

protected String createTestUser()
                         throws IOException
Throws:
IOException

createTestGroup

protected String createTestGroup()
                          throws IOException
Throws:
IOException


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.