statefulSession.equals(statefulSessionHome.create("marc4")));
getLog().debug("***Testing the various local EJBObject class calls");
getLog().debug(++test+"- "+"Get Handle ... ");
Handle statefulHandle = statefulSession.getHandle();
assertTrue("statefulHandle != null", statefulHandle != null);
getLog().debug("OK");
getLog().debug(++test+"- "+"Serialize handle and deserialize....");
MarshalledObject mo2 = new MarshalledObject(statefulHandle);
Handle statefulHandle2 = (Handle) mo2.get();
StatefulSession statefulSession2 = (StatefulSession) statefulHandle2.getEJBObject();
assertTrue("statefulSession2 != null", statefulSession2 != null);
getLog().debug("OK");
getLog().debug(++test+"- "+"Calling businessMethodB on it..." +
statefulSession2.callBusinessMethodB());
getLog().debug(++test+"- "+"They should be identical..." +
statefulSession.isIdentical(statefulSession2));
getLog().debug(++test+"- "+"Calling StatefulSession.remove()...");
statefulSession.remove();
getLog().debug("ok");
getLog().debug(++test+"- "+"Calling StatefulHome.remove(Handle) (this should fail)...");
try
{
statefulSessionHome.remove(statefulSession2.getHandle());
fail("statefulSessionHome.remove did not fail");
}
catch (Exception e)
{
getLog().debug("not found OK");
}
getLog().debug(++test+"- "+"Creating a 3rd bean and calling it...");
StatefulSession ss3 = statefulSessionHome.create("marc3");
getLog().debug(ss3.callBusinessMethodA());
getLog().debug(++test+"- "+"Calling StatefulSession.remove(Handle) on a third bean...");
Handle statefulHandle3 = ss3.getHandle();
statefulSessionHome.remove(statefulHandle3);
getLog().debug("OK");
getLog().debug(++test+"- "+"I should not be able to remove it directly...");
try {
ss3.remove();
fail("ss3.remove() did not fail");
} catch (Exception e) {
getLog().debug("OK");
}
getLog().debug(++test+"- "+"Creating a 4th bean using create<METHOD> and calling it...");
StatefulSession ss4 = statefulSessionHome.createMETHOD("marc4", "address");
getLog().debug(ss4.callBusinessMethodA());
getLog().debug(++test+"- "+"Calling StatefulSession.remove(Handle) on a fourth bean...");
Handle statefulHandle4 = ss4.getHandle();
statefulSessionHome.remove(statefulHandle4);
}