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");
}
}
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);
}
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();
}
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));
}
}
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));
}
}
Aggregations