I'm wondering if anyone tried and succeeded using OpenEJB (or even Glassfish) for integration testing instead of JBoss Embedded (didn't work out for me). I found an interesting post in the AndroMDA forum, but it's quite old. I tried applying the code from it. I managed to use Component.getInstance(..) successfully, however, when it came to JPA/DB related things it would crash:

Sure. Most part of the code is from the post in the above mentioned AndroMDA forum. I haven't worked on it for a while so meanwhile I get a new Exception (must be because of update to 2.1.1): java.lang.UnsupportedOperationException: no transaction.I haven't the slightest idea why it doesn't apparently pick up my persistence.xml (see console log at the bottom).

I have no clue about the stuff behind the scenes so I wasn't able to figure it out on my own (and yet the community didn't seem to be interested in it)...

Well it looks like I changed nothing to the ContainerEnvironment class you use as base class for your tests. It still works for me with Seam 2.1.1.GA (but not with 2.1.2.CR1 as you could see in an other post).

Anyway I don't have the exception you encounter with transactions. But this may be due to the fact I use EJB transactions because all my Seam components are EJB3 session beans (AndroMDA default cartrdige builds EJB3 Seam components, not POJO ones). Is it your case ? Do you use POJO Seam components or EJB3 Seam components ?

Note I tried to unit test POJO Seam components with OpenEJB a few weeks ago. So I had to use Seam managed persistence contexts, but I couldn't make it work with Open EJB and I finally gave up ... I might have had the same no transaction exception you have, but I am not sure, I don't remember very well ...

I'm only surprised by the lack of interest of other users in this topic because honestly I simply can't get JBoss Embedded working with my setup (maven etc.).

I could make it work with JBoss embedded, but I encountered problems because my EJB3 session beans are generated by AndroMDA in two parts : a base class that is generated from UML model and an implementation class that is generated once. For what I remember, JBoss embedded had problems finding annotations in such classes. So I decided to use OpenEJB instead and it worked much better ;) Moreover JBoss embedded is not fully EJB3 compliant, so I think it would be a good thing if Seam gave the choice to use the EJB3 embedded container you want to run unit tests instead of imposing JBOss embedded.

I would like to use POJO Seam components too, so I will investigate further about how to test them with Open EJB. But I have not a lot of time for this for the moment :(

I can't tell which files are really crucial and which are not - but I can tell you that this combination works for me :-)Of course all credit goes to Olivier Thierry - I merely changed a few lines of code and added config files.

I can't tell which files are really crucial and which are not - but I can tell you that this combination works for me :-) Of course all credit goes to Olivier Thierry - I merely changed a few lines of code and added config files.

great detail!

i got heaps of dependencies issues that i am working thru to integrated openejb into my seam project.

what did u remove from the original seam-gen classpath? i assumed u removed all the jboss-embedded jars? Did u also remove the 'bootstrap' folder?

Hi guys, i am facing the same problem with my testNG. i am following the instruction you gave, and it works almost fine :).

My only problema is the fact that, when i run my install with test my persistence.xml must have diferente jndi name, one for the tomcat and another to the openEJB. So i have to disable the test when i run install for development phase, and enable test for a deply with test, Did you have the same issue?