myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] [Resolved] (MYFACES-3862) Set mock InitialContextFactory for junit testing with myfaces impl test
Date Mon, 03 Mar 2014 01:09:20 GMT


Leonardo Uribe resolved MYFACES-3862.

       Resolution: Fixed
    Fix Version/s: 2.2.1

I tried different solutions and I found a good one using an implementation of Context interface
from geronimo xbean. I tested it with weld 1.1.x and spring 3 and it worked well. I added
an annotation @BeforeJSFInit that is very useful to fill the gap between other libraries using
servlet listeners and JSF. I detected a problem with weld 2, but we need to improve the mock
objects in myfaces-test, adding some methods from servlet 3.0 spec, so this fix should wait
some time and for now we go with the code as is right now.

> Set mock InitialContextFactory for junit testing with myfaces impl test
> -----------------------------------------------------------------------
>                 Key: MYFACES-3862
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-344
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>             Fix For: 2.2.1
> Trying some examples I have notice the code we have in the new impl-test module does
not initialize a default InitialContextFactory by default. The effect is some calls to new
InitialContext() does not work as in the web server. 
> The idea is provide a custom InitialContextFactory implementation that creates and mock
initial context, so for example when CDI set the BeanManager, it can be grabbed from the context.
> It could be good to provide an annotation to set the JNDI mapping for the test enviroment
too, so you can inject for example a datasource and so on.

This message was sent by Atlassian JIRA

View raw message