use of com.arjuna.ats.arjuna.tools.osb.util.JMXServer in project narayana by jbosstm.
the class ExposeAllLogsTest method test.
private void test(boolean exposeAllLogsViaJMX) throws Exception {
RecoveryStore store = StoreManager.getRecoveryStore();
Set<Uid> uids;
Map<Uid, ObjectName> uids2 = new HashMap<Uid, ObjectName>();
JMXServer agent = JMXServer.getAgent();
// create a record that by default the tooling does not expose
byte[] data = new byte[10240];
OutputObjectState state = new OutputObjectState();
Uid u = new Uid();
state.packBytes(data);
assertTrue(store.write_committed(u, FOO_TYPE, state));
// check that the record is not exposed
probeObjectStore(false, false);
// get uids via the object store API
uids = getUids(store, new HashSet<Uid>(), FOO_TYPE);
// and validate that there is a uid corresponding to u
assertTrue(uids.contains(u));
// get uids via JMX
getUids(uids2, agent.queryNames(osMBeanName + ",*", null));
// and validate that there is no MBean corresponding to u
assertFalse(uids2.containsKey(u));
// now try the same but tell the browser to expose all log records
probeObjectStore(true, exposeAllLogsViaJMX);
// and get the uids for log record MBeans
uids2.clear();
getUids(uids2, agent.queryNames(osMBeanName + ",*", null));
// and validate that there is now an MBean corresponding to u
assertTrue(uids2.containsKey(u));
// test that the MBean remove operation works
agent.getServer().invoke(uids2.get(u), "remove", null, null);
// check that both the log record and the MBean were removed
uids.clear();
getUids(store, uids, FOO_TYPE);
assertFalse(uids.contains(u));
uids2.clear();
getUids(uids2, agent.queryNames(osMBeanName + ",*", null));
assertFalse(uids2.containsKey(u));
}
Aggregations