use of com.hp.mwtests.ts.arjuna.resources.OnePhase in project narayana by jbosstm.
the class LastResource method run.
@Test
public void run() {
AtomicAction A = new AtomicAction();
OnePhase opRes = new OnePhase();
A.begin();
A.add(new LastResourceRecord(opRes));
A.add(new ShutdownRecord(ShutdownRecord.FAIL_IN_PREPARE));
A.commit();
assertEquals(OnePhase.ROLLEDBACK, opRes.status());
A = new AtomicAction();
opRes = new OnePhase();
A.begin();
A.add(new LastResourceRecord(opRes));
A.add(new ShutdownRecord(ShutdownRecord.FAIL_IN_COMMIT));
A.commit();
assertEquals(OnePhase.COMMITTED, opRes.status());
A = new AtomicAction();
A.begin();
A.add(new LastResourceRecord(new OnePhase()));
assertEquals(AddOutcome.AR_DUPLICATE, A.add(new LastResourceRecord(new OnePhase())));
A.abort();
}
Aggregations