TestNG & EmbeddedJBossContainer

View: New views
2 Messages — Rating Filter:   Alert me  

TestNG & EmbeddedJBossContainer

by mckhatri :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I've been trying to get EJB3 testing up and running using TestNG and references from this website: http://blog.hibernate.org/Bloggers/Everyone/Year/2005/Month/11/Day/24#ejb3withtestng

Basically, I'm trying to start up the JBOSS embedded container so that the EJB3 components have somewhere to reside.  Then, I would be able to run TestNG tests on them.  However, I'm receiving an exception complaining about me attempting to invoke a seam component outside an initialized application.

Any insight on the matter would be much appreciated.

Re: TestNG & EmbeddedJBossContainer

by threecuptea :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


mckhatri wrote:
Hi,

I've been trying to get EJB3 testing up and running using TestNG and references from this website: http://blog.hibernate.org/Bloggers/Everyone/Year/2005/Month/11/Day/24#ejb3withtestng

Basically, I'm trying to start up the JBOSS embedded container so that the EJB3 components have somewhere to reside.  Then, I would be able to run TestNG tests on them.  However, I'm receiving an exception complaining about me attempting to invoke a seam component outside an initialized application.

Any insight on the matter would be much appreciated.
Use org.jboss.ejb3.embedded.EJB3StandaloneBootstrap instead.  I use that and it works. The followings are code excerpt.  
Check Hibernate CaveatEmptor-JPA sample if you want to see the whole sample.
 @BeforeSuite(alwaysRun = true)
    @Parameters({"deploy_beans_xml", "scan_classpath","jndi_name_emf", "jndi_name_usertx"})
    public void startContainer(String deployBeansXml, String scanClasspath,
                               String jndiNameEMF, String jndiNameUserTx)
            throws Exception {
        JNDI_NAME_EMF = jndiNameEMF;
        JNDI_NAME_USERTX = jndiNameUserTx;

        // Boot the JBoss Microcontainer with EJB3 settings, automatically
        // loads ejb3-interceptors-aop.xml and embedded-jboss-beans.xml.
        EJB3StandaloneBootstrap.boot(null);

        // Deploy custom stateless beans (datasource, mostly)
        EJB3StandaloneBootstrap.deployXmlResource(deployBeansXml);

        EJB3StandaloneBootstrap.scanClasspath(scanClasspath.replace("/", File.separator));
        // Create InitialContext from jndi.properties
        jndi = new InitialContext();
    }