I am trying to set up a project that does a lot of persistence for Arquillian testing.
Our persistence requirements include auditing (last modified time/user, etc) which are done by grabbing the User Principal objects out of the request (it's on ThreadLocal) and reading the logged in user name. The Principal is populated using J2EE security, with Basic Auth on local server and corporate SSO solution populating the same object in QA and production.
Long story short, I need to have Arquillian unit test pass a basic auth headers in order to get through security configured in web.xml for the project I am testing, when it invokes tests using Servlet 3.0, but I can't figure out how to do it.... Is there such an option, either in arquillian.xml or in container configuration?
For general info: using Junit 4 integration, Arquillian 1.0 FINAL, Websphere 8.0 remote container -- but this question should apply across all containers.
Maybe you could try the drone extension and set the headers with the addCustomRequestHeader?
Aslak, I see the code in org.jboss.arquillian.protocol.servlet.ServletMethodExecutor.execute() method that invokes the test servlet, and as I thought, there's no configuration that allows me to add a custom header to the POST. But, I can't find any way to either subclass ServletMethodExecutor and override execute(), or plug any sort of custom implementation of URLConnection. Is there anything I can do myself, or you can enable me to do, with perhaps a Service Locator (??) or any other approach, to add some of my own code to add custom headers?