use of org.apache.openejb.test.TestFailureException in project tomee by apache.
the class ContextLookupMdbBean method lookupFloatEntry.
@Override
public void lookupFloatEntry() throws TestFailureException {
try {
try {
final Float expected = 1.0F;
final Float actual = (Float) mdbContext.lookup("stateless/references/Float");
Assert.assertNotNull("The Float 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);
}
}
use of org.apache.openejb.test.TestFailureException in project tomee by apache.
the class ContextLookupMdbBean method lookupStatelessBusinessRemote.
@Override
public void lookupStatelessBusinessRemote() throws TestFailureException {
try {
try {
final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) mdbContext.lookup("stateless/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);
}
}
use of org.apache.openejb.test.TestFailureException in project tomee by apache.
the class ContextLookupMdbBean method lookupJMSConnectionFactory.
@Override
public void lookupJMSConnectionFactory() throws TestFailureException {
try {
try {
Object obj = mdbContext.lookup("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 = mdbContext.lookup("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 = mdbContext.lookup("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);
}
}
use of org.apache.openejb.test.TestFailureException in project tomee by apache.
the class ContextLookupMdbBean method lookupEntityBean.
@Override
public void lookupEntityBean() throws TestFailureException {
try {
try {
final BasicBmpHome home = (BasicBmpHome) mdbContext.lookup("stateless/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);
}
}
use of org.apache.openejb.test.TestFailureException in project tomee by apache.
the class ContextLookupMdbBean method lookupPersistenceContext.
@Override
public void lookupPersistenceContext() throws TestFailureException {
try {
try {
final EntityManager em = (EntityManager) mdbContext.lookup("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);
}
}
Aggregations