Search in sources :

Example 81 with TestFailureException

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

the class EncBmpBean method lookupStatelessBean.

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

Example 82 with TestFailureException

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

the class EncBmpBean method lookupStatefulBusinessLocal.

public void lookupStatefulBusinessLocal() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) ctx.lookup("java:comp/env/entity/bmp/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 : BasicStatefulBusinessLocal(org.apache.openejb.test.stateful.BasicStatefulBusinessLocal) 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)

Example 83 with TestFailureException

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

the class EncBmpBean method lookupIntegerEntry.

public void lookupIntegerEntry() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final Integer expected = new Integer(1);
            final Integer actual = (Integer) ctx.lookup("java:comp/env/entity/bmp/references/Integer");
            Assert.assertNotNull("The Integer 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) 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)

Example 84 with TestFailureException

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

the class EncBmpBean method lookupPersistenceContext.

public void lookupPersistenceContext() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/TestContext");
            Assert.assertNotNull("The EntityManager is null", em);
            // call a do nothing method to assure entity manager actually exists
            em.getFlushMode();
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : EntityManager(javax.persistence.EntityManager) 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)

Example 85 with TestFailureException

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

the class EncBmpBean method lookupEntityBean.

// 
// Home interface methods
// =============================
// =============================
// Remote interface methods
// 
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/entity/bmp/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 : 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)

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