I have noticed some inconsistencies in behavior between the managed and remote container implementations that result in failures when running tests between application servers. Since not all application servers offer a managed container, I would expect most developers to use the remote container by default. So we would want to make sure it performs as well as the managed container.
Below is likely just one example of unexpected behavior using the remote container.
Instead, I get one of two results.
If I use just @ArquillianResource I get in return http://localhost:8010/681737db-3621-4b1a-b77a-4f571b877126 which is the name of the EAR and not the web module.
If i use @ArquillianResource(SecurityServlet.class) I get an exception:
arquillianBeforeTest(jakarta.enterprise.concurrent.spec.ManagedScheduledExecutorService.security.SecurityTests) Time elapsed: 4.134 sec <<< FAILURE!
java.lang.RuntimeException: Could not lookup value for field java.net.URL jakarta.enterprise.concurrent.spec.ManagedScheduledExecutorService.security.SecurityTests.baseURL
at org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.enrich(ArquillianResourceTestEnricher.java:68)
at org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:51)
Caused by: java.lang.RuntimeException: All Providers for type class java.net.URL returned a null value: [org.jboss.arquillian.container.test.impl.enricher.resource.URLResourceProvider@9e28539]
at org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.lookup(ArquillianResourceTestEnricher.java:126)
at org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.enrich(ArquillianResourceTestEnricher.java:66)
at org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:51)
at org.jboss.arquillian.container.test.impl.ClientTestInstanceEnricher.enrich(ClientTestInstanceEnricher.java:48)
<featureManager>
<!-- Features being tested -->
<feature>jakartaee-9.1</feature>
<!-- Supporting features -->
<feature>jndi-1.0</feature>
<!-- Features needed for arquillan support -->
<feature>localConnector-1.0</feature>
<feature>restConnector-2.0</feature>
<feature>arquillian-support-jakarta-2.0</feature>
</featureManager>
Issue Overview
I have noticed some inconsistencies in behavior between the managed and remote container implementations that result in failures when running tests between application servers. Since not all application servers offer a managed container, I would expect most developers to use the remote container by default. So we would want to make sure it performs as well as the managed container.
Below is likely just one example of unexpected behavior using the remote container.
Stackoverflow Issue: https://stackoverflow.com/questions/70177509/use-arquillianresource-to-inject-url-when-deploying-an-enterprisearchive
Expected Behaviour
When deploying an Enterprise Archive with an embedded servlet:
Each module of the archive is given a random name:
I would expect the
@ArquillianResource(SecurityServlet.class)
to return:http://localhost:8010/5f6d70e5-13f9-4d49-a32f-c7b3138da9fa
Current Behaviour
Instead, I get one of two results. If I use just
@ArquillianResource
I get in returnhttp://localhost:8010/681737db-3621-4b1a-b77a-4f571b877126
which is the name of the EAR and not the web module.If i use
@ArquillianResource(SecurityServlet.class)
I get an exception:Steps To Reproduce
Additional Information
server.xml
pom.xml