[weld-issues] [JBoss JIRA] (CDITCK-206) Add test to verify visibly of beans registered explicitly through an extension in non-bean archives
Martin Kouba (Resolved) (JIRA)
jira-events at lists.jboss.org
Mon Oct 10 06:51:16 EDT 2011
[ https://issues.jboss.org/browse/CDITCK-206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Kouba resolved CDITCK-206.
---------------------------------
Assignee: Martin Kouba
Fix Version/s: 1.1.0.CR1
Resolution: Done
Resolved as a part of CDITCK-230.
> Add test to verify visibly of beans registered explicitly through an extension in non-bean archives
> ---------------------------------------------------------------------------------------------------
>
> Key: CDITCK-206
> URL: https://issues.jboss.org/browse/CDITCK-206
> Project: CDI TCK
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: Tests
> Affects Versions: 1.0.4.Final
> Reporter: Dan Allen
> Assignee: Martin Kouba
> Fix For: 1.1.0.CR1
>
>
> Add a test that answers this question:
> Can an extension register a bean programmatically for a class that resides in another non-bean archive?
> This question requires a short example which is available in the OpenTCK test suite and may be ported to the CDI TCK [1].
> Assume one archive, a.jar, has the following contents:
> org/opentck/javaee/cdi/spi/beforebeandiscovery/BeanClassToRegister.class
> A second archive, b.jar, has the following contents:
> org/opentck/javaee/cdi/spi/beforebeandiscovery/AnotherBeanClassToRegister.class
> org/opentck/javaee/cdi/spi/beforebeandiscovery/AnotherManualBeanRegistrationExtension.class
> org/opentck/javaee/cdi/spi/beforebeandiscovery/ManualBeanRegistrationExtension.class
> META-INF/services/javax.enterprise.inject.spi.Extension
> AnotherBeanClassToRegister has an injection point of type BeanClassToRegister:
> public class AnotherBeanClassToRegister {
> @Inject
> private BeanClassToRegister collaborator;
> }
> BeanClassToRegister and AnotherBeanClassToRegister are added as beans programmatically in respective extensions listed in the service provider descriptor:
> public class ManualBeanRegistrationExtension implements Extension {
> public void registerBeans(@Observes BeforeBeanDiscovery event, BeanManager bm) {
> event.addAnnotatedType(bm.createAnnotatedType(BeanClassToRegister.class));
> }
> }
> public class AnotherManualBeanRegistrationExtension implements Extension {
> public void registerBeans(@Observes BeforeBeanDiscovery event, BeanManager bm) {
> event.addAnnotatedType(bm.createAnnotatedType(AnotherBeanClassToRegister.class));
> }
> }
> The two libraries, a.jar and b.jar are bundled in a web archive, test.war
> WEB-INF/lib/a.jar
> WEB-INF/lib/b.jar
> WEB-INF/beans.xml
> Deploying this archive to the reference implementation fails with an error message that the injection point from above cannot be satisfied. There appears to be a visibility problem across bean archives in this case.
> Adding META-INF/beans.xml to a.jar and removing the ManualBeanRegistrationExtension from b.jar resolves the issue in the reference implementation.
> [1] https://github.com/opentck/javaee_cdi/tree/master/src/test/java/org/opentck/javaee/cdi/spi/beforebeandiscovery
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the weld-issues
mailing list