[weld-dev] CDI TCK: InvocationContextTest:testGetTarget

Scott Ferguson ferg at caucho.com
Thu Jan 6 12:34:59 EST 2011


Jozef Hartinger wrote:
> Could you file a CDITCK issue and assign it to me? Thanks.
>

Thanks Jozef,

It's at https://issues.jboss.org/browse/CDITCK-203.

I'm pretty sure I don't have permission to assign you tasks, though. :)

-- Scott

> On 01/06/2011 03:24 AM, Scott Ferguson wrote:
>> This test has a implementation-dependency on how interception is
>> implemented (requires proxy implementation), but the proxy
>> implementation is not mandated by the spec (and the EJB spec has always
>> allowed both implementation methods.)
>>
>> The test calls SimpleBean.getId(), which is intercepted by Interceptor1.
>>
>> Interceptor1's aroundInvoke calls target.getId(), which is a circular
>> reference for extension and only works for proxy-based interception:
>>
>> class SimpleBean {
>>     @Interceptors(Interceptor1.class)
>>     public int getId()
>>     {
>>        return id;
>>     }
>>     ...
>> }
>>
>> class Interceptor1 {
>>     @AroundInvoke
>>     public Object aroundInvoke(InvocationContext ctx) throws Exception
>>     {
>>        SimpleBean target = (SimpleBean) ctx.getTarget();
>>        int id1 = target.getId();
>>        ...
>>      }
>> }
>>
>> The only change needed to the test is to create a SimpleBean.getBareId()
>> which is not an intercepted method.
>>
>> (Or, if the spec is re-interpreted to require a proxy implementation,
>> there should be an explicit test for it, not an implicit dependency like
>> this test.)
>>
>> -- Scott
>>
>>
>>
>> _______________________________________________
>> weld-dev mailing list
>> weld-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/weld-dev
>
>
>



More information about the weld-dev mailing list