org.jboss.seam.mock
Class BaseSeamTest

java.lang.Object
  extended by org.jboss.seam.mock.BaseSeamTest
Direct Known Subclasses:
SeamTest

public class BaseSeamTest
extends Object

Base class for integration tests for JSF/Seam applications. This class can be extended or referenced directly for integration with various testing frameworks.

Author:
Gavin King, Thomas Heute

Nested Class Summary
 class BaseSeamTest.ComponentTest
           
 class BaseSeamTest.FacesRequest
           
 class BaseSeamTest.NonFacesRequest
           
 class BaseSeamTest.Script
          Deprecated. use FacesRequest or NonFacesRequest
 
Constructor Summary
BaseSeamTest()
           
 
Method Summary
 void begin()
           
 void cleanup()
           
protected  void cleanupClass()
          Cleanup this test class instance Must be run for each test class instance (e.g.
protected  javax.servlet.Filter createSeamFilter()
           
 void end()
           
protected  javax.el.ELResolver[] getELResolvers()
           
protected  Object getField(Object object, String fieldName)
          Get the value of an object field, by reflection.
protected  InitialContext getInitialContext()
           
protected  Object getInstance(Class clazz)
          Helper method for resolving components in the test script.
protected  Object getInstance(String name)
          Helper method for resolving components in the test script.
protected  javax.servlet.http.HttpSession getSession()
           
protected  UserTransaction getUserTransaction()
           
 void init()
           
 void initServletContext(Map initParams)
          Override to set up any servlet context attributes.
protected  void installMockTransport()
           
protected  boolean isLongRunningConversation()
          Is there a long running conversation associated with the current request?
protected  boolean isSessionInvalid()
           
 Object lookup(String name)
          Search in all contexts
protected  void setField(Object object, String fieldName, Object value)
          Set the value of an object field, by reflection.
protected  void setupClass()
          Setup this test class instance Must be run for each test class instance (e.g.
protected  void startJbossEmbeddedIfNecessary()
           
protected  void startSeam()
          Boot Seam.
protected  void stopSeam()
          Shutdown Seam.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseSeamTest

public BaseSeamTest()
Method Detail

isSessionInvalid

protected boolean isSessionInvalid()

getSession

protected javax.servlet.http.HttpSession getSession()

getInstance

protected Object getInstance(Class clazz)
Helper method for resolving components in the test script.


getInstance

protected Object getInstance(String name)
Helper method for resolving components in the test script.


isLongRunningConversation

protected boolean isLongRunningConversation()
Is there a long running conversation associated with the current request?


lookup

public Object lookup(String name)
Search in all contexts


begin

public void begin()

end

public void end()

init

public void init()
          throws Exception
Throws:
Exception

startSeam

protected void startSeam()
                  throws Exception
Boot Seam. Can be used at class, test group or suite level (e.g.

Throws:
Exception

stopSeam

protected void stopSeam()
                 throws Exception
Shutdown Seam. Can be used at class, test group or suite level (e.g

Throws:
Exception

setupClass

protected void setupClass()
                   throws Exception
Setup this test class instance Must be run for each test class instance (e.g. @BeforeClass)

Throws:
Exception

cleanupClass

protected void cleanupClass()
                     throws Exception
Cleanup this test class instance Must be run for each test class instance (e.g. @AfterClass)

Throws:
Exception

cleanup

public void cleanup()
             throws Exception
Throws:
Exception

createSeamFilter

protected javax.servlet.Filter createSeamFilter()
                                         throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

initServletContext

public void initServletContext(Map initParams)
Override to set up any servlet context attributes.


getInitialContext

protected InitialContext getInitialContext()
                                    throws NamingException
Throws:
NamingException

getUserTransaction

protected UserTransaction getUserTransaction()
                                      throws NamingException
Throws:
NamingException

getField

protected Object getField(Object object,
                          String fieldName)
Get the value of an object field, by reflection.


setField

protected void setField(Object object,
                        String fieldName,
                        Object value)
Set the value of an object field, by reflection.


startJbossEmbeddedIfNecessary

protected void startJbossEmbeddedIfNecessary()
                                      throws Exception
Throws:
Exception

getELResolvers

protected javax.el.ELResolver[] getELResolvers()

installMockTransport

protected void installMockTransport()