Posts

Showing posts with the label CDI

Another Arquillian EJB test, this time based on TestNG

In my last post I presented Simple EJB Arquillian test based on JUnit running on managed JBoss AS 7 . And in this post I show a similar test only this time it is based on the TestNG testing framework. I have more experience with TestNG than with JUnit and all my tests are based on it. That is why I have decided to give it a try despite the fact that my preliminary tries failed. My goal was to create one Java EE 6 bean, a simple persistence entity and one TestNG test. A testing project described in this post is again based on the Maven and targeted on JBoss AS 7. It is only supposed to show the possibilities the Arquillian offers not to act as a real world application.

Simple EJB Arquillian test based on JUnit running on managed JBoss AS 7

I believe that every programmer understands the need for testing. We want our code to be tested and bug free, but the time is of the essence. We need tests to be easily written and executed and as exact as possible. From my experience, testing Java EE always required a special treatment. You could either code additional means to enable launching tests from your application, or you were left with creating a test environment using for example OpenEJB for beans, something different for transactions and something else for persistence. The second approach is better, because it is more manageable and transparent, but it's downside is that the tests are run in a different environment than the one used as runtime. This means that not everything that works in tests will work when deployed on server and vice versa. In this post I am demonstrating the power of Arquillian.

Wicket CDI integration on Jboss AS 7

I have recently begun experimenting with the Apache Wicket web framework. But when I launched the Wicket's examples, I have encountered " java.lang.IllegalArgumentException: Argument 'beanManager' may not be null " expeption. Even though the solution is quite simple, I don't think that it is as documented as it should be. And the fact that it is the only problem preventing the Wicket's example application from running on Jboss AS 7 is fairly grim.