New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARQ-1975 Adds arquillian resource provider for servlet context #92
Conversation
…vlet protocol. Adds ServletContext as Arquillian Resource so it can be used in the tests. In case of in-container tests, ServletContxt used is the one provided by the Servlet protocol. In case of client test, it only works in case of embedded containers and they are the responsible of provide the instance by producing the instance
Wait since I need to refactor what you mention in this comment. |
@aslakknutsen notice that ServletContext is set in ThreadLocal inside execute method (https://github.com/arquillian/arquillian-core/blob/master/protocols/servlet/src/main/java/org/jboss/arquillian/protocol/servlet/runner/ServletTestRunner.java#L92) so ManagerStarting would it contain a null or a real value? Not sure, maybe the best event would be before enrichment? |
It should be set by the time ManagerStarting happens in container. This is roughly the order of execution:
|
@@ -32,6 +34,7 @@ | |||
public void register(ExtensionBuilder builder) | |||
{ | |||
builder.service(Protocol.class, org.jboss.arquillian.protocol.servlet.v_2_5.ServletProtocol.class) | |||
.service(Protocol.class, org.jboss.arquillian.protocol.servlet.v_3.ServletProtocol.class); | |||
.service(Protocol.class, org.jboss.arquillian.protocol.servlet.v_3.ServletProtocol.class) | |||
.service(ResourceProvider.class, ServletContextResourceProvider.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think you need to add a Validate.classExists("javax.servlet.ServletContext") around the ServletContextResourceProvider service registration to avoid requiring the servlet-api classes to be available on client classpath.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix that btw..:)
Thank you! Pushed upstream d1e9964 |
No description provided.