You are on page 1of 1

Arquillian Chameleon

1. Add dependency

Add dependency in your build tool.

pom.xml

4. Chameleon annotation meta-annotation

You can use @ChameleonTarget as meta-annotation of your own annotations.

Wild y.java

<dependency> <groupId>org.arquillian.container</groupId> <artifactId> arquillian­chameleon­junit­container­starter </artifactId>

 

@Target({ ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented

@Inherited

 

<version>1.0.0.CR4</version>

 

@ChameleonTarget("wildfly:12.0.0.Final:managed")

<scope>test</scope>

 

public @interface Wildfly {

</dependency>

 

}

 

GreetingsServiceTest.java

2.

Chameleon container

 

You can de ne the container to be used in arquillian.xml using Chameleon special container.

@Wildfly @RunWith(ArquillianChameleon.class) public class GreetingServiceTest {

}

arquillian.xml

 

<container qualifier="chameleon" default="true"> <configuration> <property name="chameleonTarget">

 

5.

Rede ning meta-annotations

 

wildfly:13.0.0.Final:managed

 

</property>

 

You can use your own annotations as meta-annotations as well to rede ne any of the parameters.

</configuration>

</container>

 

Wild y13.java

3.

Chameleon annotation

 

@Target({ ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited

You

can

use

annotation

approach

by

using

@Wildfly @ChameleonTarget(version = "13.0.0") public @interface Wildfly13 {

ArquillianChameleon runner and annotating your test with

@ChameleonTarget.

 
 

}

GreetingsServiceTest.java

 

@RunWith(ArquillianChameleon.class)

 

@ChameleonTarget("wildfly:13.0.0.Final:managed")

 

public class GreetingServiceTest {

 

}

Important You

can

use

system

properties

and

variables, i.e ${application.server}

environment

6. Chameleon Maven build deployment

Add dependency:

pom.xml

<dependency> <groupId>org.arquillian.container</groupId> <artifactId> arquillian­chameleon­maven­build­deployment </artifactId>

<version>1.0.0.CR4</version>

<scope>test</scope>

</dependency>

You can execute Maven package goal and take output and deploy it to choosen container. @DeploymentParameters are used to set same parameters as you usually do in @Deployment annotation.

GreetingsServiceTest.java

@RunWith(ArquillianChameleon.class)

@ChameleonTarget("wildfly:13.0.0.Final:managed")

@MavenBuild @DeploymentParameters(testable = false) public class GreetingServiceTest {

}

7. Chameleon Gradle build deployment

pom.xml

<dependency> <groupId>org.arquillian.container</groupId> <artifactId> arquillian­chameleon­gradle­build­deployment </artifactId>

<version>1.0.0.CR4</version>

<scope>test</scope>

</dependency>

You can execute Gradle build task and take the output and deploy it to choosen container. @DeploymentParameters are used to set same parameters as you usually do in @Deployment annotation.

GreetingsServiceTest.java

@RunWith(ArquillianChameleon.class)

@ChameleonTarget("wildfly:12.0.0.Final:managed")

@GradleBuild public class GreetingServiceTest {

}

8. Supported Containers

Name

Version

JBoss EAP [6.x-7.x]

Wild y

[8.x-13.x]

JBoss AS

[7.0 - 7.1]

GlassFish

[3.1.2 - 5.x]

Payara

4.x

Tomcat

6.x-8.x]