use of javax.ejb.EJBObject in project tomee by apache.
the class StatelessPojoHandleTests method test01_getEJBObject.
// =================================
// Test handle methods
//
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());
}
}
use of javax.ejb.EJBObject 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());
}
}
use of javax.ejb.EJBObject in project tomee by apache.
the class Complex2HandleTests method Xtest02_copyHandleByMarshalledObject.
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());
}
}
use of javax.ejb.EJBObject in project tomee by apache.
the class Cmp2HandleTests method setUp.
protected void setUp() throws Exception {
super.setUp();
final Object obj = initialContext.lookup("client/tests/entity/cmp2/BasicCmpHome");
ejbHome = (BasicCmpHome) obj;
ejbObject = ejbHome.createObject("Fifth Bean");
ejbHandle = ejbObject.getHandle();
}
use of javax.ejb.EJBObject in project tomee by apache.
the class Cmp2HandleTests method Xtest03_copyHandleBySerialize.
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());
}
}
Aggregations