public void test52_returnNestedHandle() { try { final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); final EncBmpHome home = (EncBmpHome) javax.rmi.PortableRemoteObject.narrow(obj, EncBmpHome.class); assertNotNull("The EJBHome returned from JNDI is null", home); final EncBmpObject object = home.create("test_52 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 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()); } }
public void test54_returnHandleArray() { try { final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); final EncBmpHome home = (EncBmpHome) javax.rmi.PortableRemoteObject.narrow(obj, EncBmpHome.class); assertNotNull("The EJBHome returned from JNDI is null", home); final EncBmpObject object = home.create("test_54 BmpBean"); 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 = (Handle[]) 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()); } }
public ObjectGraph returnNestedHandle() throws javax.ejb.EJBException { ObjectGraph data = null; try { final InitialContext ctx = new InitialContext(); final EncBmpHome home = (EncBmpHome) ctx.lookup("java:comp/env/bmp/rmi-iiop/home"); final EncBmpObject object = home.create("Test04 BmpBean"); data = new ObjectGraph(object.getHandle()); } catch (final Exception e) { throw new javax.ejb.EJBException(e); } return data; }
public void test40_returnEJBObject() { try { final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); final EncBmpHome home = (EncBmpHome) javax.rmi.PortableRemoteObject.narrow(obj, EncBmpHome.class); assertNotNull("The EJBHome returned from JNDI is null", home); final EncBmpObject expected = home.create("test_40 BmpBean"); assertNotNull("The EJBObject created is null", expected); final EncBmpObject actual = (EncBmpObject) javax.rmi.PortableRemoteObject.narrow( ejbObject.returnEJBObject(expected), EncBmpObject.class); assertNotNull("The EJBObject returned is null", actual); assertTrue("The EJBObejcts are not identical", expected.isIdentical(actual)); } catch (final Exception e) { fail("Received Exception " + e.getClass() + " : " + e.getMessage()); } }