Search in sources :

Example 31 with EJBObject

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

the class Cmp2HandleTests 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 32 with EJBObject

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

the class Cmp2RmiIiopTests method test50_returnHandle.

/*-------------------------------------------------*/
/*  Handle                                         */
/*-------------------------------------------------*/
public void test50_returnHandle() {
    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 object = home.create("test_50 CmpBean");
        assertNotNull("The EJBObject created is null", object);
        final Handle expected = object.getHandle();
        assertNotNull("The EJBObject Handle returned is null", expected);
        assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject());
        final Handle actual = ejbObject.returnHandle(expected);
        assertNotNull("The EJBObject Handle returned is null", actual);
        assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
        final EJBObject exp = expected.getEJBObject();
        final EJBObject act = actual.getEJBObject();
        assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act));
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBObject(javax.ejb.EJBObject) EncCmpObject(org.apache.openejb.test.entity.cmp.EncCmpObject) EJBObject(javax.ejb.EJBObject) RmiIiopCmpObject(org.apache.openejb.test.entity.cmp.RmiIiopCmpObject) EncCmpHome(org.apache.openejb.test.entity.cmp.EncCmpHome) EncCmpObject(org.apache.openejb.test.entity.cmp.EncCmpObject) RemoteException(java.rmi.RemoteException) Handle(javax.ejb.Handle)

Example 33 with EJBObject

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

the class Cmp2RmiIiopTests method test42_returnNestedEJBObject.

public void test42_returnNestedEJBObject() {
    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 = home.create("test_42 CmpBean");
        assertNotNull("The EJBObject created is null", expected);
        final ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
        assertNotNull("The ObjectGraph is null", graph);
        final EncCmpObject actual = (EncCmpObject) graph.getObject();
        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());
    }
}
Also used : ObjectGraph(org.apache.openejb.test.object.ObjectGraph) EncCmpObject(org.apache.openejb.test.entity.cmp.EncCmpObject) EJBObject(javax.ejb.EJBObject) RmiIiopCmpObject(org.apache.openejb.test.entity.cmp.RmiIiopCmpObject) EncCmpHome(org.apache.openejb.test.entity.cmp.EncCmpHome) EncCmpObject(org.apache.openejb.test.entity.cmp.EncCmpObject) RemoteException(java.rmi.RemoteException)

Example 34 with EJBObject

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

the class Cmp2RmiIiopTests method test40_returnEJBObject.

/*-------------------------------------------------*/
/*  EJBObject                                      */
/*-------------------------------------------------*/
public void test40_returnEJBObject() {
    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 = home.create("test_40 CmpBean");
        assertNotNull("The EJBObject created is null", expected);
        final EncCmpObject actual = (EncCmpObject) 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());
    }
}
Also used : EncCmpObject(org.apache.openejb.test.entity.cmp.EncCmpObject) EJBObject(javax.ejb.EJBObject) RmiIiopCmpObject(org.apache.openejb.test.entity.cmp.RmiIiopCmpObject) EncCmpHome(org.apache.openejb.test.entity.cmp.EncCmpHome) EncCmpObject(org.apache.openejb.test.entity.cmp.EncCmpObject) RemoteException(java.rmi.RemoteException)

Example 35 with EJBObject

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

the class Complex2HandleTests method setUp.

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

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