[weld-issues] [JBoss JIRA] Commented: (CDITCK-168) extensions.processBean.ProcessBean event count issue

Scott Ferguson (JIRA) jira-events at lists.jboss.org
Sat Jun 26 14:00:46 EDT 2010


    [ https://jira.jboss.org/browse/CDITCK-168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12537142#action_12537142 ] 

Scott Ferguson commented on CDITCK-168:
---------------------------------------

No, that's not correct. Your #3 is correct, but your conclusion following #3 contradicts it.

There are 2 fired events (ProcessBean<Cowshed> and ProcessProducerMethod<Cowshed,Cow>), which match 3 observers.

The method which observes ProcessBean<Cowshed> will _not_ be called for ProcessProducerMethod<Cowshed,Cow> because ProcessBean<Cowshed> is not in the closure of ProcessProducerMethod<Cowshed,Cow> (because the extended interface of ProcessProducerMethod<T,X> is ProcessBean<X>, not ProcessBean<T>.) 

ProcessProducerMethod<Cowshed,Cow> will match 2 observers, not 3: ProcessBean<Cow> but not ProcessBean<Cowshed>, plus the ProcessProducerMethod observer itself. In other words, the ProcessProducerMethod only matches one additional ProcessBean observer (Cow), not both Cow and Cowshed.

If you can point to a reason why the ProcessProducerMethod<Cowshed,Cow> would match the observer ProcessBean<Cowshed> (or why the producer processing would fire 2 events instead of 1) please explain further because I can't see how the Cowshed observer matches the ProcessProducerMethod.

> extensions.processBean.ProcessBean event count issue
> ----------------------------------------------------
>
>                 Key: CDITCK-168
>                 URL: https://jira.jboss.org/browse/CDITCK-168
>             Project: CDI TCK
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Tests
>    Affects Versions: 1.0.2.CR1
>         Environment: any
>            Reporter: Scott Ferguson
>
> The issue is in an assertion in extensions.processBean.ProcessBeanTest, counting the number of times the Cowshed bean raises a discovery event. There are three tests affected by this issue:
> extensions.processBean.ProcessBeanTest
>   testProcessProducerFieldEvent()
>   testProcessProducerMethodEvent()
> extensions.processBean.ProcessSessionBeanTest
>   testProcessSessionBeanEvent()
> specifically
> testProcessProducerMethodEvent()
>  79:       assert ProcessBeanObserver.getCowShedProcessBeanCount() == 2;
>  
> testProcessProducerFieldEvent()
>  102:      assert ProcessBeanObserver.getChickenHutchProcessBeanCount()  == 2;
> testProcessSessionBeanEvent()
>  63:    assert ProcessBeanObserver.getElephantProcessBeanCount() == 2;
> But I can't see how this number is 2 instead of 1. The Cowshed looks like:
> public class Cowshed {
>   @Produces public Cow getDaisy() { ... }
> }
> So there should be 3 relevant extension events fired:
>   ProcessBean<Cowshed>
>   ProcessProducerMethod<Cowshed, Cow>
>   ProcessBean<Cow>
> I double checked the ProcessProducerMethod interface:
>   ProcessProducerMethod<T,X> extends ProcessBean<X>
> which is where the ProcessBean<Cow> comes from, but I don't see where 
> the 2nd ProcessBean<Cowshed> comes from.
> The ProcessSessionBean issue is essentially the same

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list