Search in sources :

Example 56 with TestFailureException

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

the class ContextLookupSingletonBean method lookupSingletonBean.

public void lookupSingletonBean() throws TestFailureException {
    try {
        try {
            final BasicSingletonHome home = (BasicSingletonHome) ejbContext.lookup("singleton/beanReferences/singleton");
            Assert.assertNotNull("The EJBHome looked up is null", home);
            final BasicSingletonObject 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 : 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)

Example 57 with TestFailureException

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

the class ContextLookupSingletonBean method lookupResource.

public void lookupResource() throws TestFailureException {
    try {
        try {
            final Object obj = ejbContext.lookup("datasource");
            Assert.assertNotNull("The DataSource is null", obj);
            Assert.assertTrue("Not an instance of DataSource", obj instanceof DataSource);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : BasicBmpObject(org.apache.openejb.test.entity.bmp.BasicBmpObject) 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) DataSource(javax.sql.DataSource)

Example 58 with TestFailureException

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

the class ContextLookupSingletonBean method lookupDoubleEntry.

public void lookupDoubleEntry() throws TestFailureException {
    try {
        try {
            final Double expected = new Double(1.0D);
            final Double actual = (Double) ejbContext.lookup("singleton/references/Double");
            Assert.assertNotNull("The Double 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) JMSException(javax.jms.JMSException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException)

Example 59 with TestFailureException

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

the class ContextLookupSingletonBean method lookupSingletonBusinessRemote.

public void lookupSingletonBusinessRemote() throws TestFailureException {
    try {
        try {
            final BasicSingletonBusinessRemote object = (BasicSingletonBusinessRemote) ejbContext.lookup("singleton/beanReferences/singleton-business-remote");
            Assert.assertNotNull("The EJB BusinessRemote 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) JMSException(javax.jms.JMSException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException)

Example 60 with TestFailureException

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

the class ContextLookupSingletonBean method lookupLongEntry.

public void lookupLongEntry() throws TestFailureException {
    try {
        try {
            final Long expected = new Long(1L);
            final Long actual = (Long) ejbContext.lookup("singleton/references/Long");
            Assert.assertNotNull("The Long 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) 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