Search in sources :

Example 46 with EJBMetaData

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

the class StatefulEjbHomeTests method test01_getEJBMetaData.

// ===============================
// Test ejb home methods
// 
public void test01_getEJBMetaData() {
    try {
        final EJBMetaData ejbMetaData = ejbHome.getEJBMetaData();
        assertNotNull("The EJBMetaData is null", ejbMetaData);
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBMetaData(javax.ejb.EJBMetaData) RemoveException(javax.ejb.RemoveException)

Example 47 with EJBMetaData

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

the class StatefulRmiIiopTests method test49_returnEJBMetaDataArray.

public void test49_returnEJBMetaDataArray() {
    try {
        final Object obj = initialContext.lookup("client/tests/stateful/EncBean");
        final EncStatefulHome home = (EncStatefulHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", home);
        final EJBMetaData[] expected = new EJBMetaData[3];
        for (int i = 0; i < expected.length; i++) {
            expected[i] = home.getEJBMetaData();
            assertNotNull("The EJBMetaData returned is null", expected[i]);
        }
        final EJBMetaData[] actual = (EJBMetaData[]) ejbObject.returnEJBMetaDataArray(expected);
        assertNotNull("The EJBMetaData array returned is null", actual);
        assertEquals(expected.length, actual.length);
        for (int i = 0; i < actual.length; i++) {
            assertNotNull("The EJBMetaData returned is null", actual[i]);
            assertEquals(expected[i].getHomeInterfaceClass(), actual[i].getHomeInterfaceClass());
            assertEquals(expected[i].getRemoteInterfaceClass(), actual[i].getRemoteInterfaceClass());
        }
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBMetaData(javax.ejb.EJBMetaData) EJBObject(javax.ejb.EJBObject) RemoteException(java.rmi.RemoteException)

Example 48 with EJBMetaData

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

the class StatefulRmiIiopTests method test47_returnNestedEJBMetaData.

public void test47_returnNestedEJBMetaData() {
    try {
        final Object obj = initialContext.lookup("client/tests/stateful/EncBean");
        final EncStatefulHome home = (EncStatefulHome) 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 49 with EJBMetaData

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

the class StatefulRmiIiopTests method test45_returnEJBMetaData.

/*-------------------------------------------------*/
/*  EJBMetaData                                    */
/*-------------------------------------------------*/
public void test45_returnEJBMetaData() {
    try {
        final Object obj = initialContext.lookup("client/tests/stateful/EncBean");
        final EncStatefulHome home = (EncStatefulHome) 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) EJBObject(javax.ejb.EJBObject) RemoteException(java.rmi.RemoteException)

Example 50 with EJBMetaData

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

the class StatefulRmiIiopTests method test46_returnEJBMetaData.

public void test46_returnEJBMetaData() {
    try {
        final EJBMetaData actual = ejbObject.returnEJBMetaData();
        assertNotNull("The EJBMetaData returned is null", actual);
        assertEquals(actual.getHomeInterfaceClass(), actual.getHomeInterfaceClass());
        assertEquals(actual.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass());
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBMetaData(javax.ejb.EJBMetaData) RemoteException(java.rmi.RemoteException)

Aggregations

EJBMetaData (javax.ejb.EJBMetaData)59 RemoteException (java.rmi.RemoteException)40 EJBObject (javax.ejb.EJBObject)20 ObjectGraph (org.apache.openejb.test.object.ObjectGraph)18 InitialContext (javax.naming.InitialContext)14 EJBException (javax.ejb.EJBException)12 RemoveException (javax.ejb.RemoveException)10 ObjectNotFoundException (javax.ejb.ObjectNotFoundException)7 Handle (javax.ejb.Handle)3 HomeHandle (javax.ejb.HomeHandle)3 EncCmpHome (org.apache.openejb.test.entity.cmp.EncCmpHome)3 EncCmpObject (org.apache.openejb.test.entity.cmp.EncCmpObject)3 RmiIiopCmpObject (org.apache.openejb.test.entity.cmp.RmiIiopCmpObject)3 CreateException (javax.ejb.CreateException)2 EJBHome (javax.ejb.EJBHome)2 Test (org.junit.Test)2 List (java.util.List)1 Session30 (org.jboss.as.test.integration.ejb.ejb2.reference.global.Session30)1