I'm running a JMS test (@RunAsClient) on a managed instance of jboss as 7 (7.1.1.Final).
What I noticed was that if I placed a jndi.properties file in my src/test/resources with the following:
java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
java.naming.provider.url=remote://localhost:4447
that this would fail, because the InitialContext (used in the CommonDeployableContainer), is being created before the server is up and running -- intializing the ManagedDeployableContainer (which extends the CommonDeployableContainer) is of course one of the steps necessary to get the server up and running.
However, @Resource injections, which are processed via the ResourceInjectionEnricher, are partially based on the InitialContext content.
So @Resource injections like the following would fail:
@Resource(mappedName = "jms/queues/jbpmQueue")
public Queue testQueue;
@Resource(mappedName = "jms/RemoteConnectionFactory")
public ConnectionFactory factory;
What would be great, is if there was a way to inject JNDI properties and reinitialize the InitialContext in, for example, a ServerSetupTask -- thus allowing me to use @Resource annotations.
This is sort of a developer discussion and sort of a user discussion, but I figured I'd "err on the side of caution" and post it in the user forum.
Thanks,
Marco
PS. I've also created ARQ-1362 because it does seem like injection works for in-jvm Arquillian tests with JMS resources. Existing tests that inject JMS resources don't seem to work with 1.0.3.Final -- hopefully it wasn't something in my configuration that I missed.