use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.
the class OnePhaseUnitTest method testCommit.
@Test
public void testCommit() {
SampleOnePhaseResource res = new SampleOnePhaseResource();
XidImple xid = new XidImple(new Uid());
XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
assertEquals(xares.commit(), TwoPhaseOutcome.FINISH_OK);
assertTrue(res.onePhaseCalled());
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.
the class ForgetTest method testCommitHeuristic.
@Test
public void testCommitHeuristic() {
SampleOnePhaseResource res = new SampleOnePhaseResource(SampleOnePhaseResource.ErrorType.heurcom);
XidImple xid = new XidImple(new Uid());
XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
assertEquals(xares.commit(), TwoPhaseOutcome.FINISH_OK);
assertTrue(res.forgetCalled());
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.
the class OnePhaseUnitTest method testCommitHeuristic.
@Test
public void testCommitHeuristic() {
SampleOnePhaseResource res = new SampleOnePhaseResource(ErrorType.heurcom);
XidImple xid = new XidImple(new Uid());
XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
assertEquals(xares.commit(), TwoPhaseOutcome.FINISH_OK);
assertTrue(res.forgetCalled());
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.
the class OnePhaseUnitTest method testRollbackHeuristic.
@Test
public void testRollbackHeuristic() {
SampleOnePhaseResource res = new SampleOnePhaseResource(ErrorType.heurrb);
XidImple xid = new XidImple(new Uid());
XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
assertEquals(xares.commit(), TwoPhaseOutcome.ONE_PHASE_ERROR);
assertTrue(res.forgetCalled());
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.
the class OnePhaseUnitTest method testPackUnpack.
@Test
public void testPackUnpack() throws Exception {
DummyXA res = new DummyXA(false);
XidImple xid = new XidImple(new Uid());
XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
OutputObjectState os = new OutputObjectState();
xares.pack(os);
InputObjectState is = new InputObjectState(os);
xares.unpack(is);
}
Aggregations