On 8/20/06, Dennis Byrne <[EMAIL PROTECTED]> wrote:
I would be suprised if you found a quick and easy way to do this. MyFaces core uses digester to unmarshal the config files.  It then calls the API you mention. I would start digging around in org.apache.myfaces.config .

One aggressive approach you might consider is to set up a directory structure that looks like a webapp, and then fire off the real MyFaces context listener that initializes things.  It would tie you using the MyFaces implementation for your tests, but it would pre-initialize all that stuff.  (I haven't tried this myself, so it might also run into cases where the mock objects need some extended behavior ... but i'd certainly be open to improving the test library so that it enables this use case.)

A more conservative approach would be to build an abstract base test case that did the manual configuration operations (as you are doing them), for the combination of components that you want to test, in its setUp() method.  At least that way, you'd only have to write them once.

Dennis Byrne

Craig

>-----Original Message-----
>From: Paul Spencer [mailto:[EMAIL PROTECTED]]
>Sent: Sunday, August 20, 2006 11:42 PM
>To: 'MyFaces Development'
>Subject: How to configure the default renderers and component within a Shale-Test based unit test
>
>I am writing a unit test based on the Shale Test Framework for a Tomahawk
>component.  My current problem is the I need to add the default MyFaces and
>Tomahawk components and renderers to the FacesContext. To date I have been
>using facesContext.getApplication().addComponent(...) and
>facesContext.getRenderKit().addRenderer(...).  This is becoming very
>cumbersome.  I know the defaults are out their in various configuration files,
>but I do not know how to tell Shale's test framework how to use them.
>
>Suggestions?
>
>Paul Spencer
>
>



Reply via email to