Search in sources :

Example 91 with InputObjectState

use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.

the class ObjectStoreTest method getUids.

private Collection<Uid> getUids(ObjectStore store, String type) throws Exception {
    Collection<Uid> uids = new ArrayList<>();
    InputObjectState ios = new InputObjectState();
    assertTrue(store.allObjUids(type, ios));
    while (true) {
        Uid uid = UidHelper.unpackFrom(ios);
        if (uid.equals(Uid.nullUid()))
            break;
        uids.add(uid);
    }
    return uids;
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) ArrayList(java.util.ArrayList)

Example 92 with InputObjectState

use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.

the class ObjectStoreTest method testHashedActionStore.

@Test
public void testHashedActionStore() throws Exception {
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean.setLocalOSRoot("tmp");
    HashedActionStore as = new HashedActionStore(objectStoreEnvironmentBean);
    final OutputObjectState buff = new OutputObjectState();
    final String tn = "/StateManager/junit";
    for (int i = 0; i < 100; i++) {
        Uid u = new Uid();
        as.write_uncommitted(u, tn, buff);
        as.commit_state(u, tn);
        assertTrue(as.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
        InputObjectState ios = new InputObjectState();
        as.allObjUids("", ios);
        assertTrue(as.read_uncommitted(u, tn) == null);
        as.write_committed(u, tn, buff);
        as.read_committed(u, tn);
        assertTrue(!as.remove_uncommitted(u, tn));
        as.remove_committed(u, tn);
        assertTrue(!as.hide_state(u, tn));
        assertTrue(!as.reveal_state(u, tn));
    }
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) Uid(com.arjuna.ats.arjuna.common.Uid) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) HashedActionStore(com.arjuna.ats.internal.arjuna.objectstore.HashedActionStore) Test(org.junit.Test)

Example 93 with InputObjectState

use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.

the class ObjectStoreTest method testActionStore.

@Test
public void testActionStore() throws Exception {
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean.setLocalOSRoot("tmp");
    ActionStore as = new ActionStore(objectStoreEnvironmentBean);
    final OutputObjectState buff = new OutputObjectState();
    final String tn = "/StateManager/junit";
    for (int i = 0; i < 100; i++) {
        Uid u = new Uid();
        as.write_uncommitted(u, tn, buff);
        as.commit_state(u, tn);
        assertTrue(as.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
        InputObjectState ios = new InputObjectState();
        as.allObjUids("", ios);
        assertTrue(as.read_uncommitted(u, tn) == null);
        as.write_committed(u, tn, buff);
        as.read_committed(u, tn);
        assertTrue(!as.remove_uncommitted(u, tn));
        as.remove_committed(u, tn);
        assertTrue(!as.hide_state(u, tn));
        assertTrue(!as.reveal_state(u, tn));
    }
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) Uid(com.arjuna.ats.arjuna.common.Uid) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) ActionStore(com.arjuna.ats.internal.arjuna.objectstore.ActionStore) NullActionStore(com.arjuna.ats.internal.arjuna.objectstore.NullActionStore) HashedActionStore(com.arjuna.ats.internal.arjuna.objectstore.HashedActionStore) Test(org.junit.Test)

Example 94 with InputObjectState

use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.

the class ObjectStoreTest method testShadowingStore.

@Test
public void testShadowingStore() throws Exception {
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean.setLocalOSRoot("tmp");
    ShadowingStore as = new ShadowingStore(objectStoreEnvironmentBean);
    final OutputObjectState buff = new OutputObjectState();
    final String tn = "/StateManager/junit";
    for (int i = 0; i < 100; i++) {
        Uid u = new Uid();
        as.write_uncommitted(u, tn, buff);
        as.commit_state(u, tn);
        assertTrue(as.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
        InputObjectState ios = new InputObjectState();
        as.allObjUids("", ios);
        assertTrue(as.read_uncommitted(u, tn) == null);
        as.write_committed(u, tn, buff);
        as.read_committed(u, tn);
        assertTrue(!as.remove_uncommitted(u, tn));
        as.remove_committed(u, tn);
        assertTrue(!as.hide_state(u, tn));
        assertTrue(!as.reveal_state(u, tn));
    }
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) Uid(com.arjuna.ats.arjuna.common.Uid) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) ShadowingStore(com.arjuna.ats.internal.arjuna.objectstore.ShadowingStore) Test(org.junit.Test)

Example 95 with InputObjectState

use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.

the class ObjectStoreTest method testNullActionStore.

@Test
public void testNullActionStore() throws Exception {
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean.setLocalOSRoot("tmp");
    NullActionStore as = new NullActionStore(objectStoreEnvironmentBean);
    final OutputObjectState buff = new OutputObjectState();
    final String tn = "/StateManager/junit";
    for (int i = 0; i < 100; i++) {
        Uid u = new Uid();
        as.write_uncommitted(u, tn, buff);
        as.commit_state(u, tn);
        assertTrue(as.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
        InputObjectState ios = new InputObjectState();
        as.allObjUids("", ios);
        assertTrue(as.read_uncommitted(u, tn) == null);
        as.write_committed(u, tn, buff);
        as.read_committed(u, tn);
        assertTrue(!as.remove_uncommitted(u, tn));
        as.remove_committed(u, tn);
        assertTrue(!as.hide_state(u, tn));
        assertTrue(!as.reveal_state(u, tn));
    }
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) Uid(com.arjuna.ats.arjuna.common.Uid) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) NullActionStore(com.arjuna.ats.internal.arjuna.objectstore.NullActionStore) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) Test(org.junit.Test)

Aggregations

InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)133 Uid (com.arjuna.ats.arjuna.common.Uid)83 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)55 Test (org.junit.Test)47 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)42 IOException (java.io.IOException)30 RecoveryStore (com.arjuna.ats.arjuna.objectstore.RecoveryStore)23 ObjectStoreEnvironmentBean (com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean)17 XidImple (com.arjuna.ats.jta.xa.XidImple)9 XAException (javax.transaction.xa.XAException)9 ArrayList (java.util.ArrayList)8 ParticipantStore (com.arjuna.ats.arjuna.objectstore.ParticipantStore)7 Xid (javax.transaction.xa.Xid)6 SubordinateAtomicAction (com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.SubordinateAtomicAction)5 Date (java.util.Date)5 Vector (java.util.Vector)5 AtomicAction (com.arjuna.ats.arjuna.AtomicAction)4 HashedActionStore (com.arjuna.ats.internal.arjuna.objectstore.HashedActionStore)4 NullActionStore (com.arjuna.ats.internal.arjuna.objectstore.NullActionStore)4 TransactionImple (com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple)4