use of com.arjuna.ats.internal.arjuna.objectstore.VolatileStore in project narayana by jbosstm.
the class ObjectStoreTest 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";
for (int i = 0; i < 100; i++) {
Uid u = new Uid();
InputObjectState ios = new InputObjectState();
try {
as.allObjUids("", ios);
} catch (final Exception ex) {
}
try {
assertTrue(as.read_uncommitted(u, tn) == null);
} catch (final Exception ex) {
}
try {
as.commit_state(u, tn);
} catch (final Exception ex) {
}
as.write_committed(u, tn, buff);
assertTrue(as.currentState(u, tn) == StateStatus.OS_COMMITTED);
as.read_committed(u, tn);
try {
assertTrue(as.remove_uncommitted(u, tn));
} catch (final Exception ex) {
}
as.remove_committed(u, tn);
try {
assertTrue(as.hide_state(u, tn));
} catch (final Exception ex) {
}
try {
assertTrue(as.reveal_state(u, tn));
} catch (final Exception ex) {
}
}
}
use of com.arjuna.ats.internal.arjuna.objectstore.VolatileStore 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) {
}
}
}
use of com.arjuna.ats.internal.arjuna.objectstore.VolatileStore in project narayana by jbosstm.
the class ObjectStoreTest method testTypedVolatileStore.
@Test
public void testTypedVolatileStore() throws Exception {
ObjectStoreEnvironmentBean objectStoreEnvironmentBean = new ObjectStoreEnvironmentBean();
objectStoreEnvironmentBean.setLocalOSRoot("tmp");
objectStoreEnvironmentBean.setVolatileStoreSupportAllObjUids(true);
typedVolatileStoreCommon(new VolatileStore(objectStoreEnvironmentBean));
}
use of com.arjuna.ats.internal.arjuna.objectstore.VolatileStore 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");
}
}
Aggregations