Search in sources :

Example 6 with EncCmpHome

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

the class Cmp2RmiIiopTests method test35_returnEJBHome.

/*-------------------------------------------------*/
/*  EJBHome                                        */
/*-------------------------------------------------*/
public void test35_returnEJBHome() {
    try {
        final Object obj = initialContext.lookup("client/tests/entity/cmp/EncBean");
        final EncCmpHome expected = (EncCmpHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", expected);
        final EncCmpHome actual = (EncCmpHome) ejbObject.returnEJBHome(expected);
        assertNotNull("The EJBHome returned is null", actual);
    } 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) RemoteException(java.rmi.RemoteException)

Example 7 with EncCmpHome

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

the class MiscEjbTests method _test04_isIdentical_cmp.

/**
 * DMB: Calling this now causes an error as the "entity" table doesn't exist yet
 */
public void _test04_isIdentical_cmp() {
    try {
        final String jndiName = "client/tests/entity/cmp/EncBean";
        EncCmpHome ejbHome2 = null;
        EncCmpObject ejbObject2 = null;
        final Object obj = initialContext.lookup(jndiName);
        ejbHome2 = (EncCmpHome) obj;
        ejbObject2 = ejbHome2.create("isIdentical test");
        // System.out.println("_______________________________________________________");
        // System.out.println(" ejb1 "+ejbObject);
        // System.out.println(" ejb2 "+ejbObject2);
        assertTrue("The EJBObjects should not be identical", !ejbObject.isIdentical(ejbObject2));
    // System.out.println("-------------------------------------------------------");
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EncCmpObject(org.apache.openejb.test.entity.cmp.EncCmpObject) EncStatefulObject(org.apache.openejb.test.stateful.EncStatefulObject) EncBmpObject(org.apache.openejb.test.entity.bmp.EncBmpObject) EncCmpHome(org.apache.openejb.test.entity.cmp.EncCmpHome) EncCmpObject(org.apache.openejb.test.entity.cmp.EncCmpObject)

Example 8 with EncCmpHome

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

the class MiscEjbTests method _test04_isIdentical_cmp.

/**
 * DMB: Calling this now causes an error as the "entity" table doesn't exist yet
 */
public void _test04_isIdentical_cmp() {
    try {
        final String jndiName = "client/tests/entity/cmp/EncBean";
        EncCmpHome ejbHome2 = null;
        EncCmpObject ejbObject2 = null;
        final Object obj = initialContext.lookup(jndiName);
        ejbHome2 = (EncCmpHome) obj;
        ejbObject2 = ejbHome2.create("isIdentical test");
        // System.out.println("_______________________________________________________");
        // System.out.println(" ejb1 "+ejbObject);
        // System.out.println(" ejb2 "+ejbObject2);
        assertTrue("The EJBObjects should not be identical", !ejbObject.isIdentical(ejbObject2));
    // System.out.println("-------------------------------------------------------");
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EncCmpObject(org.apache.openejb.test.entity.cmp.EncCmpObject) EncStatefulObject(org.apache.openejb.test.stateful.EncStatefulObject) EncBmpObject(org.apache.openejb.test.entity.bmp.EncBmpObject) EncCmpHome(org.apache.openejb.test.entity.cmp.EncCmpHome) EncCmpObject(org.apache.openejb.test.entity.cmp.EncCmpObject)

Example 9 with EncCmpHome

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

the class Cmp2RmiIiopTests method Xtest44_returnEJBObjectArray.

public void Xtest44_returnEJBObjectArray() {
    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 = new EncCmpObject[3];
        for (int i = 0; i < expected.length; i++) {
            expected[i] = home.create("test_44 CmpBean");
            assertNotNull("The EJBObject created is null", expected[i]);
        }
        final EJBObject[] actual = ejbObject.returnEJBObjectArray(expected);
        assertNotNull("The EJBObject array returned is null", actual);
        assertEquals(expected.length, actual.length);
        for (int i = 0; i < actual.length; i++) {
            assertTrue("The EJBObejcts are not identical", expected[i].isIdentical(actual[i]));
        }
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
Also used : EJBObject(javax.ejb.EJBObject) 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 10 with EncCmpHome

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

the class Cmp2RmiIiopTests method test49_returnEJBMetaDataArray.

public void test49_returnEJBMetaDataArray() {
    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 = 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 = 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) 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