arquillian / arquillian-container-jetty

Arquillian Jetty Containers
7 stars 14 forks source link

Configuring testing with Jetty 12 EE10 leads to an exception #185

Open manovotn opened 8 months ago

manovotn commented 8 months ago

I was trying to migrate (or rather reinvigorate) Weld's Jetty servlet testing and see if I can make it work with Jetty 12 EE 10. [Note that this module has been dead for some long time so I cannot say if this worked with previous versions of jetty.]

In the end I failed to pinpoint the issue and while I think it has to be some silly misconfiguration, I wasn't able to figure this one myself. If I run any of those tests, I can see following output and exception:

[INFO] --- surefire:3.0.0-M5:test (default-test) @ weld-servlet-test-jetty ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Mar 11, 2024 4:23:05 PM org.jboss.arquillian.container.jetty.embedded_12_ee10.JettyEmbeddedContainer start
INFO: Starting Jetty Embedded Server 12.0.7 [id:702025003]
Mar 11, 2024 4:23:06 PM org.jboss.arquillian.container.jetty.embedded_12_ee10.ArquillianAppProvider createApp
INFO: Webapp archive location: file:/home/manovotn/GitRepo/core/environments/servlet/tests/jetty/target/arquillian-jetty-temp/export1759194290394713801e810e33b-48e1-47e4-bb71-c216da9be638.war
[INFO] Running org.jboss.weld.environment.servlet.test.discovery.scope.CustomNormalScopeDiscoveryTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.026 s <<< FAILURE! - in org.jboss.weld.environment.servlet.test.discovery.scope.CustomNormalScopeDiscoveryTest
[ERROR] org.jboss.weld.environment.servlet.test.discovery.scope.CustomNormalScopeDiscoveryTest.testCustomNormalScope  Time elapsed: 0.007 s  <<< ERROR!
java.lang.IllegalArgumentException: ArquillianServletRunnerEE9 not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.

Mar 11, 2024 4:23:06 PM org.jboss.arquillian.container.jetty.embedded_12_ee10.JettyEmbeddedContainer stop
INFO: Stopping Jetty Embedded Server [id:702025003]
[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   CustomNormalScopeDiscoveryTest.testCustomNormalScope » IllegalArgument Arquill...

The good part is that I can see that Jetty is being started and the deployment is created as well. The bad part is the exception which tells me pretty much nothing - my guess was missing dependencies but the deployment that gets created actually contains the lib/arquillian-jakarta-servlet-protocol.jar which is the dep that should contains the ArquillianServletRunnerEE9 implementation. Upon further browsing, I can see in the deployment that there is the XML mentioning the servlet as well as as the servlet impl.

How to reproduce:

Here's Weld branch that has the changes and can be used to reproduce with following steps.

Versions used:

Any thoughts on what I missed and/or misconfigured? :)

joakime commented 8 months ago

Why is ArquillianServletRunnerEE9 being used for EE10 testing?

manovotn commented 8 months ago

Why is ArquillianServletRunnerEE9 being used for EE10 testing?

I think that's just unfortunate naming. See https://github.com/arquillian/arquillian-jakarta/blob/main/protocols/servlet-jakarta/src/main/resources/org/jboss/arquillian/protocol/servlet5/v_5/web-fragment.xml This is used even for EE10 testing as far as I can tell.

manovotn commented 8 months ago

@joakime Indeed the same artifact is used for Jetty embedded EE9 and EE10 as can be seen from this POM - https://github.com/arquillian/arquillian-container-jetty/blob/master/jetty-embedded-12-ee10/pom.xml#L69-L72 But like I said, that's just unfortunate naming; probably should have been ArquillianServletRunnerJakarta but I don't see a reason why this wouldn't work for EE10.