Search in sources :

Example 41 with TestFailureException

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

the class EncMdbBean method lookupPersistenceUnit.

@Override
public void lookupPersistenceUnit() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final EntityManagerFactory emf = (EntityManagerFactory) ctx.lookup("java:comp/env/persistence/TestUnit");
            Assert.assertNotNull("The EntityManagerFactory is null", emf);
        } catch (final Exception e) {
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : EntityManagerFactory(javax.persistence.EntityManagerFactory) 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)

Example 42 with TestFailureException

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

the class EncMdbBean method lookupBooleanEntry.

@Override
public void lookupBooleanEntry() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final Boolean expected = true;
            final Boolean actual = (Boolean) ctx.lookup("java:comp/env/stateless/references/Boolean");
            Assert.assertNotNull("The Boolean 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) JMSException(javax.jms.JMSException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException)

Example 43 with TestFailureException

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

the class EncMdbBean method lookupCharacterEntry.

@Override
public void lookupCharacterEntry() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final Character expected = 'D';
            final Character actual = (Character) ctx.lookup("java:comp/env/stateless/references/Character");
            Assert.assertNotNull("The Character 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) JMSException(javax.jms.JMSException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException)

Example 44 with TestFailureException

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

the class FieldInjectionMdbBean method lookupDoubleEntry.

@Override
public void lookupDoubleEntry() throws TestFailureException {
    try {
        final Double expected = 1.0D;
        Assert.assertNotNull("The Double looked up is null", doouble);
        Assert.assertEquals(expected, doouble);
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : TestFailureException(org.apache.openejb.test.TestFailureException) AssertionFailedError(junit.framework.AssertionFailedError)

Example 45 with TestFailureException

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

the class FieldInjectionMdbBean method lookupStringEntry.

@Override
public void lookupStringEntry() throws TestFailureException {
    try {
        final String expected = "1";
        Assert.assertNotNull("The String looked up is null", striing);
        Assert.assertEquals(expected, striing);
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : TestFailureException(org.apache.openejb.test.TestFailureException) AssertionFailedError(junit.framework.AssertionFailedError)

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