Search in sources :

Example 26 with EJBObject

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

the class CmpRmiIiopTests method test44_returnEJBObjectArray.

public void test44_returnEJBObjectArray() {
    try {
        final Object obj = initialContext.lookup("client/tests/entity/cmp/EncBean");
        final EncCmpHome home = (EncCmpHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", home);
        final EncCmpObject[] expected = new EncCmpObject[3];
        for (int i = 0; i < expected.length; i++) {
            expected[i] = home.create("test_44 CmpBean");
            assertNotNull("The EJBObject created is null", expected[i]);
        }
        final EJBObject[] actual = ejbObject.returnEJBObjectArray(expected);
        assertNotNull("The EJBObject array returned is null", actual);
        assertEquals(expected.length, actual.length);
        for (int i = 0; i < actual.length; i++) {
            assertTrue("The EJBObejcts are not identical", expected[i].isIdentical(actual[i]));
        }
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBObject(javax.ejb.EJBObject) EJBObject(javax.ejb.EJBObject) RemoteException(java.rmi.RemoteException)

Example 27 with EJBObject

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

the class CmpRmiIiopTests method setUp.

protected void setUp() throws Exception {
    super.setUp();
    final Object obj = initialContext.lookup("client/tests/entity/cmp/RMI-over-IIOP/EJBHome");
    ejbHome = (RmiIiopCmpHome) obj;
    ejbObject = ejbHome.create("RMI-IIOP TestBean");
}
Also used : EJBObject(javax.ejb.EJBObject)

Example 28 with EJBObject

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

the class ComplexHandleTests method test01_getEJBObject.

// =================================
// Test handle methods
// 
public void test01_getEJBObject() {
    try {
        final EJBObject object = ejbHandle.getEJBObject();
        assertNotNull("The EJBObject is null", object);
    // Wait until isIdentical is working.
    // assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBObject(javax.ejb.EJBObject)

Example 29 with EJBObject

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

the class UnknownHandleTests method setUp.

protected void setUp() throws Exception {
    super.setUp();
    final Object obj = initialContext.lookup("client/tests/entity/cmp/UnknownCmpHome");
    ejbHome = (UnknownCmpHome) obj;
    ejbObject = ejbHome.createObject("Fifth Bean");
    ejbHandle = ejbObject.getHandle();
}
Also used : EJBObject(javax.ejb.EJBObject)

Example 30 with EJBObject

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

the class Cmp2HandleTests method Xtest02_copyHandleByMarshalledObject.

public void Xtest02_copyHandleByMarshalledObject() {
    try {
        final MarshalledObject obj = new MarshalledObject(ejbHandle);
        final Handle copy = (Handle) obj.get();
        final EJBObject object = copy.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());
    }
}
Also used : EJBObject(javax.ejb.EJBObject) MarshalledObject(java.rmi.MarshalledObject) Handle(javax.ejb.Handle)

Aggregations

EJBObject (javax.ejb.EJBObject)109 RemoteException (java.rmi.RemoteException)46 Handle (javax.ejb.Handle)28 EJBLocalObject (javax.ejb.EJBLocalObject)12 ObjectGraph (org.apache.openejb.test.object.ObjectGraph)12 EJBException (javax.ejb.EJBException)11 RemoveException (javax.ejb.RemoveException)9 SystemException (javax.transaction.SystemException)9 CreateException (javax.ejb.CreateException)8 NoSuchObjectLocalException (javax.ejb.NoSuchObjectLocalException)8 EncCmpObject (org.apache.openejb.test.entity.cmp.EncCmpObject)7 RmiIiopCmpObject (org.apache.openejb.test.entity.cmp.RmiIiopCmpObject)7 InvocationTargetException (java.lang.reflect.InvocationTargetException)6 MarshalledObject (java.rmi.MarshalledObject)6 FinderException (javax.ejb.FinderException)6 EncCmpHome (org.apache.openejb.test.entity.cmp.EncCmpHome)6 Test (org.junit.Test)5 NoSuchObjectException (java.rmi.NoSuchObjectException)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3