use of com.hp.mwtests.ts.jta.common.SampleOnePhaseResource 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.hp.mwtests.ts.jta.common.SampleOnePhaseResource 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.hp.mwtests.ts.jta.common.SampleOnePhaseResource 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.hp.mwtests.ts.jta.common.SampleOnePhaseResource 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);
}
use of com.hp.mwtests.ts.jta.common.SampleOnePhaseResource 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());
}
Aggregations