return (TransactionManager) ctx.lookup("java:/TransactionManager");
}
public void basicTest() throws Exception
{
XATerminator xt = adapter.ctx.getXATerminator();
WorkManager wm = adapter.ctx.getWorkManager();
TestWork work = new TestWork();
ExecutionContext ec = new ExecutionContext();
Xid xid = new MyXid(1);
ec.setXid(xid);
wm.doWork(work, 0l, ec, null);
if (work.complete == false)
throw new Exception("Work was not done");
if (work.e != null)
throw work.e;
if (work.enlisted == false)
throw new Exception("Not enlisted");
if (work.delisted)
throw new Exception("Should not be ended yet");
if (work.committed)
throw new Exception("Should not be committed yet");
xt.commit(xid, true);
if (work.delisted == false)
throw new Exception("Should be ended");
if (work.committed == false)
throw new Exception("Should be committed");
}