[cdi-dev] dependent bean handling

Martin Kouba mkouba at redhat.com
Thu Jun 5 04:21:04 EDT 2014


Yep. By the way that's why we created a special util class
org.jboss.cdi.tck.util.DependentInstance.

This test is very old [1]. We should revise the whole test suite. I've
created a new issue:
https://issues.jboss.org/browse/CDITCK-424

Martin

[1]
https://github.com/cdi-spec/cdi-tck/blob/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java#L72


Dne 5.6.2014 09:24, Jozef Hartinger napsal(a):
> Agreed. This does not look right.
> 
> On 06/04/2014 06:13 PM, Mark Struberg wrote:
>> Hi!
>>
>> I came across this in org.jboss.cdi.tck.tests.implementation.producer.method.definition.ProducerMethodDefinitionTest ,but other methods might contain something similar:
>>
>>      @Test
>>      @SpecAssertions({ @SpecAssertion(section = DISPOSER_METHOD, id = "b") })
>>      public void testStaticDisposerMethod() throws Exception {
>>          assert getBeans(String.class, TAME_LITERAL).size() == 1;
>>          String aString = getContextualReference(String.class, TAME_LITERAL);
>>          Bean<String> stringBean = getBeans(String.class, TAME_LITERAL).iterator().next();
>>          CreationalContext<String> creationalContext = getCurrentManager().createCreationalContext(stringBean);
>>          stringBean.destroy(aString, creationalContext);
>>          assert BeanWithStaticProducerMethod.stringDestroyed;
>>      }
>>
>>
>> the Dependent producer gets called via BeanManager#getReference _internally_ by using a 'throw away' CreationalContext
>> And then you later create a _new_ CreationalContext and use this for bean.destroy.
>>
>> We should rather use the original CC. As is it now, this test is on the edge of being illegal ;)
>>
>> LieGrue,
>> strub
>>
>> _______________________________________________
>> cdi-dev mailing list
>> cdi-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/cdi-dev
> 
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
> 


More information about the cdi-dev mailing list