Search in sources :

Example 1 with OnePhase

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();
}
Also used : AtomicAction(com.arjuna.ats.arjuna.AtomicAction) ShutdownRecord(com.hp.mwtests.ts.arjuna.resources.ShutdownRecord) LastResourceRecord(com.arjuna.ats.internal.arjuna.abstractrecords.LastResourceRecord) OnePhase(com.hp.mwtests.ts.arjuna.resources.OnePhase) Test(org.junit.Test)

Aggregations

AtomicAction (com.arjuna.ats.arjuna.AtomicAction)1 LastResourceRecord (com.arjuna.ats.internal.arjuna.abstractrecords.LastResourceRecord)1 OnePhase (com.hp.mwtests.ts.arjuna.resources.OnePhase)1 ShutdownRecord (com.hp.mwtests.ts.arjuna.resources.ShutdownRecord)1 Test (org.junit.Test)1