Search in sources :

Example 11 with BasicBmpHome

use of org.apache.openejb.test.entity.bmp.BasicBmpHome in project tomee by apache.

the class EncMdbBean method lookupEntityBean.

@Override
public void lookupEntityBean() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final BasicBmpHome home = (BasicBmpHome) ctx.lookup("java:comp/env/stateless/beanReferences/bmp_entity");
            Assert.assertNotNull("The EJBHome looked up is null", home);
            final BasicBmpObject 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 : BasicBmpHome(org.apache.openejb.test.entity.bmp.BasicBmpHome) TestFailureException(org.apache.openejb.test.TestFailureException) AssertionFailedError(junit.framework.AssertionFailedError) InitialContext(javax.naming.InitialContext) JMSException(javax.jms.JMSException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException) BasicBmpObject(org.apache.openejb.test.entity.bmp.BasicBmpObject)

Example 12 with BasicBmpHome

use of org.apache.openejb.test.entity.bmp.BasicBmpHome in project tomee by apache.

the class ContextLookupSingletonPojoBean method lookupEntityBean.

public void lookupEntityBean() throws TestFailureException {
    try {
        try {
            final BasicBmpHome home = (BasicBmpHome) getSessionContext().lookup("singleton/beanReferences/bmp_entity");
            Assert.assertNotNull("The EJBHome looked up is null", home);
            final BasicBmpObject 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 : BasicBmpHome(org.apache.openejb.test.entity.bmp.BasicBmpHome) 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) BasicBmpObject(org.apache.openejb.test.entity.bmp.BasicBmpObject)

Aggregations

AssertionFailedError (junit.framework.AssertionFailedError)12 TestFailureException (org.apache.openejb.test.TestFailureException)12 BasicBmpHome (org.apache.openejb.test.entity.bmp.BasicBmpHome)12 BasicBmpObject (org.apache.openejb.test.entity.bmp.BasicBmpObject)12 EJBException (javax.ejb.EJBException)11 JMSException (javax.jms.JMSException)10 RemoteException (java.rmi.RemoteException)8 InitialContext (javax.naming.InitialContext)4 NamingException (javax.naming.NamingException)3 CreateException (javax.ejb.CreateException)2