-
1. Re: Getting Resource URL in Multi-Deployment Tests
kpiwko Jan 16, 2013 2:25 AM (in response to btsaunde)Hi Bryan,
Aslak to confirm, but I think that's not possible without a workaround now. Can you file a JIRA for that feature at issues.jboss.org/browse/ARQ?
The workaround would be similar to following:
@RunWith(Arquillian.class) public class TestClass { @Deployment(order = 1, name = "serverA") public static WebArchive createTestDeployment() { } @Deployment(order = 2, name = "serverB") public static WebArchive createTestDeployment2() { } private static URL deployment1URL; // note static, it is required here because JUnit creates new instance per test method private static URL deployment2URL; // note static, it is required here @Test @OperateOnDeployment("serverA") @RunAsClient @InSequence(1) public void getURLA(@ArquillianResource URL serverAUrl) throws Exception { deployment1URL = serverAUrl; } @Test @OperateOnDeployment("serverB") @RunAsClient @InSequence(2) public void getURLB(@ArquillianResource URL serverBUrl) throws Exception { deployment2URL = serverBUrl; } @Test @OperateOnDeployment("serverA") @RunAsClient @InSequence(3) public void callServerA() throws Exception { // deployment1URL and deployment2URL are available here } }
Regards,
Karel
-
2. Re: Getting Resource URL in Multi-Deployment Tests
aslak Jan 16, 2013 5:24 AM (in response to kpiwko)You can use @OperatesOnDeployment as a Qualifier on the @ArquillianResource injection to 'cross' contexts.
See the Container TCK for example: https://github.com/arquillian/arquillian-tck/blob/master/container/src/test/java/org/arquillian/tck/container/servlet_3_0/MultipleWebContextLookupMultiWarTestCase.java
-
3. Re: Getting Resource URL in Multi-Deployment Tests
kpiwko Jan 16, 2013 7:12 AM (in response to aslak)Pretty nice. Can the same qualifier be used for @Inject annotation as well?
-
4. Re: Getting Resource URL in Multi-Deployment Tests
aslak Jan 16, 2013 7:27 AM (in response to kpiwko)No. That would involve something like:
- override CDI injection in dep a
- from dep a call to client
- from client call dep b
- from incontainer dep b lookup the Bean and serialize it back to the client
- from client responde to dep a with the serialized Bean from dep b
- from incontainer dep a inject deserialized bean
Possible.. but.. at this point you would have a new Bean from a different BeanManager in a different Deployment. Not sure why you would want that?
-
5. Re: Getting Resource URL in Multi-Deployment Tests
kpiwko Jan 16, 2013 7:30 AM (in response to aslak)ARQ-1255 would profit from that.