Search in sources :

Example 1 with BasicRecord

use of com.hp.mwtests.ts.arjuna.resources.BasicRecord in project narayana by jbosstm.

the class LogStoreReactivationTest2 method test.

@Test
public void test() {
    arjPropertyManager.getCoordinatorEnvironmentBean().setCommitOnePhase(false);
    arjPropertyManager.getObjectStoreEnvironmentBean().setObjectStoreType(LogStore.class.getName());
    arjPropertyManager.getObjectStoreEnvironmentBean().setSynchronousRemoval(true);
    // the byteman script will enforce this
    // System.setProperty(Environment.TRANSACTION_LOG_PURGE_TIME, "1000000");  // essentially infinite
    AtomicAction A = new AtomicAction();
    Uid txId = A.get_uid();
    System.err.println("IMPORTANT: if there are warnings about USER_DEF_FIRST0 then the test has failed!");
    A.begin();
    A.add(new BasicRecord());
    A.commit();
    RecoverAtomicAction rAA = new RecoverAtomicAction(txId, ActionStatus.COMMITTED);
    rAA.replayPhase2();
}
Also used : AtomicAction(com.arjuna.ats.arjuna.AtomicAction) RecoverAtomicAction(com.arjuna.ats.arjuna.recovery.RecoverAtomicAction) Uid(com.arjuna.ats.arjuna.common.Uid) LogStore(com.arjuna.ats.internal.arjuna.objectstore.LogStore) BasicRecord(com.hp.mwtests.ts.arjuna.resources.BasicRecord) RecoverAtomicAction(com.arjuna.ats.arjuna.recovery.RecoverAtomicAction) Test(org.junit.Test)

Example 2 with BasicRecord

use of com.hp.mwtests.ts.arjuna.resources.BasicRecord in project narayana by jbosstm.

the class LogStressTest method run.

public void run() {
    for (int i = 0; i < _iters; i++) {
        try {
            MyAtomicAction A = new MyAtomicAction();
            A.begin();
            A.add(new BasicRecord());
            A.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
        Thread.yield();
    }
}
Also used : BasicRecord(com.hp.mwtests.ts.arjuna.resources.BasicRecord)

Example 3 with BasicRecord

use of com.hp.mwtests.ts.arjuna.resources.BasicRecord in project narayana by jbosstm.

the class LogStressTest2 method test.

@Test
public void test() {
    arjPropertyManager.getCoordinatorEnvironmentBean().setCommitOnePhase(false);
    arjPropertyManager.getObjectStoreEnvironmentBean().setObjectStoreType(LogStore.class.getName());
    arjPropertyManager.getObjectStoreEnvironmentBean().setTxLogSize(10000);
    // hours
    int timeLimit = 4;
    System.err.println("WARNING: this test will run for " + timeLimit + " hours.");
    final long stime = System.currentTimeMillis();
    final long endTime = timeLimit * 60 * 60 * 1000;
    long ftime;
    do {
        try {
            AtomicAction A = new AtomicAction();
            A.begin();
            A.add(new BasicRecord());
            A.commit();
        } catch (final Exception ex) {
        }
        ftime = System.currentTimeMillis();
    } while ((ftime - stime) < endTime);
}
Also used : AtomicAction(com.arjuna.ats.arjuna.AtomicAction) LogStore(com.arjuna.ats.internal.arjuna.objectstore.LogStore) BasicRecord(com.hp.mwtests.ts.arjuna.resources.BasicRecord) Test(org.junit.Test)

Example 4 with BasicRecord

use of com.hp.mwtests.ts.arjuna.resources.BasicRecord in project narayana by jbosstm.

the class LogStoreReactivationTest method test.

@Test
public void test() {
    arjPropertyManager.getCoordinatorEnvironmentBean().setCommitOnePhase(false);
    arjPropertyManager.getObjectStoreEnvironmentBean().setObjectStoreType(LogStore.class.getName());
    arjPropertyManager.getObjectStoreEnvironmentBean().setSynchronousRemoval(false);
    // the byteman script will enforce this
    // System.setProperty(Environment.TRANSACTION_LOG_PURGE_TIME, "1000000");  // essentially infinite
    AtomicAction A = new AtomicAction();
    Uid txId = A.get_uid();
    System.err.println("IMPORTANT: ignore warnings about USER_DEF_FIRST0 as they are expected due to BasicRecord usage!");
    A.begin();
    A.add(new BasicRecord());
    A.commit();
    RecoverAtomicAction rAA = new RecoverAtomicAction(txId, ActionStatus.COMMITTED);
    rAA.replayPhase2();
}
Also used : AtomicAction(com.arjuna.ats.arjuna.AtomicAction) RecoverAtomicAction(com.arjuna.ats.arjuna.recovery.RecoverAtomicAction) Uid(com.arjuna.ats.arjuna.common.Uid) LogStore(com.arjuna.ats.internal.arjuna.objectstore.LogStore) BasicRecord(com.hp.mwtests.ts.arjuna.resources.BasicRecord) RecoverAtomicAction(com.arjuna.ats.arjuna.recovery.RecoverAtomicAction) Test(org.junit.Test)

Example 5 with BasicRecord

use of com.hp.mwtests.ts.arjuna.resources.BasicRecord in project narayana by jbosstm.

the class HeuristicNotificationUnitTest method test.

@Test
public void test() throws Exception {
    AtomicAction A = new AtomicAction();
    DummyHeuristic dh = new DummyHeuristic();
    A.begin();
    A.add(new BasicRecord());
    A.add(new BasicRecord());
    A.add(new HeuristicRecord());
    A.addSynchronization(dh);
    A.commit(false);
    assertEquals(TwoPhaseOutcome.HEURISTIC_MIXED, dh.getStatus());
}
Also used : AtomicAction(com.arjuna.ats.arjuna.AtomicAction) DummyHeuristic(com.hp.mwtests.ts.arjuna.resources.DummyHeuristic) BasicRecord(com.hp.mwtests.ts.arjuna.resources.BasicRecord) HeuristicRecord(com.hp.mwtests.ts.arjuna.resources.HeuristicRecord) Test(org.junit.Test)

Aggregations

BasicRecord (com.hp.mwtests.ts.arjuna.resources.BasicRecord)6 AtomicAction (com.arjuna.ats.arjuna.AtomicAction)5 Test (org.junit.Test)5 LogStore (com.arjuna.ats.internal.arjuna.objectstore.LogStore)3 Uid (com.arjuna.ats.arjuna.common.Uid)2 RecoverAtomicAction (com.arjuna.ats.arjuna.recovery.RecoverAtomicAction)2 DummyHeuristic (com.hp.mwtests.ts.arjuna.resources.DummyHeuristic)1 HeuristicRecord (com.hp.mwtests.ts.arjuna.resources.HeuristicRecord)1 OnePhaseAbstractRecord (com.hp.mwtests.ts.arjuna.resources.OnePhaseAbstractRecord)1