use of javax.ejb.EJBObject in project tomee by apache.
the class StatefulPojoHandleTests method test01_getEJBObject.
// =================================
// Test handle methods
//
public void test01_getEJBObject() {
try {
final EJBObject object = ejbHandle.getEJBObject();
assertNotNull("The EJBObject is null", object);
assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
use of javax.ejb.EJBObject in project tomee by apache.
the class StatefulPojoHandleTests method setUp.
protected void setUp() throws Exception {
super.setUp();
final Object obj = initialContext.lookup("client/tests/stateful/BasicStatefulPojoHome");
ejbHome = (BasicStatefulHome) obj;
ejbObject = ejbHome.createObject("StatefulPojoHandleTests Bean");
ejbHandle = ejbObject.getHandle();
}
use of javax.ejb.EJBObject in project tomee by apache.
the class StatefulRmiIiopTests method test40_returnEJBObject.
/*-------------------------------------------------*/
/* EJBObject */
/*-------------------------------------------------*/
public void test40_returnEJBObject() {
try {
final Object obj = initialContext.lookup("client/tests/stateful/EncBean");
final EncStatefulHome home = (EncStatefulHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncStatefulObject expected = home.create("test_40 StatefulBean");
assertNotNull("The EJBObject created is null", expected);
final EncStatefulObject actual = (EncStatefulObject) ejbObject.returnEJBObject(expected);
assertNotNull("The EJBObject returned is null", actual);
assertTrue("The EJBObejcts are not identical", expected.isIdentical(actual));
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
use of javax.ejb.EJBObject in project tomee by apache.
the class StatelessHandleTests method setUp.
protected void setUp() throws Exception {
super.setUp();
final Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessHome");
ejbHome = (BasicStatelessHome) obj;
ejbObject = ejbHome.createObject();
ejbHandle = ejbObject.getHandle();
}
use of javax.ejb.EJBObject in project tomee by apache.
the class EntityContext method getEJBObject.
public EJBObject getEJBObject() throws IllegalStateException {
doCheck(Call.getEJBObject);
final ThreadContext threadContext = ThreadContext.getThreadContext();
final BeanContext di = threadContext.getBeanContext();
if (di.getRemoteInterface() == null) {
throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface");
}
final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getBeanContext(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>(), di.getRemoteInterface());
try {
final Class[] interfaces = new Class[] { di.getRemoteInterface(), IntraVmProxy.class };
return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler);
} catch (final IllegalAccessException iae) {
throw new InternalErrorException("Could not create IVM proxy for " + di.getRemoteInterface() + " interface", iae);
}
}
Aggregations