To get code coverage with Arquillian we often use jacoco because:
- there is an arquillian extension 🙂
- cobertura, emma…doesn’t work
This is generally true but if you try to use jacoco with OpenEJB embedded Arquillian adapter (this note applies to OpenWebBeans adapter too) it will fail. Why? Simply because this adapter is not a standard one for Arquillian since it is embedded, the JVM is shared between the client and the server…You can remove the jacoco extension and use the jacoco maven plugin/javaagent…but there is easier.
Yes that’s embedded so you can use what you want: cobertura (or Emma) works!
Note on using cobertura in an EJB container: cobertura instruments classes adding an interface. It means if you have a @Local EJB it will magically implement two interfaces (your business one and the Cobertura one). From a spec point of view the deployment will fail. The workaround is to specify as @Local parameter the business interface the bean implements: @Local(MyBusiness.class). In the same idea, @LocalBean becomes mandatory with cobertura (it is not otherwise).
Redirecting a http request to another page is often application related but sometimes we just want to make a simple redirection. Two ways to do it generally: using a front redirection (mod rewrite ;)) or adding a filter to do so.
To make it easier in simple cases TomEE has its own router.
In some case you will want to add a set of jars to all webapps deployed to TomEE.
You can imagine a lot of ways to do so but in fact TomEE includes a simple solution to manage it.
When you write a JEE application it is common to need to interact with remote hosts (at least for your database).
Depending on network quality you can get poor performances and sometimes it is hard to check it (let say you don’t have a ssh access to the machine which is pretty common for cloud platforms).
Another use case is to valid you can contact the remote host (in complex environment with proxies for instance).
That’s why we added to TomEE a JMX ping!
Caucho wrote for Resin Quercus. This is mainly (from a user point of view) a servlet managing PHP in a java container.
I first thought it was linked to Resin but in fact it is pretty generic and can be used in almost all containers (with sometimes some few limitations).
So i tried with my prefered container: TomEE.
When you write tests using TomEE Arquillian Remote Adapter you can discover a data directory was created. Here is the little tip to avoid it.
Maybe Mockito sounds today an old school way to write a test since Arquillian is out but it keeps some benefit in some complicated cases.
That’s why in last days OpenEJB was integrated with Mockito.