use of javax.ejb.EJBObject in project tomee by apache.
the class BmpHandleTests method setUp.
protected void setUp() throws Exception {
super.setUp();
final Object obj = initialContext.lookup("client/tests/entity/bmp/BasicBmpHome");
ejbHome = (BasicBmpHome) obj;
ejbObject = ejbHome.createObject("Fifth Bean");
ejbHandle = ejbObject.getHandle();
}
use of javax.ejb.EJBObject in project tomee by apache.
the class BmpRmiIiopTests method test40_returnEJBObject.
/*-------------------------------------------------*/
/* EJBObject */
/*-------------------------------------------------*/
public void test40_returnEJBObject() {
try {
final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
final EncBmpHome home = (EncBmpHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncBmpObject expected = home.create("test_40 BmpBean");
assertNotNull("The EJBObject created is null", expected);
final EncBmpObject actual = (EncBmpObject) 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 SingletonAllowedOperationsTests method setUp.
protected void setUp() throws Exception {
super.setUp();
final Object obj = initialContext.lookup("client/tests/singleton/BasicSingletonHome");
ejbHome = (BasicSingletonHome) obj;
ejbObject = ejbHome.createObject();
ejbHandle = ejbObject.getHandle();
timerSync = (TimerSync) initialContext.lookup("TimerSyncBeanBusinessRemote");
// setUp_ejbActivate_Passivate();
/* These tests will only work if the specified
* method has already been called by the container.
*
* TO DO:
* Implement a little application senario to ensure
* that all methods tested for below have been called
* by the container.
*/
ejbObject.businessMethod("activate me please");
}
use of javax.ejb.EJBObject in project Payara by payara.
the class SafeProperties method createRemoteReferenceWithId.
/**
* Create an EJBObject reference from the instanceKey
* Called from EJBObjectOutputStream.SerializableRemoteRef
* during deserialization of a remote-ref
* @param instanceKey instanceKey of the ejbobject
* @param generatedRemoteBusinessIntf non-null, this is a remote business view and the param
* is the name of the generated remote business interface.
* Otherwise, this is for the RemoteHome view
*/
public java.rmi.Remote createRemoteReferenceWithId(byte[] instanceKey, String generatedRemoteBusinessIntf) {
final Thread currentThread = Thread.currentThread();
final ClassLoader previousClassLoader = currentThread.getContextClassLoader();
final ClassLoader myClassLoader = loader;
try {
if (System.getSecurityManager() == null) {
currentThread.setContextClassLoader(myClassLoader);
} else {
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
public java.lang.Object run() {
currentThread.setContextClassLoader(myClassLoader);
return null;
}
});
}
java.rmi.Remote remoteRef = null;
if (generatedRemoteBusinessIntf == null) {
remoteRef = remoteHomeRefFactory.createRemoteReference(instanceKey);
} else {
RemoteReferenceFactory remoteBusinessRefFactory = remoteBusinessIntfInfo.get(generatedRemoteBusinessIntf).referenceFactory;
remoteRef = remoteBusinessRefFactory.createRemoteReference(instanceKey);
}
return remoteRef;
} finally {
if (System.getSecurityManager() == null) {
currentThread.setContextClassLoader(previousClassLoader);
} else {
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
public java.lang.Object run() {
currentThread.setContextClassLoader(previousClassLoader);
return null;
}
});
}
}
}
use of javax.ejb.EJBObject in project Payara by payara.
the class SafeProperties method instantiateEJBLocalObjectImpl.
protected EJBLocalObjectImpl instantiateEJBLocalObjectImpl(Object key) throws Exception {
EJBLocalObjectImpl localObjImpl = null;
EJBLocalObjectInvocationHandler handler = new EJBLocalObjectInvocationHandler(proxyInvocationInfoMap, localIntf);
localObjImpl = handler;
try {
EJBLocalObject localObjectProxy = (EJBLocalObject) ejbLocalObjectProxyCtor.newInstance(new Object[] { handler });
handler.setProxy(localObjectProxy);
} catch (ClassCastException e) {
String msg = localStrings.getLocalString("ejb.basecontainer_invalid_local_interface", "Local component interface [{0}] is invalid since it does not extend javax.ejb.EJBLocalObject.", localIntf);
throw new IllegalArgumentException(msg, e);
}
localObjImpl.setContainer(this);
if (key != null) {
// associate the EJBObject with the key
localObjImpl.setKey(key);
}
return localObjImpl;
}
Aggregations