Adam Bien's Weblog

TomEE Maven Alien--Sample Project For Maven 3, Arquillian and TomEE

Lets assume you would like to integration test the following EJB within TomEE (a Tomcat on stereoids which makes lots of your boilerplate superfluous) with Arquillian:

public class HelloBoundary {
    public String hello(){
        return "Good Morning: " + new Date();

Arquillian test code is server agnostic; the archive is created, deployed and the EJB HelloBoundary is available for injection:

import javax.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.runner.RunWith;

public class HelloBoundaryIT {
    HelloBoundary cut;
    public static WebArchive deploy(){
        return ShrinkWrap.create(WebArchive.class).
    public void injection() {

Usually Java EE 6 projects are packaged as WARs. The only interesting part of the POM are the TomEE and Arquillian dependencies:




The project tomee-alien was checked in into

[In the "Real World Java EE Patterns--Rethinking Best Practices" book (Second Iteration, "Green Book"), Arquillian was used for integration testing of Java EE-infrastructure dependent code.]

See you at Java EE Workshops at MUC Airport!

NEW dates, new workshop: Java EE 7 Workshops: Bootstrap, Effective, Architectures, JavaScript Bootstrap and HTML 5 December, 7th-11th
NEW: Java EE 7 Testing-- Available For Streaming


A book about rethinking Java EE Patterns


Shouldn't the tomee-dependency be also test-scoped?

Posted by on November 12, 2012 at 01:08 PM CET #


it could, but I'm using the TomEE dependencies for regular compilation as well. Please also see:



Posted by Adam Bien on November 13, 2012 at 06:10 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments