Arquillian – real world usage

Since a  few days we are using Arquillian. The first tests are good, because we tried it in a separated project. This you can see from my blog entry http://www.rapidpm.org/2013/05/javaee-arquillian-first-version-to-play.html But.. I found some problems.

The demo project is a single module maven project. The real live project is a multi-maven project. So I started to fill the parent pom.xml with the dependencies, went to the child module and started with my first jUnit. A quite simple CDI.
As you can see, it is the LoggerProducer.
image

The jUnit test looks like this one:
image
As you can see, nothing complicated. The test is running with a weld-ee container. After this, I thought that we can start with the next jUnit test. A simple EJB test would be the first one using a jboss managed container.
First step is writing the deployment like this:
image
But what happened? The jUnit test failed with the error that to many Service-implementations are available.
After a little searching it shows..  not to many Services.. No Service was found.. But it was not able to run.
So I changed a few things.
1) If you have a multi module project you have to put in every pom.xml the dependencies incl the dep-management. Not nice, but the only way to get it running in the moment.
2) You have to read every pom.xml you need… only reading the parent pom.xml is not enough. I hope this will change in the future.
image
3) Creating from a ready war is more stable..
image

Finally the full create deployment class will look like this.
image

With this you can create the jUnit deployment in the way here shown..
image

Kommentare

Beliebte Posts