Search in sources :

Example 36 with TestFailureException

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

the class EncMdbBean method lookupStatelessBusinessLocal.

@Override
public void lookupStatelessBusinessLocal() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final Object o = ctx.lookup("java:comp/env/stateless/beanReferences/stateless-business-local");
            final BasicStatelessBusinessLocal object = (BasicStatelessBusinessLocal) o;
            Assert.assertNotNull("The EJB BusinessLocal is null", object);
        } catch (final Exception e) {
            e.printStackTrace();
            Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    } catch (final AssertionFailedError afe) {
        throw new TestFailureException(afe);
    }
}
Also used : BasicStatelessBusinessLocal(org.apache.openejb.test.stateless.BasicStatelessBusinessLocal) BasicStatelessObject(org.apache.openejb.test.stateless.BasicStatelessObject) BasicStatefulObject(org.apache.openejb.test.stateful.BasicStatefulObject) BasicBmpObject(org.apache.openejb.test.entity.bmp.BasicBmpObject) 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 37 with TestFailureException

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

the class EncMdbBean method lookupResource.

@Override
public void lookupResource() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final Object obj = ctx.lookup("java:comp/env/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 : BasicStatelessObject(org.apache.openejb.test.stateless.BasicStatelessObject) BasicStatefulObject(org.apache.openejb.test.stateful.BasicStatefulObject) BasicBmpObject(org.apache.openejb.test.entity.bmp.BasicBmpObject) 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) DataSource(javax.sql.DataSource)

Example 38 with TestFailureException

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

the class EncMdbBean method lookupStatefulBusinessLocal.

@Override
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/stateless/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) JMSException(javax.jms.JMSException) EJBException(javax.ejb.EJBException) TestFailureException(org.apache.openejb.test.TestFailureException)

Example 39 with TestFailureException

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

the class EncMdbBean method lookupStringEntry.

@Override
public void lookupStringEntry() throws TestFailureException {
    try {
        try {
            final InitialContext ctx = new InitialContext();
            Assert.assertNotNull("The InitialContext is null", ctx);
            final String expected = "1";
            final String actual = (String) ctx.lookup("java:comp/env/stateless/references/String");
            Assert.assertNotNull("The String 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 40 with TestFailureException

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

the class EncMdbBean method lookupStatefulBusinessRemote.

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

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