Search in sources :

Example 26 with ObjectGraph

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

the class RmiIiopStatelessBean method returnNestedEJBObject.

public ObjectGraph returnNestedEJBObject() throws javax.ejb.EJBException {
    ObjectGraph data = null;
    try {
        final InitialContext ctx = new InitialContext();
        final EncStatelessHome home = (EncStatelessHome) ctx.lookup("java:comp/env/stateless/rmi-iiop/home");
        final EncStatelessObject object = home.create();
        data = new ObjectGraph(object);
    } 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) RemoteException(java.rmi.RemoteException)

Example 27 with ObjectGraph

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

the class RmiIiopSingletonBean method returnNestedEJBHome.

public ObjectGraph returnNestedEJBHome() throws javax.ejb.EJBException {
    ObjectGraph data = null;
    try {
        final InitialContext ctx = new InitialContext();
        final Object object = ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
        data = new ObjectGraph(object);
    } 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) EJBObject(javax.ejb.EJBObject) InitialContext(javax.naming.InitialContext) EJBException(javax.ejb.EJBException) RemoteException(java.rmi.RemoteException)

Example 28 with ObjectGraph

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

the class RmiIiopSingletonBean method returnNestedHandle.

public ObjectGraph returnNestedHandle() throws javax.ejb.EJBException {
    ObjectGraph data = null;
    try {
        final InitialContext ctx = new InitialContext();
        final EncSingletonHome home = (EncSingletonHome) ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
        final EncSingletonObject object = home.create();
        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) RemoteException(java.rmi.RemoteException)

Example 29 with ObjectGraph

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

the class RmiIiopSingletonBean method returnNestedEJBObject.

public ObjectGraph returnNestedEJBObject() throws javax.ejb.EJBException {
    ObjectGraph data = null;
    try {
        final InitialContext ctx = new InitialContext();
        final EncSingletonHome home = (EncSingletonHome) ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
        final EncSingletonObject object = home.create();
        data = new ObjectGraph(object);
    } 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) RemoteException(java.rmi.RemoteException)

Example 30 with ObjectGraph

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

the class BmpRmiIiopTests method test52_returnNestedHandle.

public void test52_returnNestedHandle() {
    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 object = home.create("test_52 BmpBean");
        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 ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
        assertNotNull("The ObjectGraph is null", graph);
        final Handle actual = (Handle) graph.getObject();
        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) ObjectGraph(org.apache.openejb.test.object.ObjectGraph) EJBObject(javax.ejb.EJBObject) RemoteException(java.rmi.RemoteException) Handle(javax.ejb.Handle)

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