jakartaee / rest

Jakarta RESTful Web Services
Other
351 stars 114 forks source link

TCK context root improvements #1190

Open jbescos opened 7 months ago

jbescos commented 7 months ago

Many tests are done to have the root context of a war file, but this it not valid in some frameworks like Helidon, where there is no such context root.

Any JAXRSClientIT contains the next 2 things:

setContextRoot("/jaxrs_spec_resource_valueofandfromstring_web");
...
WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxrs_spec_resource_valueofandfromstring_web.war");

We can see that explicitly sets the context root with the war name.

It would be really helpful for Helidon developers if TCKs takes the context root in this other way (as it is already done in rest/jaxrs-tck/src/main/java/ee/jakarta/tck/ws/rs/spec/client/exceptions/ClientExceptionsIT.java):

    @ArquillianResource
    private URL baseUrl;

In this way the web container will provide the context root and we get rid of this issue in Helidon.

jamezp commented 7 months ago

My assumption is this was because that's how the tests were and it was minimal effort to get them migrated to Arquillian based tests. However, using the URL, or URI, injection is the correct way to do it.

spericas commented 7 months ago

@jbescos Feel free to create a PR for this