Search in sources :

Example 31 with ObjectGraph

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

the class StatelessRmiIiopTests method test63_returnNestedColor2.

public void test63_returnNestedColor2() {
    try {
        final Color expected = Color.GREEN;
        final ObjectGraph graph = ejbObject.returnNestedColor();
        assertNotNull("The ObjectGraph is null", graph);
        final Color actual = (Color) graph.getObject();
        assertNotNull("The Color returned is null", actual);
        assertEquals(expected, actual);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : Color(org.apache.openejb.test.object.Color) ObjectGraph(org.apache.openejb.test.object.ObjectGraph) RemoteException(java.rmi.RemoteException)

Example 32 with ObjectGraph

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

the class StatelessRmiIiopTests method test37_returnNestedEJBHome.

public void test37_returnNestedEJBHome() {
    try {
        final Object obj = initialContext.lookup("client/tests/stateless/EncBean");
        final EncStatelessHome expected = (EncStatelessHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", expected);
        final ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
        assertNotNull("The ObjectGraph is null", graph);
        final EncStatelessHome actual = (EncStatelessHome) 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) EJBObject(javax.ejb.EJBObject) RemoteException(java.rmi.RemoteException)

Example 33 with ObjectGraph

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

the class SingletonRmiIiopTests method test47_returnNestedEJBMetaData.

public void test47_returnNestedEJBMetaData() {
    try {
        final Object obj = initialContext.lookup("client/tests/singleton/EncBean");
        final EncSingletonHome home = (EncSingletonHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", home);
        final EJBMetaData expected = home.getEJBMetaData();
        assertNotNull("The EJBMetaData returned is null", expected);
        final ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
        assertNotNull("The ObjectGraph is null", graph);
        final EJBMetaData actual = (EJBMetaData) graph.getObject();
        assertNotNull("The EJBMetaData returned is null", actual);
        assertEquals(expected.getHomeInterfaceClass(), actual.getHomeInterfaceClass());
        assertEquals(expected.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass());
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBMetaData(javax.ejb.EJBMetaData) ObjectGraph(org.apache.openejb.test.object.ObjectGraph) EJBObject(javax.ejb.EJBObject) RemoteException(java.rmi.RemoteException)

Example 34 with ObjectGraph

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

the class SingletonRmiIiopTests method test52_returnNestedHandle.

public void test52_returnNestedHandle() {
    try {
        final Object obj = initialContext.lookup("client/tests/singleton/EncBean");
        final EncSingletonHome home = (EncSingletonHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", home);
        final EncSingletonObject object = home.create();
        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)

Example 35 with ObjectGraph

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

the class SingletonRmiIiopTests method test48_returnNestedEJBMetaData2.

public void test48_returnNestedEJBMetaData2() {
    try {
        final ObjectGraph graph = ejbObject.returnNestedEJBMetaData();
        assertNotNull("The ObjectGraph is null", graph);
        final EJBMetaData actual = (EJBMetaData) graph.getObject();
        assertNotNull("The EJBMetaData returned is null", actual);
        assertNotNull("The home interface class of the EJBMetaData is null", actual.getHomeInterfaceClass());
        assertNotNull("The remote interface class of the EJBMetaData is null", actual.getRemoteInterfaceClass());
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBMetaData(javax.ejb.EJBMetaData) ObjectGraph(org.apache.openejb.test.object.ObjectGraph) 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