Its all about unit testing for my team. Our app is a mixture of JMX (dynamic) MBeans and
EJBs (3). We are not using Seam. Project is Maven 2 based. We intend to do extensive
unit testing inline with the Maven build (out-of-container testing) on ALL code.
Specific out-of-container test patterns we need supported.
1. MBean in isolation.
Pretty easy. Unit test code just simulates JMX container calls to MBean lifecycle methods
to start/stop the MBean, etc.
2. SLSB in isolation.
One of our SLSBs wraps all our JPA operations. Currently we are able to make this work
(SLSB/JPA) using EJB3Unit, but its docs are poor and project has little community support.
We have done some initial reading re: OpenEJB3 and GlassFish maybe being a better
alternative.
3. MBean calling MBean(s).
Completely blocked here. My guess is that, unlike service beans, dynamic MBeans can not
use JNDI to obtain instances of other dynamic MBeans. MBean must call JBoss JMX server to
locate called MBean. No apparent way to support this out-of-container (JMX server).
4. MBean calling SLSB(s)
We are able to fake this out via stuffing JNDI with a mock SLSB. Test setup again
simulates JMX lifecycle in instantiate MBean, which then is able to get to the SLSB mock
via the stuffed JNDI.
5. SLSB calling MBean (s).
EJB3Unit is able to instantiate the SLSB. Again, we simulate JMX lifecycle methods to
create the MBean instance, then inject it via a direct call to a property setter. Note
that this means we must use property based injection for DI (not a problem).
-----------------
2 and 5 are problems because embedded container would not work, EJB3Unit is barely
sufficient.
3 is a problem because it seems a dynamic MBean, unlike a SLSB, can not use DI/JNDI to get
an instance of an other dynamic MBean? I believe 3 goes away if we were using @Service
beans, but then we would not be able to manipulate MBean meta data (operation and
attribute descriptions, validation on attribute settings, etc... we developed several Java
7 like annotations for our MBeans).
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4189875#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...