use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean in project narayana by jbosstm.
the class ObjectStoreTest method testFileLockingStore.
@Test
public void testFileLockingStore() throws Exception {
ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
objectStoreEnvironmentBean.setLocalOSRoot("tmp");
DummyOS as = new DummyOS(objectStoreEnvironmentBean);
assertTrue(as.typeIs() != -1);
assertTrue(as.lock());
assertTrue(as.unlock());
}
use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean in project narayana by jbosstm.
the class ObjectStoreTest method testShadowNoFileLockStore.
@Test
public void testShadowNoFileLockStore() throws Exception {
ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
objectStoreEnvironmentBean.setLocalOSRoot("tmp");
ShadowNoFileLockStore as = new ShadowNoFileLockStore(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));
}
}
use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean in project narayana by jbosstm.
the class ObjectStoreTest method testCacheStore.
// @Test
public void testCacheStore() throws Exception {
ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
objectStoreEnvironmentBean.setLocalOSRoot("tmp");
CacheStore as = new CacheStore(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);
// may or may not be there if cache flush hasn't happened
as.read_uncommitted(u, tn);
as.write_committed(u, tn, buff);
as.read_committed(u, tn);
// may or may not be there if cache flush hasn't happened
as.remove_uncommitted(u, tn);
as.remove_committed(u, tn);
assertTrue(!as.hide_state(u, tn));
assertTrue(!as.reveal_state(u, tn));
}
}
use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean in project narayana by jbosstm.
the class RemoveCachedTest method test.
@Test
public void test() throws IOException, ObjectStoreException {
boolean passed = true;
RecoveryStore store = new CacheStore(new ObjectStoreEnvironmentBean());
String type = "ArjunaMS/Destinations/a3d6227_dc656_3b77ce7e_2/Messages";
InputObjectState buff = new InputObjectState();
if (store.allObjUids(type, buff, StateStatus.OS_COMMITTED)) {
Uid toRemove = new Uid(Uid.nullUid());
do {
toRemove = UidHelper.unpackFrom(buff);
if (toRemove.notEquals(Uid.nullUid())) {
System.err.println("Removing " + toRemove + "\n");
if (store.remove_committed(toRemove, type))
passed = true;
else {
System.err.println("Failed for " + toRemove);
passed = false;
}
}
} while (toRemove.notEquals(Uid.nullUid()));
}
assertTrue(passed);
}
use of com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean in project narayana by jbosstm.
the class StoreManager method initStore.
private static final ObjectStoreAPI initStore(String name) {
ObjectStoreEnvironmentBean storeEnvBean = BeanPopulator.getNamedInstance(ObjectStoreEnvironmentBean.class, name);
String storeType = storeEnvBean.getObjectStoreType();
ObjectStoreAPI store;
try {
store = ClassloadingUtility.loadAndInstantiateClass(ObjectStoreAPI.class, storeType, name);
} catch (final Throwable ex) {
throw new FatalError(tsLogger.i18NLogger.get_StoreManager_invalidtype() + " " + storeType, ex);
}
store.start();
return store;
}
Aggregations