javax.ejb.EJBObject Java Examples

The following examples show how to use javax.ejb.EJBObject. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SingletonRmiIiopTests.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void test44_returnEJBObjectArray() {
    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[] expected = new EncSingletonObject[3];
        for (int i = 0; i < expected.length; i++) {
            expected[i] = home.create();
            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());
    }
}
 
Example #2
Source File: Unknown2HandleTests.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void Xtest03_copyHandleBySerialize() {
    try {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        final ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(ejbHandle);
        oos.flush();
        oos.close();
        final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        final ObjectInputStream ois = new ObjectInputStream(bais);
        final Handle copy = (Handle) ois.readObject();

        final EJBObject object = copy.getEJBObject();
        assertNotNull("The EJBObject is null", object);
        assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
Example #3
Source File: BmpRmiIiopTests.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void test44_returnEJBObjectArray() {
    try {
        final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
        final EncBmpHome home = (EncBmpHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", home);

        final EncBmpObject[] expected = new EncBmpObject[3];
        for (int i = 0; i < expected.length; i++) {
            expected[i] = home.create("test_44 BmpBean");
            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 EJBObjects are not identical", expected[i].isIdentical(actual[i]));
        }

    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
Example #4
Source File: BmpRmiIiopTests.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void test50_returnHandle() {
    try {
        final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
        final EncBmpHome home = (EncBmpHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", home);

        final EncBmpObject object = home.create("test_50 BmpBean");
        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 Handle actual = ejbObject.returnHandle(expected);
        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());
    }
}
 
Example #5
Source File: EntityContext.java    From tomee with Apache License 2.0 6 votes vote down vote up
public EJBObject getEJBObject() throws IllegalStateException {
    doCheck(Call.getEJBObject);

    final ThreadContext threadContext = ThreadContext.getThreadContext();
    final BeanContext di = threadContext.getBeanContext();

    if (di.getRemoteInterface() == null) {
        throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface");
    }

    final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getBeanContext(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<>(), di.getRemoteInterface());
    try {
        final Class[] interfaces = new Class[]{di.getRemoteInterface(), IntraVmProxy.class};
        return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler);
    } catch (final IllegalAccessException iae) {
        throw new InternalErrorException("Could not create IVM proxy for " + di.getRemoteInterface() + " interface", iae);
    }
}
 
Example #6
Source File: Cmp2RmiIiopTests.java    From tomee with Apache License 2.0 6 votes vote down vote up
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());
    }
}
 
Example #7
Source File: Cmp2RmiIiopTests.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void test50_returnHandle() {
    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_50 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 Handle actual = ejbObject.returnHandle(expected);
        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());
    }
}
 
Example #8
Source File: Cmp2HandleTests.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void Xtest03_copyHandleBySerialize() {
    try {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        final ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(ejbHandle);
        oos.flush();
        oos.close();
        final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        final ObjectInputStream ois = new ObjectInputStream(bais);
        final Handle copy = (Handle) ois.readObject();

        final EJBObject object = copy.getEJBObject();
        assertNotNull("The EJBObject is null", object);
        assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
    } catch (final Exception e) {
        fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
}
 
Example #9
Source File: CmpRmiIiopTests.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void test50_returnHandle() {
    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_50 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 Handle actual = ejbObject.returnHandle(expected);
        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());
    }
}
 
Example #10
Source File: StatelessRmiIiopTests.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void test44_returnEJBObjectArray() {
    try {
        final Object obj = initialContext.lookup("client/tests/stateless/EncBean");
        final EncStatelessHome home = (EncStatelessHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", home);

        final EncStatelessObject[] expected = new EncStatelessObject[3];
        for (int i = 0; i < expected.length; i++) {
            expected[i] = home.create();
            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());
    }
}
 
Example #11
Source File: StatelessRmiIiopTests.java    From tomee with Apache License 2.0 6 votes vote down vote up
public void test50_returnHandle() {
    try {
        final Object obj = initialContext.lookup("client/tests/stateless/EncBean");
        final EncStatelessHome home = (EncStatelessHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", home);

        final EncStatelessObject 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 Handle actual = ejbObject.returnHandle(expected);
        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());
    }
}
 
Example #12
Source File: RmiIiopSingletonBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
public EJBObject returnEJBObject() throws javax.ejb.EJBException {
    EncSingletonObject data = null;

    try {
        final InitialContext ctx = new InitialContext();

        final EncSingletonHome home = (EncSingletonHome) ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
        data = home.create();

    } catch (final Exception e) {
        throw new javax.ejb.EJBException(e);
    }
    return data;
}
 
Example #13
Source File: RmiIiopStatelessBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
public EJBObject returnEJBObject() throws javax.ejb.EJBException {
    EncStatelessObject data = null;

    try {
        final InitialContext ctx = new InitialContext();

        final EncStatelessHome home = (EncStatelessHome) ctx.lookup("java:comp/env/stateless/rmi-iiop/home");
        data = home.create();

    } catch (final Exception e) {
        throw new javax.ejb.EJBException(e);
    }
    return data;
}
 
Example #14
Source File: RmiIiopStatefulBean.java    From tomee with Apache License 2.0 5 votes vote down vote up
public EJBObject returnEJBObject() throws javax.ejb.EJBException {
    EncStatefulObject data = null;

    try {
        final InitialContext ctx = new InitialContext();

        final EncStatefulHome home = (EncStatefulHome) ctx.lookup("java:comp/env/stateful/rmi-iiop/home");
        data = home.create("Test01 StatefulBean");

    } catch (final Exception e) {
        throw new javax.ejb.EJBException(e);
    }
    return data;
}
 
Example #15
Source File: StatelessRmiIiopTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void test52_returnNestedHandle() {
    try {
        final Object obj = initialContext.lookup("client/tests/stateless/EncBean");
        final EncStatelessHome home = (EncStatelessHome) obj;
        assertNotNull("The EJBHome returned from JNDI is null", home);

        final EncStatelessObject 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());
    }
}
 
