Search in sources :

Example 6 with ExtendedCrashRecord

use of com.hp.mwtests.ts.jta.jts.common.ExtendedCrashRecord in project narayana by jbosstm.

the class JTSObjStoreBrowserTest method startTest.

// create 2 participants, start the action and enlist both participants
private ExtendedCrashRecord[] startTest(TwoPhaseCoordinator A) throws Exception {
    ThreadActionData.purgeActions();
    ExtendedCrashRecord[] recs = { new ExtendedCrashRecord(ExtendedCrashRecord.CrashLocation.NoCrash, ExtendedCrashRecord.CrashType.Normal), new ExtendedCrashRecord(ExtendedCrashRecord.CrashLocation.CrashInCommit, ExtendedCrashRecord.CrashType.HeuristicHazard) };
    RecordTypeManager.manager().add(new RecordTypeMap() {

        public Class<? extends AbstractRecord> getRecordClass() {
            return ExtendedCrashRecord.class;
        }

        public int getType() {
            return RecordType.USER_DEF_FIRST0;
        }
    });
    A.start();
    for (ExtendedCrashRecord rec : recs) A.add(rec);
    return recs;
}
Also used : ExtendedCrashRecord(com.hp.mwtests.ts.jta.jts.common.ExtendedCrashRecord) RecordTypeMap(com.arjuna.ats.arjuna.coordinator.abstractrecord.RecordTypeMap) AbstractRecord(com.arjuna.ats.arjuna.coordinator.AbstractRecord) BeforeClass(org.junit.BeforeClass) AfterClass(org.junit.AfterClass)

Example 7 with ExtendedCrashRecord

use of com.hp.mwtests.ts.jta.jts.common.ExtendedCrashRecord in project narayana by jbosstm.

the class JTSObjStoreBrowserTest method jtsRemoveTest.

/**
 * Similar to aaRemoveTest but uses a JTS transaction instead of an AtomicAction
 * @throws Exception if test fails unexpectedly
 */
@Test
public void jtsRemoveTest() throws Exception {
    ArjunaTransactionImple A = new ArjunaTransactionImple(null);
    ExtendedCrashRecord[] recs = startTest(A);
    int outcome = ActionStatus.COMMITTED;
    try {
        A.commit(true);
    } catch (HeuristicHazard e) {
        outcome = ActionStatus.H_HAZARD;
    }
    assertEquals(ActionStatus.H_HAZARD, outcome);
    finishTest(A, false, recs);
}
Also used : ExtendedCrashRecord(com.hp.mwtests.ts.jta.jts.common.ExtendedCrashRecord) ArjunaTransactionImple(com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple) HeuristicHazard(org.omg.CosTransactions.HeuristicHazard) Test(org.junit.Test)

Aggregations

ExtendedCrashRecord (com.hp.mwtests.ts.jta.jts.common.ExtendedCrashRecord)7 Test (org.junit.Test)3 AtomicAction (com.arjuna.ats.arjuna.AtomicAction)2 ArjunaTransactionImple (com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple)2 HeuristicHazard (org.omg.CosTransactions.HeuristicHazard)2 AbstractRecord (com.arjuna.ats.arjuna.coordinator.AbstractRecord)1 RecordTypeMap (com.arjuna.ats.arjuna.coordinator.abstractrecord.RecordTypeMap)1 ActionBean (com.arjuna.ats.arjuna.tools.osb.mbean.ActionBean)1 LogRecordWrapper (com.arjuna.ats.arjuna.tools.osb.mbean.LogRecordWrapper)1 OSEntryBean (com.arjuna.ats.arjuna.tools.osb.mbean.OSEntryBean)1 ObjStoreBrowser (com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBrowser)1 UidWrapper (com.arjuna.ats.arjuna.tools.osb.mbean.UidWrapper)1 AfterClass (org.junit.AfterClass)1 BeforeClass (org.junit.BeforeClass)1