use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.
the class ForgetTest method testRollbackHeuristic.
@Test
public void testRollbackHeuristic() {
SampleOnePhaseResource res = new SampleOnePhaseResource(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 testPackUnpackError.
@Test
public void testPackUnpackError() throws Exception {
SampleOnePhaseResource res = new SampleOnePhaseResource();
XidImple xid = new XidImple(new Uid());
XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
OutputObjectState os = new OutputObjectState();
try {
xares.pack(os);
fail();
} catch (final IOException ex) {
}
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.
the class OnePhaseUnitTest method testInvalid.
@Test
public void testInvalid() {
XAOnePhaseResource xares = new XAOnePhaseResource();
assertEquals(xares.commit(), TwoPhaseOutcome.ONE_PHASE_ERROR);
assertEquals(xares.rollback(), TwoPhaseOutcome.FINISH_ERROR);
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.
the class OnePhaseUnitTest method testFailure.
@Test
public void testFailure() throws Exception {
SampleOnePhaseResource res = new SampleOnePhaseResource(ErrorType.heurmix);
XAOnePhaseResource xares = new XAOnePhaseResource(res, new XidImple(new Uid()), null);
assertEquals(xares.commit(), TwoPhaseOutcome.HEURISTIC_HAZARD);
res = new SampleOnePhaseResource(ErrorType.rmerr);
xares = new XAOnePhaseResource(res, new XidImple(new Uid()), null);
assertEquals(xares.commit(), TwoPhaseOutcome.ONE_PHASE_ERROR);
res = new SampleOnePhaseResource(ErrorType.nota);
xares = new XAOnePhaseResource(res, new XidImple(new Uid()), null);
assertEquals(xares.commit(), TwoPhaseOutcome.HEURISTIC_HAZARD);
res = new SampleOnePhaseResource(ErrorType.inval);
xares = new XAOnePhaseResource(res, new XidImple(new Uid()), null);
assertEquals(xares.commit(), TwoPhaseOutcome.HEURISTIC_HAZARD);
res = new SampleOnePhaseResource(ErrorType.proto);
xares = new XAOnePhaseResource(res, new XidImple(new Uid()), null);
assertEquals(xares.commit(), TwoPhaseOutcome.ONE_PHASE_ERROR);
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource in project narayana by jbosstm.
the class OnePhaseUnitTest method test.
@Test
public void test() throws Exception {
DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
Object[] obj = new Object[1];
SampleOnePhaseResource res = new SampleOnePhaseResource();
obj[XAResourceRecord.XACONNECTION] = rc;
XAOnePhaseResource xares = new XAOnePhaseResource(res, new XidImple(new Uid()), obj);
OutputObjectState os = new OutputObjectState();
xares.pack(os);
InputObjectState is = new InputObjectState(os);
xares.unpack(is);
}
Aggregations