Search in sources :

Example 26 with ObjectStoreEnvironmentBean

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

the class ObjectStoreTest method testTwoVolatileStores.

@Test
public void testTwoVolatileStores() throws Exception {
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean1 = new ObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean1.setLocalOSRoot("tmp");
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean2 = new ObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean2.setLocalOSRoot("tmp2");
    objectStoreEnvironmentBean2.setVolatileStoreSupportAllObjUids(true);
    VolatileStore as1 = new VolatileStore(objectStoreEnvironmentBean1);
    VolatileStore as2 = new VolatileStore(objectStoreEnvironmentBean2);
    final OutputObjectState buff = new OutputObjectState();
    final String tn = "/StateManager/junit";
    try {
        as1.allObjUids("", new InputObjectState());
        fail("testTwoVolatileStores: allObjUids should have failed");
    } catch (final Exception ex) {
    }
    try {
        as1.allTypes(new InputObjectState());
        fail("testTwoVolatileStores: allTypes should have failed");
    } catch (final Exception ex) {
    }
    try {
        as2.allObjUids("", new InputObjectState());
    } catch (final Exception ex) {
        fail("testTwoVolatileStores: allObjUids should have passed");
    }
    try {
        as2.allTypes(new InputObjectState());
    } catch (final Exception ex) {
        fail("testTwoVolatileStores: allTypes should have passed");
    }
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) IOException(java.io.IOException) ObjectStoreException(com.arjuna.ats.arjuna.exceptions.ObjectStoreException) VolatileStore(com.arjuna.ats.internal.arjuna.objectstore.VolatileStore) TwoPhaseVolatileStore(com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore) Test(org.junit.Test)

Example 27 with ObjectStoreEnvironmentBean

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

the class CachedTest method test.

@Test
public void test() throws Exception {
    int cacheSize = 2048;
    int threads = 100;
    Thread[] t = new Thread[threads];
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean = arjPropertyManager.getObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean.setCacheStoreSize(cacheSize);
    ParticipantStore store = new CacheStore(objectStoreEnvironmentBean);
    long stime = Calendar.getInstance().getTime().getTime();
    for (int i = 0; i < threads; i++) {
        System.err.println("i: " + i);
        t[i] = new ThreadWriter(store);
        t[i].start();
    }
    for (int j = 0; j < threads; j++) {
        System.err.println("j: " + j);
        t[j].join();
        assertTrue(((ThreadWriter) t[j]).passed);
    }
    long ftime = Calendar.getInstance().getTime().getTime();
    long timeTaken = ftime - stime;
    store.sync();
    System.err.println("time for " + threads + " users is " + timeTaken);
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) CacheStore(com.arjuna.ats.internal.arjuna.objectstore.CacheStore) ParticipantStore(com.arjuna.ats.arjuna.objectstore.ParticipantStore) Test(org.junit.Test)

Example 28 with ObjectStoreEnvironmentBean

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

the class ExposeAllLogsTest method probeObjectStore.

private void probeObjectStore(boolean exposeAllLogs, boolean useJMX) throws MBeanException {
    ObjectStoreEnvironmentBean osEnvBean = BeanPopulator.getDefaultInstance(ObjectStoreEnvironmentBean.class);
    osEnvBean.setExposeAllLogRecordsAsMBeans(exposeAllLogs);
    ObjStoreBrowser osb = new ObjStoreBrowser();
    // make sure the object store tooling MBean is ready
    osb.start();
    if (useJMX)
        osb.setExposeAllRecordsAsMBeans(exposeAllLogs);
    osb.probe();
}
Also used : ObjectStoreEnvironmentBean(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean) ObjStoreBrowser(com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBrowser)

Example 29 with ObjectStoreEnvironmentBean

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

the class OtherObjectStoreAPIJMXTest method testHashedStore.

@Test
public void testHashedStore() throws Exception {
    ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
    objectStoreEnvironmentBean.setLocalOSRoot("tmp");
    HashedStore as = new HashedStore(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(!as.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) HashedStore(com.arjuna.ats.internal.arjuna.objectstore.HashedStore) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) Test(org.junit.Test)

Example 30 with ObjectStoreEnvironmentBean

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

the class OtherObjectStoreAPIJMXTest 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";
    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) ShadowingStore(com.arjuna.ats.internal.arjuna.objectstore.ShadowingStore) Test(org.junit.Test)

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