Search in sources :

Example 1 with ExpiredTransactionScanner

use of com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionScanner in project narayana by jbosstm.

the class LogMoveTest method test.

@Test
public void test() {
    RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
    OutputObjectState fluff = new OutputObjectState();
    Uid kungfuTx = new Uid();
    boolean passed = false;
    final String tn = new AtomicAction().type();
    try {
        UidHelper.packInto(kungfuTx, fluff);
        System.err.println("Creating dummy log");
        recoveryStore.write_committed(kungfuTx, tn, fluff);
        if (recoveryStore.currentState(kungfuTx, tn) == StateStatus.OS_COMMITTED) {
            System.err.println("Wrote dummy transaction " + kungfuTx);
            // quicker to deal with scanner directly
            ExpiredTransactionScanner scanner = new ExpiredTransactionScanner(tn, "/StateManager/ExpiredEntries");
            scanner.scan();
            scanner.scan();
            if (recoveryStore.currentState(kungfuTx, tn) == StateStatus.OS_COMMITTED)
                System.err.println("Transaction log not moved!");
            else {
                System.err.println("Transaction log moved!");
                passed = true;
            }
        } else
            System.err.println("State is not committed!");
    } catch (final Exception ex) {
        ex.printStackTrace();
    }
    assertTrue(passed);
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) AtomicAction(com.arjuna.ats.arjuna.AtomicAction) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) ExpiredTransactionScanner(com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionScanner) RecoveryStore(com.arjuna.ats.arjuna.objectstore.RecoveryStore) Test(org.junit.Test)

Aggregations

AtomicAction (com.arjuna.ats.arjuna.AtomicAction)1 Uid (com.arjuna.ats.arjuna.common.Uid)1 RecoveryStore (com.arjuna.ats.arjuna.objectstore.RecoveryStore)1 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)1 ExpiredTransactionScanner (com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionScanner)1 Test (org.junit.Test)1