I'm trying to test a bean using an @Resource with the following dependencies:
<dependency> <groupId>org.jboss.arquillian.container</groupId> <artifactId>arquillian-weld-ee-embedded-1.1</artifactId> <version>1.0.0.CR3</version> </dependency> <dependency> <groupId>org.jboss.weld</groupId> <artifactId>weld-core</artifactId> <version>1.1.8.Final</version> </dependency>
Unfortunately, I can't find a way to override the MockResourceInjectionService of the weld-ee container.
I have a solution at hand that works with weld-se:
In weld-ee this don't work since the BeanDeploymentArchive is built directly and not loaded via any ConfigurationBuilder :-(
On the other hand, the tests contain RequestScoped beans => weld-se won't work because it doesn't have request or session scope :-(
Is there any way to override the Mock-Services (JPA is the next on my list)?
Found a solution:
Replace the services in the BeanManagerImpl using a CDI-extension and the event BeforeBeanDiscovery.