1 Reply Latest reply on Mar 5, 2012 5:43 AM by aslak

    @ArquillianResource java.net.URL when test is run on the server




      I've followed the discussions on the AS7 mailing lists about changing hardcoded URLs to injected @ArquillianResources and I'd really like to use it myself.


      Unfortunately these URLs are not supported when the test is run on the server - which is actually ok - and breaks the test with

          [junit] 11:09:14,188 ERROR [org.jboss.arquillian.protocol.jmx.JMXTestRunner] (pool-5-thread-1) Failed: MyTest.testFindAfterImport: java.lang.RuntimeException: Could not lookup value for field private java.net.URL MyTest.url


      This poses a problem for me because I want to have a test that looks like this:

      1. The first part runs as a client and modifies some server data using an HTTP request. Therefore I need the URL and I even get it injected.

      2. The second step should run on the server and check if the data from step 1 has been imported correctly. It should not use the HTTP interface but use other APIs to check that. I do not need the URL for this and it could be null, but breaking the test is not good for this.


      In my opinion I cannot split the tests into two classes because separate test classes should run independently of each other and each tests initializes the whole system including the database.


      Does anyone have any ideas if this could be solved differently, maybe can I "lookup" the URL in step 1?


      Thanks & kind regards,