public
Created

Arquillian Getting Started Guide - With Containers

  • Download Gist
pom.xml
XML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
 
<groupId>org.arquillian.example</groupId>
<artifactId>arquillian-tutorial</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
 
<name>arquillian-tutorial</name>
<url>http://arquillian.org</url>
 
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
 
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.0.0.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>arquillian-weld-ee-embedded</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
<version>1.0.0.CR2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core</artifactId>
<version>1.1.5.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>arquillian-glassfish-embedded</id>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>arquillian-jbossas-managed</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<version>7.0.2.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

Hi,
Is not it better to use the artifactId "jboss-javaee-web-6.0" for jboss-as profile of version AS 7.0? In addition the jboss-javaee-web-6.0 has 2.0.0.Final version already.
ZoPa

Hi Dan,
For beginners, consider to use the arquillian-glassfish-remote-3.1 container. If you use the remote then you can manage the GlssFish by the standard glassfish management tools that my be well known by the developers having glassfish background. It is particularly true when you want to set-up data-sources or messaging endpoints for your tests. In addition the remote container is much faster then the embedded one.
I have tried to insert here my example profile for the remote glassfish 3.1, but had some difficulties inserting xml tags .-). You can find my example profile in the Arquillian Reference Guide at the Complete Container Reference section.
ZoPa

zpaulovics, thanks for the feedback.

The jboss-javaee-web-6.0 profile would be ideal, but there is a bug in it that prevents it from working without an exclusion for xalan. We want to keep things simple, so until that's resolved, we are keen to avoid recommending it's usage.

I am going to include a part 2 of the guide that will talk about using remote containers. For part 1, the focus is on minimal action & setup on the readers part, which is why I opted for using containers that are started automatically by Arquillian.

The tutorials will be posted soon so that you can see these files in context.

Thank you, I have got it. So I need to use org.jboss.as:jboss-javaee-6.0:1.0.0.Final not to got the xalan issue. Is that right?

Just for fun I have made a try using javax:javaee-api:6.0 and javax:javaee-web-api:6.0. in my jbossas-remote-7.0 profile. My tests (using EJBs and JPA2) work perfectly with these dependencies. In my stupid thinking the api should be the same. Why Jboss release a different implementation? Is there any particular reason of that you are not using the javax library api (for instance Jboss has different interpretation of the specification), or is it just a policy within Jboss to use your own api? It is a bit confusing for me as a developer if a can not trust in the APIs in the javax library.

Zoltan

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.