Example #16
Source File: StatelessHandleTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void test01_getEJBObject() {

        try {
            final EJBObject object = ejbHandle.getEJBObject();
            assertNotNull("The EJBObject is null", object);
            // Wait until isIdentical is working.
            //assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
        } catch (final Exception e) {
            fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    }
 
Example #17
Source File: SingletonHandleTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void test01_getEJBObject() {

        try {
            final EJBObject object = ejbHandle.getEJBObject();
            assertNotNull("The EJBObject is null", object);
            // Wait until isIdentical is working.
            //assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
        } catch (final Exception e) {
            fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    }
 
Example #18
Source File: SimpleRemoteSlsbInvokerInterceptor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Remove the cached session bean instance, if necessary.
 */
@Override
public void destroy() {
	if (this.cacheSessionBean) {
		synchronized (this.beanInstanceMonitor) {
			if (this.beanInstance instanceof EJBObject) {
				removeSessionBeanInstance((EJBObject) this.beanInstance);
			}
		}
	}
}
 
Example #19
Source File: StatelessAllowedOperationsTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
private void setUp_ejbActivate_Passivate() throws Exception {

        /* Create more instances to fill the pool size 
         * causing instances to be passivated
         */
        final EJBObject[] ejbObjects = new EJBObject[10];
        for (int i = 0; i < ejbObjects.length; i++) {
            ejbObjects[i] = ejbHome.createObject();
        }
        ejbObject.businessMethod("activate me please");
    }
 
Example #20
Source File: StatefulPojoHandleTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void test01_getEJBObject() {

        try {
            final EJBObject object = ejbHandle.getEJBObject();
            assertNotNull("The EJBObject is null", object);
            assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
        } catch (final Exception e) {
            fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    }
 
Example #21
Source File: SingletonAllowedOperationsTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
private void setUp_ejbActivate_Passivate() throws Exception {

        /* Create more instances to fill the pool size 
         * causing instances to be passivated
         */
        final EJBObject[] ejbObjects = new EJBObject[10];
        for (int i = 0; i < ejbObjects.length; i++) {
            ejbObjects[i] = ejbHome.createObject();
        }
        ejbObject.businessMethod("activate me please");
    }
 
Example #22
Source File: CmpRmiIiopTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
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());
    }
}
 
Example #23
Source File: SingletonPojoHandleTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void test01_getEJBObject() {

        try {
            final EJBObject object = ejbHandle.getEJBObject();
            assertNotNull("The EJBObject is null", object);
            assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
        } catch (final Exception e) {
            fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    }
 
Example #24
Source File: ComplexHandleTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void test01_getEJBObject() {

        try {
            final EJBObject object = ejbHandle.getEJBObject();
            assertNotNull("The EJBObject is null", object);
            // Wait until isIdentical is working.
            //assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
        } catch (final Exception e) {
            fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    }
 
Example #25
Source File: SimpleRemoteSlsbInvokerInterceptor.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Remove the cached session bean instance, if necessary.
 */
@Override
public void destroy() {
	if (this.cacheSessionBean) {
		synchronized (this.beanInstanceMonitor) {
			if (this.beanInstance instanceof EJBObject) {
				removeSessionBeanInstance((EJBObject) this.beanInstance);
			}
		}
	}
}
 
Example #26
Source File: MethodInfoUtil.java    From tomee with Apache License 2.0 5 votes vote down vote up
private static boolean containerMethod(final Method method) {
    return (method.getDeclaringClass() == EJBObject.class ||
        method.getDeclaringClass() == EJBHome.class ||
        method.getDeclaringClass() == EJBLocalObject.class ||
        method.getDeclaringClass() == EJBLocalHome.class) &&
        !method.getName().equals("remove");
}
 
Example #27
Source File: Cmp2HandleTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void test01_getEJBObject() {

        try {
            final EJBObject object = ejbHandle.getEJBObject();
            assertNotNull("The EJBObject is null", object);
            // Wait until isIdentical is working.
            //assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
        } catch (final Exception e) {
            fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    }
 
Example #28
Source File: Cmp2RmiIiopTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
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());
    }
}
 
Example #29
Source File: JpaCmpEngine.java    From tomee with Apache License 2.0 5 votes vote down vote up
public int executeUpdateQuery(final BeanContext beanContext, final String signature, Object[] args) throws FinderException {
    final EntityManager entityManager = getEntityManager(beanContext);

    Query query = createNamedQuery(entityManager, signature);
    if (query == null) {
        final int parenIndex = signature.indexOf('(');
        if (parenIndex > 0) {
            final String shortName = signature.substring(0, parenIndex);
            query = createNamedQuery(entityManager, shortName);
        }
        if (query == null) {
            throw new FinderException("No query defined for method " + signature);
        }
    }

    // process args
    if (args == null) {
        args = NO_ARGS;
    }
    for (int i = 0; i < args.length; i++) {
        Object arg = args[i];
        // ejb proxies need to be swapped out for real instance classes
        if (arg instanceof EJBObject) {
            arg = Cmp2Util.getEntityBean((EJBObject) arg);
        }
        if (arg instanceof EJBLocalObject) {
            arg = Cmp2Util.getEntityBean((EJBLocalObject) arg);
        }
        query.setParameter(i + 1, arg);
    }

    final int result = query.executeUpdate();
    return result;
}
 
Example #30
Source File: SingletonRmiIiopTests.java    From tomee with Apache License 2.0 5 votes vote down vote up
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());
    }
}