Java Code Examples for javax.ejb.Handle#getEJBObject()
The following examples show how to use
javax.ejb.Handle#getEJBObject() .
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: BmpRmiIiopTests.java From tomee with Apache License 2.0 | 6 votes |
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 2
Source File: SingletonRmiIiopTests.java From tomee with Apache License 2.0 | 6 votes |
public void test50_returnHandle() { 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 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 3
Source File: Unknown2HandleTests.java From tomee with Apache License 2.0 | 6 votes |
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 4
Source File: Complex2HandleTests.java From tomee with Apache License 2.0 | 6 votes |
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 5
Source File: Cmp2RmiIiopTests.java From tomee with Apache License 2.0 | 6 votes |
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 6
Source File: StatelessRmiIiopTests.java From tomee with Apache License 2.0 | 6 votes |
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 7
Source File: Cmp2HandleTests.java From tomee with Apache License 2.0 | 6 votes |
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 8
Source File: CmpRmiIiopTests.java From tomee with Apache License 2.0 | 6 votes |
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 9
Source File: StatefulRmiIiopTests.java From tomee with Apache License 2.0 | 6 votes |
public void test50_returnHandle() { 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 EncStatefulObject object = home.create("test_50 StatefulBean"); 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: SingletonRmiIiopTests.java From tomee with Apache License 2.0 | 5 votes |
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()); } }
Example 11
Source File: EntityEJBHomeHandler.java From tomee with Apache License 2.0 | 5 votes |
@Override protected Object removeWithHandle(final Method method, final Object[] args, final Object proxy) throws Throwable { if (args[0] == null) { throw new RemoteException("Handler is null"); } final Handle handle = (Handle) args[0]; final EJBObject ejbObject = handle.getEJBObject(); if (ejbObject == null) { throw new NullPointerException("The handle.getEJBObject() is null."); } final Object primKey = ejbObject.getPrimaryKey(); if (primKey == null) { throw new NullPointerException("The handle.getEJBObject().getPrimaryKey() is null."); } final EJBRequest req = new EJBRequest(RequestMethodCode.EJB_HOME_REMOVE_BY_HANDLE, ejb, method, args, primKey, client.getSerializer()); final EJBResponse res = request(req); switch (res.getResponseCode()) { case ResponseCodes.EJB_ERROR: throw new SystemError((ThrowableArtifact) res.getResult()); case ResponseCodes.EJB_SYS_EXCEPTION: throw new SystemException((ThrowableArtifact) res.getResult()); case ResponseCodes.EJB_APP_EXCEPTION: throw new ApplicationException((ThrowableArtifact) res.getResult()); case ResponseCodes.EJB_OK: invalidateAllHandlers(ejb.deploymentID + ":" + primKey); return null; default: throw new RemoteException("Received invalid response code from server: " + res.getResponseCode()); } }
Example 12
Source File: StatelessRmiIiopTests.java From tomee with Apache License 2.0 | 5 votes |
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 13
Source File: StatefulRmiIiopTests.java From tomee with Apache License 2.0 | 5 votes |
public void test52_returnNestedHandle() { 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 EncStatefulObject object = home.create("test_52 StatefulBean"); 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 14
Source File: CmpRmiIiopTests.java From tomee with Apache License 2.0 | 5 votes |
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 15
Source File: Cmp2HandleTests.java From tomee with Apache License 2.0 | 5 votes |
public void Xtest02_copyHandleByMarshalledObject() { try { final MarshalledObject obj = new MarshalledObject(ejbHandle); final Handle copy = (Handle) obj.get(); 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 16
Source File: Cmp2RmiIiopTests.java From tomee with Apache License 2.0 | 5 votes |
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 17
Source File: Complex2HandleTests.java From tomee with Apache License 2.0 | 5 votes |
public void Xtest02_copyHandleByMarshalledObject() { try { final MarshalledObject obj = new MarshalledObject(ejbHandle); final Handle copy = (Handle) obj.get(); 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 18
Source File: Unknown2HandleTests.java From tomee with Apache License 2.0 | 5 votes |
public void Xtest02_copyHandleByMarshalledObject() { try { final MarshalledObject obj = new MarshalledObject(ejbHandle); final Handle copy = (Handle) obj.get(); 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 19
Source File: BmpRmiIiopTests.java From tomee with Apache License 2.0 | 5 votes |
public void test52_returnNestedHandle() { 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_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()); } }