[weld-dev] cdi tck: org.jboss.cdi.tck.tests.context.application.event.ApplicationScopeEventMultiWarTest

Emily Jiang emijiang6 at googlemail.com
Sun May 24 10:21:46 EDT 2015


I am trying to run the cdi tck:
org.jboss.cdi.tck.tests.context.application.event.ApplicationScopeEventMultiWarTest
Method: testDeployment

It seems this test is to verify whether both web modules receive the
initilization event of ApplicationScoped. The confusing bit is that the
test directly verfies whether both events are received without trying to
send request to activate the web modules. I think the test assume web
modules are active and did not consider the fact of that some application
server starts the modules in a lazy mode.

The CDI spec says:
The application scope is active:
• during the service() method of any servlet in the web application, during
the doFilter()
method of any servlet filter and when the container calls any
ServletContextListener,
HttpSessionListener, AsyncListener or ServletRequestListener

According to cdi spec 6.7.3:
An event with qualifier @Initialized(ApplicationScoped.class) is fired when
the application
context is initialized and an event with qualifier
@Destroyed(ApplicationScoped.class) is fired
when the application is destroyed. The event payload is:
• the ServletContext if the application is a web application deployed to a
Servlet container, or
• any java.lang.Object for other types of application.
The spec did not say whether the event should be recieved. In my
environment, if the web module url is hit, the obeserved event will be
obsevered.

I think we have implemented this correctly as I can confirm the application
scope is active when a request is sent and the event of
@Initialized(ApplicationScoped.class) is received as well but the test
assumes the web module is active automatically without even needing to send
the first request.

Can someone shed some lights on this? What is the test trying to do? I am
suggesting the test should be updated to send the first request first
before checking the size of the obsevers.

I did not directly send to cdi tck as I would like to get some input from
weld dev list first.

-- 
Thanks
Emily
=================
Emily Jiang
ejiang at apache.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20150524/567a5fd1/attachment.html 


More information about the weld-dev mailing list