public abstract class AbstractMyFacesTestCase extends Object
Abstract JUnit test case base class, which sets up MyFaces Core environment using mock object for the outer servlet environment.
Since jsp engine is not bundled with MyFaces, this configuration is able to handle facelet pages only.
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractMyFacesTestCase.MyFacesMockFacesConfigurationProvider
Mock FacesConfigurationProvider that replace the original ViewDeclarationLanguageFactory with a customized one that
contains only facelets vdl and cache some FacesConfig that does not change to reduce the time required to process each test.
|
Modifier and Type | Field and Description |
---|---|
static int |
AFTER_RENDER_STEP |
static int |
BEFORE_RENDER_STEP |
static int |
BUILD_VIEW_CYCLE_STEP |
protected org.apache.myfaces.spi.FacesConfigurationProvider |
facesConfigurationProvider |
protected FacesContextFactory |
facesContextFactory |
static String |
LAST_PHASE_PROCESSED |
static String |
LAST_RENDER_PHASE_STEP |
protected javax.faces.lifecycle.Lifecycle |
lifecycle |
protected javax.faces.lifecycle.LifecycleFactory |
lifecycleFactory |
protected org.apache.myfaces.webapp.StartupServletContextListener |
listener |
static String |
PHASE_MANAGER_INSTANCE |
protected org.apache.myfaces.test.mock.MockServletConfig |
servletConfig |
protected org.apache.myfaces.test.mock.MockServletContext |
servletContext |
static int |
VIEWHANDLER_RENDER_STEP |
Constructor and Description |
---|
AbstractMyFacesTestCase()
Construct a new instance of this test case.
|
Modifier and Type | Method and Description |
---|---|
protected javax.el.ExpressionFactory |
createExpressionFactory()
Create the ExpressionFactory instance that will be used to initialize the test
environment.
|
protected org.apache.myfaces.spi.FacesConfigurationProvider |
createFacesConfigurationProvider() |
void |
executeAfterRender(FacesContext facesContext) |
protected void |
executeBeforeRender(FacesContext facesContext) |
void |
executeBuildViewCycle(FacesContext facesContext) |
protected void |
executePhase(FacesContext facesContext,
PhaseId phase)
Execute an specified phase, doing some reflection over LifecycleImpl.
|
void |
executeViewHandlerRender(FacesContext facesContext) |
protected String |
getRenderedContent(FacesContext facesContext) |
protected String |
getWebappContextFilePath()
Return a path that is used to load resources like facelet files an others.
|
protected URI |
getWebappContextURI()
Return an URI that identifies the base path that will be used by servletContext
to load resources like facelet files an others.
|
protected boolean |
isScanAnnotations()
Indicate if annotation scanning should be done over the classpath.
|
protected void |
processApplyRequestValuesPhase(FacesContext facesContext)
Execute apply request values phase.
|
protected void |
processInvokeApplicationPhase(FacesContext facesContext)
Execute invoke application phase.
|
protected void |
processLifecycleExecute(FacesContext facesContext)
Call lifecycle.execute(facesContext)
|
protected void |
processRemainingExecutePhases(FacesContext facesContext) |
protected void |
processRemainingPhases(FacesContext facesContext) |
protected void |
processRender(FacesContext facesContext)
Call lifecycle.render(facesContext)
|
protected void |
processRestoreViewPhase(FacesContext facesContext)
Execute restore view phase.
|
protected void |
processUpdateModelPhase(FacesContext facesContext)
Execute update model phase.
|
protected void |
processValidationsPhase(FacesContext facesContext)
Execute process validations phase.
|
void |
setUp()
Set up instance variables required by this test case.
|
protected void |
setUpFacesServlet() |
protected void |
setUpMyFaces() |
protected void |
setUpServletListeners()
setup listeners avaliable in the test environment
|
protected void |
setUpServletObjects()
Setup servlet objects that will be used for the test:
|
protected void |
setUpServlets()
setup servlets avaliable in the test environment
|
protected void |
setUpWebConfigParams()
Setup web config params.
|
void |
tearDown() |
protected void |
tearDownFacesServlet() |
protected void |
tearDownMyFaces() |
protected void |
tearDownServletListeners() |
protected void |
tearDownServlets() |
public static final String PHASE_MANAGER_INSTANCE
public static final String LAST_PHASE_PROCESSED
public static final String LAST_RENDER_PHASE_STEP
public static final int BEFORE_RENDER_STEP
public static final int BUILD_VIEW_CYCLE_STEP
public static final int VIEWHANDLER_RENDER_STEP
public static final int AFTER_RENDER_STEP
protected org.apache.myfaces.test.mock.MockServletConfig servletConfig
protected org.apache.myfaces.test.mock.MockServletContext servletContext
protected org.apache.myfaces.webapp.StartupServletContextListener listener
protected org.apache.myfaces.spi.FacesConfigurationProvider facesConfigurationProvider
protected FacesContextFactory facesContextFactory
protected javax.faces.lifecycle.LifecycleFactory lifecycleFactory
protected javax.faces.lifecycle.Lifecycle lifecycle
public AbstractMyFacesTestCase()
Construct a new instance of this test case.
name
- Name of this test casepublic void setUp() throws Exception
Set up instance variables required by this test case.
Exception
protected void setUpServletObjects() throws Exception
Setup servlet objects that will be used for the test:
servletConfig
(MockServletConfig
)servletContext
(MockServletContext
)Exception
protected void setUpWebConfigParams() throws Exception
Setup web config params. By default it sets the following params
Exception
protected URI getWebappContextURI()
Return an URI that identifies the base path that will be used by servletContext to load resources like facelet files an others. By default it points to the directory path calculated from the package name of the child test class.
protected String getWebappContextFilePath()
protected javax.el.ExpressionFactory createExpressionFactory()
protected void setUpServlets() throws Exception
Exception
protected void setUpServletListeners() throws Exception
Exception
protected org.apache.myfaces.spi.FacesConfigurationProvider createFacesConfigurationProvider()
protected void tearDownServletListeners() throws Exception
Exception
protected void processLifecycleExecute(FacesContext facesContext)
facesContext
- protected void processRestoreViewPhase(FacesContext facesContext) throws Exception
facesContext
- Exception
protected void processApplyRequestValuesPhase(FacesContext facesContext) throws Exception
facesContext
- Exception
protected void processValidationsPhase(FacesContext facesContext) throws Exception
facesContext
- Exception
protected void processUpdateModelPhase(FacesContext facesContext) throws Exception
facesContext
- Exception
protected void processInvokeApplicationPhase(FacesContext facesContext) throws Exception
facesContext
- Exception
protected void processRender(FacesContext facesContext) throws Exception
facesContext
- Exception
protected void processRemainingExecutePhases(FacesContext facesContext) throws Exception
Exception
protected void processRemainingPhases(FacesContext facesContext) throws Exception
Exception
protected boolean isScanAnnotations()
protected void executeBeforeRender(FacesContext facesContext) throws Exception
Exception
public void executeBuildViewCycle(FacesContext facesContext) throws Exception
Exception
public void executeViewHandlerRender(FacesContext facesContext)
public void executeAfterRender(FacesContext facesContext) throws Exception
Exception
protected void executePhase(FacesContext facesContext, PhaseId phase) throws Exception
facesContext
- phase
- Exception
protected String getRenderedContent(FacesContext facesContext) throws IOException
IOException
Copyright © 2016 The Apache Software Foundation. All Rights Reserved.