Search in sources :

Example 11 with EncCmpHome

use of org.apache.openejb.test.entity.cmp.EncCmpHome in project tomee by apache.

the class Cmp2RmiIiopTests method test47_returnNestedEJBMetaData.

public void test47_returnNestedEJBMetaData() {
    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 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) 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) RemoteException(java.rmi.RemoteException)

Example 12 with EncCmpHome

use of org.apache.openejb.test.entity.cmp.EncCmpHome in project tomee by apache.

the class Cmp2RmiIiopTests method test36_returnEJBHome2.

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

Example 13 with EncCmpHome

use of org.apache.openejb.test.entity.cmp.EncCmpHome in project tomee by apache.

the class Cmp2RmiIiopTests method test45_returnEJBMetaData.

/*-------------------------------------------------*/
/*  EJBMetaData                                    */
/*-------------------------------------------------*/
public void test45_returnEJBMetaData() {
    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 EJBMetaData expected = home.getEJBMetaData();
        assertNotNull("The EJBMetaData returned is null", expected);
        final EJBMetaData actual = ejbObject.returnEJBMetaData(expected);
        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) 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) RemoteException(java.rmi.RemoteException)

Example 14 with EncCmpHome

use of org.apache.openejb.test.entity.cmp.EncCmpHome in project tomee by apache.

the class Cmp2RmiIiopTests method test54_returnHandleArray.

public void test54_returnHandleArray() {
    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_54 CmpBean");
        assertNotNull("The EJBObject created is null", object);
        final Handle[] expected = new Handle[3];
        for (int i = 0; i < expected.length; i++) {
            expected[i] = object.getHandle();
            assertNotNull("The EJBObject Handle returned is null", expected[i]);
        }
        final Handle[] actual = ejbObject.returnHandleArray(expected);
        assertNotNull("The Handle array returned is null", actual);
        assertEquals(expected.length, actual.length);
        for (int i = 0; i < expected.length; i++) {
            assertNotNull("The EJBObject Handle returned is null", actual[i]);
            assertNotNull("The EJBObject in the Handle is null", actual[i].getEJBObject());
            assertTrue("The EJBObjects in the Handles are not equal", expected[i].getEJBObject().isIdentical(actual[i].getEJBObject()));
        }
    } 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) Handle(javax.ejb.Handle)

Example 15 with EncCmpHome

use of org.apache.openejb.test.entity.cmp.EncCmpHome in project tomee by apache.

the class Cmp2RmiIiopTests method Xtest39_returnEJBHomeArray.

public void Xtest39_returnEJBHomeArray() {
    try {
        final EncCmpHome[] expected = new EncCmpHome[3];
        for (int i = 0; i < expected.length; i++) {
            final Object obj = initialContext.lookup("client/tests/entity/cmp/EncBean");
            expected[i] = (EncCmpHome) obj;
            assertNotNull("The EJBHome returned from JNDI is null", expected[i]);
        }
        final EJBHome[] actual = ejbObject.returnEJBHomeArray(expected);
        assertNotNull("The EJBHome array returned is null", actual);
        assertEquals(expected.length, actual.length);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBHome(javax.ejb.EJBHome) 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) RemoteException(java.rmi.RemoteException)

Aggregations

EncCmpHome (org.apache.openejb.test.entity.cmp.EncCmpHome)16 RemoteException (java.rmi.RemoteException)14 EncCmpObject (org.apache.openejb.test.entity.cmp.EncCmpObject)14 EJBObject (javax.ejb.EJBObject)12 RmiIiopCmpObject (org.apache.openejb.test.entity.cmp.RmiIiopCmpObject)12 ObjectGraph (org.apache.openejb.test.object.ObjectGraph)5 EJBMetaData (javax.ejb.EJBMetaData)3 Handle (javax.ejb.Handle)3 EncBmpObject (org.apache.openejb.test.entity.bmp.EncBmpObject)2 EncStatefulObject (org.apache.openejb.test.stateful.EncStatefulObject)2 EJBHome (javax.ejb.EJBHome)1