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 image](http://lh4.ggpht.com/-L_aNkKABkl8/Ua8FT4OxFaI/AAAAAAABRO4/W4MKk4g_RNM/image_thumb%25255B2%25255D.png?imgmax=800)
The jUnit test looks like this one:
![image image](http://lh4.ggpht.com/-xWooibQEZ-k/Ua8FVFnw0II/AAAAAAABRPI/L3Tz2j3p4c4/image_thumb%25255B4%25255D.png?imgmax=800)
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 image](http://lh6.ggpht.com/-55nx9W6eqik/Ua8FWCoaeII/AAAAAAABRPY/SJGabgMyQFw/image_thumb%25255B6%25255D.png?imgmax=800)
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 image](http://lh5.ggpht.com/-gMADKk0JsD0/Ua8FXYWMysI/AAAAAAABRPo/Ze8ipEPxYog/image_thumb%25255B20%25255D.png?imgmax=800)
3) Creating from a ready war is more stable..
![image image](http://lh5.ggpht.com/-0EH4EdWaw3Y/Ua8FYI71EmI/AAAAAAABRP4/Mi_IACYKvtU/image_thumb%25255B22%25255D.png?imgmax=800)
Finally the full create deployment class will look like this.
![image image](http://lh6.ggpht.com/-HRapO9kqv5A/Ua8J1FLSXRI/AAAAAAABRQQ/tlX5yIx-hB4/image_thumb%25255B26%25255D.png?imgmax=800)
With this you can create the jUnit deployment in the way here shown..
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 image](http://lh4.ggpht.com/-L_aNkKABkl8/Ua8FT4OxFaI/AAAAAAABRO4/W4MKk4g_RNM/image_thumb%25255B2%25255D.png?imgmax=800)
The jUnit test looks like this one:
![image image](http://lh4.ggpht.com/-xWooibQEZ-k/Ua8FVFnw0II/AAAAAAABRPI/L3Tz2j3p4c4/image_thumb%25255B4%25255D.png?imgmax=800)
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 image](http://lh6.ggpht.com/-55nx9W6eqik/Ua8FWCoaeII/AAAAAAABRPY/SJGabgMyQFw/image_thumb%25255B6%25255D.png?imgmax=800)
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 image](http://lh5.ggpht.com/-gMADKk0JsD0/Ua8FXYWMysI/AAAAAAABRPo/Ze8ipEPxYog/image_thumb%25255B20%25255D.png?imgmax=800)
3) Creating from a ready war is more stable..
![image image](http://lh5.ggpht.com/-0EH4EdWaw3Y/Ua8FYI71EmI/AAAAAAABRP4/Mi_IACYKvtU/image_thumb%25255B22%25255D.png?imgmax=800)
Finally the full create deployment class will look like this.
![image image](http://lh6.ggpht.com/-HRapO9kqv5A/Ua8J1FLSXRI/AAAAAAABRQQ/tlX5yIx-hB4/image_thumb%25255B26%25255D.png?imgmax=800)
With this you can create the jUnit deployment in the way here shown..
![image image](http://lh5.ggpht.com/-27xBj-x46_I/Ua8J3BApfKI/AAAAAAABRQg/0HtGvj4-IpM/image_thumb%25255B28%25255D.png?imgmax=800)
Kommentare
Kommentar veröffentlichen