Search in sources :

Example 11 with ObjectStoreEnvironmentBean

use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean in project narayana by jbosstm.

the class OtherObjectStoreAPIJMXTest 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";
    createMBeans(as, as);
    for (int i = 0; i < 10; i++) {
        Uid u = new Uid();
        psProxy.write_uncommitted(u, tn, buff);
        psProxy.commit_state(u, tn);
        assertTrue(rsProxy.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
        InputObjectState ios = new InputObjectState();
        rsProxy.allObjUids("", ios);
        assertTrue(psProxy.read_uncommitted(u, tn) == null);
        rsProxy.write_committed(u, tn, buff);
        rsProxy.read_committed(u, tn);
        assertTrue(!psProxy.remove_uncommitted(u, tn));
        rsProxy.remove_committed(u, tn);
        assertTrue(!rsProxy.hide_state(u, tn));
        assertTrue(!rsProxy.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 12 with ObjectStoreEnvironmentBean

use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean in project narayana by jbosstm.

the class OtherObjectStoreAPIJMXTest method testVolatileStore.

@Test
public void testVolatileStore() throws Exception {
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean.setLocalOSRoot("tmp");
    VolatileStore as = new VolatileStore(objectStoreEnvironmentBean);
    final OutputObjectState buff = new OutputObjectState();
    final String tn = "/StateManager/junit";
    createMBeans(as, as);
    for (int i = 0; i < 10; i++) {
        Uid u = new Uid();
        InputObjectState ios = new InputObjectState();
        try {
            rsProxy.allObjUids("", ios);
        } catch (final Exception ex) {
        }
        try {
            assertTrue(psProxy.read_uncommitted(u, tn) == null);
        } catch (final Exception ex) {
        }
        try {
            psProxy.commit_state(u, tn);
        } catch (final Exception ex) {
        }
        rsProxy.write_committed(u, tn, buff);
        assertTrue(rsProxy.currentState(u, tn) == StateStatus.OS_COMMITTED);
        rsProxy.read_committed(u, tn);
        try {
            assertTrue(psProxy.remove_uncommitted(u, tn));
        } catch (final Exception ex) {
        }
        rsProxy.remove_committed(u, tn);
        try {
            assertTrue(rsProxy.hide_state(u, tn));
        } catch (final Exception ex) {
        }
        try {
            assertTrue(rsProxy.reveal_state(u, tn));
        } catch (final Exception ex) {
        }
    }
}
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) VolatileStore(com.arjuna.ats.internal.arjuna.objectstore.VolatileStore) Test(org.junit.Test)

Example 13 with ObjectStoreEnvironmentBean

use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean in project narayana by jbosstm.

the class OtherObjectStoreAPIJMXTest 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";
    createMBeans(as, as);
    for (int i = 0; i < 10; i++) {
        Uid u = new Uid();
        psProxy.write_uncommitted(u, tn, buff);
        psProxy.commit_state(u, tn);
        assertTrue(rsProxy.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
        InputObjectState ios = new InputObjectState();
        rsProxy.allObjUids("", ios);
        assertTrue(psProxy.read_uncommitted(u, tn) == null);
        rsProxy.write_committed(u, tn, buff);
        rsProxy.read_committed(u, tn);
        assertTrue(!psProxy.remove_uncommitted(u, tn));
        rsProxy.remove_committed(u, tn);
        assertTrue(!rsProxy.hide_state(u, tn));
        assertTrue(!rsProxy.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 14 with ObjectStoreEnvironmentBean

use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean in project narayana by jbosstm.

the class OtherObjectStoreAPIJMXTest 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";
    createMBeans(as, as);
    for (int i = 0; i < 10; i++) {
        Uid u = new Uid();
        psProxy.write_uncommitted(u, tn, buff);
        psProxy.commit_state(u, tn);
        assertTrue(rsProxy.currentState(u, tn) != StateStatus.OS_UNCOMMITTED);
        InputObjectState ios = new InputObjectState();
        rsProxy.allObjUids("", ios);
        assertTrue(psProxy.read_uncommitted(u, tn) == null);
        rsProxy.write_committed(u, tn, buff);
        rsProxy.read_committed(u, tn);
        assertTrue(!psProxy.remove_uncommitted(u, tn));
        rsProxy.remove_committed(u, tn);
        assertTrue(!rsProxy.hide_state(u, tn));
        assertTrue(!rsProxy.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)

Example 15 with ObjectStoreEnvironmentBean

use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean in project narayana by jbosstm.

the class ObjStoreBrowserTest method tryRemove.

private HeuristicTestData tryRemove(boolean failForget, boolean ignoreMBeanHeuristics, HeuristicTestData hd) throws MBeanException, MalformedObjectNameException, InstanceNotFoundException {
    ObjectStoreEnvironmentBean osEnv = arjPropertyManager.getObjectStoreEnvironmentBean();
    osEnv.setIgnoreMBeanHeuristics(ignoreMBeanHeuristics);
    hd.failureXAResource.setRefuseForget(hd.failureXAResource.getXid(), failForget);
    // remove the bean via a JMX proxy
    hd.getParticipantMBean().remove();
    // an equivalent alternative would have been to call remove directly on the bean
    // hd.resourceBean.remove();
    // assert that forget was called on the resource
    assertEquals(1, hd.failureXAResource.getForgetCount(hd.failureXAResource.getXid()));
    osb.probe();
    return hd;
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean)

Aggregations

ObjectStoreEnvironmentBean (com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean)35 Test (org.junit.Test)22 Uid (com.arjuna.ats.arjuna.common.Uid)17 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)17 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)17 TwoPhaseVolatileStore (com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore)7 CacheStore (com.arjuna.ats.internal.arjuna.objectstore.CacheStore)5 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)4 HashedActionStore (com.arjuna.ats.internal.arjuna.objectstore.HashedActionStore)4 NullActionStore (com.arjuna.ats.internal.arjuna.objectstore.NullActionStore)4 VolatileStore (com.arjuna.ats.internal.arjuna.objectstore.VolatileStore)4 IOException (java.io.IOException)4 ParticipantStore (com.arjuna.ats.arjuna.objectstore.ParticipantStore)3 ShadowingStore (com.arjuna.ats.internal.arjuna.objectstore.ShadowingStore)3 FatalError (com.arjuna.ats.arjuna.exceptions.FatalError)2 StoreManager (com.arjuna.ats.arjuna.objectstore.StoreManager)2 ActionStore (com.arjuna.ats.internal.arjuna.objectstore.ActionStore)2 HashedStore (com.arjuna.ats.internal.arjuna.objectstore.HashedStore)2 CoordinatorEnvironmentBean (com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean)1 CoreEnvironmentBean (com.arjuna.ats.arjuna.common.CoreEnvironmentBean)1