Search in sources :

Example 11 with HomeHandle

use of javax.ejb.HomeHandle in project tomee by apache.

the class Cmp2HomeHandleTests method Xtest03_copyHandleBySerialize.

public void Xtest03_copyHandleBySerialize() {
    try {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        final ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(ejbHomeHandle);
        oos.flush();
        oos.close();
        final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        final ObjectInputStream ois = new ObjectInputStream(bais);
        final HomeHandle copy = (HomeHandle) ois.readObject();
        assertNotNull("The HomeHandle copy is null", copy);
        final EJBHome home = copy.getEJBHome();
        assertNotNull("The EJBHome is null", home);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) EJBHome(javax.ejb.EJBHome) HomeHandle(javax.ejb.HomeHandle) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) ObjectInputStream(java.io.ObjectInputStream)

Aggregations

HomeHandle (javax.ejb.HomeHandle)11 EJBHome (javax.ejb.EJBHome)8 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 ObjectInputStream (java.io.ObjectInputStream)3 ObjectOutputStream (java.io.ObjectOutputStream)3 MarshalledObject (java.rmi.MarshalledObject)3 EJBMetaData (javax.ejb.EJBMetaData)3 Handle (javax.ejb.Handle)3 EJBObject (javax.ejb.EJBObject)2 InitialContext (javax.naming.InitialContext)2 Test (org.junit.Test)2 List (java.util.List)1 DeploymentRepository (org.jboss.as.ejb3.deployment.DeploymentRepository)1 Session30 (org.jboss.as.test.integration.ejb.ejb2.reference.global.Session30)1 AbstractEJBMetaData (org.jboss.ejb.client.AbstractEJBMetaData)1 EJBHandle (org.jboss.ejb.client.EJBHandle)1 EJBHomeHandle (org.jboss.ejb.client.EJBHomeHandle)1 EJBLocator (org.jboss.ejb.client.EJBLocator)1 EJBMetaDataImpl (org.jboss.ejb.client.EJBMetaDataImpl)1