Search in sources :

Example 1 with BasicStatefulObject

use of org.apache.openejb.test.stateful.BasicStatefulObject in project tomee by apache.

the class EncSingletonBean method lookupStatefulBean.

public void lookupStatefulBean() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final BasicStatefulHome home = (BasicStatefulHome) ctx.lookup("java:comp/env/singleton/beanReferences/stateful");
            Assert.assertNotNull("The EJBHome looked up is null", home);
            final BasicStatefulObject object = home.createObject("Enc Bean");
            Assert.assertNotNull("The EJBObject is null", object);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : BasicStatefulHome(org.apache.openejb.test.stateful.BasicStatefulHome) TestFailureException(org.apache.openejb.test.TestFailureException) AssertionFailedError(junit.framework.AssertionFailedError) InitialContext(javax.naming.InitialContext) JMSException(javax.jms.JMSException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException) BasicStatefulObject(org.apache.openejb.test.stateful.BasicStatefulObject)

Example 2 with BasicStatefulObject

use of org.apache.openejb.test.stateful.BasicStatefulObject in project tomee by apache.

the class ContextLookupMdbPojoBean method lookupStatefulBean.

public void lookupStatefulBean() throws TestFailureException {
    try {
        try {
            final BasicStatefulHome home = (BasicStatefulHome) getMessageDrivenContext().lookup("stateless/beanReferences/stateful");
            Assert.assertNotNull("The EJBHome looked up is null", home);
            final BasicStatefulObject object = home.createObject("Enc Bean");
            Assert.assertNotNull("The EJBObject is null", object);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : BasicStatefulHome(org.apache.openejb.test.stateful.BasicStatefulHome) TestFailureException(org.apache.openejb.test.TestFailureException) AssertionFailedError(junit.framework.AssertionFailedError) NamingException(javax.naming.NamingException) JMSException(javax.jms.JMSException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException) BasicStatefulObject(org.apache.openejb.test.stateful.BasicStatefulObject)

Example 3 with BasicStatefulObject

use of org.apache.openejb.test.stateful.BasicStatefulObject in project tomee by apache.

the class EncBmpBean method lookupStatefulBean.

public void lookupStatefulBean() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final BasicStatefulHome home = (BasicStatefulHome) ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateful");
            Assert.assertNotNull("The EJBHome looked up is null", home);
            final BasicStatefulObject object = home.createObject("Enc Bean");
            Assert.assertNotNull("The EJBObject is null", object);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : BasicStatefulHome(org.apache.openejb.test.stateful.BasicStatefulHome) TestFailureException(org.apache.openejb.test.TestFailureException) AssertionFailedError(junit.framework.AssertionFailedError) InitialContext(javax.naming.InitialContext) RemoveException(javax.ejb.RemoveException) JMSException(javax.jms.JMSException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException) BasicStatefulObject(org.apache.openejb.test.stateful.BasicStatefulObject)

Example 4 with BasicStatefulObject

use of org.apache.openejb.test.stateful.BasicStatefulObject in project tomee by apache.

the class EncStatelessBean method lookupStatefulBean.

public void lookupStatefulBean() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final BasicStatefulHome home = (BasicStatefulHome) ctx.lookup("java:comp/env/stateless/beanReferences/stateful");
            Assert.assertNotNull("The EJBHome looked up is null", home);
            final BasicStatefulObject object = home.createObject("Enc Bean");
            Assert.assertNotNull("The EJBObject is null", object);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : BasicStatefulHome(org.apache.openejb.test.stateful.BasicStatefulHome) TestFailureException(org.apache.openejb.test.TestFailureException) AssertionFailedError(junit.framework.AssertionFailedError) InitialContext(javax.naming.InitialContext) JMSException(javax.jms.JMSException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException) BasicStatefulObject(org.apache.openejb.test.stateful.BasicStatefulObject)

Example 5 with BasicStatefulObject

use of org.apache.openejb.test.stateful.BasicStatefulObject in project tomee by apache.

the class ContextLookupStatelessPojoBean method lookupStatefulBean.

public void lookupStatefulBean() throws TestFailureException {
    try {
        try {
            final BasicStatefulHome home = (BasicStatefulHome) getSessionContext().lookup("stateless/beanReferences/stateful");
            Assert.assertNotNull("The EJBHome looked up is null", home);
            final BasicStatefulObject object = home.createObject("Enc Bean");
            Assert.assertNotNull("The EJBObject is null", object);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : BasicStatefulHome(org.apache.openejb.test.stateful.BasicStatefulHome) TestFailureException(org.apache.openejb.test.TestFailureException) AssertionFailedError(junit.framework.AssertionFailedError) NamingException(javax.naming.NamingException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException) BasicStatefulObject(org.apache.openejb.test.stateful.BasicStatefulObject)

Aggregations

AssertionFailedError (junit.framework.AssertionFailedError)12 TestFailureException (org.apache.openejb.test.TestFailureException)12 BasicStatefulHome (org.apache.openejb.test.stateful.BasicStatefulHome)12 BasicStatefulObject (org.apache.openejb.test.stateful.BasicStatefulObject)12 EJBException (javax.ejb.EJBException)11 JMSException (javax.jms.JMSException)11 RemoteException (java.rmi.RemoteException)8 InitialContext (javax.naming.InitialContext)6 RemoveException (javax.ejb.RemoveException)4 NamingException (javax.naming.NamingException)2 CreateException (javax.ejb.CreateException)1