1 Reply Latest reply on Apr 7, 2010 2:51 AM by Stuart Douglas

    disable mail when running tests in the embedded JBoss

    Jean Luc Apprentice

      When the code is deployed in the regular environment, my application sends emails (through a JNDI-defined configuration). Is is possible to elegantly disable this functionality when the code is running tests in the embedded JBoss? I don't want to test the emails but simply to not send them.

      If I simply not configure a <mail:mail-session> in the components.xml used by the embedded JBoss, I get the following error:

      Caused by: java.lang.NullPointerException
           at org.jboss.seam.ui.facelet.RendererRequest.cleanup(RendererRequest.java:69)
           at org.jboss.seam.ui.facelet.RendererRequest.run(RendererRequest.java:105)
           at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:43)

      A kludgy approach would be to figure out in the application code whether it's running in the embedded JBoss (either by some system property or by successfully loaded an embedded-specific class or something similar), but I really hope I can solve this through configuration.