Search in sources :

Example 96 with TestFailureException

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

the class EncCmpBean method lookupCharacterEntry.

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

Example 97 with TestFailureException

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

the class EncCmpBean 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/cmp/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 98 with TestFailureException

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

the class EncCmpBean method lookupLongEntry.

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

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

the class EncCmpBean method lookupStatelessBusinessRemote.

public void lookupStatelessBusinessRemote() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateless-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 : BasicStatelessBusinessRemote(org.apache.openejb.test.stateless.BasicStatelessBusinessRemote) 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 100 with TestFailureException

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

the class EncCmpBean method lookupJMSConnectionFactory.

public void lookupJMSConnectionFactory() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            Object obj = ctx.lookup("java:comp/env/jms");
            Assert.assertNotNull("The JMS ConnectionFactory is null", obj);
            Assert.assertTrue("Not an instance of ConnectionFactory", obj instanceof ConnectionFactory);
            final ConnectionFactory connectionFactory = (ConnectionFactory) obj;
            testJmsConnection(connectionFactory.createConnection());
            obj = ctx.lookup("java:comp/env/TopicCF");
            Assert.assertNotNull("The JMS TopicConnectionFactory is null", obj);
            Assert.assertTrue("Not an instance of TopicConnectionFactory", obj instanceof TopicConnectionFactory);
            final TopicConnectionFactory topicConnectionFactory = (TopicConnectionFactory) obj;
            testJmsConnection(topicConnectionFactory.createConnection());
            obj = ctx.lookup("java:comp/env/QueueCF");
            Assert.assertNotNull("The JMS QueueConnectionFactory is null", obj);
            Assert.assertTrue("Not an instance of QueueConnectionFactory", obj instanceof QueueConnectionFactory);
            final QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) obj;
            testJmsConnection(queueConnectionFactory.createConnection());
        } catch (final Exception e) {
            e.printStackTrace();
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : TopicConnectionFactory(javax.jms.TopicConnectionFactory) QueueConnectionFactory(javax.jms.QueueConnectionFactory) TopicConnectionFactory(javax.jms.TopicConnectionFactory) ConnectionFactory(javax.jms.ConnectionFactory) QueueConnectionFactory(javax.jms.QueueConnectionFactory) BasicStatelessObject(org.apache.openejb.test.stateless.BasicStatelessObject) BasicStatefulObject(org.apache.openejb.test.stateful.BasicStatefulObject) 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