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.JUnitFacesInitializer |
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.
|
protected static class |
AbstractMyFacesTestCase.SharedFacesConfiguration |
Modifier and Type | Field and Description |
---|---|
static int |
AFTER_RENDER_STEP |
static int |
BEFORE_RENDER_STEP |
static int |
BUILD_VIEW_CYCLE_STEP |
protected 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 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 |
protected org.apache.myfaces.test.mock.MockWebContainer |
webContainer |
Constructor and Description |
---|
AbstractMyFacesTestCase()
Construct a new instance of this test case.
|
Modifier and Type | Method and Description |
---|---|
void |
applyRequestValues(FacesContext facesContext)
Execute apply request values phase.
|
protected javax.el.ExpressionFactory |
createExpressionFactory()
Create the ExpressionFactory instance that will be used to initialize the test
environment.
|
protected FacesConfigurationProvider |
createFacesConfigurationProvider() |
protected AbstractFacesInitializer |
createFacesInitializer() |
void |
executeAfterRender(FacesContext facesContext) |
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 Class<?> |
getTestJavaClass() |
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 String |
getWebappResourcePath()
Return a path that is used to load resources like facelet files an others.
|
void |
invokeApplication(FacesContext facesContext)
Execute invoke application phase.
|
protected boolean |
isScanAnnotations()
Indicate if annotation scanning should be done over the classpath.
|
void |
processLifecycleExecute(FacesContext facesContext)
Call lifecycle.execute(facesContext)
|
void |
processLifecycleRender(FacesContext facesContext) |
void |
processRemainingExecutePhases(FacesContext facesContext) |
void |
processRemainingPhases(FacesContext facesContext) |
protected void |
processRemainingPhasesBefore(FacesContext facesContext,
PhaseId phaseId) |
void |
processValidations(FacesContext facesContext)
Execute process validations phase.
|
void |
renderResponse(FacesContext facesContext)
Call lifecycle.render(facesContext)
|
void |
restoreView(FacesContext facesContext)
Execute restore view phase.
|
void |
setUp()
Set up instance variables required by this test case.
|
protected void |
setUpClassloader()
Set up the thread context classloader.
|
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() |
static void |
tearDownClass() |
protected void |
tearDownClassloader() |
protected void |
tearDownFacesServlet() |
protected void |
tearDownMyFaces() |
protected void |
tearDownServletListeners() |
protected void |
tearDownServlets() |
void |
updateModelValues(FacesContext facesContext)
Execute update model phase.
|
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.test.mock.MockWebContainer webContainer
protected StartupServletContextListener listener
protected 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 setUpClassloader() throws Exception
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 getWebappResourcePath()
protected javax.el.ExpressionFactory createExpressionFactory()
protected void setUpServlets() throws Exception
Exception
protected void setUpServletListeners() throws Exception
Exception
protected FacesConfigurationProvider createFacesConfigurationProvider()
protected AbstractFacesInitializer createFacesInitializer()
protected void tearDownMyFaces()
protected void tearDownServletListeners() throws Exception
Exception
public static void tearDownClass()
public void processLifecycleExecute(FacesContext facesContext)
facesContext
- public void restoreView(FacesContext facesContext)
facesContext
- Exception
public void applyRequestValues(FacesContext facesContext)
facesContext
- Exception
public void processValidations(FacesContext facesContext)
facesContext
- Exception
public void updateModelValues(FacesContext facesContext)
facesContext
- Exception
public void invokeApplication(FacesContext facesContext)
facesContext
- Exception
public void processLifecycleRender(FacesContext facesContext)
public void renderResponse(FacesContext facesContext)
facesContext
- protected void processRemainingPhasesBefore(FacesContext facesContext, PhaseId phaseId)
public void processRemainingExecutePhases(FacesContext facesContext)
public void processRemainingPhases(FacesContext facesContext)
protected boolean isScanAnnotations()
public void executeBeforeRender(FacesContext facesContext)
public void executeBuildViewCycle(FacesContext facesContext)
public void executeViewHandlerRender(FacesContext facesContext)
public void executeAfterRender(FacesContext facesContext)
protected void executePhase(FacesContext facesContext, PhaseId phase)
facesContext
- phase
- Exception
protected String getRenderedContent(FacesContext facesContext) throws IOException
IOException
protected Class<?> getTestJavaClass()
Copyright © 2020 The Apache Software Foundation. All rights reserved.