Search in sources :

Example 11 with ObjectGraph

use of org.apache.openejb.test.object.ObjectGraph 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 12 with ObjectGraph

use of org.apache.openejb.test.object.ObjectGraph in project tomee by apache.

the class Cmp2RmiIiopTests method test43_returnNestedEJBObject2.

public void test43_returnNestedEJBObject2() {
    try {
        final ObjectGraph graph = ejbObject.returnNestedEJBObject();
        assertNotNull("The ObjectGraph is null", graph);
        final EncCmpObject actual = (EncCmpObject) graph.getObject();
        assertNotNull("The EJBHome returned is null", 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) RemoteException(java.rmi.RemoteException)

Example 13 with ObjectGraph

use of org.apache.openejb.test.object.ObjectGraph in project tomee by apache.

the class Cmp2RmiIiopTests method test38_returnNestedEJBHome2.

public void test38_returnNestedEJBHome2() {
    try {
        final ObjectGraph graph = ejbObject.returnNestedEJBHome();
        assertNotNull("The ObjectGraph is null", graph);
        final EncCmpHome actual = (EncCmpHome) graph.getObject();
        assertNotNull("The EJBHome returned is null", actual);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : ObjectGraph(org.apache.openejb.test.object.ObjectGraph) EncCmpHome(org.apache.openejb.test.entity.cmp.EncCmpHome) RemoteException(java.rmi.RemoteException)

Example 14 with ObjectGraph

use of org.apache.openejb.test.object.ObjectGraph in project tomee by apache.

the class RmiIiopCmp2Bean method returnNestedEJBMetaData.

public ObjectGraph returnNestedEJBMetaData() {
    ObjectGraph data = null;
    try {
        final InitialContext ctx = new InitialContext();
        final EncCmpHome home = (EncCmpHome) ctx.lookup("java:comp/env/cmp/rmi-iiop/home");
        final EJBMetaData object = home.getEJBMetaData();
        data = new ObjectGraph(object);
    } catch (final Exception e) {
        throw new EJBException(e);
    }
    return data;
}
Also used : EJBMetaData(javax.ejb.EJBMetaData) ObjectGraph(org.apache.openejb.test.object.ObjectGraph) EJBException(javax.ejb.EJBException) InitialContext(javax.naming.InitialContext) EJBException(javax.ejb.EJBException) CreateException(javax.ejb.CreateException)

Example 15 with ObjectGraph

use of org.apache.openejb.test.object.ObjectGraph in project tomee by apache.

the class RmiIiopCmpBean method returnNestedHandle.

public ObjectGraph returnNestedHandle() throws javax.ejb.EJBException {
    ObjectGraph data = null;
    try {
        final InitialContext ctx = new InitialContext();
        final EncCmpHome home = (EncCmpHome) ctx.lookup("java:comp/env/cmp/rmi-iiop/home");
        final EncCmpObject object = home.create("Test04 CmpBean");
        data = new ObjectGraph(object.getHandle());
    } catch (final Exception e) {
        throw new javax.ejb.EJBException(e);
    }
    return data;
}
Also used : EJBException(javax.ejb.EJBException) ObjectGraph(org.apache.openejb.test.object.ObjectGraph) InitialContext(javax.naming.InitialContext) EJBException(javax.ejb.EJBException) RemoveException(javax.ejb.RemoveException) RemoteException(java.rmi.RemoteException)

Aggregations

ObjectGraph (org.apache.openejb.test.object.ObjectGraph)80 RemoteException (java.rmi.RemoteException)76 EJBObject (javax.ejb.EJBObject)30 EJBException (javax.ejb.EJBException)24 InitialContext (javax.naming.InitialContext)24 EJBMetaData (javax.ejb.EJBMetaData)18 Handle (javax.ejb.Handle)12 RemoveException (javax.ejb.RemoveException)8 EncCmpHome (org.apache.openejb.test.entity.cmp.EncCmpHome)5 EncCmpObject (org.apache.openejb.test.entity.cmp.EncCmpObject)5 CreateException (javax.ejb.CreateException)4 RmiIiopCmpObject (org.apache.openejb.test.entity.cmp.RmiIiopCmpObject)4 Color (org.apache.openejb.test.object.Color)2