Methods Summary |
---|
StatefulLocal | getStateful()
InitialContext ctx = new InitialContext();
return (StatefulLocal)ctx.lookup("StatefulBean/local");
|
public void | testStatefulWithTx()
StatefulLocal stateful = getStateful();
Transaction tx = stateful.beginNoEnd();
stateful.endCommit(tx);
tx = stateful.beginNoEnd();
stateful.endRollback(tx);
stateful.beginCommitEnd();
stateful.beginRollbackEnd();
|
public void | testStatefulWithoutTx()
StatefulLocal stateful = getStateful();
Transaction tx = stateful.beginNoEnd();
if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
stateful.endCommit(tx);
if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
tx = stateful.beginNoEnd();
if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
stateful.endRollback(tx);
if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
stateful.beginCommitEnd();
if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
stateful.beginRollbackEnd();
if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
|
public void | testStatelessWithTx()
stateless.beginCommitEnd();
stateless.beginRollbackEnd();
try
{
stateless.beginNoEnd();
}
catch (Exception e)
{
if (e instanceof TestException) throw e;
log.info("should be EJBException thrown that begin and no end was called: ", e);
}
|
public void | testStatelessWithoutTx()
stateless.beginCommitEnd();
if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
stateless.beginRollbackEnd();
if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
try
{
stateless.beginNoEnd();
}
catch (Exception e)
{
if (e instanceof TestException) throw e;
log.info("should be EJBException thrown that begin and no end was called: ", e);
}
if (tm.getTransaction() != null) throw new RuntimeException("tx is associated");
|