-
1. Re: Multiple @Deployments?
aslak Sep 9, 2010 8:44 AM (in response to michaelschuetz)There is no way of doing multiple Deployments currently with the API.
We are working on exposing a Deployer API so you can deploy any number of deployments when ever you want, but currently not supported.
If you want to do it now, you can create a impl of ClassContextAppender and register e.g. a BeforeClass/AfterClass eventhandler that can scan your TestClass for a annotated method and deploy/undeploy the result using the DeployableContainer instance found in the Context.
-aslak-
-
2. Re: Multiple @Deployments?
dan.j.allen Sep 14, 2010 5:02 AM (in response to aslak)1 of 1 people found this helpfulI also want to mention that it would be very helpful to know which container is being used by the test run when the deployments are being created. This would allow me to deploy something different to GlassFish vs JBoss AS (or Java EE 5 vs Java EE 6 vs a Servlet container)
One way to accomplish this would be to inject a container identifier into the @Deployment method. Another would be to allow multiple @Deployment methods, each annotated with an execution environment qualifier (and perhaps one without a qualifier that's the fallback). Arquillian would then select the appropriate @Deployment method according to which container I am targeting. (See Proposal: Filtering out tests not compatible with target container).
For example:
@Deployment @JBossAS6Container public static Archive<?> createDeploymentForJBossAS() { // prepare for JBoss AS 6 } @Deployment @GlassFishV3Container public static Archive<?> createDeploymentForGlassFish() { // prepare for GlassFish V3 }
-
3. Re: Multiple @Deployments?
dan.j.allen Sep 14, 2010 5:03 AM (in response to dan.j.allen)The declarative approach is obviously much better for tooling
-
-
5. Re: Multiple @Deployments?
michaelschuetz Sep 14, 2010 7:34 PM (in response to dan.j.allen)Aslak, Dan - thanks a lot for your interesting replies.
Dan Allen schrieb:
@Deployment @JBossAS6Container
public static Archive<?> createDeploymentForJBossAS()
{
// prepare for JBoss AS 6
}Yeah, or even something like this:
@Deployment @JavaEE6Compliant
public static Archive<?> createDeploymentForEE6Containers()
{
// prepare for Java EE 6 qualified containers
}This would lead a bit into Paxexam direction.
I do find this really usefull for internal testing of Open Source projects like JBoss Weld etc.
Nevertheless, I personally wouldn't really need this feature within testing my projects as it is not so common to support multiple containers.
What I would really appreciate is the multiple @Deployment thing. This would help to build even more realistic integration tests. Could move some preconfiguration parts into test, directly.
Regards
Michael