Search in sources :

Example 6 with EncCmpObject

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

the class Cmp2RmiIiopTests method test41_returnEJBObject2.

public void test41_returnEJBObject2() {
    try {
        final EncCmpObject actual = (EncCmpObject) ejbObject.returnEJBObject();
        assertNotNull("The EJBObject 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) RemoteException(java.rmi.RemoteException)

Example 7 with EncCmpObject

use of org.apache.openejb.test.entity.cmp.EncCmpObject 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 8 with EncCmpObject

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

the class Cmp2RmiIiopTests method test52_returnNestedHandle.

public void test52_returnNestedHandle() {
    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_52 CmpBean");
        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) 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 9 with EncCmpObject

use of org.apache.openejb.test.entity.cmp.EncCmpObject 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 EncCmpObject

use of org.apache.openejb.test.entity.cmp.EncCmpObject 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)

Aggregations

EncCmpObject (org.apache.openejb.test.entity.cmp.EncCmpObject)10 RemoteException (java.rmi.RemoteException)8 EncCmpHome (org.apache.openejb.test.entity.cmp.EncCmpHome)8 EJBObject (javax.ejb.EJBObject)6 RmiIiopCmpObject (org.apache.openejb.test.entity.cmp.RmiIiopCmpObject)6 Handle (javax.ejb.Handle)3 ObjectGraph (org.apache.openejb.test.object.ObjectGraph)3 EncBmpObject (org.apache.openejb.test.entity.bmp.EncBmpObject)2 EncStatefulObject (org.apache.openejb.test.stateful.EncStatefulObject)2