Search in sources :

Example 66 with TestFailureException

use of org.apache.openejb.test.TestFailureException in project tomee by apache.

the class ContextLookupSingletonBean method lookupEntityBean.

// =============================
// Home interface methods
// 
// 
// Home interface methods
// =============================
// =============================
// Remote interface methods
// 
public void lookupEntityBean() throws TestFailureException {
    try {
        try {
            final BasicBmpHome home = (BasicBmpHome) ejbContext.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) JMSException(javax.jms.JMSException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException) BasicBmpObject(org.apache.openejb.test.entity.bmp.BasicBmpObject)

Example 67 with TestFailureException

use of org.apache.openejb.test.TestFailureException in project tomee by apache.

the class ContextLookupSingletonPojoBean method lookupByteEntry.

public void lookupByteEntry() throws TestFailureException {
    try {
        try {
            final Byte expected = new Byte((byte) 1);
            final Byte actual = (Byte) getSessionContext().lookup("singleton/references/Byte");
            Assert.assertNotNull("The Byte looked up is null", actual);
            Assert.assertEquals(expected, actual);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : 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)

Example 68 with TestFailureException

use of org.apache.openejb.test.TestFailureException in project tomee by apache.

the class ContextLookupSingletonPojoBean method lookupStatefulBusinessLocal.

public void lookupStatefulBusinessLocal() throws TestFailureException {
    try {
        try {
            final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) getSessionContext().lookup("singleton/beanReferences/stateful-business-local");
            Assert.assertNotNull("The EJB BusinessLocal 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 : 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)

Example 69 with TestFailureException

use of org.apache.openejb.test.TestFailureException in project tomee by apache.

the class ContextLookupSingletonPojoBean method lookupStatefulBean.

public void lookupStatefulBean() throws TestFailureException {
    try {
        try {
            final BasicStatefulHome home = (BasicStatefulHome) getSessionContext().lookup("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 : 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)

Example 70 with TestFailureException

use of org.apache.openejb.test.TestFailureException in project tomee by apache.

the class EncSingletonBean method lookupStatefulBusinessLocalBean.

public void lookupStatefulBusinessLocalBean() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final BasicStatefulPojoBean object = (BasicStatefulPojoBean) ctx.lookup("java:comp/env/singleton/beanReferences/stateful-business-localbean");
            Assert.assertNotNull("The EJB BusinessLocalBean 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 : BasicStatefulPojoBean(org.apache.openejb.test.stateful.BasicStatefulPojoBean) 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)

Aggregations

AssertionFailedError (junit.framework.AssertionFailedError)503 TestFailureException (org.apache.openejb.test.TestFailureException)503 JMSException (javax.jms.JMSException)336 EJBException (javax.ejb.EJBException)334 RemoteException (java.rmi.RemoteException)268 InitialContext (javax.naming.InitialContext)168 RemoveException (javax.ejb.RemoveException)80 CreateException (javax.ejb.CreateException)77 NamingException (javax.naming.NamingException)65 BasicStatefulObject (org.apache.openejb.test.stateful.BasicStatefulObject)42 BasicBmpObject (org.apache.openejb.test.entity.bmp.BasicBmpObject)41 BasicStatelessObject (org.apache.openejb.test.stateless.BasicStatelessObject)38 EntityManager (javax.persistence.EntityManager)21 EntityManagerFactory (javax.persistence.EntityManagerFactory)17 DataSource (javax.sql.DataSource)16 ConnectionFactory (javax.jms.ConnectionFactory)15 QueueConnectionFactory (javax.jms.QueueConnectionFactory)15 TopicConnectionFactory (javax.jms.TopicConnectionFactory)15 EJBContext (javax.ejb.EJBContext)12 BasicBmpHome (org.apache.openejb.test.entity.bmp.BasicBmpHome)12