org.apache.sling.junit.impl.servlet
Class SlingJUnitServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.sling.junit.impl.servlet.JUnitServlet
              extended by org.apache.sling.junit.impl.servlet.SlingJUnitServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

@Service(value=javax.servlet.Servlet.class)
@Properties(value={@Property(name="sling.servlet.resourceTypes",value="sling/junit/testing"),@Property(name="sling.servlet.extensions",value="junit"),@Property(name="sling.servlet.methods",value={"GET","POST"})})
public class SlingJUnitServlet
extends JUnitServlet

Alternate entry point for testing, that uses the Sling request/response cycle. Can be used to run tests in an environment that more closely matches how Sling components run, but requires Sling - so we keep both servlets in order for this module to be reusable without Sling. This servlet is registered with a specific resource type, to call it a Sling resource must be created with this resource type.

See Also:
Serialized Form

Field Summary
static java.lang.String EXTENSION
           
 
Fields inherited from class org.apache.sling.junit.impl.servlet.JUnitServlet
CSS
 
Constructor Summary
SlingJUnitServlet()
           
 
Method Summary
protected  java.lang.String getServletPath(org.osgi.service.component.ComponentContext ctx)
          Do not register this servlet with HttpService ourselves, Sling will take care of that.
protected  java.lang.String getTestExecutionPath(javax.servlet.http.HttpServletRequest request, TestSelector selector, java.lang.String extension)
          Return path to which to POST to execute specified test
protected  java.lang.String getTestSelectionPath(javax.servlet.http.HttpServletRequest request)
          Return subpath to use for selecting tests
 
Methods inherited from class org.apache.sling.junit.impl.servlet.JUnitServlet
activate, deactivate, doGet, doPost, getTestSelector
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENSION

public static final java.lang.String EXTENSION
See Also:
Constant Field Values
Constructor Detail

SlingJUnitServlet

public SlingJUnitServlet()
Method Detail

getServletPath

protected java.lang.String getServletPath(org.osgi.service.component.ComponentContext ctx)
Do not register this servlet with HttpService ourselves, Sling will take care of that.

Overrides:
getServletPath in class JUnitServlet

getTestSelectionPath

protected java.lang.String getTestSelectionPath(javax.servlet.http.HttpServletRequest request)
Description copied from class: JUnitServlet
Return subpath to use for selecting tests

Overrides:
getTestSelectionPath in class JUnitServlet

getTestExecutionPath

protected java.lang.String getTestExecutionPath(javax.servlet.http.HttpServletRequest request,
                                                TestSelector selector,
                                                java.lang.String extension)
Return path to which to POST to execute specified test

Overrides:
getTestExecutionPath in class JUnitServlet


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