Skip to content

Instantly share code, notes, and snippets.

@mojavelinux
Created October 5, 2011 08:34
Show Gist options
  • Save mojavelinux/1263934 to your computer and use it in GitHub Desktop.
Save mojavelinux/1263934 to your computer and use it in GitHub Desktop.
Arquillian Getting Started Guide - With Containers
<?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>
@zpaulovics
Copy link

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

@zpaulovics
Copy link

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

@mojavelinux
Copy link
Author

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.

@zpaulovics
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment