org.apache.sling.testing.tools.sling
Class SlingTestBase

java.lang.Object
  extended by org.apache.sling.testing.tools.sling.SlingTestBase
All Implemented Interfaces:
SlingInstance

public class SlingTestBase
extends Object
implements SlingInstance

Base class for running tests against a Sling instance, takes care of starting Sling and waiting for it to be ready.


Field Summary
static String ADDITONAL_BUNDLES_PATH
           
static String ADMIN
           
static String BUNDLE_INSTALL_TIMEOUT_SECONDS
           
static String BUNDLE_TO_INSTALL_PREFIX
           
static String KEEP_JAR_RUNNING_PROP
           
static String SERVER_HOSTNAME_PROP
           
static String SERVER_READY_PROP_PREFIX
           
static String SERVER_READY_TIMEOUT_PROP
           
static String START_BUNDLES_TIMEOUT_SECONDS
           
static String TEST_SERVER_PASSWORD
           
static String TEST_SERVER_URL_PROP
           
static String TEST_SERVER_USERNAME
           
 
Constructor Summary
SlingTestBase()
           
SlingTestBase(SlingInstanceState slingTestState, Properties systemProperties)
          Get configuration but do not start server yet, that's done on demand
 
Method Summary
protected  void blockIfRequested()
          Optionally block here so that the runnable jar stays up - we can then run tests against it from another VM.
protected  List<File> getBundlesToInstall(String additionalBundlesPath)
          Get the list of additional bundles to install, as specified by path parameter
 org.apache.http.client.HttpClient getHttpClient()
           
 RequestBuilder getRequestBuilder()
          Start server if needed, and return a RequestBuilder that points to it
 RequestExecutor getRequestExecutor()
          Returns a RequestExecutor for this server
 String getServerBaseUrl()
          Start server if needed, and return its base URL
 String getServerPassword()
          Return password configured for execution of HTTP requests
 String getServerUsername()
          Return username configured for execution of HTTP requests
 WebconsoleClient getWebconsoleClient()
           
protected  void installAdditionalBundles()
           
 boolean isServerStartedByThisClass()
           
protected  void waitForServerReady()
          Check a number of server URLs for readyness
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEST_SERVER_URL_PROP

public static final String TEST_SERVER_URL_PROP
See Also:
Constant Field Values

TEST_SERVER_USERNAME

public static final String TEST_SERVER_USERNAME
See Also:
Constant Field Values

TEST_SERVER_PASSWORD

public static final String TEST_SERVER_PASSWORD
See Also:
Constant Field Values

SERVER_READY_TIMEOUT_PROP

public static final String SERVER_READY_TIMEOUT_PROP
See Also:
Constant Field Values

SERVER_READY_PROP_PREFIX

public static final String SERVER_READY_PROP_PREFIX
See Also:
Constant Field Values

KEEP_JAR_RUNNING_PROP

public static final String KEEP_JAR_RUNNING_PROP
See Also:
Constant Field Values

SERVER_HOSTNAME_PROP

public static final String SERVER_HOSTNAME_PROP
See Also:
Constant Field Values

ADDITONAL_BUNDLES_PATH

public static final String ADDITONAL_BUNDLES_PATH
See Also:
Constant Field Values

BUNDLE_TO_INSTALL_PREFIX

public static final String BUNDLE_TO_INSTALL_PREFIX
See Also:
Constant Field Values

START_BUNDLES_TIMEOUT_SECONDS

public static final String START_BUNDLES_TIMEOUT_SECONDS
See Also:
Constant Field Values

BUNDLE_INSTALL_TIMEOUT_SECONDS

public static final String BUNDLE_INSTALL_TIMEOUT_SECONDS
See Also:
Constant Field Values

ADMIN

public static final String ADMIN
See Also:
Constant Field Values
Constructor Detail

SlingTestBase

public SlingTestBase()

SlingTestBase

public SlingTestBase(SlingInstanceState slingTestState,
                     Properties systemProperties)
Get configuration but do not start server yet, that's done on demand

Method Detail

installAdditionalBundles

protected void installAdditionalBundles()

getRequestBuilder

public RequestBuilder getRequestBuilder()
Start server if needed, and return a RequestBuilder that points to it

Specified by:
getRequestBuilder in interface SlingInstance

getServerBaseUrl

public String getServerBaseUrl()
Start server if needed, and return its base URL

Specified by:
getServerBaseUrl in interface SlingInstance

getServerUsername

public String getServerUsername()
Return username configured for execution of HTTP requests

Specified by:
getServerUsername in interface SlingInstance

getServerPassword

public String getServerPassword()
Return password configured for execution of HTTP requests

Specified by:
getServerPassword in interface SlingInstance

blockIfRequested

protected void blockIfRequested()
Optionally block here so that the runnable jar stays up - we can then run tests against it from another VM.


waitForServerReady

protected void waitForServerReady()
                           throws Exception
Check a number of server URLs for readyness

Throws:
Exception

getBundlesToInstall

protected List<File> getBundlesToInstall(String additionalBundlesPath)
Get the list of additional bundles to install, as specified by path parameter


isServerStartedByThisClass

public boolean isServerStartedByThisClass()

getHttpClient

public org.apache.http.client.HttpClient getHttpClient()

getRequestExecutor

public RequestExecutor getRequestExecutor()
Description copied from interface: SlingInstance
Returns a RequestExecutor for this server

Specified by:
getRequestExecutor in interface SlingInstance

getWebconsoleClient

public WebconsoleClient getWebconsoleClient()


Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.