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