Unit testing is essential part of software development. Testing POJOs with JUnit is de facto standard. But when it comes to execute unit tests on Java EE artifacts like servlets and EJB beans, a problem arises. Java EE artifacts live in a Java EE container rather than in a pure Java Virtual Machine. How do we execute our JUnits for servlets and EJBs in the environment of the Java EE container?
The Apache Cactus project tries to solve this problem for years and, indeed, it makes more and more steps towards reaching the goal. The main problem with Cactus is that you need to run your entire application server just for the sake of unit testing your EJBs. In many cases the application server could be a monster that could eat a lot of resources of your developer system.
In this post I will uncover you a little secret on how to test your EJBs in much simpler and resource efficient way. You may have already known about the Apache OpenEJB project and the lightweight and embeddable EJB container it provides. If you still miss that, then it is a good idea to take a look at my previous blog post where you will learn how to integrate it with your Eclipse IDE.
Saturday, August 9, 2008
Friday, August 1, 2008
Looking for an easy and lightweight environment for developing Enterprise JavaBeans? The Eclipse IDE for Java EE Developers gives you a great tooling to develop your EJBs, while Apache OpenEJB project provides an embeddable and lightweight EJB 3.0 runtime to execute them. The glue that sticks the Eclipse's and Apache's perls together is the OpenEJB Eclipse plug-in, developed by Jonathan Gallimore. In this post I will give you some kick-off hints about installing this plug-in that integrates the OpenEJB runtime with Eclipse.